forked from qt-creator/qt-creator
App output pane: More fine-grained popup options
Let users specify that the app output pane should pop up only on initial output. Fixes: QTCREATORBUG-22844 Change-Id: I13d44af8edebac151b81d7b49fb0640e251ea3ab Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -51,6 +51,8 @@
|
|||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QFormLayout>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
@@ -497,10 +499,18 @@ void AppOutputPane::appendMessage(RunControl *rc, const QString &out, Utils::Out
|
|||||||
stringToWrite += out;
|
stringToWrite += out;
|
||||||
window->appendMessage(stringToWrite, format);
|
window->appendMessage(stringToWrite, format);
|
||||||
if (format != Utils::NormalMessageFormat) {
|
if (format != Utils::NormalMessageFormat) {
|
||||||
if (m_runControlTabs.at(index).behaviorOnOutput == Flash)
|
RunControlTab &tab = m_runControlTabs[index];
|
||||||
|
switch (tab.behaviorOnOutput) {
|
||||||
|
case AppOutputPaneMode::FlashOnOutput:
|
||||||
flash();
|
flash();
|
||||||
else
|
break;
|
||||||
|
case AppOutputPaneMode::PopupOnFirstOutput:
|
||||||
|
tab.behaviorOnOutput = AppOutputPaneMode::FlashOnOutput;
|
||||||
|
Q_FALLTHROUGH();
|
||||||
|
case AppOutputPaneMode::PopupOnOutput:
|
||||||
popup(NoModeSwitch);
|
popup(NoModeSwitch);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -515,8 +525,8 @@ void AppOutputPane::setSettings(const AppOutputSettings &settings)
|
|||||||
void AppOutputPane::storeSettings() const
|
void AppOutputPane::storeSettings() const
|
||||||
{
|
{
|
||||||
QSettings * const s = Core::ICore::settings();
|
QSettings * const s = Core::ICore::settings();
|
||||||
s->setValue(POP_UP_FOR_RUN_OUTPUT_KEY, m_settings.popUpForRunOutput);
|
s->setValue(POP_UP_FOR_RUN_OUTPUT_KEY, int(m_settings.runOutputMode));
|
||||||
s->setValue(POP_UP_FOR_DEBUG_OUTPUT_KEY, m_settings.popUpForDebugOutput);
|
s->setValue(POP_UP_FOR_DEBUG_OUTPUT_KEY, int(m_settings.debugOutputMode));
|
||||||
s->setValue(CLEAN_OLD_OUTPUT_KEY, m_settings.cleanOldOutput);
|
s->setValue(CLEAN_OLD_OUTPUT_KEY, m_settings.cleanOldOutput);
|
||||||
s->setValue(MERGE_CHANNELS_KEY, m_settings.mergeChannels);
|
s->setValue(MERGE_CHANNELS_KEY, m_settings.mergeChannels);
|
||||||
s->setValue(WRAP_OUTPUT_KEY, m_settings.wrapOutput);
|
s->setValue(WRAP_OUTPUT_KEY, m_settings.wrapOutput);
|
||||||
@@ -526,8 +536,13 @@ void AppOutputPane::storeSettings() const
|
|||||||
void AppOutputPane::loadSettings()
|
void AppOutputPane::loadSettings()
|
||||||
{
|
{
|
||||||
QSettings * const s = Core::ICore::settings();
|
QSettings * const s = Core::ICore::settings();
|
||||||
m_settings.popUpForRunOutput = s->value(POP_UP_FOR_RUN_OUTPUT_KEY, true).toBool();
|
const auto modeFromSettings = [s](const QString key, AppOutputPaneMode defaultValue) {
|
||||||
m_settings.popUpForDebugOutput = s->value(POP_UP_FOR_DEBUG_OUTPUT_KEY, false).toBool();
|
return static_cast<AppOutputPaneMode>(s->value(key, int(defaultValue)).toInt());
|
||||||
|
};
|
||||||
|
m_settings.runOutputMode = modeFromSettings(POP_UP_FOR_RUN_OUTPUT_KEY,
|
||||||
|
AppOutputPaneMode::PopupOnFirstOutput);
|
||||||
|
m_settings.debugOutputMode = modeFromSettings(POP_UP_FOR_DEBUG_OUTPUT_KEY,
|
||||||
|
AppOutputPaneMode::FlashOnOutput);
|
||||||
m_settings.cleanOldOutput = s->value(CLEAN_OLD_OUTPUT_KEY, false).toBool();
|
m_settings.cleanOldOutput = s->value(CLEAN_OLD_OUTPUT_KEY, false).toBool();
|
||||||
m_settings.mergeChannels = s->value(MERGE_CHANNELS_KEY, false).toBool();
|
m_settings.mergeChannels = s->value(MERGE_CHANNELS_KEY, false).toBool();
|
||||||
m_settings.wrapOutput = s->value(WRAP_OUTPUT_KEY, true).toBool();
|
m_settings.wrapOutput = s->value(WRAP_OUTPUT_KEY, true).toBool();
|
||||||
@@ -540,7 +555,7 @@ void AppOutputPane::showTabFor(RunControl *rc)
|
|||||||
m_tabWidget->setCurrentIndex(tabWidgetIndexOf(indexOf(rc)));
|
m_tabWidget->setCurrentIndex(tabWidgetIndexOf(indexOf(rc)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppOutputPane::setBehaviorOnOutput(RunControl *rc, AppOutputPane::BehaviorOnOutput mode)
|
void AppOutputPane::setBehaviorOnOutput(RunControl *rc, AppOutputPaneMode mode)
|
||||||
{
|
{
|
||||||
const int index = indexOf(rc);
|
const int index = indexOf(rc);
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
@@ -815,18 +830,23 @@ public:
|
|||||||
m_cleanOldOutputCheckBox.setChecked(settings.cleanOldOutput);
|
m_cleanOldOutputCheckBox.setChecked(settings.cleanOldOutput);
|
||||||
m_mergeChannelsCheckBox.setText(tr("Merge stderr and stdout"));
|
m_mergeChannelsCheckBox.setText(tr("Merge stderr and stdout"));
|
||||||
m_mergeChannelsCheckBox.setChecked(settings.mergeChannels);
|
m_mergeChannelsCheckBox.setChecked(settings.mergeChannels);
|
||||||
m_popUpForRunOutputCheckBox.setText(tr("Open pane on output when running"));
|
for (QComboBox * const modeComboBox
|
||||||
m_popUpForRunOutputCheckBox.setChecked(settings.popUpForRunOutput);
|
: {&m_runOutputModeComboBox, &m_debugOutputModeComboBox}) {
|
||||||
m_popUpForDebugOutputCheckBox.setText(tr("Open pane on output when debugging"));
|
modeComboBox->addItem(tr("Always"), int(AppOutputPaneMode::PopupOnOutput));
|
||||||
m_popUpForDebugOutputCheckBox.setChecked(settings.popUpForDebugOutput);
|
modeComboBox->addItem(tr("Never"), int(AppOutputPaneMode::FlashOnOutput));
|
||||||
|
modeComboBox->addItem(tr("On first output only"),
|
||||||
|
int(AppOutputPaneMode::PopupOnFirstOutput));
|
||||||
|
}
|
||||||
|
m_runOutputModeComboBox.setCurrentIndex(m_runOutputModeComboBox
|
||||||
|
.findData(int(settings.runOutputMode)));
|
||||||
|
m_debugOutputModeComboBox.setCurrentIndex(m_debugOutputModeComboBox
|
||||||
|
.findData(int(settings.debugOutputMode)));
|
||||||
m_maxCharsBox.setMaximum(100000000);
|
m_maxCharsBox.setMaximum(100000000);
|
||||||
m_maxCharsBox.setValue(settings.maxCharCount);
|
m_maxCharsBox.setValue(settings.maxCharCount);
|
||||||
const auto layout = new QVBoxLayout(this);
|
const auto layout = new QVBoxLayout(this);
|
||||||
layout->addWidget(&m_wrapOutputCheckBox);
|
layout->addWidget(&m_wrapOutputCheckBox);
|
||||||
layout->addWidget(&m_cleanOldOutputCheckBox);
|
layout->addWidget(&m_cleanOldOutputCheckBox);
|
||||||
layout->addWidget(&m_mergeChannelsCheckBox);
|
layout->addWidget(&m_mergeChannelsCheckBox);
|
||||||
layout->addWidget(&m_popUpForRunOutputCheckBox);
|
|
||||||
layout->addWidget(&m_popUpForDebugOutputCheckBox);
|
|
||||||
const auto maxCharsLayout = new QHBoxLayout;
|
const auto maxCharsLayout = new QHBoxLayout;
|
||||||
const QString msg = tr("Limit output to %1 characters");
|
const QString msg = tr("Limit output to %1 characters");
|
||||||
const QStringList parts = msg.split("%1") << QString() << QString();
|
const QStringList parts = msg.split("%1") << QString() << QString();
|
||||||
@@ -834,6 +854,11 @@ public:
|
|||||||
maxCharsLayout->addWidget(&m_maxCharsBox);
|
maxCharsLayout->addWidget(&m_maxCharsBox);
|
||||||
maxCharsLayout->addWidget(new QLabel(parts.at(1).trimmed()));
|
maxCharsLayout->addWidget(new QLabel(parts.at(1).trimmed()));
|
||||||
maxCharsLayout->addStretch(1);
|
maxCharsLayout->addStretch(1);
|
||||||
|
const auto outputModeLayout = new QFormLayout;
|
||||||
|
outputModeLayout->addRow(tr("Open pane on output when running:"), &m_runOutputModeComboBox);
|
||||||
|
outputModeLayout->addRow(tr("Open pane on output when debugging:"),
|
||||||
|
&m_debugOutputModeComboBox);
|
||||||
|
layout->addLayout(outputModeLayout);
|
||||||
layout->addLayout(maxCharsLayout);
|
layout->addLayout(maxCharsLayout);
|
||||||
layout->addStretch(1);
|
layout->addStretch(1);
|
||||||
}
|
}
|
||||||
@@ -844,8 +869,10 @@ public:
|
|||||||
s.wrapOutput = m_wrapOutputCheckBox.isChecked();
|
s.wrapOutput = m_wrapOutputCheckBox.isChecked();
|
||||||
s.cleanOldOutput = m_cleanOldOutputCheckBox.isChecked();
|
s.cleanOldOutput = m_cleanOldOutputCheckBox.isChecked();
|
||||||
s.mergeChannels = m_mergeChannelsCheckBox.isChecked();
|
s.mergeChannels = m_mergeChannelsCheckBox.isChecked();
|
||||||
s.popUpForRunOutput = m_popUpForRunOutputCheckBox.isChecked();
|
s.runOutputMode = static_cast<AppOutputPaneMode>(
|
||||||
s.popUpForDebugOutput = m_popUpForDebugOutputCheckBox.isChecked();
|
m_runOutputModeComboBox.currentData().toInt());
|
||||||
|
s.debugOutputMode = static_cast<AppOutputPaneMode>(
|
||||||
|
m_debugOutputModeComboBox.currentData().toInt());
|
||||||
s.maxCharCount = m_maxCharsBox.value();
|
s.maxCharCount = m_maxCharsBox.value();
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@@ -854,8 +881,8 @@ private:
|
|||||||
QCheckBox m_wrapOutputCheckBox;
|
QCheckBox m_wrapOutputCheckBox;
|
||||||
QCheckBox m_cleanOldOutputCheckBox;
|
QCheckBox m_cleanOldOutputCheckBox;
|
||||||
QCheckBox m_mergeChannelsCheckBox;
|
QCheckBox m_mergeChannelsCheckBox;
|
||||||
QCheckBox m_popUpForRunOutputCheckBox;
|
QComboBox m_runOutputModeComboBox;
|
||||||
QCheckBox m_popUpForDebugOutputCheckBox;
|
QComboBox m_debugOutputModeComboBox;
|
||||||
QSpinBox m_maxCharsBox;
|
QSpinBox m_maxCharsBox;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -62,11 +62,6 @@ public:
|
|||||||
CloseTabWithPrompt
|
CloseTabWithPrompt
|
||||||
};
|
};
|
||||||
|
|
||||||
enum BehaviorOnOutput {
|
|
||||||
Flash,
|
|
||||||
Popup
|
|
||||||
};
|
|
||||||
|
|
||||||
AppOutputPane();
|
AppOutputPane();
|
||||||
~AppOutputPane() override;
|
~AppOutputPane() override;
|
||||||
|
|
||||||
@@ -88,7 +83,7 @@ public:
|
|||||||
|
|
||||||
void createNewOutputWindow(RunControl *rc);
|
void createNewOutputWindow(RunControl *rc);
|
||||||
void showTabFor(RunControl *rc);
|
void showTabFor(RunControl *rc);
|
||||||
void setBehaviorOnOutput(RunControl *rc, BehaviorOnOutput mode);
|
void setBehaviorOnOutput(RunControl *rc, AppOutputPaneMode mode);
|
||||||
|
|
||||||
bool aboutToClose() const;
|
bool aboutToClose() const;
|
||||||
void closeTabs(CloseTabMode mode);
|
void closeTabs(CloseTabMode mode);
|
||||||
@@ -130,7 +125,7 @@ private:
|
|||||||
Core::OutputWindow *window = nullptr);
|
Core::OutputWindow *window = nullptr);
|
||||||
QPointer<RunControl> runControl;
|
QPointer<RunControl> runControl;
|
||||||
QPointer<Core::OutputWindow> window;
|
QPointer<Core::OutputWindow> window;
|
||||||
BehaviorOnOutput behaviorOnOutput = Flash;
|
AppOutputPaneMode behaviorOnOutput = AppOutputPaneMode::FlashOnOutput;
|
||||||
};
|
};
|
||||||
|
|
||||||
void closeTab(int index, CloseTabMode cm = CloseTabWithPrompt);
|
void closeTab(int index, CloseTabMode cm = CloseTabWithPrompt);
|
||||||
|
@@ -2308,9 +2308,12 @@ void ProjectExplorerPluginPrivate::startRunControl(RunControl *runControl)
|
|||||||
m_outputPane.flash(); // one flash for starting
|
m_outputPane.flash(); // one flash for starting
|
||||||
m_outputPane.showTabFor(runControl);
|
m_outputPane.showTabFor(runControl);
|
||||||
Core::Id runMode = runControl->runMode();
|
Core::Id runMode = runControl->runMode();
|
||||||
bool popup = (runMode == Constants::NORMAL_RUN_MODE && m_outputPane.settings().popUpForRunOutput)
|
const auto popupMode = runMode == Constants::NORMAL_RUN_MODE
|
||||||
|| (runMode == Constants::DEBUG_RUN_MODE && m_outputPane.settings().popUpForDebugOutput);
|
? m_outputPane.settings().runOutputMode
|
||||||
m_outputPane.setBehaviorOnOutput(runControl, popup ? AppOutputPane::Popup : AppOutputPane::Flash);
|
: runMode == Constants::DEBUG_RUN_MODE
|
||||||
|
? m_outputPane.settings().debugOutputMode
|
||||||
|
: AppOutputPaneMode::FlashOnOutput;
|
||||||
|
m_outputPane.setBehaviorOnOutput(runControl, popupMode);
|
||||||
connect(runControl, &QObject::destroyed, this, &ProjectExplorerPluginPrivate::checkForShutdown,
|
connect(runControl, &QObject::destroyed, this, &ProjectExplorerPluginPrivate::checkForShutdown,
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
++m_activeRunControlCount;
|
++m_activeRunControlCount;
|
||||||
|
@@ -34,6 +34,7 @@ namespace ProjectExplorer {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
enum class TerminalMode { On, Off, Smart };
|
enum class TerminalMode { On, Off, Smart };
|
||||||
|
enum class AppOutputPaneMode { FlashOnOutput, PopupOnOutput, PopupOnFirstOutput };
|
||||||
|
|
||||||
class ProjectExplorerSettings
|
class ProjectExplorerSettings
|
||||||
{
|
{
|
||||||
@@ -83,8 +84,8 @@ inline bool operator==(const ProjectExplorerSettings &p1, const ProjectExplorerS
|
|||||||
class AppOutputSettings
|
class AppOutputSettings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool popUpForRunOutput = true;
|
AppOutputPaneMode runOutputMode = AppOutputPaneMode::PopupOnFirstOutput;
|
||||||
bool popUpForDebugOutput = false;
|
AppOutputPaneMode debugOutputMode = AppOutputPaneMode::FlashOnOutput;
|
||||||
bool cleanOldOutput = false;
|
bool cleanOldOutput = false;
|
||||||
bool mergeChannels = false;
|
bool mergeChannels = false;
|
||||||
bool wrapOutput = false;
|
bool wrapOutput = false;
|
||||||
|
Reference in New Issue
Block a user