Commit d52ee686 authored by Eike Ziller's avatar Eike Ziller

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: default avatarhjk <hjk121@nokiamail.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 4cc473c2
......@@ -1783,9 +1783,6 @@ void EditorManager::autoSave()
if (!errors.isEmpty())
QMessageBox::critical(ICore::mainWindow(), tr("File Error"),
errors.join(QLatin1String("\n")));
// Also save settings while accessing the disk anyway:
ICore::saveSettings();
}
MakeWritableResult EditorManager::makeFileWritable(IDocument *document)
......
......@@ -317,7 +317,7 @@ ICore::ICore(MainWindow *mainwindow)
m_mainwindow = mainwindow;
// Save settings once after all plugins are initialized:
connect(ExtensionSystem::PluginManager::instance(), SIGNAL(initializationDone()),
this, SIGNAL(saveSettingsRequested()));
this, SLOT(saveSettings()));
}
ICore::~ICore()
......
......@@ -118,6 +118,7 @@ public:
static void emitNewItemsDialogRequested();
public slots:
static void saveSettings();
signals:
......
......@@ -72,7 +72,6 @@ struct ModeManagerPrivate
QSignalMapper *m_signalMapper;
Context m_addedContexts;
int m_oldCurrent;
bool m_saveSettingsOnModeChange;
bool m_modeSelectorVisible;
};
......@@ -100,15 +99,12 @@ ModeManager::ModeManager(Internal::MainWindow *mainWindow,
d->m_oldCurrent = -1;
d->m_actionBar = new Internal::FancyActionBar(modeStack);
d->m_modeStack->addCornerWidget(d->m_actionBar);
d->m_saveSettingsOnModeChange = false;
d->m_modeSelectorVisible = true;
d->m_modeStack->setSelectionWidgetVisible(d->m_modeSelectorVisible);
connect(d->m_modeStack, SIGNAL(currentAboutToShow(int)), SLOT(currentTabAboutToChange(int)));
connect(d->m_modeStack, SIGNAL(currentChanged(int)), SLOT(currentTabChanged(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()
......@@ -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)
{
IMode *mode = Aggregation::query<IMode>(obj);
......@@ -283,11 +273,8 @@ void ModeManager::currentTabAboutToChange(int index)
{
if (index >= 0) {
IMode *mode = d->m_modes.at(index);
if (mode) {
if (d->m_saveSettingsOnModeChange)
ICore::saveSettings();
if (mode)
emit currentModeAboutToChange(mode);
}
}
}
......
......@@ -82,8 +82,6 @@ private slots:
void currentTabChanged(int index);
void updateModeToolTip();
void enabledStateChanged();
void handleStartup();
void handleShutdown();
private:
explicit ModeManager(Internal::MainWindow *mainWindow, Internal::FancyTabWidget *modeStack);
......
......@@ -1497,7 +1497,8 @@ void ProjectExplorerPlugin::updateWelcomePage()
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)
updateWelcomePage();
}
......
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