From 14bffd2c88eecfd9539468f7ffdd0baf03206887 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 12 Mar 2019 10:18:14 +0100 Subject: [PATCH] ProjectExplorer: Add settings icon to app and compile output panes This provides a natural shortcut to the respective options page. Change-Id: I1e57c64d1541540cb1c0c44c6fb8eaad69fc2e32 Reviewed-by: Alessandro Portale --- doc/src/howto/creator-ui.qdoc | 11 +++++++---- src/plugins/projectexplorer/appoutputpane.cpp | 15 +++++++++++++-- src/plugins/projectexplorer/appoutputpane.h | 1 + .../projectexplorer/compileoutputwindow.cpp | 12 ++++++++++-- src/plugins/projectexplorer/compileoutputwindow.h | 1 + 5 files changed, 32 insertions(+), 8 deletions(-) diff --git a/doc/src/howto/creator-ui.qdoc b/doc/src/howto/creator-ui.qdoc index 8a6411ce5e9..9d0249251b1 100644 --- a/doc/src/howto/creator-ui.qdoc +++ b/doc/src/howto/creator-ui.qdoc @@ -320,10 +320,10 @@ To specify settings for displaying application output, select \uicontrol Tools > \uicontrol Options > \uicontrol {Build & Run} > - \uicontrol Application Output. You can select whether to open the - \uicontrol{Application Output} pane on output when running or debugging - applications, to clear old output on a new run, to word-wrap output, and to - limit output to the specified number of lines. + \uicontrol Application Output, or click the \uicontrol {Open Settings Page} + button. You can select whether to open the \uicontrol{Application Output} pane + on output when running or debugging applications, to clear old output on a new run, + to word-wrap output, and to limit output to the specified number of lines. \section2 Compile Output @@ -345,6 +345,9 @@ In the \uicontrol {Limit output to} field, you can specify the maximum amount of build output lines to display in the pane. + You can also reach the options page by clicking the \uicontrol {Open Settings Page} + button. + \if defined(qtcreator) \section2 To-Do Entries diff --git a/src/plugins/projectexplorer/appoutputpane.cpp b/src/plugins/projectexplorer/appoutputpane.cpp index c7b01ebd9bd..4e2686d5249 100644 --- a/src/plugins/projectexplorer/appoutputpane.cpp +++ b/src/plugins/projectexplorer/appoutputpane.cpp @@ -66,6 +66,9 @@ static Q_LOGGING_CATEGORY(appOutputLog, "qtc.projectexplorer.appoutput", QtWarni using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; +const char OPTIONS_PAGE_ID[] = "B.ProjectExplorer.AppOutputOptions"; + + static QObject *debuggerPlugin() { return ExtensionSystem::PluginManager::getObjectByName("DebuggerPlugin"); @@ -176,6 +179,7 @@ AppOutputPane::AppOutputPane() : m_attachButton(new QToolButton), m_zoomInButton(new QToolButton), m_zoomOutButton(new QToolButton), + m_settingsButton(new QToolButton), m_formatterWidget(new QWidget) { setObjectName("AppOutputPane"); // Used in valgrind engine @@ -226,6 +230,13 @@ AppOutputPane::AppOutputPane() : connect(m_zoomOutButton, &QToolButton::clicked, this, &AppOutputPane::zoomOut); + m_settingsButton->setToolTip(tr("Open Settings Page")); + m_settingsButton->setIcon(Utils::Icons::SETTINGS_TOOLBAR.icon()); + m_settingsButton->setAutoRaise(true); + connect(m_settingsButton, &QToolButton::clicked, this, [] { + Core::ICore::showOptionsDialog(OPTIONS_PAGE_ID); + }); + auto formatterWidgetsLayout = new QHBoxLayout; formatterWidgetsLayout->setContentsMargins(QMargins()); m_formatterWidget->setLayout(formatterWidgetsLayout); @@ -343,7 +354,7 @@ QWidget *AppOutputPane::outputWidget(QWidget *) QList AppOutputPane::toolBarWidgets() const { return { m_reRunButton, m_stopButton, m_attachButton, m_zoomInButton, - m_zoomOutButton, m_formatterWidget }; + m_zoomOutButton, m_settingsButton, m_formatterWidget }; } QString AppOutputPane::displayName() const @@ -864,7 +875,7 @@ private: AppOutputSettingsPage::AppOutputSettingsPage() { - setId("B.ProjectExplorer.AppOutputOptions"); + setId(OPTIONS_PAGE_ID); setDisplayName(tr("Application Output")); setCategory(Constants::BUILD_AND_RUN_SETTINGS_CATEGORY); } diff --git a/src/plugins/projectexplorer/appoutputpane.h b/src/plugins/projectexplorer/appoutputpane.h index 582ad653d9a..32f56693988 100644 --- a/src/plugins/projectexplorer/appoutputpane.h +++ b/src/plugins/projectexplorer/appoutputpane.h @@ -162,6 +162,7 @@ private: QToolButton *m_attachButton; QToolButton *m_zoomInButton; QToolButton *m_zoomOutButton; + QToolButton * const m_settingsButton; QWidget *m_formatterWidget; float m_zoom; AppOutputSettings m_settings; diff --git a/src/plugins/projectexplorer/compileoutputwindow.cpp b/src/plugins/projectexplorer/compileoutputwindow.cpp index 305d6ca6e2f..cd633054c72 100644 --- a/src/plugins/projectexplorer/compileoutputwindow.cpp +++ b/src/plugins/projectexplorer/compileoutputwindow.cpp @@ -66,6 +66,7 @@ const char C_COMPILE_OUTPUT[] = "ProjectExplorer.CompileOutput"; const char POP_UP_KEY[] = "ProjectExplorer/Settings/ShowCompilerOutput"; const char WRAP_OUTPUT_KEY[] = "ProjectExplorer/Settings/WrapBuildOutput"; const char MAX_LINES_KEY[] = "ProjectExplorer/Settings/MaxBuildOutputLines"; +const char OPTIONS_PAGE_ID[] = "C.ProjectExplorer.CompileOutputOptions"; } namespace ProjectExplorer { @@ -159,6 +160,7 @@ CompileOutputWindow::CompileOutputWindow(QAction *cancelBuildAction) : m_cancelBuildButton(new QToolButton), m_zoomInButton(new QToolButton), m_zoomOutButton(new QToolButton), + m_settingsButton(new QToolButton), m_formatter(new Utils::OutputFormatter) { Core::Context context(C_COMPILE_OUTPUT); @@ -187,6 +189,8 @@ CompileOutputWindow::CompileOutputWindow(QAction *cancelBuildAction) : m_zoomInButton->setIcon(Utils::Icons::PLUS_TOOLBAR.icon()); m_zoomOutButton->setToolTip(tr("Decrease Font Size")); m_zoomOutButton->setIcon(Utils::Icons::MINUS.icon()); + m_settingsButton->setToolTip(tr("Open Settings Page")); + m_settingsButton->setIcon(Utils::Icons::SETTINGS_TOOLBAR.icon()); updateZoomEnabled(); @@ -198,6 +202,9 @@ CompileOutputWindow::CompileOutputWindow(QAction *cancelBuildAction) : this, [this]() { m_outputWindow->zoomIn(1); }); connect(m_zoomOutButton, &QToolButton::clicked, this, [this]() { m_outputWindow->zoomOut(1); }); + connect(m_settingsButton, &QToolButton::clicked, this, [] { + Core::ICore::showOptionsDialog(OPTIONS_PAGE_ID); + }); auto agg = new Aggregation::Aggregate; agg->add(m_outputWindow); @@ -218,6 +225,7 @@ CompileOutputWindow::~CompileOutputWindow() delete m_cancelBuildButton; delete m_zoomInButton; delete m_zoomOutButton; + delete m_settingsButton; delete m_formatter; } @@ -259,7 +267,7 @@ QWidget *CompileOutputWindow::outputWidget(QWidget *) QList CompileOutputWindow::toolBarWidgets() const { - return {m_cancelBuildButton, m_zoomInButton, m_zoomOutButton}; + return {m_cancelBuildButton, m_zoomInButton, m_zoomOutButton, m_settingsButton}; } void CompileOutputWindow::appendText(const QString &text, BuildStep::OutputFormat format) @@ -432,7 +440,7 @@ private: CompileOutputSettingsPage::CompileOutputSettingsPage() { - setId("C.ProjectExplorer.CompileOutputOptions"); + setId(OPTIONS_PAGE_ID); setDisplayName(tr("Compile Output")); setCategory(Constants::BUILD_AND_RUN_SETTINGS_CATEGORY); } diff --git a/src/plugins/projectexplorer/compileoutputwindow.h b/src/plugins/projectexplorer/compileoutputwindow.h index e2376c2b3f1..bf21345f702 100644 --- a/src/plugins/projectexplorer/compileoutputwindow.h +++ b/src/plugins/projectexplorer/compileoutputwindow.h @@ -99,6 +99,7 @@ private: QToolButton *m_cancelBuildButton; QToolButton *m_zoomInButton; QToolButton *m_zoomOutButton; + QToolButton * const m_settingsButton; Utils::OutputFormatter *m_formatter; CompileOutputSettings m_settings; };