aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/guiSQLiteStudio/windows/tablewindow.cpp
diff options
context:
space:
mode:
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);
+ }
+}