From d9aa870e5d509cc7309ab82dd102a937ab58613a Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Thu, 9 Feb 2017 04:36:04 -0500 Subject: Imported Upstream version 3.1.1+dfsg1 --- .../guiSQLiteStudio/windows/viewwindow.cpp | 47 +++++++++++++++------- 1 file changed, 32 insertions(+), 15 deletions(-) (limited to 'SQLiteStudio3/guiSQLiteStudio/windows/viewwindow.cpp') diff --git a/SQLiteStudio3/guiSQLiteStudio/windows/viewwindow.cpp b/SQLiteStudio3/guiSQLiteStudio/windows/viewwindow.cpp index 07c927c..be805af 100644 --- a/SQLiteStudio3/guiSQLiteStudio/windows/viewwindow.cpp +++ b/SQLiteStudio3/guiSQLiteStudio/windows/viewwindow.cpp @@ -237,9 +237,10 @@ void ViewWindow::init() connect(ui->outputColumnsTable->model(), SIGNAL(rowsMoved(const QModelIndex&, int, int, const QModelIndex&, int)), this, SLOT(updateQueryToolbarStatus())); connect(ui->outputColumnsTable, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(updateQueryToolbarStatus())); connect(CFG_UI.General.DataTabAsFirstInViews, SIGNAL(changed(const QVariant&)), this, SLOT(updateTabsOrder())); + connect(CFG_UI.Fonts.DataView, SIGNAL(changed(QVariant)), this, SLOT(updateFont())); structureExecutor = new ChainExecutor(this); - connect(structureExecutor, SIGNAL(success()), this, SLOT(changesSuccessfullyCommited())); + connect(structureExecutor, SIGNAL(success(SqlQueryPtr)), this, SLOT(changesSuccessfullyCommitted())); connect(structureExecutor, SIGNAL(failure(int,QString)), this, SLOT(changesFailedToCommit(int,QString))); setupCoverWidget(); @@ -253,6 +254,7 @@ void ViewWindow::init() updateTabsOrder(); + updateFont(); refreshTriggers(); updateQueryToolbarStatus(); updateTriggersState(); @@ -347,23 +349,23 @@ void ViewWindow::setSelect(const QString &selectSql) ui->queryEdit->setPlainText(selectSql); } -bool ViewWindow::isUncommited() const +bool ViewWindow::isUncommitted() const { - return ui->dataView->isUncommited() || isModified(); + return ui->dataView->isUncommitted() || isModified(); } -QString ViewWindow::getQuitUncommitedConfirmMessage() const +QString ViewWindow::getQuitUncommittedConfirmMessage() const { QString title = getMdiWindow()->windowTitle(); - if (ui->dataView->isUncommited() && isModified()) - return tr("View window \"%1\" has uncommited structure modifications and data.").arg(title); - else if (ui->dataView->isUncommited()) - return tr("View window \"%1\" has uncommited data.").arg(title); + if (ui->dataView->isUncommitted() && isModified()) + return tr("View window \"%1\" has uncommitted structure modifications and data.").arg(title); + else if (ui->dataView->isUncommitted()) + return tr("View window \"%1\" has uncommitted data.").arg(title); else if (isModified()) - return tr("View window \"%1\" has uncommited structure modifications.").arg(title); + return tr("View window \"%1\" has uncommitted structure modifications.").arg(title); else { - qCritical() << "Unhandled message case in ViewWindow::getQuitUncommitedConfirmMessage()."; + qCritical() << "Unhandled message case in ViewWindow::getQuitUncommittedConfirmMessage()."; return QString(); } } @@ -569,8 +571,8 @@ void ViewWindow::tabChanged(int tabIdx) { if (isModified()) { - int res = QMessageBox::question(this, tr("Uncommited changes"), - tr("There are uncommited structure modifications. You cannot browse or edit data until you have " + int res = QMessageBox::question(this, tr("Uncommitted changes"), + tr("There are uncommitted structure modifications. You cannot browse or edit data until you have " "the view structure settled.\n" "Do you want to commit the structure, or do you want to go back to the structure tab?"), tr("Go back to structure tab"), tr("Commit modifications and browse data.")); @@ -604,7 +606,7 @@ void ViewWindow::updateQueryToolbarStatus() actionMap[REFRESH_QUERY]->setEnabled(existingView); } -void ViewWindow::changesSuccessfullyCommited() +void ViewWindow::changesSuccessfullyCommitted() { QStringList sqls = structureExecutor->getQueries(); CFG->addDdlHistory(sqls.join("\n"), db->getName(), db->getPath()); @@ -624,9 +626,9 @@ void ViewWindow::changesSuccessfullyCommited() updateWindowTitle(); if (oldView.compare(view, Qt::CaseInsensitive) == 0) - notifyInfo(tr("Commited changes for view '%1' successfly.").arg(view)); + notifyInfo(tr("Committed changes for view '%1' successfully.").arg(view)); else - notifyInfo(tr("Commited changes for view '%1' (named before '%2') successfly.").arg(view, oldView)); + notifyInfo(tr("Committed changes for view '%1' (named before '%2') successfully.").arg(view, oldView)); DBTREE->refreshSchema(db); } @@ -1044,3 +1046,18 @@ void ViewWindow::executeStructureChanges() structureExecutor->exec(); widgetCover->show(); } + +void ViewWindow::updateFont() +{ + QFont f = CFG_UI.Fonts.DataView.get(); + QFontMetrics fm(f); + + QTableView* views[] = {ui->triggersList}; + for (QTableView* view : views) + { + view->setFont(f); + view->horizontalHeader()->setFont(f); + view->verticalHeader()->setFont(f); + view->verticalHeader()->setDefaultSectionSize(fm.height() + 4); + } +} -- cgit v1.2.3