diff options
author | hjk <hjk@qt.io> | 2018-01-29 11:46:23 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2018-02-01 13:29:58 +0000 |
commit | 974022c77b7227ef048740dee9a61beca928304c (patch) | |
tree | 159d77c88ae25d6fe72756a22bf6c2e4b80287cd /src/plugins/coreplugin/mainwindow.cpp | |
parent | 9d8abd935205106917f2706750f27d698b699305 (diff) | |
download | qt-creator-974022c77b7227ef048740dee9a61beca928304c.tar.gz |
Core: Reduce code path ping-pong between ICore and MainWindow
Public entry points for displaying settings dialog were in ICore,
diverting to MainWindow, and back in some cases.
Move implementation to icore.cpp instead.
Change-Id: I02cbf1dcfe6241c665d7d701b4b4af1a8a242af5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/coreplugin/mainwindow.cpp')
-rw-r--r-- | src/plugins/coreplugin/mainwindow.cpp | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index a17dc50e28..b2b8603882 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -57,7 +57,6 @@ #include <coreplugin/actionmanager/actionmanager_p.h> #include <coreplugin/actionmanager/command.h> #include <coreplugin/dialogs/newdialog.h> -#include <coreplugin/dialogs/settingsdialog.h> #include <coreplugin/dialogs/shortcutsettings.h> #include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager_p.h> @@ -85,9 +84,7 @@ #include <QFileInfo> #include <QMenu> #include <QMenuBar> -#include <QMessageBox> #include <QPrinter> -#include <QPushButton> #include <QSettings> #include <QStatusBar> #include <QStyleFactory> @@ -632,7 +629,7 @@ void MainWindow::registerDefaultActions() cmd = ActionManager::registerAction(m_optionsAction, Constants::OPTIONS); cmd->setDefaultKeySequence(QKeySequence::Preferences); mtools->addAction(cmd, Constants::G_TOOLS_OPTIONS); - connect(m_optionsAction, &QAction::triggered, this, [this]() { showOptionsDialog(); }); + connect(m_optionsAction, &QAction::triggered, this, [] { ICore::showOptionsDialog(Id()); }); mwindow->addSeparator(Constants::G_WINDOW_LIST); @@ -832,15 +829,6 @@ void MainWindow::setFocusToEditor() EditorManagerPrivate::doEscapeKeyFocusMoveMagic(); } -bool MainWindow::showOptionsDialog(Id page, QWidget *parent) -{ - emit m_coreImpl->optionsDialogRequested(); - if (!parent) - parent = ICore::dialogParent(); - SettingsDialog *dialog = SettingsDialog::getSettingsDialog(parent, page); - return dialog->execDialog(); -} - void MainWindow::saveAll() { DocumentManager::saveAllModifiedDocumentsSilently(); @@ -1121,30 +1109,6 @@ QPrinter *MainWindow::printer() const return m_printer; } -// Display a warning with an additional button to open -// the debugger settings dialog if settingsId is nonempty. - -bool MainWindow::showWarningWithOptions(const QString &title, - const QString &text, - const QString &details, - Id settingsId, - QWidget *parent) -{ - if (parent == 0) - parent = this; - QMessageBox msgBox(QMessageBox::Warning, title, text, - QMessageBox::Ok, parent); - if (!details.isEmpty()) - msgBox.setDetailedText(details); - QAbstractButton *settingsButton = nullptr; - if (settingsId.isValid()) - settingsButton = msgBox.addButton(tr("Settings..."), QMessageBox::AcceptRole); - msgBox.exec(); - if (settingsButton && msgBox.clickedButton() == settingsButton) - return showOptionsDialog(settingsId); - return false; -} - void MainWindow::restoreWindowState() { QSettings *settings = PluginManager::settings(); |