diff options
author | hjk <hjk@qt.io> | 2022-05-25 15:57:20 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2022-05-30 14:10:59 +0000 |
commit | 17ee38775647306e7b79549ec5941618bf52c8f1 (patch) | |
tree | 831b2251b4ec9dfde8e4068270aff31b8742ee80 /src/plugins/projectexplorer/appoutputpane.cpp | |
parent | d325f56cc1c2fcea4cd338d8f4f30a522533446f (diff) |
ProjectExplorer: Dissolve a few uses of Runnable
Change-Id: I71b8f1b00e488360e7f9c136912bc64b5a76609a
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/appoutputpane.cpp')
-rw-r--r-- | src/plugins/projectexplorer/appoutputpane.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/plugins/projectexplorer/appoutputpane.cpp b/src/plugins/projectexplorer/appoutputpane.cpp index 380ec9f071..bb96e200f7 100644 --- a/src/plugins/projectexplorer/appoutputpane.cpp +++ b/src/plugins/projectexplorer/appoutputpane.cpp @@ -44,6 +44,7 @@ #include <extensionsystem/invoker.h> #include <extensionsystem/pluginmanager.h> + #include <utils/algorithm.h> #include <utils/outputformatter.h> #include <utils/qtcassert.h> @@ -66,6 +67,8 @@ static Q_LOGGING_CATEGORY(appOutputLog, "qtc.projectexplorer.appoutput", QtWarningMsg); +using namespace Utils; + namespace ProjectExplorer { namespace Internal { @@ -398,19 +401,20 @@ void AppOutputPane::createNewOutputWindow(RunControl *rc) connect(rc, &RunControl::applicationProcessHandleChanged, this, &AppOutputPane::enableDefaultButtons); connect(rc, &RunControl::appendMessage, - this, [this, rc](const QString &out, Utils::OutputFormat format) { + this, [this, rc](const QString &out, OutputFormat format) { appendMessage(rc, out, format); }); // First look if we can reuse a tab - const Runnable thisRunnable = rc->runnable(); + const CommandLine thisCommand = rc->commandLine(); + const FilePath thisWorkingDirectory = rc->workingDirectory(); + const Environment thisEnvironment = rc->environment(); const int tabIndex = Utils::indexOf(m_runControlTabs, [&](const RunControlTab &tab) { if (!tab.runControl || tab.runControl->isRunning()) return false; - const Runnable otherRunnable = tab.runControl->runnable(); - return thisRunnable.command == otherRunnable.command - && thisRunnable.workingDirectory == otherRunnable.workingDirectory - && thisRunnable.environment == otherRunnable.environment; + return thisCommand == tab.runControl->commandLine() + && thisWorkingDirectory == tab.runControl->workingDirectory() + && thisEnvironment == tab.runControl->environment(); }); if (tabIndex != -1) { RunControlTab &tab = m_runControlTabs[tabIndex]; @@ -433,7 +437,7 @@ void AppOutputPane::createNewOutputWindow(RunControl *rc) } // Create new static int counter = 0; - Utils::Id contextId = Utils::Id(C_APP_OUTPUT).withSuffix(counter++); + Id contextId = Id(C_APP_OUTPUT).withSuffix(counter++); Core::Context context(contextId); Core::OutputWindow *ow = new Core::OutputWindow(context, SETTINGS_KEY, m_tabWidget); ow->setWindowTitle(tr("Application Output Window")); @@ -486,19 +490,19 @@ void AppOutputPane::updateFromSettings() } } -void AppOutputPane::appendMessage(RunControl *rc, const QString &out, Utils::OutputFormat format) +void AppOutputPane::appendMessage(RunControl *rc, const QString &out, OutputFormat format) { const int index = indexOf(rc); if (index != -1) { Core::OutputWindow *window = m_runControlTabs.at(index).window; QString stringToWrite; - if (format == Utils::NormalMessageFormat || format == Utils::ErrorMessageFormat) { + if (format == NormalMessageFormat || format == ErrorMessageFormat) { stringToWrite = QTime::currentTime().toString(); stringToWrite += ": "; } stringToWrite += out; window->appendMessage(stringToWrite, format); - if (format != Utils::NormalMessageFormat) { + if (format != NormalMessageFormat) { RunControlTab &tab = m_runControlTabs[index]; switch (tab.behaviorOnOutput) { case AppOutputPaneMode::FlashOnOutput: @@ -530,7 +534,7 @@ const bool kWrapOutputDefault = true; void AppOutputPane::storeSettings() const { - Utils::QtcSettings *const s = Core::ICore::settings(); + QtcSettings *const s = Core::ICore::settings(); s->setValueWithDefault(POP_UP_FOR_RUN_OUTPUT_KEY, int(m_settings.runOutputMode), int(kRunOutputModeDefault)); @@ -706,7 +710,7 @@ void AppOutputPane::enableButtons(const RunControl *rc) m_stopAction->setEnabled(isRunning); if (isRunning && debuggerPlugin() && rc->applicationProcessHandle().isValid()) { m_attachButton->setEnabled(true); - Utils::ProcessHandle h = rc->applicationProcessHandle(); + ProcessHandle h = rc->applicationProcessHandle(); QString tip = h.isValid() ? RunControl::tr("PID %1").arg(h.pid()) : RunControl::tr("Invalid"); m_attachButton->setToolTip(msgAttachDebuggerTooltip(tip)); |