diff options
| author | 2015-01-30 17:00:24 -0500 | |
|---|---|---|
| committer | 2015-01-30 17:00:24 -0500 | |
| commit | e4767514ed04e6a0bddf3f4a47f5f0b09e65e0ee (patch) | |
| tree | 86cadc2137831d44fa29fd40a2964f7fb1326de4 /SQLiteStudio3/guiSQLiteStudio/windows | |
| parent | 26ddfe11c2b7fac52e5f57dcd9f5223a50b2a9a7 (diff) | |
| parent | 016003905ca0e8e459e3dc33e786beda8ec92f45 (diff) | |
Merge tag 'upstream/3.0.2'
Upstream version 3.0.2
# gpg: Signature made Fri 30 Jan 2015 05:00:11 PM EST using RSA key ID EBE9BD91
# gpg: Good signature from "Unit 193 <unit193@gmail.com>"
# gpg: aka "Unit 193 <unit193@ninthfloor.org>"
# gpg: aka "Unit 193 <unit193@ubuntu.com>"
Diffstat (limited to 'SQLiteStudio3/guiSQLiteStudio/windows')
12 files changed, 119 insertions, 36 deletions
diff --git a/SQLiteStudio3/guiSQLiteStudio/windows/bugreporthistorywindow.ui b/SQLiteStudio3/guiSQLiteStudio/windows/bugreporthistorywindow.ui index 3218822..2211ec2 100644 --- a/SQLiteStudio3/guiSQLiteStudio/windows/bugreporthistorywindow.ui +++ b/SQLiteStudio3/guiSQLiteStudio/windows/bugreporthistorywindow.ui @@ -11,7 +11,7 @@ </rect> </property> <property name="windowTitle"> - <string>Form</string> + <string notr="true">Form</string> </property> <layout class="QVBoxLayout" name="verticalLayout"> <item> diff --git a/SQLiteStudio3/guiSQLiteStudio/windows/collationseditor.ui b/SQLiteStudio3/guiSQLiteStudio/windows/collationseditor.ui index 635ae59..98e7ddb 100644 --- a/SQLiteStudio3/guiSQLiteStudio/windows/collationseditor.ui +++ b/SQLiteStudio3/guiSQLiteStudio/windows/collationseditor.ui @@ -11,7 +11,7 @@ </rect> </property> <property name="windowTitle"> - <string>Form</string> + <string notr="true">Form</string> </property> <layout class="QVBoxLayout" name="verticalLayout"> <property name="leftMargin"> diff --git a/SQLiteStudio3/guiSQLiteStudio/windows/ddlhistorywindow.ui b/SQLiteStudio3/guiSQLiteStudio/windows/ddlhistorywindow.ui index 6591198..33cdb66 100644 --- a/SQLiteStudio3/guiSQLiteStudio/windows/ddlhistorywindow.ui +++ b/SQLiteStudio3/guiSQLiteStudio/windows/ddlhistorywindow.ui @@ -11,7 +11,7 @@ </rect> </property> <property name="windowTitle"> - <string>Form</string> + <string notr="true">Form</string> </property> <layout class="QVBoxLayout" name="verticalLayout"> <item> diff --git a/SQLiteStudio3/guiSQLiteStudio/windows/editorwindow.cpp b/SQLiteStudio3/guiSQLiteStudio/windows/editorwindow.cpp index 7856a5e..590a2fd 100644 --- a/SQLiteStudio3/guiSQLiteStudio/windows/editorwindow.cpp +++ b/SQLiteStudio3/guiSQLiteStudio/windows/editorwindow.cpp @@ -17,13 +17,13 @@ #include "parser/lexer.h" #include "common/utils_sql.h" #include "parser/parser.h" +#include "dbobjectdialogs.h" +#include "dialogs/exportdialog.h" #include <QComboBox> #include <QDebug> #include <QStringListModel> #include <QActionGroup> #include <QMessageBox> -#include <dbobjectdialogs.h> -#include <dialogs/exportdialog.h> CFG_KEYS_DEFINE(EditorWindow) EditorWindow::ResultsDisplayMode EditorWindow::resultsDisplayMode; @@ -94,6 +94,10 @@ void EditorWindow::init() initActions(); updateShortcutTips(); + Db* treeSelectedDb = DBTREE->getSelectedOpenDb(); + if (treeSelectedDb) + dbCombo->setCurrentIndex(dbComboModel->getIndexForDb(treeSelectedDb)); + Db* currentDb = getCurrentDb(); resultsModel->setDb(currentDb); ui->sqlEdit->setDb(currentDb); @@ -484,7 +488,16 @@ void EditorWindow::executionSuccessful() { double secs = ((double)resultsModel->getExecutionTime()) / 1000; QString time = QString::number(secs, 'f', 3); - notifyInfo(tr("Query finished in %2 second(s).").arg(time)); + + if (resultsModel->wasDataModifyingQuery()) + { + QString rowsAffected = QString::number(resultsModel->getTotalRowsAffected()); + notifyInfo(tr("Query finished in %1 second(s). Rows affected: %2").arg(time, rowsAffected)); + } + else + { + notifyInfo(tr("Query finished in %1 second(s).").arg(time)); + } lastQueryHistoryId = CFG->addSqlHistory(resultsModel->getQuery(), resultsModel->getDb()->getName(), resultsModel->getExecutionTime(), 0); diff --git a/SQLiteStudio3/guiSQLiteStudio/windows/editorwindow.h b/SQLiteStudio3/guiSQLiteStudio/windows/editorwindow.h index 0052a74..4666386 100644 --- a/SQLiteStudio3/guiSQLiteStudio/windows/editorwindow.h +++ b/SQLiteStudio3/guiSQLiteStudio/windows/editorwindow.h @@ -25,7 +25,7 @@ class SqlEditor; CFG_KEY_LIST(EditorWindow, QObject::tr("SQL editor window"), CFG_KEY_ENTRY(EXEC_QUERY, Qt::Key_F9, QObject::tr("Execute query")) - CFG_KEY_ENTRY(EXPLAIN_QUERY, Qt::Key_F8, QObject::tr("Execute \"EXPLAIN\" query")) + CFG_KEY_ENTRY(EXPLAIN_QUERY, Qt::Key_F8, QObject::tr("Execute \"%1\" query").arg("EXPLAIN")) CFG_KEY_ENTRY(PREV_DB, Qt::CTRL + Qt::Key_Up, QObject::tr("Switch current working database to previous on the list")) CFG_KEY_ENTRY(NEXT_DB, Qt::CTRL + Qt::Key_Down, QObject::tr("Switch current working database to next on the list")) CFG_KEY_ENTRY(SHOW_NEXT_TAB, Qt::ALT + Qt::Key_Right, QObject::tr("Go to next editor tab")) diff --git a/SQLiteStudio3/guiSQLiteStudio/windows/editorwindow.ui b/SQLiteStudio3/guiSQLiteStudio/windows/editorwindow.ui index b0d598b..51d5503 100644 --- a/SQLiteStudio3/guiSQLiteStudio/windows/editorwindow.ui +++ b/SQLiteStudio3/guiSQLiteStudio/windows/editorwindow.ui @@ -11,10 +11,19 @@ </rect> </property> <property name="windowTitle"> - <string>SQL editor</string> + <string notr="true">SQL editor</string> </property> <layout class="QVBoxLayout" name="verticalLayout"> - <property name="margin"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> <number>0</number> </property> <item> @@ -42,7 +51,16 @@ </widget> <widget class="QWidget" name="resultsContainer" native="true"> <layout class="QVBoxLayout" name="verticalLayout_5"> - <property name="margin"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> <number>0</number> </property> </layout> @@ -59,7 +77,16 @@ <item> <widget class="QWidget" name="resultsFrame" native="true"> <layout class="QVBoxLayout" name="verticalLayout_6"> - <property name="margin"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> <number>0</number> </property> <item> @@ -116,6 +143,11 @@ </widget> <customwidgets> <customwidget> + <class>SqlView</class> + <extends>QPlainTextEdit</extends> + <header>sqlview.h</header> + </customwidget> + <customwidget> <class>DataView</class> <extends>QTabWidget</extends> <header>dataview.h</header> @@ -126,11 +158,6 @@ <extends>QPlainTextEdit</extends> <header>sqleditor.h</header> </customwidget> - <customwidget> - <class>SqlView</class> - <extends>QPlainTextEdit</extends> - <header>sqlview.h</header> - </customwidget> </customwidgets> <resources/> <connections/> diff --git a/SQLiteStudio3/guiSQLiteStudio/windows/functionseditor.ui b/SQLiteStudio3/guiSQLiteStudio/windows/functionseditor.ui index d5d5015..45d291d 100644 --- a/SQLiteStudio3/guiSQLiteStudio/windows/functionseditor.ui +++ b/SQLiteStudio3/guiSQLiteStudio/windows/functionseditor.ui @@ -11,7 +11,7 @@ </rect> </property> <property name="windowTitle"> - <string>Form</string> + <string notr="true">Form</string> </property> <layout class="QVBoxLayout" name="verticalLayout"> <property name="leftMargin"> diff --git a/SQLiteStudio3/guiSQLiteStudio/windows/tablewindow.cpp b/SQLiteStudio3/guiSQLiteStudio/windows/tablewindow.cpp index 56accd0..1b47433 100644 --- a/SQLiteStudio3/guiSQLiteStudio/windows/tablewindow.cpp +++ b/SQLiteStudio3/guiSQLiteStudio/windows/tablewindow.cpp @@ -208,6 +208,7 @@ void TableWindow::createStructureActions() ui->structureToolBar->addAction(actionMap[POPULATE]); ui->structureToolBar->addSeparator(); createAction(CREATE_SIMILAR, ICONS.TABLE_CREATE_SIMILAR, tr("Create similar table", "table window"), this, SLOT(createSimilarTable()), ui->structureToolBar); + createAction(RESET_AUTOINCREMENT, ICONS.RESET_AUTOINCREMENT, tr("Reset autoincrement value", "table window"), this, SLOT(resetAutoincrement()), ui->structureToolBar); // Table constraints createAction(ADD_TABLE_CONSTRAINT, ICONS.TABLE_CONSTRAINT_ADD, tr("Add table constraint", "table window"), this, SLOT(addConstraint()), ui->tableConstraintsToolbar, ui->tableConstraintsView); @@ -834,6 +835,24 @@ void TableWindow::rollbackStructure() updateStructureCommitState(); updateStructureToolbarState(); updateTableConstraintsToolbarState(); + updateDdlTab(); +} + +void TableWindow::resetAutoincrement() +{ + if (!existingTable) + return; + + QMessageBox::StandardButton btn = QMessageBox::question(this, tr("Reset autoincrement"), tr("Are you sure you want to reset autoincrement value for table '%1'?") + .arg(table)); + if (btn != QMessageBox::Yes) + return; + + SqlQueryPtr res = db->exec("DELETE FROM sqlite_sequence WHERE name = ?;", {table}); + 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)); } void TableWindow::addColumn() @@ -947,15 +966,15 @@ bool TableWindow::validate(bool skipWarning) if (!hasPk) { - notifyError(tr("Cannot create table without ROWID, if it has no PRIMARY KEY defined." - " Either uncheck the WITHOUT ROWID, or define a PRIMARY KEY.")); + notifyError(tr("Cannot create table %1, if it has no primary key defined." + " Either uncheck the %2, or define a primary key.").arg("WITHOUT ROWID", "WITHOUT ROWID")); return false; } if (isPkAutoIncr) { - notifyError(tr("Cannot use AUTOINCREMENT for PRIMARY KEY when WITHOUT ROWID clause is used." - " Either uncheck the WITHOUT ROWID, or the AUTOINCREMENT in a PRIMARY KEY.")); + notifyError(tr("Cannot use autoincrement for primary key when %1 clause is used." + " Either uncheck the %2, or the autoincrement in a primary key.").arg("WITHOUT ROWID", "WITHOUT ROWID")); return false; } } @@ -1023,9 +1042,12 @@ void TableWindow::applyInitialTab() void TableWindow::updateDdlTab() { - CodeFormatter* formatter = SQLITESTUDIO->getCodeFormatter(); createTable->rebuildTokens(); - ui->ddlEdit->setPlainText(formatter->format("sql", createTable->detokenize(), db)); + QString ddl = createTable->detokenize(); + if (createTable->columns.size() > 0) + ddl = SQLITESTUDIO->getCodeFormatter()->format("sql", ddl, db); + + ui->ddlEdit->setPlainText(ddl); } void TableWindow::updateNewTableState() @@ -1037,6 +1059,7 @@ void TableWindow::updateNewTableState() actionMap[IMPORT]->setEnabled(existingTable); actionMap[POPULATE]->setEnabled(existingTable); actionMap[CREATE_SIMILAR]->setEnabled(existingTable); + actionMap[RESET_AUTOINCREMENT]->setEnabled(existingTable); actionMap[REFRESH_STRUCTURE]->setEnabled(existingTable); } diff --git a/SQLiteStudio3/guiSQLiteStudio/windows/tablewindow.h b/SQLiteStudio3/guiSQLiteStudio/windows/tablewindow.h index b0ee1e3..54d544f 100644 --- a/SQLiteStudio3/guiSQLiteStudio/windows/tablewindow.h +++ b/SQLiteStudio3/guiSQLiteStudio/windows/tablewindow.h @@ -79,6 +79,7 @@ class GUI_API_EXPORT TableWindow : public MdiChild IMPORT, POPULATE, CREATE_SIMILAR, + RESET_AUTOINCREMENT, // Indexes tab REFRESH_INDEXES, ADD_INDEX, @@ -189,6 +190,7 @@ class GUI_API_EXPORT TableWindow : public MdiChild void changesSuccessfullyCommited(); void changesFailedToCommit(int errorCode, const QString& errorText); void rollbackStructure(); + void resetAutoincrement(); void editColumn(); void delColumn(); void moveColumnUp(); diff --git a/SQLiteStudio3/guiSQLiteStudio/windows/tablewindow.ui b/SQLiteStudio3/guiSQLiteStudio/windows/tablewindow.ui index 8c46443..f1fe409 100644 --- a/SQLiteStudio3/guiSQLiteStudio/windows/tablewindow.ui +++ b/SQLiteStudio3/guiSQLiteStudio/windows/tablewindow.ui @@ -11,7 +11,7 @@ </rect> </property> <property name="windowTitle"> - <string>Form</string> + <string notr="true">Form</string> </property> <layout class="QHBoxLayout" name="horizontalLayout"> <property name="leftMargin"> @@ -74,7 +74,7 @@ <item> <widget class="QCheckBox" name="withoutRowIdCheck"> <property name="text"> - <string>WITHOUT ROWID</string> + <string notr="true">WITHOUT ROWID</string> </property> </widget> </item> diff --git a/SQLiteStudio3/guiSQLiteStudio/windows/viewwindow.cpp b/SQLiteStudio3/guiSQLiteStudio/windows/viewwindow.cpp index a37f387..a699801 100644 --- a/SQLiteStudio3/guiSQLiteStudio/windows/viewwindow.cpp +++ b/SQLiteStudio3/guiSQLiteStudio/windows/viewwindow.cpp @@ -284,9 +284,9 @@ void ViewWindow::createTriggersTabActions() { createAction(REFRESH_TRIGGERS, ICONS.RELOAD, tr("Refresh trigger list", "view window"), this, SLOT(refreshTriggers()), ui->triggersToolbar, ui->triggersList); ui->triggersToolbar->addSeparator(); - createAction(ADD_TRIGGER, ICONS.TRIGGER_ADD, tr("Create new triger", "view window"), this, SLOT(addTrigger()), ui->triggersToolbar, ui->triggersList); - createAction(EDIT_TRIGGER, ICONS.TRIGGER_EDIT, tr("Edit selected triger", "view window"), this, SLOT(editTrigger()), ui->triggersToolbar, ui->triggersList); - createAction(DEL_TRIGGER, ICONS.TRIGGER_DEL, tr("Delete selected triger", "view window"), this, SLOT(deleteTrigger()), ui->triggersToolbar, ui->triggersList); + createAction(ADD_TRIGGER, ICONS.TRIGGER_ADD, tr("Create new trigger", "view window"), this, SLOT(addTrigger()), ui->triggersToolbar, ui->triggersList); + createAction(EDIT_TRIGGER, ICONS.TRIGGER_EDIT, tr("Edit selected trigger", "view window"), this, SLOT(editTrigger()), ui->triggersToolbar, ui->triggersList); + createAction(DEL_TRIGGER, ICONS.TRIGGER_DEL, tr("Delete selected trigger", "view window"), this, SLOT(deleteTrigger()), ui->triggersToolbar, ui->triggersList); } QString ViewWindow::getView() const { diff --git a/SQLiteStudio3/guiSQLiteStudio/windows/viewwindow.ui b/SQLiteStudio3/guiSQLiteStudio/windows/viewwindow.ui index 734a265..94f5ea7 100644 --- a/SQLiteStudio3/guiSQLiteStudio/windows/viewwindow.ui +++ b/SQLiteStudio3/guiSQLiteStudio/windows/viewwindow.ui @@ -11,10 +11,19 @@ </rect> </property> <property name="windowTitle"> - <string>Form</string> + <string notr="true">Form</string> </property> <layout class="QVBoxLayout" name="verticalLayout"> - <property name="margin"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> <number>0</number> </property> <item> @@ -33,7 +42,16 @@ <item> <widget class="QWidget" name="nameWidget" native="true"> <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="margin"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> <number>0</number> </property> <item> @@ -116,6 +134,11 @@ </widget> <customwidgets> <customwidget> + <class>SqlView</class> + <extends>QPlainTextEdit</extends> + <header>sqlview.h</header> + </customwidget> + <customwidget> <class>DataView</class> <extends>QTabWidget</extends> <header>dataview.h</header> @@ -126,11 +149,6 @@ <extends>QPlainTextEdit</extends> <header>sqleditor.h</header> </customwidget> - <customwidget> - <class>SqlView</class> - <extends>QPlainTextEdit</extends> - <header>sqlview.h</header> - </customwidget> </customwidgets> <resources/> <connections/> |
