diff options
| author | 2015-05-12 16:19:40 -0400 | |
|---|---|---|
| committer | 2015-05-12 16:19:40 -0400 | |
| commit | 9618f0ebbf4b88045247c01ce8c8f58203508ebf (patch) | |
| tree | 20c9894691353ee8bab4eec668e9b0b6c6426e0f /SQLiteStudio3/guiSQLiteStudio/mainwindow.cpp | |
| parent | a308f430f694423064ebc86fd0506c8c6fdb3d93 (diff) | |
Imported Upstream version 3.0.6upstream/3.0.6
Diffstat (limited to 'SQLiteStudio3/guiSQLiteStudio/mainwindow.cpp')
| -rw-r--r-- | SQLiteStudio3/guiSQLiteStudio/mainwindow.cpp | 66 |
1 files changed, 56 insertions, 10 deletions
diff --git a/SQLiteStudio3/guiSQLiteStudio/mainwindow.cpp b/SQLiteStudio3/guiSQLiteStudio/mainwindow.cpp index 373b21d..4691dda 100644 --- a/SQLiteStudio3/guiSQLiteStudio/mainwindow.cpp +++ b/SQLiteStudio3/guiSQLiteStudio/mainwindow.cpp @@ -37,6 +37,8 @@ #include "dialogs/newversiondialog.h" #include "dialogs/quitconfirmdialog.h" #include "common/widgetcover.h" +#include "dialogs/cssdebugdialog.h" +#include "themetuner.h" #include <QMdiSubWindow> #include <QDebug> #include <QStyleFactory> @@ -77,6 +79,7 @@ void MainWindow::init() #endif Committable::init(MainWindow::confirmQuit); + updateCornerDocking(); DbTreeModel::staticInit(); dbTree = new DbTree(this); @@ -120,8 +123,10 @@ void MainWindow::init() notifyInfo(tr("Running in debug mode. Debug messages are printed to the standard output.")); } +#ifdef PORTABLE_CONFIG connect(UPDATES, SIGNAL(updatesAvailable(QList<UpdateManager::UpdateEntry>)), this, SLOT(updatesAvailable(QList<UpdateManager::UpdateEntry>))); connect(UPDATES, SIGNAL(noUpdatesAvailable()), this, SLOT(noUpdatesAvailable())); +#endif connect(statusField, SIGNAL(linkActivated(QString)), this, SLOT(statusFieldLinkClicked(QString))); // Widget cover @@ -145,8 +150,10 @@ void MainWindow::init() widgetCover->getContainerLayout()->addWidget(updatingLabel, 0, 0); widgetCover->getContainerLayout()->addWidget(updatingBusyBar, 1, 0); widgetCover->getContainerLayout()->addWidget(updatingSubBar, 2, 0); +#ifdef PORTABLE_CONFIG connect(UPDATES, SIGNAL(updatingProgress(QString,int,int)), this, SLOT(handleUpdatingProgress(QString,int,int))); connect(UPDATES, SIGNAL(updatingError(QString)), this, SLOT(handleUpdatingError())); +#endif connect(CFG_CORE.General.Language, SIGNAL(changed(QVariant)), this, SLOT(notifyAboutLanguageChange())); } @@ -167,6 +174,8 @@ void MainWindow::cleanUp() delete ui; + ThemeTuner::cleanUp(); + safe_delete(formManager); } @@ -266,6 +275,7 @@ void MainWindow::createActions() createAction(RENAME_WINDOW, ICONS.WIN_RENAME, tr("Rename selected window"), this, SLOT(renameWindow()), this); createAction(OPEN_DEBUG_CONSOLE, tr("Open Debug Console"), this, SLOT(openDebugConsole()), this); + createAction(OPEN_CSS_CONSOLE, tr("Open CSS Console"), this, SLOT(openCssConsole()), this); createAction(REPORT_BUG, ICONS.BUG, tr("Report a bug"), this, SLOT(reportBug()), this); createAction(FEATURE_REQUEST, ICONS.FEATURE_REQUEST, tr("Propose a new feature"), this, SLOT(requestFeature()), this); createAction(ABOUT, ICONS.SQLITESTUDIO_APP16, tr("About"), this, SLOT(aboutSqlitestudio()), this); @@ -275,7 +285,9 @@ void MainWindow::createActions() createAction(USER_MANUAL, ICONS.USER_MANUAL, tr("User Manual"), this, SLOT(userManual()), this); createAction(SQLITE_DOCS, ICONS.SQLITE_DOCS, tr("SQLite documentation"), this, SLOT(sqliteDocs()), this); createAction(BUG_REPORT_HISTORY, ICONS.BUG_LIST, tr("Report history"), this, SLOT(reportHistory()), this); +#ifdef PORTABLE_CONFIG createAction(CHECK_FOR_UPDATES, ICONS.GET_UPDATE, tr("Check for updates"), this, SLOT(checkForUpdates()), this); +#endif actionMap[ABOUT]->setMenuRole(QAction::AboutRole); actionMap[OPEN_CONFIG]->setMenuRole(QAction::PreferencesRole); @@ -404,11 +416,13 @@ void MainWindow::initMenuBar() sqlitestudioMenu->addAction(actionMap[HOMEPAGE]); sqlitestudioMenu->addAction(actionMap[FORUM]); sqlitestudioMenu->addSeparator(); +#ifdef PORTABLE_CONFIG if (UPDATES->isPlatformEligibleForUpdate()) { sqlitestudioMenu->addAction(actionMap[CHECK_FOR_UPDATES]); sqlitestudioMenu->addSeparator(); } +#endif sqlitestudioMenu->addAction(actionMap[REPORT_BUG]); sqlitestudioMenu->addAction(actionMap[FEATURE_REQUEST]); sqlitestudioMenu->addAction(actionMap[BUG_REPORT_HISTORY]); @@ -453,10 +467,15 @@ void MainWindow::restoreSession() { QHash<QString,QVariant> sessionValue = CFG_UI.General.Session.get(); if (sessionValue.size() == 0) + { + THEME_TUNER->tuneCurrentTheme(); return; + } if (sessionValue.contains("style")) setStyle(sessionValue["style"].toString()); + else + THEME_TUNER->tuneCurrentTheme(); if (sessionValue.contains("geometry")) restoreGeometry(sessionValue["geometry"].toByteArray()); @@ -484,6 +503,7 @@ void MainWindow::restoreSession() if (statusField->hasMessages()) statusField->setVisible(true); + updateCornerDocking(); updateWindowActions(); } @@ -550,6 +570,7 @@ void MainWindow::setStyle(const QString& styleName) return; } QApplication::setStyle(style); + THEME_TUNER->tuneTheme(styleName); } QString MainWindow::currentStyle() const @@ -680,6 +701,12 @@ void MainWindow::openDebugConsole() showUiDebugConsole(); } +void MainWindow::openCssConsole() +{ + CssDebugDialog* dialog = new CssDebugDialog; + dialog->show(); +} + void MainWindow::reportBug() { BugDialog dialog(this); @@ -730,6 +757,18 @@ void MainWindow::reportHistory() openReportHistory(); } +void MainWindow::statusFieldLinkClicked(const QString& link) +{ +#ifdef PORTABLE_CONFIG + if (link == openUpdatesUrl && newVersionDialog) + { + newVersionDialog->exec(); + return; + } +#endif +} + +#ifdef PORTABLE_CONFIG void MainWindow::updatesAvailable(const QList<UpdateManager::UpdateEntry>& updates) { manualUpdatesChecking = false; @@ -747,19 +786,10 @@ void MainWindow::noUpdatesAvailable() manualUpdatesChecking = false; } -void MainWindow::statusFieldLinkClicked(const QString& link) -{ - if (link == openUpdatesUrl && newVersionDialog) - { - newVersionDialog->exec(); - return; - } -} - void MainWindow::checkForUpdates() { manualUpdatesChecking = true; - UPDATES->checkForUpdates(); + UPDATES->checkForUpdates(true); } void MainWindow::handleUpdatingProgress(const QString& jobTitle, int jobPercent, int totalPercent) @@ -776,6 +806,22 @@ void MainWindow::handleUpdatingError() { widgetCover->hide(); } +#endif + +void MainWindow::updateCornerDocking() +{ + if (CFG_UI.General.DockLayout.get() == "vertical") { + setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea); + setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); + setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea); + setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea); + } else { + setCorner(Qt::TopLeftCorner, Qt::TopDockWidgetArea); + setCorner(Qt::TopRightCorner, Qt::TopDockWidgetArea); + setCorner(Qt::BottomLeftCorner, Qt::BottomDockWidgetArea); + setCorner(Qt::BottomRightCorner, Qt::BottomDockWidgetArea); + } +} DdlHistoryWindow* MainWindow::openDdlHistory() { |
