Commit a9ab174f authored by hjk's avatar hjk

ProjectExplorerPlugin: Make settings accessor static

Change-Id: Ic4c78e4d2eefeefe55e2868a7f9db1eca52c3863
Reviewed-by: default avatarDavid Schulz <david.schulz@digia.com>
parent 61a8257b
......@@ -2403,7 +2403,7 @@ void DebuggerPluginPrivate::showSettingsDialog()
void DebuggerPluginPrivate::updateDebugWithoutDeployMenu()
{
const bool state = ProjectExplorerPlugin::instance()->projectExplorerSettings().deployBeforeRun;
const bool state = ProjectExplorerPlugin::projectExplorerSettings().deployBeforeRun;
m_debugWithoutDeployAction->setVisible(state);
}
......
......@@ -181,7 +181,7 @@ void AbstractMsvcToolChain::addToEnvironment(Utils::Environment &env) const
QString AbstractMsvcToolChain::makeCommand(const Utils::Environment &environment) const
{
bool useJom = ProjectExplorerPlugin::instance()->projectExplorerSettings().useJom;
bool useJom = ProjectExplorerPlugin::projectExplorerSettings().useJom;
const QString jom = QLatin1String("jom.exe");
const QString nmake = QLatin1String("nmake.exe");
QString tmp;
......
......@@ -90,7 +90,7 @@ ApplicationLauncherPrivate::ApplicationLauncherPrivate() :
ApplicationLauncher::ApplicationLauncher(QObject *parent)
: QObject(parent), d(new ApplicationLauncherPrivate)
{
if (ProjectExplorerPlugin::instance()->projectExplorerSettings().mergeStdErrAndStdOut){
if (ProjectExplorerPlugin::projectExplorerSettings().mergeStdErrAndStdOut){
d->m_guiProcess.setReadChannelMode(QProcess::MergedChannels);
} else {
d->m_guiProcess.setReadChannelMode(QProcess::SeparateChannels);
......
......@@ -327,8 +327,8 @@ void AppOutputPane::createNewOutputWindow(RunControl *rc)
ow->setWindowTitle(tr("Application Output Window"));
ow->setWindowIcon(QIcon(QLatin1String(Constants::ICON_WINDOW)));
ow->setFormatter(formatter);
ow->setWordWrapEnabled(ProjectExplorerPlugin::instance()->projectExplorerSettings().wrapAppOutput);
ow->setMaxLineCount(ProjectExplorerPlugin::instance()->projectExplorerSettings().maxAppOutputLines);
ow->setWordWrapEnabled(ProjectExplorerPlugin::projectExplorerSettings().wrapAppOutput);
ow->setMaxLineCount(ProjectExplorerPlugin::projectExplorerSettings().maxAppOutputLines);
Aggregation::Aggregate *agg = new Aggregation::Aggregate;
agg->add(ow);
agg->add(new Find::BaseTextFind(ow));
......@@ -341,7 +341,7 @@ void AppOutputPane::createNewOutputWindow(RunControl *rc)
void AppOutputPane::handleOldOutput(Core::OutputWindow *window) const
{
if (ProjectExplorerPlugin::instance()->projectExplorerSettings().cleanOldAppOutput)
if (ProjectExplorerPlugin::projectExplorerSettings().cleanOldAppOutput)
window->clear();
else
window->grayOutOldContent();
......@@ -352,8 +352,8 @@ void AppOutputPane::updateFromSettings()
const int size = m_runControlTabs.size();
for (int i = 0; i < size; i++) {
RunControlTab &tab =m_runControlTabs[i];
tab.window->setWordWrapEnabled(ProjectExplorerPlugin::instance()->projectExplorerSettings().wrapAppOutput);
tab.window->setMaxLineCount(ProjectExplorerPlugin::instance()->projectExplorerSettings().maxAppOutputLines);
tab.window->setWordWrapEnabled(ProjectExplorerPlugin::projectExplorerSettings().wrapAppOutput);
tab.window->setMaxLineCount(ProjectExplorerPlugin::projectExplorerSettings().maxAppOutputLines);
}
}
......@@ -486,11 +486,10 @@ bool AppOutputPane::closeTab(int tabIndex, CloseTabMode closeTabMode)
bool AppOutputPane::optionallyPromptToStop(RunControl *runControl)
{
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
ProjectExplorerSettings settings = pe->projectExplorerSettings();
ProjectExplorerSettings settings = ProjectExplorerPlugin::projectExplorerSettings();
if (!runControl->promptToStop(&settings.prompToStopRunControl))
return false;
pe->setProjectExplorerSettings(settings);
ProjectExplorerPlugin::setProjectExplorerSettings(settings);
return true;
}
......
......@@ -544,7 +544,7 @@ bool BuildManager::buildLists(QList<BuildStepList *> bsls, const QStringList &st
return false;
}
if (ProjectExplorerPlugin::instance()->projectExplorerSettings().showCompilerOutput)
if (ProjectExplorerPlugin::projectExplorerSettings().showCompilerOutput)
d->m_outputWindow->popup(IOutputPane::NoModeSwitch);
startBuildQueue(preambelMessage);
return true;
......@@ -557,7 +557,7 @@ void BuildManager::appendStep(BuildStep *step, const QString &name)
d->m_outputWindow->popup(IOutputPane::NoModeSwitch);
return;
}
if (ProjectExplorerPlugin::instance()->projectExplorerSettings().showCompilerOutput)
if (ProjectExplorerPlugin::projectExplorerSettings().showCompilerOutput)
d->m_outputWindow->popup(IOutputPane::NoModeSwitch);
startBuildQueue();
}
......
......@@ -146,7 +146,7 @@ CompileOutputWindow::~CompileOutputWindow()
void CompileOutputWindow::updateWordWrapMode()
{
m_outputWindow->setWordWrapEnabled(ProjectExplorerPlugin::instance()->projectExplorerSettings().wrapAppOutput);
m_outputWindow->setWordWrapEnabled(ProjectExplorerPlugin::projectExplorerSettings().wrapAppOutput);
}
bool CompileOutputWindow::hasFocus() const
......
......@@ -2981,17 +2981,17 @@ void ProjectExplorerPlugin::setSession(QAction *action)
void ProjectExplorerPlugin::setProjectExplorerSettings(const ProjectExplorerSettings &pes)
{
QTC_ASSERT(d->m_projectExplorerSettings.environmentId == pes.environmentId, return);
QTC_ASSERT(m_instance->d->m_projectExplorerSettings.environmentId == pes.environmentId, return);
if (d->m_projectExplorerSettings == pes)
if (m_instance->d->m_projectExplorerSettings == pes)
return;
d->m_projectExplorerSettings = pes;
emit settingsChanged();
m_instance->d->m_projectExplorerSettings = pes;
emit m_instance->settingsChanged();
}
ProjectExplorerSettings ProjectExplorerPlugin::projectExplorerSettings() const
ProjectExplorerSettings ProjectExplorerPlugin::projectExplorerSettings()
{
return d->m_projectExplorerSettings;
return m_instance->d->m_projectExplorerSettings;
}
QStringList ProjectExplorerPlugin::projectFilePatterns()
......
......@@ -94,8 +94,8 @@ public:
void extensionsInitialized();
ShutdownFlag aboutToShutdown();
void setProjectExplorerSettings(const Internal::ProjectExplorerSettings &pes);
Internal::ProjectExplorerSettings projectExplorerSettings() const;
static void setProjectExplorerSettings(const Internal::ProjectExplorerSettings &pes);
static Internal::ProjectExplorerSettings projectExplorerSettings();
void startRunControl(RunControl *runControl, RunMode runMode);
static void showRunErrorMessage(const QString &errorMessage);
......
......@@ -191,7 +191,7 @@ ProjectExplorerSettingsPage::~ProjectExplorerSettingsPage()
QWidget *ProjectExplorerSettingsPage::createPage(QWidget *parent)
{
m_widget = new ProjectExplorerSettingsWidget(parent);
m_widget->setSettings(ProjectExplorerPlugin::instance()->projectExplorerSettings());
m_widget->setSettings(ProjectExplorerPlugin::projectExplorerSettings());
m_widget->setProjectsDirectory(Core::DocumentManager::projectsDirectory());
m_widget->setUseProjectsDirectory(Core::DocumentManager::useProjectsDirectory());
m_widget->setBuildDirectory(Core::DocumentManager::buildDirectory());
......@@ -203,7 +203,7 @@ QWidget *ProjectExplorerSettingsPage::createPage(QWidget *parent)
void ProjectExplorerSettingsPage::apply()
{
if (m_widget) {
ProjectExplorerPlugin::instance()->setProjectExplorerSettings(m_widget->settings());
ProjectExplorerPlugin::setProjectExplorerSettings(m_widget->settings());
Core::DocumentManager::setProjectsDirectory(m_widget->projectsDirectory());
Core::DocumentManager::setUseProjectsDirectory(m_widget->useProjectsDirectory());
Core::DocumentManager::setBuildDirectory(m_widget->buildDirectory());
......
......@@ -729,7 +729,7 @@ QStringList SettingsAccessor::findSettingsFiles(const QString &suffix) const
QByteArray SettingsAccessor::creatorId()
{
return ProjectExplorerPlugin::instance()->projectExplorerSettings().environmentId.toByteArray();
return ProjectExplorerPlugin::projectExplorerSettings().environmentId.toByteArray();
}
QString SettingsAccessor::defaultFileName(const QString &suffix) const
......
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