summaryrefslogtreecommitdiff
path: root/src/plugins/projectexplorer
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/projectexplorer')
-rw-r--r--src/plugins/projectexplorer/appoutputpane.cpp2
-rw-r--r--src/plugins/projectexplorer/codestylesettingspropertiespage.cpp2
-rw-r--r--src/plugins/projectexplorer/compileoutputwindow.cpp2
-rw-r--r--src/plugins/projectexplorer/editorconfiguration.cpp89
-rw-r--r--src/plugins/projectexplorer/editorconfiguration.h4
-rw-r--r--src/plugins/projectexplorer/environmentitemswidget.cpp3
-rw-r--r--src/plugins/projectexplorer/projectfilewizardextension.cpp8
7 files changed, 51 insertions, 59 deletions
diff --git a/src/plugins/projectexplorer/appoutputpane.cpp b/src/plugins/projectexplorer/appoutputpane.cpp
index d3e4dac077..74917d06d7 100644
--- a/src/plugins/projectexplorer/appoutputpane.cpp
+++ b/src/plugins/projectexplorer/appoutputpane.cpp
@@ -301,7 +301,7 @@ void AppOutputPane::createNewOutputWindow(RunControl *rc)
this, SLOT(appendMessage(ProjectExplorer::RunControl*,QString,Utils::OutputFormat)));
Utils::OutputFormatter *formatter = rc->outputFormatter();
- formatter->setFont(TextEditor::TextEditorSettings::instance()->fontSettings().font());
+ formatter->setFont(TextEditor::TextEditorSettings::fontSettings().font());
// First look if we can reuse a tab
const int size = m_runControlTabs.size();
diff --git a/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp b/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp
index 839feef5ac..8cb5ebe29c 100644
--- a/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp
+++ b/src/plugins/projectexplorer/codestylesettingspropertiespage.cpp
@@ -75,7 +75,7 @@ CodeStyleSettingsWidget::CodeStyleSettingsWidget(Project *project) : QWidget(),
const EditorConfiguration *config = m_project->editorConfiguration();
QMap<Core::Id, ICodeStylePreferencesFactory *> factories
- = TextEditor::TextEditorSettings::instance()->codeStyleFactories();
+ = TextEditor::TextEditorSettings::codeStyleFactories();
QMapIterator<Core::Id, ICodeStylePreferencesFactory *> it(factories);
while (it.hasNext()) {
it.next();
diff --git a/src/plugins/projectexplorer/compileoutputwindow.cpp b/src/plugins/projectexplorer/compileoutputwindow.cpp
index db539c0fb1..b2babe8a99 100644
--- a/src/plugins/projectexplorer/compileoutputwindow.cpp
+++ b/src/plugins/projectexplorer/compileoutputwindow.cpp
@@ -82,7 +82,7 @@ public:
private slots:
void fontSettingsChanged()
{
- setFont(TextEditor::TextEditorSettings::instance()->fontSettings().font());
+ setFont(TextEditor::TextEditorSettings::fontSettings().font());
}
protected:
diff --git a/src/plugins/projectexplorer/editorconfiguration.cpp b/src/plugins/projectexplorer/editorconfiguration.cpp
index 6d60d43c86..62cada1656 100644
--- a/src/plugins/projectexplorer/editorconfiguration.cpp
+++ b/src/plugins/projectexplorer/editorconfiguration.cpp
@@ -63,10 +63,10 @@ struct EditorConfigurationPrivate
{
EditorConfigurationPrivate()
: m_useGlobal(true)
- , m_typingSettings(TextEditorSettings::instance()->typingSettings())
- , m_storageSettings(TextEditorSettings::instance()->storageSettings())
- , m_behaviorSettings(TextEditorSettings::instance()->behaviorSettings())
- , m_extraEncodingSettings(TextEditorSettings::instance()->extraEncodingSettings())
+ , m_typingSettings(TextEditorSettings::typingSettings())
+ , m_storageSettings(TextEditorSettings::storageSettings())
+ , m_behaviorSettings(TextEditorSettings::behaviorSettings())
+ , m_extraEncodingSettings(TextEditorSettings::extraEncodingSettings())
, m_textCodec(Core::EditorManager::defaultTextCodec())
{
}
@@ -84,17 +84,15 @@ struct EditorConfigurationPrivate
EditorConfiguration::EditorConfiguration() : d(new EditorConfigurationPrivate)
{
- TextEditorSettings *textEditorSettings = TextEditorSettings::instance();
-
- const QMap<Core::Id, ICodeStylePreferences *> languageCodeStylePreferences = textEditorSettings->codeStyles();
+ const QMap<Core::Id, ICodeStylePreferences *> languageCodeStylePreferences = TextEditorSettings::codeStyles();
QMapIterator<Core::Id, ICodeStylePreferences *> itCodeStyle(languageCodeStylePreferences);
while (itCodeStyle.hasNext()) {
itCodeStyle.next();
Core::Id languageId = itCodeStyle.key();
ICodeStylePreferences *originalPreferences = itCodeStyle.value();
- ICodeStylePreferencesFactory *factory = textEditorSettings->codeStyleFactory(languageId);
+ ICodeStylePreferencesFactory *factory = TextEditorSettings::codeStyleFactory(languageId);
ICodeStylePreferences *preferences = factory->createCodeStyle();
- preferences->setDelegatingPool(textEditorSettings->codeStylePool(languageId));
+ preferences->setDelegatingPool(TextEditorSettings::codeStylePool(languageId));
preferences->setId(languageId.toString() + QLatin1String("Project"));
preferences->setDisplayName(tr("Project %1", "Settings, %1 is a language (C++ or QML)").arg(factory->displayName()));
preferences->setCurrentDelegate(originalPreferences);
@@ -102,11 +100,10 @@ EditorConfiguration::EditorConfiguration() : d(new EditorConfigurationPrivate)
}
d->m_defaultCodeStyle = new SimpleCodeStylePreferences(this);
- d->m_defaultCodeStyle->setDelegatingPool(textEditorSettings->codeStylePool());
+ d->m_defaultCodeStyle->setDelegatingPool(TextEditorSettings::codeStylePool());
d->m_defaultCodeStyle->setDisplayName(tr("Project", "Settings"));
d->m_defaultCodeStyle->setId(kId);
- d->m_defaultCodeStyle->setCurrentDelegate(d->m_useGlobal
- ? TextEditorSettings::instance()->codeStyle() : 0);
+ d->m_defaultCodeStyle->setCurrentDelegate(d->m_useGlobal ? TextEditorSettings::codeStyle() : 0);
}
EditorConfiguration::~EditorConfiguration()
@@ -122,13 +119,11 @@ bool EditorConfiguration::useGlobalSettings() const
void EditorConfiguration::cloneGlobalSettings()
{
- TextEditorSettings *textEditorSettings = TextEditorSettings::instance();
-
- d->m_defaultCodeStyle->setTabSettings(textEditorSettings->codeStyle()->tabSettings());
- setTypingSettings(textEditorSettings->typingSettings());
- setStorageSettings(textEditorSettings->storageSettings());
- setBehaviorSettings(textEditorSettings->behaviorSettings());
- setExtraEncodingSettings(textEditorSettings->extraEncodingSettings());
+ d->m_defaultCodeStyle->setTabSettings(TextEditorSettings::codeStyle()->tabSettings());
+ setTypingSettings(TextEditorSettings::typingSettings());
+ setStorageSettings(TextEditorSettings::storageSettings());
+ setBehaviorSettings(TextEditorSettings::behaviorSettings());
+ setExtraEncodingSettings(TextEditorSettings::extraEncodingSettings());
d->m_textCodec = Core::EditorManager::defaultTextCodec();
}
@@ -247,7 +242,7 @@ void EditorConfiguration::setUseGlobalSettings(bool use)
{
d->m_useGlobal = use;
d->m_defaultCodeStyle->setCurrentDelegate(d->m_useGlobal
- ? TextEditorSettings::instance()->codeStyle() : 0);
+ ? TextEditorSettings::codeStyle() : 0);
QList<Core::IEditor *> opened = Core::EditorManager::documentModel()->editorsForDocuments(
Core::EditorManager::documentModel()->openedDocuments());
foreach (Core::IEditor *editor, opened) {
@@ -259,43 +254,45 @@ void EditorConfiguration::setUseGlobalSettings(bool use)
}
}
-void EditorConfiguration::switchSettings(BaseTextEditorWidget *baseTextEditor) const
-{
- if (d->m_useGlobal)
- switchSettings_helper(TextEditorSettings::instance(), this, baseTextEditor);
- else
- switchSettings_helper(this, TextEditorSettings::instance(), baseTextEditor);
-}
-
-template <class NewSenderT, class OldSenderT>
-void EditorConfiguration::switchSettings_helper(const NewSenderT *newSender,
- const OldSenderT *oldSender,
- BaseTextEditorWidget *baseTextEditor) const
+static void switchSettings_helper(const QObject *newSender, const QObject *oldSender,
+ BaseTextEditorWidget *baseTextEditor)
{
- baseTextEditor->setTypingSettings(newSender->typingSettings());
- baseTextEditor->setStorageSettings(newSender->storageSettings());
- baseTextEditor->setBehaviorSettings(newSender->behaviorSettings());
- baseTextEditor->setExtraEncodingSettings(newSender->extraEncodingSettings());
-
- disconnect(oldSender, SIGNAL(typingSettingsChanged(TextEditor::TypingSettings)),
+ QObject::disconnect(oldSender, SIGNAL(typingSettingsChanged(TextEditor::TypingSettings)),
baseTextEditor, SLOT(setTypingSettings(TextEditor::TypingSettings)));
- disconnect(oldSender, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)),
+ QObject::disconnect(oldSender, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)),
baseTextEditor, SLOT(setStorageSettings(TextEditor::StorageSettings)));
- disconnect(oldSender, SIGNAL(behaviorSettingsChanged(TextEditor::BehaviorSettings)),
+ QObject::disconnect(oldSender, SIGNAL(behaviorSettingsChanged(TextEditor::BehaviorSettings)),
baseTextEditor, SLOT(setBehaviorSettings(TextEditor::BehaviorSettings)));
- disconnect(oldSender, SIGNAL(extraEncodingSettingsChanged(TextEditor::ExtraEncodingSettings)),
+ QObject::disconnect(oldSender, SIGNAL(extraEncodingSettingsChanged(TextEditor::ExtraEncodingSettings)),
baseTextEditor, SLOT(setExtraEncodingSettings(TextEditor::ExtraEncodingSettings)));
- connect(newSender, SIGNAL(typingSettingsChanged(TextEditor::TypingSettings)),
+ QObject::connect(newSender, SIGNAL(typingSettingsChanged(TextEditor::TypingSettings)),
baseTextEditor, SLOT(setTypingSettings(TextEditor::TypingSettings)));
- connect(newSender, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)),
+ QObject::connect(newSender, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)),
baseTextEditor, SLOT(setStorageSettings(TextEditor::StorageSettings)));
- connect(newSender, SIGNAL(behaviorSettingsChanged(TextEditor::BehaviorSettings)),
+ QObject::connect(newSender, SIGNAL(behaviorSettingsChanged(TextEditor::BehaviorSettings)),
baseTextEditor, SLOT(setBehaviorSettings(TextEditor::BehaviorSettings)));
- connect(newSender, SIGNAL(extraEncodingSettingsChanged(TextEditor::ExtraEncodingSettings)),
+ QObject::connect(newSender, SIGNAL(extraEncodingSettingsChanged(TextEditor::ExtraEncodingSettings)),
baseTextEditor, SLOT(setExtraEncodingSettings(TextEditor::ExtraEncodingSettings)));
}
+void EditorConfiguration::switchSettings(BaseTextEditorWidget *baseTextEditor) const
+{
+ if (d->m_useGlobal) {
+ baseTextEditor->setTypingSettings(TextEditorSettings::typingSettings());
+ baseTextEditor->setStorageSettings(TextEditorSettings::storageSettings());
+ baseTextEditor->setBehaviorSettings(TextEditorSettings::behaviorSettings());
+ baseTextEditor->setExtraEncodingSettings(TextEditorSettings::extraEncodingSettings());
+ switchSettings_helper(TextEditorSettings::instance(), this, baseTextEditor);
+ } else {
+ baseTextEditor->setTypingSettings(typingSettings());
+ baseTextEditor->setStorageSettings(storageSettings());
+ baseTextEditor->setBehaviorSettings(behaviorSettings());
+ baseTextEditor->setExtraEncodingSettings(extraEncodingSettings());
+ switchSettings_helper(this, TextEditorSettings::instance(), baseTextEditor);
+ }
+}
+
void EditorConfiguration::setTypingSettings(const TextEditor::TypingSettings &settings)
{
d->m_typingSettings = settings;
@@ -331,7 +328,7 @@ TabSettings actualTabSettings(const QString &fileName, const BaseTextEditorWidge
return baseTextEditor->tabSettings();
if (Project *project = SessionManager::projectForFile(fileName))
return project->editorConfiguration()->codeStyle()->tabSettings();
- return TextEditorSettings::instance()->codeStyle()->tabSettings();
+ return TextEditorSettings::codeStyle()->tabSettings();
}
} // ProjectExplorer
diff --git a/src/plugins/projectexplorer/editorconfiguration.h b/src/plugins/projectexplorer/editorconfiguration.h
index 0caaf2f58c..af419c8c6c 100644
--- a/src/plugins/projectexplorer/editorconfiguration.h
+++ b/src/plugins/projectexplorer/editorconfiguration.h
@@ -98,10 +98,6 @@ private slots:
private:
void switchSettings(TextEditor::BaseTextEditorWidget *baseTextEditor) const;
- template <class NewSenderT, class OldSenderT>
- void switchSettings_helper(const NewSenderT *newSender,
- const OldSenderT *oldSender,
- TextEditor::BaseTextEditorWidget *baseTextEditor) const;
EditorConfigurationPrivate *d;
};
diff --git a/src/plugins/projectexplorer/environmentitemswidget.cpp b/src/plugins/projectexplorer/environmentitemswidget.cpp
index 3e3f30a03f..381abe0adc 100644
--- a/src/plugins/projectexplorer/environmentitemswidget.cpp
+++ b/src/plugins/projectexplorer/environmentitemswidget.cpp
@@ -71,8 +71,7 @@ EnvironmentItemsWidget::EnvironmentItemsWidget(QWidget *parent) :
QWidget(parent), d(new EnvironmentItemsWidgetPrivate)
{
d->m_editor = new TextEditor::SnippetEditorWidget(this);
- TextEditor::TextEditorSettings *settings = TextEditor::TextEditorSettings::instance();
- d->m_editor->setFontSettings(settings->fontSettings());
+ d->m_editor->setFontSettings(TextEditor::TextEditorSettings::fontSettings());
QVBoxLayout *layout = new QVBoxLayout(this);
layout->addWidget(d->m_editor);
}
diff --git a/src/plugins/projectexplorer/projectfilewizardextension.cpp b/src/plugins/projectexplorer/projectfilewizardextension.cpp
index f38e4bcb48..bb2f72608b 100644
--- a/src/plugins/projectexplorer/projectfilewizardextension.cpp
+++ b/src/plugins/projectexplorer/projectfilewizardextension.cpp
@@ -538,7 +538,7 @@ static TextEditor::ICodeStylePreferences *codeStylePreferences(ProjectExplorer::
if (project)
return project->editorConfiguration()->codeStyle(languageId);
- return TextEditor::TextEditorSettings::instance()->codeStyle(languageId);
+ return TextEditor::TextEditorSettings::codeStyle(languageId);
}
void ProjectFileWizardExtension::applyCodeStyle(Core::GeneratedFile *file) const
@@ -547,7 +547,7 @@ void ProjectFileWizardExtension::applyCodeStyle(Core::GeneratedFile *file) const
return; // nothing to do
Core::MimeType mt = Core::MimeDatabase::findByFile(QFileInfo(file->path()));
- Core::Id languageId = TextEditor::TextEditorSettings::instance()->languageId(mt.type());
+ Core::Id languageId = TextEditor::TextEditorSettings::languageId(mt.type());
if (!languageId.isValid())
return; // don't modify files like *.ui *.pro
@@ -560,7 +560,7 @@ void ProjectFileWizardExtension::applyCodeStyle(Core::GeneratedFile *file) const
Project *baseProject = SessionManager::projectForNode(project);
TextEditor::ICodeStylePreferencesFactory *factory
- = TextEditor::TextEditorSettings::instance()->codeStyleFactory(languageId);
+ = TextEditor::TextEditorSettings::codeStyleFactory(languageId);
TextEditor::Indenter *indenter = 0;
if (factory)
@@ -575,7 +575,7 @@ void ProjectFileWizardExtension::applyCodeStyle(Core::GeneratedFile *file) const
cursor.select(QTextCursor::Document);
indenter->indent(&doc, cursor, QChar::Null, codeStylePrefs->currentTabSettings());
delete indenter;
- if (TextEditor::TextEditorSettings::instance()->storageSettings().m_cleanWhitespace) {
+ if (TextEditor::TextEditorSettings::storageSettings().m_cleanWhitespace) {
QTextBlock block = doc.firstBlock();
while (block.isValid()) {
codeStylePrefs->currentTabSettings().removeTrailingWhitespace(cursor, block);