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 <alessandro.portale@qt.io>
This commit is contained in:
Christian Kandeler
2019-03-12 10:18:14 +01:00
parent fecf863b78
commit 14bffd2c88
5 changed files with 32 additions and 8 deletions

View File

@@ -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

View File

@@ -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<QWidget*> 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);
}

View File

@@ -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;

View File

@@ -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<QWidget *> 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);
}

View File

@@ -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;
};