forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/2.6'
This commit is contained in:
@@ -542,6 +542,8 @@ void SettingsDialog::done(int val)
|
||||
settings->setValue(QLatin1String(categoryKeyC), m_currentCategory);
|
||||
settings->setValue(QLatin1String(pageKeyC), m_currentPage);
|
||||
|
||||
ICore::saveSettings(); // save all settings
|
||||
|
||||
// exit all additional event loops, see comment in execDialog()
|
||||
QListIterator<QEventLoop *> it(m_eventLoops);
|
||||
it.toBack();
|
||||
|
||||
@@ -1506,6 +1506,9 @@ 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)
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
|
||||
#include "icore.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
/*!
|
||||
\namespace Core
|
||||
\brief The Core namespace contains all classes that make up the Core plugin
|
||||
@@ -373,6 +375,9 @@ ICore::ICore(MainWindow *mainwindow)
|
||||
{
|
||||
m_instance = this;
|
||||
m_mainwindow = mainwindow;
|
||||
// Save settings once after all plugins are initialized:
|
||||
connect(ExtensionSystem::PluginManager::instance(), SIGNAL(initializationDone()),
|
||||
this, SIGNAL(saveSettingsRequested()));
|
||||
}
|
||||
|
||||
ICore::~ICore()
|
||||
@@ -553,4 +558,12 @@ void ICore::emitNewItemsDialogRequested()
|
||||
emit m_instance->newItemsDialogRequested();
|
||||
}
|
||||
|
||||
void ICore::saveSettings()
|
||||
{
|
||||
emit m_instance->saveSettingsRequested();
|
||||
|
||||
ICore::settings(QSettings::SystemScope)->sync();
|
||||
ICore::settings(QSettings::UserScope)->sync();
|
||||
}
|
||||
|
||||
} // namespace Core
|
||||
|
||||
@@ -134,6 +134,8 @@ public:
|
||||
|
||||
static void emitNewItemsDialogRequested();
|
||||
|
||||
static void saveSettings();
|
||||
|
||||
signals:
|
||||
void coreAboutToOpen();
|
||||
void coreOpened();
|
||||
|
||||
@@ -82,6 +82,7 @@
|
||||
#include <coreplugin/icorelistener.h>
|
||||
#include <coreplugin/inavigationwidgetfactory.h>
|
||||
#include <coreplugin/settingsdatabase.h>
|
||||
#include <utils/historycompleter.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/stylehelper.h>
|
||||
#include <utils/stringutils.h>
|
||||
@@ -175,6 +176,8 @@ MainWindow::MainWindow() :
|
||||
(void) new DocumentManager(this);
|
||||
OutputPaneManager::create();
|
||||
|
||||
Utils::HistoryCompleter::setSettings(m_settings);
|
||||
|
||||
setWindowTitle(tr("Qt Creator"));
|
||||
#ifndef Q_OS_MAC
|
||||
QApplication::setWindowIcon(QIcon(QLatin1String(Constants::ICON_QTLOGO_128)));
|
||||
@@ -233,11 +236,6 @@ MainWindow::MainWindow() :
|
||||
#if defined(Q_OS_MAC)
|
||||
MacFullScreen::addFullScreen(this);
|
||||
#endif
|
||||
|
||||
m_autoSaveSessionTimer = new QTimer(this);
|
||||
m_autoSaveSessionTimer->setInterval(10000);
|
||||
connect(m_autoSaveSessionTimer, SIGNAL(timeout()),
|
||||
m_coreImpl, SIGNAL(saveSettingsRequested()));
|
||||
}
|
||||
|
||||
void MainWindow::setSidebarVisible(bool visible)
|
||||
@@ -377,13 +375,11 @@ void MainWindow::extensionsInitialized()
|
||||
emit m_coreImpl->coreAboutToOpen();
|
||||
show();
|
||||
emit m_coreImpl->coreOpened();
|
||||
m_autoSaveSessionTimer->start();
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
m_autoSaveSessionTimer->stop();
|
||||
emit m_coreImpl->saveSettingsRequested();
|
||||
ICore::saveSettings();
|
||||
|
||||
// Save opened files
|
||||
bool cancelled;
|
||||
@@ -979,7 +975,6 @@ bool MainWindow::showOptionsDialog(const QString &category,
|
||||
void MainWindow::saveAll()
|
||||
{
|
||||
DocumentManager::saveModifiedDocumentsSilently(DocumentManager::modifiedDocuments());
|
||||
emit m_coreImpl->saveSettingsRequested();
|
||||
}
|
||||
|
||||
void MainWindow::exit()
|
||||
|
||||
@@ -229,7 +229,6 @@ private:
|
||||
QColor m_overrideColor;
|
||||
|
||||
QStringList m_filesToOpenDelayed;
|
||||
QTimer *m_autoSaveSessionTimer;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user