forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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;
|
||||
|
||||
|
@@ -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());
|
||||
|
@@ -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();
|
||||
|
@@ -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);
|
||||
|
@@ -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());
|
||||
|
Reference in New Issue
Block a user