forked from qt-creator/qt-creator
ProjectExplorer: Use runnable contents for appoutputpane re-use
Change-Id: I6dd4b9258321a23462bb6488b132aa9f3d1ed5c2 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -719,4 +719,12 @@ AnalyzerRunControl *AnalyzerManager::createRunControl(RunConfiguration *runConfi
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool operator==(const AnalyzerConnection &c1, const AnalyzerConnection &c2)
|
||||||
|
{
|
||||||
|
return c1.connParams == c2.connParams
|
||||||
|
&& c1.analyzerHost == c2.analyzerHost
|
||||||
|
&& c1.analyzerSocket == c2.analyzerSocket
|
||||||
|
&& c1.analyzerPort == c2.analyzerPort;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Analyzer
|
} // namespace Analyzer
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ public:
|
|||||||
quint16 analyzerPort = 0;
|
quint16 analyzerPort = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ANALYZER_EXPORT bool operator==(const AnalyzerConnection &c1, const AnalyzerConnection &c2);
|
||||||
|
|
||||||
} // namespace Analyzer
|
} // namespace Analyzer
|
||||||
|
|
||||||
#endif // ANALYZERSTARTPARAMETERS_H
|
#endif // ANALYZERSTARTPARAMETERS_H
|
||||||
|
|||||||
@@ -42,6 +42,17 @@ struct ANDROID_EXPORT AndroidRunnable
|
|||||||
QString deviceSerialNumber;
|
QString deviceSerialNumber;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline bool operator==(const AndroidRunnable &r1, const AndroidRunnable &r2)
|
||||||
|
{
|
||||||
|
return r1.packageName == r2.packageName
|
||||||
|
&& r1.intentName == r2.intentName
|
||||||
|
&& r1.commandLineArguments == r2.commandLineArguments
|
||||||
|
&& r1.environment == r2.environment
|
||||||
|
&& r1.beforeStartADBCommands == r2.beforeStartADBCommands
|
||||||
|
&& r1.afterFinishADBCommands == r2.afterFinishADBCommands
|
||||||
|
&& r1.deviceSerialNumber == r2.deviceSerialNumber;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Android
|
} // namespace Android
|
||||||
|
|
||||||
#endif // ANDROIDRUNNABLE_H
|
#endif // ANDROIDRUNNABLE_H
|
||||||
|
|||||||
@@ -398,7 +398,7 @@ void AppOutputPane::createNewOutputWindow(RunControl *rc)
|
|||||||
const int size = m_runControlTabs.size();
|
const int size = m_runControlTabs.size();
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
RunControlTab &tab =m_runControlTabs[i];
|
RunControlTab &tab =m_runControlTabs[i];
|
||||||
if (tab.runControl->sameRunConfiguration(rc) && !tab.runControl->isRunning()) {
|
if (rc->canReUseOutputPane(tab.runControl)) {
|
||||||
// Reuse this tab
|
// Reuse this tab
|
||||||
delete tab.runControl;
|
delete tab.runControl;
|
||||||
tab.runControl = rc;
|
tab.runControl = rc;
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ SOURCES += projectexplorer.cpp \
|
|||||||
environmentaspectwidget.cpp \
|
environmentaspectwidget.cpp \
|
||||||
gcctoolchain.cpp \
|
gcctoolchain.cpp \
|
||||||
importwidget.cpp \
|
importwidget.cpp \
|
||||||
|
runnables.cpp \
|
||||||
localenvironmentaspect.cpp \
|
localenvironmentaspect.cpp \
|
||||||
osparser.cpp \
|
osparser.cpp \
|
||||||
projectimporter.cpp \
|
projectimporter.cpp \
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ QtcPlugin {
|
|||||||
"projectwizardpage.cpp", "projectwizardpage.h", "projectwizardpage.ui",
|
"projectwizardpage.cpp", "projectwizardpage.h", "projectwizardpage.ui",
|
||||||
"propertiespanel.cpp", "propertiespanel.h",
|
"propertiespanel.cpp", "propertiespanel.h",
|
||||||
"removetaskhandler.cpp", "removetaskhandler.h",
|
"removetaskhandler.cpp", "removetaskhandler.h",
|
||||||
"runnables.h",
|
"runnables.cpp", "runnables.h",
|
||||||
"runconfiguration.cpp", "runconfiguration.h",
|
"runconfiguration.cpp", "runconfiguration.h",
|
||||||
"runconfigurationaspects.cpp", "runconfigurationaspects.h",
|
"runconfigurationaspects.cpp", "runconfigurationaspects.h",
|
||||||
"runconfigurationmodel.cpp", "runconfigurationmodel.h",
|
"runconfigurationmodel.cpp", "runconfigurationmodel.h",
|
||||||
|
|||||||
@@ -655,6 +655,14 @@ Project *RunControl::project() const
|
|||||||
return d->project.data();
|
return d->project.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RunControl::canReUseOutputPane(const RunControl *other) const
|
||||||
|
{
|
||||||
|
if (other->isRunning())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return d->runnable == other->d->runnable;
|
||||||
|
}
|
||||||
|
|
||||||
ProcessHandle RunControl::applicationProcessHandle() const
|
ProcessHandle RunControl::applicationProcessHandle() const
|
||||||
{
|
{
|
||||||
return d->applicationProcessHandle;
|
return d->applicationProcessHandle;
|
||||||
@@ -723,11 +731,6 @@ bool RunControl::showPromptToStopDialog(const QString &title,
|
|||||||
return close;
|
return close;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RunControl::sameRunConfiguration(const RunControl *other) const
|
|
||||||
{
|
|
||||||
return other->d->runConfiguration.data() == d->runConfiguration.data();
|
|
||||||
}
|
|
||||||
|
|
||||||
void RunControl::bringApplicationToForeground(qint64 pid)
|
void RunControl::bringApplicationToForeground(qint64 pid)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_OSX
|
#ifdef Q_OS_OSX
|
||||||
@@ -760,4 +763,9 @@ void RunControl::appendMessage(const QString &msg, Utils::OutputFormat format)
|
|||||||
emit appendMessage(this, msg, format);
|
emit appendMessage(this, msg, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Runnable::operator==(const Runnable &other) const
|
||||||
|
{
|
||||||
|
return d ? d->equals(other.d) : (other.d.get() == 0);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ class PROJECTEXPLORER_EXPORT ClonableConcept
|
|||||||
public:
|
public:
|
||||||
virtual ~ClonableConcept() {}
|
virtual ~ClonableConcept() {}
|
||||||
virtual ClonableConcept *clone() const = 0;
|
virtual ClonableConcept *clone() const = 0;
|
||||||
|
virtual bool equals(const std::unique_ptr<ClonableConcept> &other) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
@@ -167,6 +168,12 @@ public:
|
|||||||
ClonableModel(const T &data) : m_data(data) {}
|
ClonableModel(const T &data) : m_data(data) {}
|
||||||
ClonableConcept *clone() const override { return new ClonableModel(*this); }
|
ClonableConcept *clone() const override { return new ClonableModel(*this); }
|
||||||
|
|
||||||
|
bool equals(const std::unique_ptr<ClonableConcept> &other) const override
|
||||||
|
{
|
||||||
|
auto that = dynamic_cast<const ClonableModel<T> *>(other.get());
|
||||||
|
return that && m_data == that->m_data;
|
||||||
|
}
|
||||||
|
|
||||||
T m_data;
|
T m_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -188,6 +195,8 @@ public:
|
|||||||
return static_cast<ClonableModel<T> *>(d.get())->m_data;
|
return static_cast<ClonableModel<T> *>(d.get())->m_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool operator==(const Runnable &other) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<ClonableConcept> d;
|
std::unique_ptr<ClonableConcept> d;
|
||||||
};
|
};
|
||||||
@@ -363,7 +372,7 @@ public:
|
|||||||
|
|
||||||
RunConfiguration *runConfiguration() const;
|
RunConfiguration *runConfiguration() const;
|
||||||
Project *project() const;
|
Project *project() const;
|
||||||
bool sameRunConfiguration(const RunControl *other) const;
|
bool canReUseOutputPane(const RunControl *other) const;
|
||||||
|
|
||||||
Utils::OutputFormatter *outputFormatter();
|
Utils::OutputFormatter *outputFormatter();
|
||||||
Core::Id runMode() const;
|
Core::Id runMode() const;
|
||||||
|
|||||||
38
src/plugins/projectexplorer/runnables.cpp
Normal file
38
src/plugins/projectexplorer/runnables.cpp
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2016 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3 as published by the Free Software
|
||||||
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||||
|
** included in the packaging of this file. Please review the following
|
||||||
|
** information to ensure the GNU General Public License requirements will
|
||||||
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "runnables.h"
|
||||||
|
|
||||||
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
|
bool operator==(const StandardRunnable &r1, const StandardRunnable &r2)
|
||||||
|
{
|
||||||
|
return r1.executable == r2.executable
|
||||||
|
&& r1.commandLineArguments == r2.commandLineArguments
|
||||||
|
&& r1.workingDirectory == r2.workingDirectory
|
||||||
|
&& r1.environment == r2.environment;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ProjectExplorer
|
||||||
@@ -45,6 +45,8 @@ public:
|
|||||||
ApplicationLauncher::Mode runMode;
|
ApplicationLauncher::Mode runMode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PROJECTEXPLORER_EXPORT bool operator==(const StandardRunnable &r1, const StandardRunnable &r2);
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
|
||||||
#endif // PROJECTEXPLORER_RUNNABLES_H
|
#endif // PROJECTEXPLORER_RUNNABLES_H
|
||||||
|
|||||||
Reference in New Issue
Block a user