Commit 43f69abe authored by hjk's avatar hjk Committed by hjk

Rename {Analyzer,Debugger}ProjectSettings to *RunConfigurationAspect

Change-Id: I5913ddaaab1a80b1557f0bcf7ebcc15e0e4b74eb
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 2153c228
......@@ -98,17 +98,17 @@ void AnalyzerRunConfigWidget::setRunConfiguration(ProjectExplorer::RunConfigurat
{
QTC_ASSERT(rc, return);
m_settings = rc->extraAspect<AnalyzerProjectSettings>();
QTC_ASSERT(m_settings, return);
m_aspect = rc->extraAspect<AnalyzerRunConfigurationAspect>();
QTC_ASSERT(m_aspect, return);
// add config widget for each sub config
foreach (AbstractAnalyzerSubConfig *config, m_settings->customSubConfigs()) {
foreach (AbstractAnalyzerSubConfig *config, m_aspect->customSubConfigs()) {
QWidget *widget = new AnalyzerToolDetailWidget(config);
m_subConfigWidget->layout()->addWidget(widget);
}
setDetailEnabled(!m_settings->isUsingGlobalSettings());
m_settingsCombo->setCurrentIndex(m_settings->isUsingGlobalSettings() ? 0 : 1);
m_restoreButton->setEnabled(!m_settings->isUsingGlobalSettings());
setDetailEnabled(!m_aspect->isUsingGlobalSettings());
m_settingsCombo->setCurrentIndex(m_aspect->isUsingGlobalSettings() ? 0 : 1);
m_restoreButton->setEnabled(!m_aspect->isUsingGlobalSettings());
}
void AnalyzerRunConfigWidget::setDetailEnabled(bool value)
......@@ -120,16 +120,16 @@ void AnalyzerRunConfigWidget::setDetailEnabled(bool value)
void AnalyzerRunConfigWidget::chooseSettings(int setting)
{
QTC_ASSERT(m_settings, return);
QTC_ASSERT(m_aspect, return);
setDetailEnabled(setting != 0);
m_settings->setUsingGlobalSettings(setting == 0);
m_restoreButton->setEnabled(!m_settings->isUsingGlobalSettings());
m_aspect->setUsingGlobalSettings(setting == 0);
m_restoreButton->setEnabled(!m_aspect->isUsingGlobalSettings());
}
void AnalyzerRunConfigWidget::restoreGlobal()
{
QTC_ASSERT(m_settings, return);
m_settings->resetCustomToGlobalSettings();
QTC_ASSERT(m_aspect, return);
m_aspect->resetCustomToGlobalSettings();
}
} // namespace Internal
......
......@@ -85,7 +85,7 @@ private slots:
private:
QWidget *m_subConfigWidget;
AnalyzerProjectSettings *m_settings;
AnalyzerRunConfigurationAspect *m_aspect;
QComboBox *m_settingsCombo;
QPushButton *m_restoreButton;
};
......
......@@ -86,15 +86,11 @@ RunControl *AnalyzerRunControlFactory::create(RunConfiguration *runConfiguration
IRunConfigurationAspect *AnalyzerRunControlFactory::createRunConfigurationAspect()
{
return new AnalyzerProjectSettings;
return new AnalyzerRunConfigurationAspect;
}
RunConfigWidget *AnalyzerRunControlFactory::createConfigurationWidget(RunConfiguration *runConfiguration)
{
AnalyzerProjectSettings *settings = runConfiguration->extraAspect<AnalyzerProjectSettings>();
if (!settings)
return 0;
AnalyzerRunConfigWidget *ret = new AnalyzerRunConfigWidget;
ret->setRunConfiguration(runConfiguration);
return ret;
......
......@@ -152,7 +152,7 @@ void AnalyzerGlobalSettings::registerTool(IAnalyzerTool *tool)
}
AnalyzerProjectSettings::AnalyzerProjectSettings(QObject *parent)
AnalyzerRunConfigurationAspect::AnalyzerRunConfigurationAspect(QObject *parent)
: AnalyzerSettings(parent), m_useGlobalSettings(true)
{
QList<IAnalyzerTool*> tools = AnalyzerManager::tools();
......@@ -167,30 +167,30 @@ AnalyzerProjectSettings::AnalyzerProjectSettings(QObject *parent)
resetCustomToGlobalSettings();
}
AnalyzerProjectSettings::~AnalyzerProjectSettings()
AnalyzerRunConfigurationAspect::~AnalyzerRunConfigurationAspect()
{
qDeleteAll(m_customConfigurations);
}
QString AnalyzerProjectSettings::displayName() const
QString AnalyzerRunConfigurationAspect::displayName() const
{
return tr("Analyzer Settings");
}
void AnalyzerProjectSettings::fromMap(const QVariantMap &map)
void AnalyzerRunConfigurationAspect::fromMap(const QVariantMap &map)
{
AnalyzerSettings::fromMap(map, &m_customConfigurations);
m_useGlobalSettings = map.value(QLatin1String(useGlobalC), true).toBool();
}
QVariantMap AnalyzerProjectSettings::toMap() const
QVariantMap AnalyzerRunConfigurationAspect::toMap() const
{
QVariantMap map = AnalyzerSettings::toMap(m_customConfigurations);
map.insert(QLatin1String(useGlobalC), m_useGlobalSettings);
return map;
}
void AnalyzerProjectSettings::setUsingGlobalSettings(bool value)
void AnalyzerRunConfigurationAspect::setUsingGlobalSettings(bool value)
{
if (value == m_useGlobalSettings)
return;
......@@ -202,7 +202,7 @@ void AnalyzerProjectSettings::setUsingGlobalSettings(bool value)
}
}
void AnalyzerProjectSettings::resetCustomToGlobalSettings()
void AnalyzerRunConfigurationAspect::resetCustomToGlobalSettings()
{
AnalyzerGlobalSettings *gs = AnalyzerGlobalSettings::instance();
AnalyzerSettings::fromMap(gs->toMap(), &m_customConfigurations);
......
......@@ -160,14 +160,14 @@ private:
* rc->extraAspect<AnalyzerProjectSettings>()->subConfig<YourProjectConfig>()->...
* @endcode
*/
class ANALYZER_EXPORT AnalyzerProjectSettings
class ANALYZER_EXPORT AnalyzerRunConfigurationAspect
: public AnalyzerSettings, public ProjectExplorer::IRunConfigurationAspect
{
Q_OBJECT
public:
AnalyzerProjectSettings(QObject *parent = 0);
~AnalyzerProjectSettings();
AnalyzerRunConfigurationAspect(QObject *parent = 0);
~AnalyzerRunConfigurationAspect();
QString displayName() const;
virtual QVariantMap toMap() const;
......
......@@ -172,7 +172,7 @@ private slots:
void qmlDebugServerPortChanged(int port);
public:
DebuggerProjectSettings *m_settings; // not owned
DebuggerRunConfigurationAspect *m_aspect; // not owned
QCheckBox *m_useCppDebugger;
QCheckBox *m_useQmlDebugger;
......@@ -183,7 +183,7 @@ public:
DebuggerRunConfigWidget::DebuggerRunConfigWidget(RunConfiguration *runConfiguration)
{
m_settings = runConfiguration->debuggerAspect();
m_aspect = runConfiguration->debuggerAspect();
m_useCppDebugger = new QCheckBox(tr("Enable C++"), this);
m_useQmlDebugger = new QCheckBox(tr("Enable QML"), this);
......@@ -199,9 +199,9 @@ DebuggerRunConfigWidget::DebuggerRunConfigWidget(RunConfiguration *runConfigurat
"qthelp://com.nokia.qtcreator/doc/creator-debugging-qml.html"
"\">What are the prerequisites?</a>"));
useCppDebuggerToggled(m_settings->useCppDebugger());
useQmlDebuggerToggled(m_settings->useQmlDebugger());
m_debugServerPort->setValue(m_settings->qmlDebugServerPort());
useCppDebuggerToggled(m_aspect->useCppDebugger());
useQmlDebuggerToggled(m_aspect->useQmlDebugger());
m_debugServerPort->setValue(m_aspect->qmlDebugServerPort());
connect(m_qmlDebuggerInfoLabel, SIGNAL(linkActivated(QString)),
Core::HelpManager::instance(), SLOT(handleHelpRequest(QString)));
......@@ -212,7 +212,7 @@ DebuggerRunConfigWidget::DebuggerRunConfigWidget(RunConfiguration *runConfigurat
connect(m_debugServerPort, SIGNAL(valueChanged(int)),
SLOT(qmlDebugServerPortChanged(int)));
if (m_settings->areQmlDebuggingOptionsSuppressed()) {
if (m_aspect->areQmlDebuggingOptionsSuppressed()) {
m_debugServerPortLabel->hide();
m_debugServerPort->hide();
m_useQmlDebugger->hide();
......@@ -235,12 +235,12 @@ DebuggerRunConfigWidget::DebuggerRunConfigWidget(RunConfiguration *runConfigurat
void DebuggerRunConfigWidget::qmlDebugServerPortChanged(int port)
{
m_settings->m_qmlDebugServerPort = port;
m_aspect->m_qmlDebugServerPort = port;
}
void DebuggerRunConfigWidget::useCppDebuggerToggled(bool toggled)
{
m_settings->m_useCppDebugger = toggled;
m_aspect->m_useCppDebugger = toggled;
if (!toggled && !m_useQmlDebugger->isChecked())
m_useQmlDebugger->setChecked(true);
}
......@@ -250,9 +250,9 @@ void DebuggerRunConfigWidget::useQmlDebuggerToggled(bool toggled)
m_debugServerPort->setEnabled(toggled);
m_debugServerPortLabel->setEnabled(toggled);
m_settings->m_useQmlDebugger = toggled
? DebuggerProjectSettings::EnableQmlDebugger
: DebuggerProjectSettings::DisableQmlDebugger;
m_aspect->m_useQmlDebugger = toggled
? DebuggerRunConfigurationAspect::EnableQmlDebugger
: DebuggerRunConfigurationAspect::DisableQmlDebugger;
if (!toggled && !m_useCppDebugger->isChecked())
m_useCppDebugger->setChecked(true);
}
......
......@@ -195,10 +195,10 @@ bool ProcessHandle::equals(const ProcessHandle &rhs) const
}
/*!
\class ProjectExplorer::DebuggerProjectSettings
\class ProjectExplorer::DebuggerRunConfigurationAspect
*/
DebuggerProjectSettings::DebuggerProjectSettings(RunConfiguration *rc) :
DebuggerRunConfigurationAspect::DebuggerRunConfigurationAspect(RunConfiguration *rc) :
m_runConfiguration(rc),
m_useCppDebugger(true),
m_useQmlDebugger(AutoEnableQmlDebugger),
......@@ -206,31 +206,31 @@ DebuggerProjectSettings::DebuggerProjectSettings(RunConfiguration *rc) :
m_suppressQmlDebuggingOptions(false)
{}
DebuggerProjectSettings::DebuggerProjectSettings(DebuggerProjectSettings *other) :
DebuggerRunConfigurationAspect::DebuggerRunConfigurationAspect(DebuggerRunConfigurationAspect *other) :
m_runConfiguration(other->m_runConfiguration),
m_useCppDebugger(other->m_useCppDebugger),
m_useQmlDebugger(other->m_useQmlDebugger),
m_qmlDebugServerPort(other->m_qmlDebugServerPort)
{}
RunConfiguration *DebuggerProjectSettings::runConfiguration()
RunConfiguration *DebuggerRunConfigurationAspect::runConfiguration()
{
return m_runConfiguration;
}
void DebuggerProjectSettings::setUseQmlDebugger(bool value)
void DebuggerRunConfigurationAspect::setUseQmlDebugger(bool value)
{
m_useQmlDebugger = value ? EnableQmlDebugger : DisableQmlDebugger;
emit debuggersChanged();
}
void DebuggerProjectSettings::setUseCppDebugger(bool value)
void DebuggerRunConfigurationAspect::setUseCppDebugger(bool value)
{
m_useCppDebugger = value;
emit debuggersChanged();
}
bool DebuggerProjectSettings::useCppDebugger() const
bool DebuggerRunConfigurationAspect::useCppDebugger() const
{
return m_useCppDebugger;
}
......@@ -242,39 +242,39 @@ static bool isQtQuickAppProject(Project *project)
return project->files(Project::ExcludeGeneratedFiles).contains(filePath);
}
bool DebuggerProjectSettings::useQmlDebugger() const
bool DebuggerRunConfigurationAspect::useQmlDebugger() const
{
if (m_useQmlDebugger == DebuggerProjectSettings::AutoEnableQmlDebugger)
if (m_useQmlDebugger == DebuggerRunConfigurationAspect::AutoEnableQmlDebugger)
return isQtQuickAppProject(m_runConfiguration->target()->project());
return m_useQmlDebugger == DebuggerProjectSettings::EnableQmlDebugger;
return m_useQmlDebugger == DebuggerRunConfigurationAspect::EnableQmlDebugger;
}
uint DebuggerProjectSettings::qmlDebugServerPort() const
uint DebuggerRunConfigurationAspect::qmlDebugServerPort() const
{
return m_qmlDebugServerPort;
}
void DebuggerProjectSettings::setQmllDebugServerPort(uint port)
void DebuggerRunConfigurationAspect::setQmllDebugServerPort(uint port)
{
m_qmlDebugServerPort = port;
}
void DebuggerProjectSettings::suppressQmlDebuggingOptions()
void DebuggerRunConfigurationAspect::suppressQmlDebuggingOptions()
{
m_suppressQmlDebuggingOptions = true;
}
bool DebuggerProjectSettings::areQmlDebuggingOptionsSuppressed() const
bool DebuggerRunConfigurationAspect::areQmlDebuggingOptionsSuppressed() const
{
return m_suppressQmlDebuggingOptions;
}
QString DebuggerProjectSettings::displayName() const
QString DebuggerRunConfigurationAspect::displayName() const
{
return tr("Debugger settings");
}
QVariantMap DebuggerProjectSettings::toMap() const
QVariantMap DebuggerRunConfigurationAspect::toMap() const
{
QVariantMap map;
map.insert(QLatin1String(USE_CPP_DEBUGGER_KEY), m_useCppDebugger);
......@@ -284,7 +284,7 @@ QVariantMap DebuggerProjectSettings::toMap() const
return map;
}
void DebuggerProjectSettings::fromMap(const QVariantMap &map)
void DebuggerRunConfigurationAspect::fromMap(const QVariantMap &map)
{
m_useCppDebugger = map.value(QLatin1String(USE_CPP_DEBUGGER_KEY), true).toBool();
if (map.value(QLatin1String(USE_QML_DEBUGGER_AUTO_KEY), false).toBool()) {
......@@ -312,7 +312,7 @@ void DebuggerProjectSettings::fromMap(const QVariantMap &map)
RunConfiguration::RunConfiguration(Target *target, const QString &id) :
ProjectConfiguration(target, id),
m_debuggerAspect(new DebuggerProjectSettings(this))
m_debuggerAspect(new DebuggerRunConfigurationAspect(this))
{
Q_ASSERT(target);
addExtraAspects();
......@@ -320,7 +320,7 @@ RunConfiguration::RunConfiguration(Target *target, const QString &id) :
RunConfiguration::RunConfiguration(Target *target, RunConfiguration *source) :
ProjectConfiguration(target, source),
m_debuggerAspect(new DebuggerProjectSettings(source->debuggerAspect()))
m_debuggerAspect(new DebuggerRunConfigurationAspect(source->debuggerAspect()))
{
Q_ASSERT(target);
addExtraAspects();
......
......@@ -50,7 +50,7 @@ namespace Utils { class OutputFormatter; }
namespace ProjectExplorer {
class Abi;
class BuildConfiguration;
class DebuggerProjectSettings;
class DebuggerRunConfigurationAspect;
class RunConfiguration;
class RunControl;
class Target;
......@@ -86,14 +86,14 @@ protected:
virtual void fromMap(const QVariantMap &map) = 0;
};
class PROJECTEXPLORER_EXPORT DebuggerProjectSettings
class PROJECTEXPLORER_EXPORT DebuggerRunConfigurationAspect
: public QObject, public ProjectExplorer::IRunConfigurationAspect
{
Q_OBJECT
public:
DebuggerProjectSettings(RunConfiguration *runConfiguration);
DebuggerProjectSettings(DebuggerProjectSettings *other);
DebuggerRunConfigurationAspect(RunConfiguration *runConfiguration);
DebuggerRunConfigurationAspect(DebuggerRunConfigurationAspect *other);
enum QmlDebuggerStatus {
DisableQmlDebugger = 0,
......@@ -147,7 +147,7 @@ public:
virtual bool fromMap(const QVariantMap &map);
virtual QVariantMap toMap() const;
DebuggerProjectSettings *debuggerAspect() const { return m_debuggerAspect; }
DebuggerRunConfigurationAspect *debuggerAspect() const { return m_debuggerAspect; }
QList<IRunConfigurationAspect *> extraAspects() const;
template <typename T> T *extraAspect() const
......@@ -178,7 +178,7 @@ private:
void addExtraAspects();
QList<IRunConfigurationAspect *> m_aspects;
DebuggerProjectSettings *m_debuggerAspect;
DebuggerRunConfigurationAspect *m_debuggerAspect;
};
class PROJECTEXPLORER_EXPORT IRunConfigurationFactory : public QObject
......
......@@ -601,7 +601,7 @@ IAnalyzerEngine *CallgrindToolPrivate::createEngine(const AnalyzerStartParameter
// apply project settings
if (runConfiguration) {
if (const AnalyzerProjectSettings *analyzerSettings = runConfiguration->extraAspect<AnalyzerProjectSettings>()) {
if (const AnalyzerRunConfigurationAspect *analyzerSettings = runConfiguration->extraAspect<AnalyzerRunConfigurationAspect>()) {
if (const ValgrindProjectSettings *settings = analyzerSettings->subConfig<ValgrindProjectSettings>()) {
m_visualisation->setMinimumInclusiveCostRatio(settings->visualisationMinimumInclusiveCostRatio() / 100.0);
m_proxyModel->setMinimumInclusiveCostRatio(settings->minimumInclusiveCostRatio() / 100.0);
......
......@@ -236,7 +236,7 @@ void MemcheckTool::maybeActiveRunConfigurationChanged()
if (ProjectExplorer::Project *project = pe->startupProject()) {
if (ProjectExplorer::Target *target = project->activeTarget()) {
if (ProjectExplorer::RunConfiguration *rc = target->activeRunConfiguration()) {
settings = rc->extraAspect<AnalyzerProjectSettings>();
settings = rc->extraAspect<AnalyzerRunConfigurationAspect>();
}
}
}
......
......@@ -63,7 +63,7 @@ ValgrindEngine::ValgrindEngine(IAnalyzerTool *tool, const AnalyzerStartParameter
m_isStopping(false)
{
if (runConfiguration)
m_settings = runConfiguration->extraAspect<AnalyzerProjectSettings>();
m_settings = runConfiguration->extraAspect<AnalyzerRunConfigurationAspect>();
if (!m_settings)
m_settings = AnalyzerGlobalSettings::instance();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment