aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/guiSQLiteStudio/windows/tablewindow.cpp
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2017-02-09 04:37:26 -0500
committerLibravatarUnit 193 <unit193@ubuntu.com>2017-02-09 04:37:26 -0500
commitc9d6debf9015b7853c3e061bbc64a555d85e2fcd (patch)
tree53341bc57ae9fbad2beb5b6c08d97a68bee0ec8e /SQLiteStudio3/guiSQLiteStudio/windows/tablewindow.cpp
parentd5caba2b1f36dc3b92fa705a06097d0597fa2ddd (diff)
parentd9aa870e5d509cc7309ab82dd102a937ab58613a (diff)
Merge tag 'upstream/3.1.1+dfsg1'
Upstream version 3.1.1+dfsg1 # gpg: Signature made Thu 09 Feb 2017 04:37:24 AM EST # gpg: using RSA key 5001E1B09AA3744B # gpg: issuer "unit193@ubuntu.com" # gpg: Good signature from "Unit 193 <unit193@ubuntu.com>" [unknown] # gpg: aka "Unit 193 <unit193@gmail.com>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 8DB3 E586 865D 2B4A 2B18 5A5C 5001 E1B0 9AA3 744B
Diffstat (limited to 'SQLiteStudio3/guiSQLiteStudio/windows/tablewindow.cpp')
-rw-r--r--SQLiteStudio3/guiSQLiteStudio/windows/tablewindow.cpp57
1 files changed, 40 insertions, 17 deletions
diff --git a/SQLiteStudio3/guiSQLiteStudio/windows/tablewindow.cpp b/SQLiteStudio3/guiSQLiteStudio/windows/tablewindow.cpp
index fd344e8..286aad7 100644
--- a/SQLiteStudio3/guiSQLiteStudio/windows/tablewindow.cpp
+++ b/SQLiteStudio3/guiSQLiteStudio/windows/tablewindow.cpp
@@ -176,9 +176,10 @@ void TableWindow::init()
connect(CFG_UI.General.DataTabAsFirstInTables, SIGNAL(changed(const QVariant&)), this, SLOT(updateTabsOrder()));
connect(ui->structureView, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(structureViewDoubleClicked(const QModelIndex&)));
connect(ui->tableConstraintsView, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(constraintsViewDoubleClicked(const QModelIndex&)));
+ 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)));
THEME_TUNER->manageCompactLayout({
@@ -191,6 +192,7 @@ void TableWindow::init()
ui->ddlTab
});
+ updateFont();
setupCoverWidget();
updateAfterInit();
}
@@ -797,7 +799,7 @@ void TableWindow::commitStructure(bool skipWarning)
executeStructureChanges();
}
-void TableWindow::changesSuccessfullyCommited()
+void TableWindow::changesSuccessfullyCommitted()
{
modifyingThisTable = false;
@@ -820,10 +822,17 @@ void TableWindow::changesSuccessfullyCommited()
updateNewTableState();
updateWindowTitle();
+ NotifyManager* notifyManager = NotifyManager::getInstance();
if (oldTable.compare(table, Qt::CaseInsensitive) == 0 || oldTable.isEmpty())
- notifyInfo(tr("Commited changes for table '%1' successfly.").arg(table));
+ {
+ notifyInfo(tr("Committed changes for table '%1' successfully.").arg(table));
+ }
else
- notifyInfo(tr("Commited changes for table '%1' (named before '%2') successfly.").arg(table, oldTable));
+ {
+ notifyInfo(tr("Committed changes for table '%1' (named before '%2') successfully.").arg(table, oldTable));
+ notifyManager->renamed(db, database, oldTable, table);
+ }
+ notifyManager->modified(db, database, table);
DBTREE->refreshSchema(db);
@@ -835,7 +844,6 @@ void TableWindow::changesSuccessfullyCommited()
tableModifier->getModifiedTriggers(),
tableModifier->getModifiedViews()
};
- NotifyManager* notifyManager = NotifyManager::getInstance();
foreach (const QStringList& objList, modifiedObjects)
{
foreach (const QString& obj, objList)
@@ -886,7 +894,7 @@ void TableWindow::resetAutoincrement()
if (res->isError())
notifyError(tr("An error occurred while trying to reset autoincrement value for table '%1': %2").arg(table, res->getErrorText()));
else
- notifyInfo(tr("Autoincrement value for table '%1' has been reset successfly.").arg(table));
+ notifyInfo(tr("Autoincrement value for table '%1' has been reset successfully.").arg(table));
}
void TableWindow::addColumn()
@@ -1259,8 +1267,8 @@ void TableWindow::tabChanged(int newTab)
{
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 "
"table 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."));
@@ -1596,23 +1604,23 @@ bool TableWindow::handleInitialFocus()
return false;
}
-bool TableWindow::isUncommited() const
+bool TableWindow::isUncommitted() const
{
- return ui->dataView->isUncommited() || isModified();
+ return ui->dataView->isUncommitted() || isModified();
}
-QString TableWindow::getQuitUncommitedConfirmMessage() const
+QString TableWindow::getQuitUncommittedConfirmMessage() const
{
QString title = getMdiWindow()->windowTitle();
- if (ui->dataView->isUncommited() && isModified())
- return tr("Table window \"%1\" has uncommited structure modifications and data.").arg(title);
- else if (ui->dataView->isUncommited())
- return tr("Table window \"%1\" has uncommited data.").arg(title);
+ if (ui->dataView->isUncommitted() && isModified())
+ return tr("Table window \"%1\" has uncommitted structure modifications and data.").arg(title);
+ else if (ui->dataView->isUncommitted())
+ return tr("Table window \"%1\" has uncommitted data.").arg(title);
else if (isModified())
- return tr("Table window \"%1\" has uncommited structure modifications.").arg(title);
+ return tr("Table window \"%1\" has uncommitted structure modifications.").arg(title);
else
{
- qCritical() << "Unhandled message case in TableWindow::getQuitUncommitedConfirmMessage().";
+ qCritical() << "Unhandled message case in TableWindow::getQuitUncommittedConfirmMessage().";
return QString();
}
}
@@ -1630,3 +1638,18 @@ Db* TableWindow::getAssociatedDb() const
{
return db;
}
+
+void TableWindow::updateFont()
+{
+ QFont f = CFG_UI.Fonts.DataView.get();
+ QFontMetrics fm(f);
+
+ QTableView* views[] = {ui->structureView, ui->tableConstraintsView, ui->indexList, ui->triggerList};
+ for (QTableView* view : views)
+ {
+ view->setFont(f);
+ view->horizontalHeader()->setFont(f);
+ view->verticalHeader()->setFont(f);
+ view->verticalHeader()->setDefaultSectionSize(fm.height() + 4);
+ }
+}