summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@theqtcompany.com>2015-05-13 16:12:45 +0200
committerNikolai Kosjar <nikolai.kosjar@theqtcompany.com>2015-06-03 08:59:06 +0000
commit7050f78b8d4df3af3a7fe723667968e214fd1908 (patch)
treeaa2c51c6ac2b9b447b45fdc948308c1cea79e6ae
parent7e41b40c910b30084244768aac318d1fc121455b (diff)
downloadqt-creator-7050f78b8d4df3af3a7fe723667968e214fd1908.tar.gz
Core: Make EditorManager::reloadSettings available for tests
Needed for a test in ClangCodeModel in order to avoid a blocking pop-up dialog. Change-Id: I5a337cfcbf514052681f1941845a995d2a5856ac Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
-rw-r--r--src/plugins/coreplugin/documentmanager.cpp2
-rw-r--r--src/plugins/coreplugin/editormanager/editormanager.cpp20
-rw-r--r--src/plugins/coreplugin/editormanager/editormanager.h5
-rw-r--r--src/plugins/coreplugin/editormanager/editormanager_p.h2
-rw-r--r--src/plugins/coreplugin/generalsettings.cpp4
5 files changed, 18 insertions, 15 deletions
diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp
index 81ba85f32f..74b4b650b2 100644
--- a/src/plugins/coreplugin/documentmanager.cpp
+++ b/src/plugins/coreplugin/documentmanager.cpp
@@ -915,7 +915,7 @@ void DocumentManager::checkForReload()
d->m_blockActivated = true;
- IDocument::ReloadSetting defaultBehavior = EditorManagerPrivate::reloadSetting();
+ IDocument::ReloadSetting defaultBehavior = EditorManager::reloadSetting();
ReloadPromptAnswer previousReloadAnswer = ReloadCurrent;
FileDeletedPromptAnswer previousDeletedAnswer = FileDeletedSave;
diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index c000e0a4cb..b4b7f35817 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -975,16 +975,6 @@ void EditorManagerPrivate::readSettings()
updateAutoSave();
}
-void EditorManagerPrivate::setReloadSetting(IDocument::ReloadSetting behavior)
-{
- d->m_reloadSetting = behavior;
-}
-
-IDocument::ReloadSetting EditorManagerPrivate::reloadSetting()
-{
- return d->m_reloadSetting;
-}
-
void EditorManagerPrivate::setAutoSaveEnabled(bool enabled)
{
d->m_autoSaveEnabled = enabled;
@@ -2176,6 +2166,16 @@ void EditorManager::populateOpenWithMenu(QMenu *menu, const QString &fileName)
menu->setEnabled(anyMatches);
}
+IDocument::ReloadSetting EditorManager::reloadSetting()
+{
+ return d->m_reloadSetting;
+}
+
+void EditorManager::setReloadSetting(IDocument::ReloadSetting behavior)
+{
+ d->m_reloadSetting = behavior;
+}
+
void EditorManager::saveDocument()
{
EditorManagerPrivate::saveDocument(currentDocument());
diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h
index a844f3588f..f475e1e5dd 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.h
+++ b/src/plugins/coreplugin/editormanager/editormanager.h
@@ -32,6 +32,7 @@
#define EDITORMANAGER_H
#include "../core_global.h"
+#include "../idocument.h"
#include "documentmodel.h"
@@ -171,6 +172,10 @@ public:
static void addNativeDirAndOpenWithActions(QMenu *contextMenu, DocumentModel::Entry *entry);
static void populateOpenWithMenu(QMenu *menu, const QString &fileName);
+public: // for tests
+ static IDocument::ReloadSetting reloadSetting();
+ static void setReloadSetting(IDocument::ReloadSetting behavior);
+
signals:
void currentEditorChanged(Core::IEditor *editor);
void currentDocumentStateChanged();
diff --git a/src/plugins/coreplugin/editormanager/editormanager_p.h b/src/plugins/coreplugin/editormanager/editormanager_p.h
index a448dba0fb..ea838af285 100644
--- a/src/plugins/coreplugin/editormanager/editormanager_p.h
+++ b/src/plugins/coreplugin/editormanager/editormanager_p.h
@@ -107,8 +107,6 @@ public:
static void saveSettings();
static void readSettings();
- static void setReloadSetting(IDocument::ReloadSetting behavior);
- static IDocument::ReloadSetting reloadSetting();
static void setAutoSaveEnabled(bool enabled);
static bool autoSaveEnabled();
static void setAutoSaveInterval(int interval);
diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp
index 8c31525d29..f2eb8d1a50 100644
--- a/src/plugins/coreplugin/generalsettings.cpp
+++ b/src/plugins/coreplugin/generalsettings.cpp
@@ -114,7 +114,7 @@ QWidget *GeneralSettings::widget()
fillLanguageBox();
m_page->colorButton->setColor(StyleHelper::requestedBaseColor());
- m_page->reloadBehavior->setCurrentIndex(EditorManagerPrivate::reloadSetting());
+ m_page->reloadBehavior->setCurrentIndex(EditorManager::reloadSetting());
if (HostOsInfo::isAnyUnixHost()) {
const QStringList availableTerminals = ConsoleProcess::availableTerminalEmulators();
const QString currentTerminal = ConsoleProcess::terminalEmulator(ICore::settings(), false);
@@ -176,7 +176,7 @@ void GeneralSettings::apply()
setLanguage(m_page->languageBox->itemData(currentIndex, Qt::UserRole).toString());
// Apply the new base color if accepted
StyleHelper::setBaseColor(m_page->colorButton->color());
- EditorManagerPrivate::setReloadSetting(IDocument::ReloadSetting(m_page->reloadBehavior->currentIndex()));
+ EditorManager::setReloadSetting(IDocument::ReloadSetting(m_page->reloadBehavior->currentIndex()));
if (HostOsInfo::isAnyUnixHost()) {
ConsoleProcess::setTerminalEmulator(ICore::settings(),
m_page->terminalComboBox->lineEdit()->text());