Save settings less aggressively.

Remove saving settings on auto-save, and only save settings when
switching away from projects mode, instead of any mode switch.

Change-Id: I3369b7f5ee785467d57c47e1a194a8ef989b98fb
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Eike Ziller
2014-03-07 14:14:57 +01:00
parent 4cc473c2e2
commit d52ee686d1
6 changed files with 5 additions and 21 deletions

View File

@@ -1783,9 +1783,6 @@ void EditorManager::autoSave()
if (!errors.isEmpty()) if (!errors.isEmpty())
QMessageBox::critical(ICore::mainWindow(), tr("File Error"), QMessageBox::critical(ICore::mainWindow(), tr("File Error"),
errors.join(QLatin1String("\n"))); errors.join(QLatin1String("\n")));
// Also save settings while accessing the disk anyway:
ICore::saveSettings();
} }
MakeWritableResult EditorManager::makeFileWritable(IDocument *document) MakeWritableResult EditorManager::makeFileWritable(IDocument *document)

View File

@@ -317,7 +317,7 @@ ICore::ICore(MainWindow *mainwindow)
m_mainwindow = mainwindow; m_mainwindow = mainwindow;
// Save settings once after all plugins are initialized: // Save settings once after all plugins are initialized:
connect(ExtensionSystem::PluginManager::instance(), SIGNAL(initializationDone()), connect(ExtensionSystem::PluginManager::instance(), SIGNAL(initializationDone()),
this, SIGNAL(saveSettingsRequested())); this, SLOT(saveSettings()));
} }
ICore::~ICore() ICore::~ICore()

View File

@@ -118,6 +118,7 @@ public:
static void emitNewItemsDialogRequested(); static void emitNewItemsDialogRequested();
public slots:
static void saveSettings(); static void saveSettings();
signals: signals:

View File

@@ -72,7 +72,6 @@ struct ModeManagerPrivate
QSignalMapper *m_signalMapper; QSignalMapper *m_signalMapper;
Context m_addedContexts; Context m_addedContexts;
int m_oldCurrent; int m_oldCurrent;
bool m_saveSettingsOnModeChange;
bool m_modeSelectorVisible; bool m_modeSelectorVisible;
}; };
@@ -100,15 +99,12 @@ ModeManager::ModeManager(Internal::MainWindow *mainWindow,
d->m_oldCurrent = -1; d->m_oldCurrent = -1;
d->m_actionBar = new Internal::FancyActionBar(modeStack); d->m_actionBar = new Internal::FancyActionBar(modeStack);
d->m_modeStack->addCornerWidget(d->m_actionBar); d->m_modeStack->addCornerWidget(d->m_actionBar);
d->m_saveSettingsOnModeChange = false;
d->m_modeSelectorVisible = true; d->m_modeSelectorVisible = true;
d->m_modeStack->setSelectionWidgetVisible(d->m_modeSelectorVisible); d->m_modeStack->setSelectionWidgetVisible(d->m_modeSelectorVisible);
connect(d->m_modeStack, SIGNAL(currentAboutToShow(int)), SLOT(currentTabAboutToChange(int))); connect(d->m_modeStack, SIGNAL(currentAboutToShow(int)), SLOT(currentTabAboutToChange(int)));
connect(d->m_modeStack, SIGNAL(currentChanged(int)), SLOT(currentTabChanged(int))); connect(d->m_modeStack, SIGNAL(currentChanged(int)), SLOT(currentTabChanged(int)));
connect(d->m_signalMapper, SIGNAL(mapped(int)), this, SLOT(slotActivateMode(int))); connect(d->m_signalMapper, SIGNAL(mapped(int)), this, SLOT(slotActivateMode(int)));
connect(ExtensionSystem::PluginManager::instance(), SIGNAL(initializationDone()), this, SLOT(handleStartup()));
connect(ICore::instance(), SIGNAL(coreAboutToClose()), this, SLOT(handleShutdown()));
} }
void ModeManager::init() void ModeManager::init()
@@ -239,12 +235,6 @@ void ModeManager::enabledStateChanged()
} }
} }
void ModeManager::handleStartup()
{ d->m_saveSettingsOnModeChange = true; }
void ModeManager::handleShutdown()
{ d->m_saveSettingsOnModeChange = false; }
void ModeManager::aboutToRemoveObject(QObject *obj) void ModeManager::aboutToRemoveObject(QObject *obj)
{ {
IMode *mode = Aggregation::query<IMode>(obj); IMode *mode = Aggregation::query<IMode>(obj);
@@ -283,11 +273,8 @@ void ModeManager::currentTabAboutToChange(int index)
{ {
if (index >= 0) { if (index >= 0) {
IMode *mode = d->m_modes.at(index); IMode *mode = d->m_modes.at(index);
if (mode) { if (mode)
if (d->m_saveSettingsOnModeChange)
ICore::saveSettings();
emit currentModeAboutToChange(mode); emit currentModeAboutToChange(mode);
}
} }
} }

View File

@@ -82,8 +82,6 @@ private slots:
void currentTabChanged(int index); void currentTabChanged(int index);
void updateModeToolTip(); void updateModeToolTip();
void enabledStateChanged(); void enabledStateChanged();
void handleStartup();
void handleShutdown();
private: private:
explicit ModeManager(Internal::MainWindow *mainWindow, Internal::FancyTabWidget *modeStack); explicit ModeManager(Internal::MainWindow *mainWindow, Internal::FancyTabWidget *modeStack);

View File

@@ -1497,7 +1497,8 @@ void ProjectExplorerPlugin::updateWelcomePage()
void ProjectExplorerPlugin::currentModeChanged(IMode *mode, IMode *oldMode) void ProjectExplorerPlugin::currentModeChanged(IMode *mode, IMode *oldMode)
{ {
Q_UNUSED(oldMode); if (oldMode && oldMode->id() == ProjectExplorer::Constants::MODE_SESSION)
ICore::saveSettings();
if (mode && mode->id() == Core::Constants::MODE_WELCOME) if (mode && mode->id() == Core::Constants::MODE_WELCOME)
updateWelcomePage(); updateWelcomePage();
} }