Пример #1
0
void pTabBar::updateTabsNumber( int i )
{
    // fill i if i = -1 for complete update
    if ( i == -1 )
        i = 0;

    // loop documents starting at id i
    for ( int j = i; j < count(); j++ )
    {
        // only 10 tabs can have shortcut
        if ( j > 9 )
            return;

        // got tab text
        QString s = tabText( j );

        // look index of cut part
        int k = s.indexOf( ":" );

        // set new tab caption
        if ( tabsHaveShortcut() )
            setTabText( j, QString( "&%1: %2" ).arg( j ).arg( s.mid( k != -1 ? k +2 : 0 ) ) );
        else
            setTabText( j, s.mid( k != -1 ? k +2 : 0 ) );
    }
}
Пример #2
0
void TabView::updateSnippetNameDataLanguageID(int snippetID)
{
    if (snippetID < 1)
        return;

    const auto nTabIndex = snippetTabIndex(snippetID);

    if (nTabIndex >= 0 && nTabIndex < count()) {
        if (auto pTab = qobject_cast<Tab*>(widget(nTabIndex))) {
            auto pTabSnippet = pTab->snippet();

            if (!pTabSnippet)
                return;

            qDebug() << Q_FUNC_INFO;

            const auto bIsTabModified = pTab->isModified();
            auto strTitle = pTabSnippet->name();

            pTab->setTitle(strTitle);
            emit tabTitleChanged(strTitle);

            if (bIsTabModified)
                strTitle += "*";

            setTabText(nTabIndex, strTitle);
            setTabToolTip(nTabIndex, strTitle);

            emit tabModified(bIsTabModified);
        }
    }
}
Пример #3
0
void TabView::onSnippetContentUpdated(int snippetID)
{
    if (snippetID < 1)
        return;

    const auto nTabIndex = snippetTabIndex(snippetID);

    if (nTabIndex >= 0 && nTabIndex < count()) {
        if (auto pTab = qobject_cast<Tab*>(widget(nTabIndex))) {
            qDebug() << Q_FUNC_INFO;

            const auto strCurrentTitle = pTab->title();

            setTabText(nTabIndex, strCurrentTitle);
            setTabToolTip(nTabIndex, strCurrentTitle);

            disconnectTab(pTab);
            pTab->updateContent();
            connectTab(pTab);

            pTab->setModified(false);
            emit tabModified(false);
        }
    }
}
Пример #4
0
void TabView::onTabContentChanged()
{
    if (auto pCurrentTab = qobject_cast<Tab *>(currentWidget())) {
        pCurrentTab->setModified(true);

        if (pCurrentTab->isNew())
            emit tabModified(true);
        else {
            if (auto pTabSnippet = pCurrentTab->snippet()) {
                const auto strTitle = QString{"%1*"}.arg(pTabSnippet->name());
                pCurrentTab->setTitle(pTabSnippet->name());

                const auto nIndex = currentIndex();

                setTabText(nIndex, strTitle);
                setTabToolTip(nIndex, strTitle);

                pTabSnippet->setModified(true);

                emit tabTitleChanged(pTabSnippet->name());
                emit tabModified(true);
                emit tabContentChanged(pTabSnippet->id(), true);
            }
        }
    }
}
Пример #5
0
void SearchResultsTabWidget::updateNumSearchResults(QWidget *w, int numSearches,int numFiltered)
{
    int index = indexOf(static_cast<SearchResultsView*>(w));
    QString searchTerms = static_cast<SearchResultsView*>(w)->getSearchTerms();
    QString labelText = QString("%1 (%2/%3)").arg(searchTerms,QString::number(numFiltered), QString::number(numSearches));
    setTabText(index, labelText);
}
Пример #6
0
void PanelTabBar::layoutTabs()
{
   for (int i = 0; i < count(); i++) {
        setTabText(i, squeeze(DISPLAY(((ListPanel*)tabData(i).toLongLong())->virtualPath()), i));
        emit ((ListPanel*)tabData(i).toLongLong())->refreshPathLabel();
   }
}
Пример #7
0
void KateTabBar::slotDocumentChange(KTextEditor::Document *document)
{
    int key = m_keys [document];

    // sets the icon
    setTabIcon(key, KIcon(KIO::pixmapForUrl(document->url(), 0, KIconLoader::Desktop, 16)));

    if(document->isModified()) {
        setTabText(key, document->documentName() + " *");
        setTabTextColor(key, Qt::red);
    }
    else {
        setTabText(key, document->documentName());
        setTabTextColor(key, Qt::black);
    }
}
Пример #8
0
void TabBar::renameTab()
{
    QString name = tabToolTip(m_cur_menu_tab);
    QString conStr;
    if(name.contains(" - "))
    {
        conStr = name.mid(name.lastIndexOf(" - "));
        name = name.left(name.lastIndexOf(" - "));
    }

    QString newName = QInputDialog::getText(this, tr("Rename tab"), tr("New name:"),
                                         QLineEdit::Normal, name);
    if(!newName.isEmpty())
    {
        newName.replace('-', '_');
        newName += conStr;

        setTabToolTip(m_cur_menu_tab, newName);

        if(newName.size() > 25)
        {
            newName.resize(25);
            newName += "...";
        }
        setTabText(m_cur_menu_tab, newName);
    }
}
void BtAboutDialog::init_lic_tab()
{
	selectTab(4);
	setTabText(tr("License Agreement"));

	QByteArray text;
	text += tr("BibleTime is released under the GPL licence.");
	text += tr("You can download and use (but not distribute) the program for personal, private, public or commercial purposes without restrictions.");
	text += tr("You can give away or distribute the program if you also distribute the corresponding source code.");
	text += "<br><br>";
	text += tr("The complete legally binding license is below.");

	QFile licFile(util::filesystem::DirectoryUtil::getLicenseDir().path() + "/license.html");
	if (licFile.open(QFile::ReadOnly))
	{
		QByteArray html;
		while (!licFile.atEnd())
		{
			QByteArray line = licFile.readLine();
			html = html + line;
		}
		licFile.close();
		html.replace("TRANSLATED TEXT", text);
		setHtml(QString(html));
	}
}
Пример #10
0
void EditFiles::textBufferModified(FileEditView *editView, bool modified)
    {
    OovString text = editView->getFileName();
    if(modified)
        text += '*';
    setTabText(editView, text);
    }
Пример #11
0
void main_tab_widget::sync_tab_info(QWidget* w)
{
    int i = indexOf(w);
    setTabText(i, w->windowTitle());
    setTabIcon(i, w->windowIcon());
    setTabToolTip(i, w->toolTip());
}
Пример #12
0
void TabSupervisor::retranslateUi()
{
    QList<Tab *> tabs;
    tabs.append(tabServer);
    tabs.append(tabReplays);
    tabs.append(tabDeckStorage);
    tabs.append(tabAdmin);
    tabs.append(tabUserLists);
    tabs.append(tabLog);
    QMapIterator<int, TabRoom *> roomIterator(roomTabs);
    while (roomIterator.hasNext())
        tabs.append(roomIterator.next().value());
    QMapIterator<int, TabGame *> gameIterator(gameTabs);
    while (gameIterator.hasNext())
        tabs.append(gameIterator.next().value());
    QListIterator<TabGame *> replayIterator(replayTabs);
    while (replayIterator.hasNext())
        tabs.append(replayIterator.next());
    QListIterator<TabDeckEditor *> deckEditorIterator(deckEditorTabs);
    while (deckEditorIterator.hasNext())
        tabs.append(deckEditorIterator.next());
    QMapIterator<QString, TabMessage *> messageIterator(messageTabs);
    while (messageIterator.hasNext())
        tabs.append(messageIterator.next().value());
    
    for (int i = 0; i < tabs.size(); ++i)
        if (tabs[i]) {
            int idx = indexOf(tabs[i]);
            QString tabText = tabs[i]->getTabText();
            setTabText(idx, sanitizeTabName(tabText));
            setTabToolTip(idx, sanitizeHtml(tabText));
            tabs[i]->retranslateUi();
        }
}
Пример #13
0
void QueuePool::slotRemoveCurrentQueue()
{
    QueueListView* const queue = currentQueue();

    if (!queue)
    {
        return;
    }

    removeTab(indexOf(queue));

    if (count() == 0)
    {
        slotAddQueue();
    }
    else
    {
        for (int i = 0; i < count(); ++i)
        {
            setTabText(i, QString("#%1").arg(i + 1));
        }
    }

    emit signalQueuePoolChanged();
}
Пример #14
0
void EditorTab::onEditorTextChanged(void)
{
	int index = currentIndex();
	Editor * editor = (Editor *)widget(index);
	
	setTabText(index, "*" + QFileInfo(editor->GetFileName()).fileName());
	emit codeChanged();
}
Пример #15
0
void WorkAreaTabWidget::tabTextChange(const QString &text)
{
    QWidget *send = qobject_cast<QWidget*>(sender());
    if(!send)
        return;

    setTabText(indexOf(send), text);
}
Пример #16
0
/*!
    \details Set if tabs have or not a small close button
    \param buttons True for buttons, else false
*/
void pTabBar::setTabsHaveCloseButton( bool buttons )
{
    if ( aToggleTabsHaveCloseButton->isChecked() == buttons && sender() != aToggleTabsHaveCloseButton )
        return;
    aToggleTabsHaveCloseButton->setChecked( buttons );
    setTabText( 0, tabText( 0 ) ); // workaround for tabs update
    emit tabsHaveCloseButtonChanged( aToggleTabsHaveCloseButton->isChecked() );
}
Пример #17
0
void MainTab::changeTabTitle(QString newTitle)
{
    QWidget* widget = (QWidget*) sender();
    int i = indexOf(widget);

    if(i >= 0)
        setTabText(i, newTitle);
}
Пример #18
0
void ScriptEditor::setFilename(const QString& filename)
{
    m_filename = filename;
    if(!m_filename.isEmpty())
    {
        ui->nameLabel->setText(filename.split("/").last());
        setTabText(tr("%1 - Script").arg(ui->nameLabel->text()));
        setWindowTitle(tr("%1 - Script").arg(ui->nameLabel->text()));
    }
    else
    {
        ui->nameLabel->setText(QString());
        setTabText(tr("Script"));
        setWindowTitle(tr("Script"));
    }
    m_editor->setModified(false);
}
Пример #19
0
void TabBar::editFinished()
{
    if (renamingIndex_ != -1 && lineEdit_) {
        setTabText(renamingIndex_, lineEdit_->text());
        lineEdit_->hide();
        lineEdit_->deleteLater();
        lineEdit_ = nullptr;
    }
}
Пример #20
0
/*!
    \details Set if tabs text is elided or not
    \param elided True for elided text, else false
*/
void pTabBar::setTabsElided( bool elided )
{
    if ( aToggleTabsElided->isChecked() == elided && sender() != aToggleTabsElided )
        return;
    aToggleTabsElided->setChecked( elided );
    setElideMode( elided ? Qt::ElideMiddle : Qt::ElideNone );
    setTabText( 0, tabText( 0 ) ); // workaround for tabs update
    emit tabsElidedChanged( aToggleTabsElided->isChecked() );
}
Пример #21
0
//-----------------------------------------------------------------------------
// Function: DrawingBoard::onDocumentNameChanged()
//-----------------------------------------------------------------------------
void DrawingBoard::onDocumentTitleChanged(TabDocument* document, QString const& newTitle)
{
    int index = indexOf(document);

    if (index >= 0)
    {
        setTabText(index, newTitle);
    }
}
Пример #22
0
void QHorizontalTabBar::paintEvent(QPaintEvent *e)
{
	QList<QIcon> icons;
	QList<QSize> iconSizes;
	QList<QString> texts;
	for (int index = 0; index < count(); index++)
	{
		QStyleOptionTabV3 tab;
		initStyleOption(&tab, index);

		icons.append(tab.icon);
		iconSizes.append(tab.iconSize);
		texts.append(tab.text);

		// don't paint the icon and text
		setTabIcon(index, QIcon());
		setTabText(index, QString());
	}
	QTabBar::paintEvent(e);

	QFont font = QFont("Courier", 16);
	font.setFixedPitch(true);
	for (int index = 0; index < count(); index++)
	{
		QIcon icon = icons.at(index);
		QSize iconSize = iconSizes.at(index);
		QString text = texts.at(index);

		QRect tabrect = tabRect(index);
		tabrect.adjust(0, 40, 0, -40);

		// restore the icon and text
		setTabIcon(index, icon);
		setTabText(index, text);

		QPainter painter;
		painter.begin(this);
		painter.setFont(font);
		painter.setPen(Qt::white);
		painter.drawText(tabrect, Qt::AlignBottom | Qt::AlignHCenter, text);
		icon.paint(&painter, 16, tabrect.top(), iconSize.width(), iconSize.height(), Qt::AlignTop | Qt::AlignHCenter);    
		painter.end();
	}
}
void BtAboutDialog::init_contributors_tab()
{
	selectTab(1);
	setTabText(tr("Contributors"));
	QString content;
	content += make_bold(tr("The following people contributed to BibleTime:")) + make_br();
	// sorted alphabetically (last name)
	content += "<ul>";
	content += "<li>Thomas Abthorpe (" + tr("documentation and translation manager") + ")</li>";
	content += "<li>Joachim Ansorg (" + tr("project founder, developer") + ")</li>";
	content += "<li>David Blue (" + tr("designer") + ")</li>";
	content += "<li>Tim Brodie (" + tr("developer") + ")</li>";
	content += "<li>Timothy R. Butler (" + tr("designer") + ")</li>";
	content += "<li>Jim Campbell (" + tr("developer") + ")</li>";
	content += "<li>Lee Carpenter (" + tr("developer") + ")</li>";
	content += "<li>Jeremy Erickson (" + tr("packager") + ")</li>";
	content += "<li>Troy A. Griffitts (" + tr("creator of The Sword Project") + ")</li>";
	content += "<li>Martin Gruner (" + tr("project manager, developer") + ")</li>";
	content += "<li>Thomas Hagedorn (" + tr("domain sponsor") + ")</li>";
	content += "<li>Bob Harman (" + tr("howto") + ")</li>";
	content += "<li>Gary Holmlund (" + tr("developer") + ")</li>";
	content += "<li>Nikolay Igotti (" + tr("developer") + ")</li>";
	content += "<li>Eeli Kaikkonnen (" + tr("developer") + ")</li>";
	content += "<li>Chris Kujawa (" + tr("developer") + ")</li>";
	content += "<li>Mark Lybarger (" + tr("developer") + ")</li>";
	content += "<li>Luke Mauldin (" + tr("developer") + ")</li>";
	content += "<li>James Ots (" + tr("designer") + ")</li>";
	content += "<li>Fred Saalbach (" + tr("documentation") + ")</li>";
	content += "<li>Gary Sims (" + tr("developer") + ")</li>";
	content += "<li>Wolfgang Stradner (" + tr("tester, usability expert") + ")</li>";
	content += "<li>Thorsten Uhlmann (" + tr("developer") + ")</li>";
	content += "<li>David White (" + tr("developer") + ")</li>";
	content += "<li>Mark Zealey (" + tr("developer") + ")</li>";
	content += "</ul>";

	content += make_bold(tr("The following people translated BibleTime into their language:")) + make_br();
	// sorted alphabetically (last name)
	content += "<ul>";
	content += "<li>Horatiu Alexe</li>";
	content += "<li>Chun-shek Chan</li>";
	content += "<li>Ilpo Kantonen</li>";
	content += "<li>Pavel Laukko</li>";
	content += "<li>Piotr Markiewicz</li>";
	content += "<li>Gabriel P&eacute;rez</li>";
	content += "<li>Igor Plisco</li>";
	content += "<li>Igor Rykhlin</li>";
	content += "<li>Vlad Savitsky</li>";
	content += "<li>Johan van der Lingen</li>";
	content += "<li>Jean Van Schaftingen</li>";
	content += "<li>Dmitry Yurevich</li>";
	content += "<li>Esteban Zeller</li>";
	content += "</ul>";

	QString contributors = make_html(make_head("") + make_body(content));
	setHtml(contributors);
}
Пример #24
0
void DiagramsView::onDiagramRenamed(const MDiagram *diagram)
{
    if (!diagram) {
        return;
    }
    DiagramView *diagramView = m_diagramViews.value(diagram->uid());
    if (diagramView) {
        setTabText(indexOf(diagramView), diagram->name());
    }
}
Пример #25
0
void MainWindow::setCurrentFile(const QString &fileName)
{
  if(opt.arg_debug) printf("setCurrentFile\n");
  curFile = fileName;
  QString shownName;
  if (curFile.isEmpty()) shownName = "ProcessViewBrowser";
  else                   shownName = curFile;
  setWindowTitle(tr("%1[*] - %2").arg(shownName).arg(tr("pvbrowser " VERSION)));
  setTabText(shownName.toUtf8());
}
Пример #26
0
OovStatusReturn EditFiles::saveAsTextFileWithDialog()
    {
    FileEditView *editView = getEditView();
    OovStatus status = editView->saveAsTextFileWithDialog();
    if(status.ok())
        {
        setTabText(editView, editView->getFileName());
        }
    return status;
    }
Пример #27
0
bool EditFiles::saveAsTextFileWithDialog()
    {
    FileEditView *editView = getEditView();
    bool saved = editView->saveAsTextFileWithDialog();
    if(saved)
        {
        setTabText(editView, editView->getFileName());
        }
    return saved;
    }
Пример #28
0
void PanelTabBar::updateTab(ListPanel *panel)
{
    // find which is the correct tab
    for (int i = 0; i < count(); i++) {
        if ((ListPanel*)tabData(i).toLongLong() == panel) {
            setTabText(i, squeeze(DISPLAY(panel->virtualPath()), i));
            break;
        }
    }
}
Пример #29
0
void BrowserFrame::browserLoaded(bool ok) {
	if (ok) {
		QWebView *browser = static_cast<QWebView *>(QObject::sender());
		if (browser) for (int i = 0; i < count(); i++) {
			if (widget(i) == browser) {
				setTabText(i, browser->title());
				break;
			}
		}
	}
}
Пример #30
0
void CanvasTabWidget::onCanvasDocumentPropertyChanged(Canvas *canvas)
{
	for (int i = 0; i < count(); ++i)
	{
		auto view = canvasViewAt(i);
		if (view && view->canvas() == canvas)
		{
			setTabText(i, canvasTabText(canvas));
		}
	}
}