Refactor OutputFormatter

Move link handling code to outputwindow from OutputFormatter

Move createOutputFormatter to the RunConfiguration

That makes it easier for Qt4RunConfiguration et all.
This also fixes that each time a runcontrol was rerun a new
OutputFormatter was created without deleting the old one, thus
increasing the memory usage.
This commit is contained in:
dt
2010-07-13 15:02:37 +02:00
parent 4e6c8e38be
commit 7862e31256
21 changed files with 177 additions and 113 deletions

View File

@@ -179,6 +179,11 @@ Target *RunConfiguration::target() const
return m_target;
}
ProjectExplorer::OutputFormatter *RunConfiguration::createOutputFormatter() const
{
return new OutputFormatter();
}
IRunConfigurationFactory::IRunConfigurationFactory(QObject *parent) :
QObject(parent)
{
@@ -218,13 +223,23 @@ IRunControlFactory::~IRunControlFactory()
RunControl::RunControl(RunConfiguration *runConfiguration, QString mode)
: m_runMode(mode), m_runConfiguration(runConfiguration)
{
if (runConfiguration)
if (runConfiguration) {
m_displayName = runConfiguration->displayName();
m_outputFormatter = runConfiguration->createOutputFormatter();
}
// We need to ensure that there's always a OutputFormatter
if (!m_outputFormatter)
m_outputFormatter = new OutputFormatter();
}
RunControl::~RunControl()
{
delete m_outputFormatter;
}
OutputFormatter *RunControl::outputFormatter()
{
return m_outputFormatter;
}
QString RunControl::runMode() const
@@ -242,11 +257,6 @@ bool RunControl::sameRunConfiguration(RunControl *other)
return other->m_runConfiguration.data() == m_runConfiguration.data();
}
OutputFormatter *RunControl::createOutputFormatter(QObject *parent)
{
return new OutputFormatter(parent);
}
void RunControl::bringApplicationToForeground(qint64 pid)
{
#ifdef Q_OS_MAC