diff --git a/src/frontends/qt4/Dialog.cpp b/src/frontends/qt4/Dialog.cpp index a9c1250b6e..c44419bd04 100644 --- a/src/frontends/qt4/Dialog.cpp +++ b/src/frontends/qt4/Dialog.cpp @@ -275,9 +275,8 @@ QString Dialog::sessionKey() const } -void Dialog::saveSession() const +void Dialog::saveSession(QSettings & settings) const { - QSettings settings; settings.setValue(sessionKey() + "/geometry", asQWidget()->saveGeometry()); } diff --git a/src/frontends/qt4/Dialog.h b/src/frontends/qt4/Dialog.h index a9769ff4ab..067d2f2969 100644 --- a/src/frontends/qt4/Dialog.h +++ b/src/frontends/qt4/Dialog.h @@ -20,6 +20,7 @@ #include +class QSettings; class QWidget; namespace lyx { @@ -72,7 +73,7 @@ public: * This default implementation saves the geometry state. * Reimplement to save more settings. **/ - virtual void saveSession() const; + virtual void saveSession(QSettings & settings) const; /// Restore session settings. /** diff --git a/src/frontends/qt4/GuiCharacter.cpp b/src/frontends/qt4/GuiCharacter.cpp index e01687678a..218d619b37 100644 --- a/src/frontends/qt4/GuiCharacter.cpp +++ b/src/frontends/qt4/GuiCharacter.cpp @@ -455,10 +455,9 @@ void GuiCharacter::dispatchParams() } -void GuiCharacter::saveSession() const +void GuiCharacter::saveSession(QSettings & settings) const { - Dialog::saveSession(); - QSettings settings; + Dialog::saveSession(settings); settings.setValue(sessionKey() + "/toggleall", toggleallCB->isChecked()); settings.setValue(sessionKey() + "/autoapply", autoapplyCB->isChecked()); } diff --git a/src/frontends/qt4/GuiCharacter.h b/src/frontends/qt4/GuiCharacter.h index 812c08405a..8cb39fe1b1 100644 --- a/src/frontends/qt4/GuiCharacter.h +++ b/src/frontends/qt4/GuiCharacter.h @@ -74,7 +74,7 @@ private: void dispatchParams(); bool isBufferDependent() const { return true; } FuncCode getLfun() const { return LFUN_TEXTSTYLE_UPDATE; } - void saveSession() const; + void saveSession(QSettings & settings) const; void restoreSession(); //@} diff --git a/src/frontends/qt4/GuiCitation.cpp b/src/frontends/qt4/GuiCitation.cpp index 4c4bcf13f7..8f8a73bd27 100644 --- a/src/frontends/qt4/GuiCitation.cpp +++ b/src/frontends/qt4/GuiCitation.cpp @@ -816,10 +816,9 @@ BiblioInfo const & GuiCitation::bibInfo() const } -void GuiCitation::saveSession() const +void GuiCitation::saveSession(QSettings & settings) const { - Dialog::saveSession(); - QSettings settings; + Dialog::saveSession(settings); settings.setValue( sessionKey() + "/regex", regexp_->isChecked()); settings.setValue( diff --git a/src/frontends/qt4/GuiCitation.h b/src/frontends/qt4/GuiCitation.h index 035b2d2e2a..8e27a480b7 100644 --- a/src/frontends/qt4/GuiCitation.h +++ b/src/frontends/qt4/GuiCitation.h @@ -76,7 +76,7 @@ private: void clearParams(); void dispatchParams(); bool isBufferDependent() const { return true; } - void saveSession() const; + void saveSession(QSettings & settings) const; void restoreSession(); /** Disconnect from the inset when the Apply button is pressed. * Allows easy insertion of multiple citations. diff --git a/src/frontends/qt4/GuiParagraph.cpp b/src/frontends/qt4/GuiParagraph.cpp index 2a9c708d46..15958d721b 100644 --- a/src/frontends/qt4/GuiParagraph.cpp +++ b/src/frontends/qt4/GuiParagraph.cpp @@ -384,10 +384,9 @@ bool GuiParagraph::hasLabelwidth() const } -void GuiParagraph::saveSession() const +void GuiParagraph::saveSession(QSettings & settings) const { - Dialog::saveSession(); - QSettings settings; + Dialog::saveSession(settings); settings.setValue(sessionKey() + "/autoapply", synchronizedViewCB->isChecked()); } diff --git a/src/frontends/qt4/GuiParagraph.h b/src/frontends/qt4/GuiParagraph.h index aee410f607..735d58ca8f 100644 --- a/src/frontends/qt4/GuiParagraph.h +++ b/src/frontends/qt4/GuiParagraph.h @@ -39,7 +39,7 @@ public: void enableView(bool enable); bool isBufferDependent() const { return true; } virtual FuncCode getLfun() const { return LFUN_PARAGRAPH_PARAMS_APPLY; } - void saveSession() const; + void saveSession(QSettings & settings) const; void restoreSession(); //@} diff --git a/src/frontends/qt4/GuiProgressView.cpp b/src/frontends/qt4/GuiProgressView.cpp index a27f6b2dc0..69f1b73299 100644 --- a/src/frontends/qt4/GuiProgressView.cpp +++ b/src/frontends/qt4/GuiProgressView.cpp @@ -224,10 +224,9 @@ void GuiProgressView::appendText(QString const & text) } -void GuiProgressView::saveSession() const +void GuiProgressView::saveSession(QSettings & settings) const { - Dialog::saveSession(); - QSettings settings; + Dialog::saveSession(settings); settings.setValue( sessionKey() + "/autoclear", widget_->autoClearCB->isChecked()); settings.setValue( diff --git a/src/frontends/qt4/GuiProgressView.h b/src/frontends/qt4/GuiProgressView.h index 9a743f2322..fd6db70ebc 100644 --- a/src/frontends/qt4/GuiProgressView.h +++ b/src/frontends/qt4/GuiProgressView.h @@ -61,7 +61,7 @@ public: void updateView() {} bool wantInitialFocus() const { return false; } void restoreSession(); - void saveSession() const; + void saveSession(QSettings & settings) const; ///@} private Q_SLOTS: diff --git a/src/frontends/qt4/GuiToolbar.cpp b/src/frontends/qt4/GuiToolbar.cpp index 2f0b510991..902c6be080 100644 --- a/src/frontends/qt4/GuiToolbar.cpp +++ b/src/frontends/qt4/GuiToolbar.cpp @@ -353,9 +353,8 @@ QString GuiToolbar::sessionKey() const } -void GuiToolbar::saveSession() const +void GuiToolbar::saveSession(QSettings & settings) const { - QSettings settings; settings.setValue(sessionKey() + "/visibility", visibility_); } diff --git a/src/frontends/qt4/GuiToolbar.h b/src/frontends/qt4/GuiToolbar.h index caad355bd8..3f54ac8bd4 100644 --- a/src/frontends/qt4/GuiToolbar.h +++ b/src/frontends/qt4/GuiToolbar.h @@ -20,6 +20,8 @@ #include #include +class QSettings; + namespace lyx { class DocumentClass; @@ -84,7 +86,7 @@ public: **/ QString sessionKey() const; /// Save session settings. - void saveSession() const; + void saveSession(QSettings & settings) const; /// Restore session settings. void restoreSession(); diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 0dd47a2a3f..79cb8a4f9d 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -726,14 +726,16 @@ void GuiView::saveLayout() const void GuiView::saveUISettings() const { + QSettings settings; + // Save the toolbar private states ToolbarMap::iterator end = d.toolbars_.end(); for (ToolbarMap::iterator it = d.toolbars_.begin(); it != end; ++it) - it->second->saveSession(); + it->second->saveSession(settings); // Now take care of all other dialogs map::const_iterator it = d.dialogs_.begin(); for (; it!= d.dialogs_.end(); ++it) - it->second->saveSession(); + it->second->saveSession(settings); } diff --git a/src/frontends/qt4/GuiViewSource.cpp b/src/frontends/qt4/GuiViewSource.cpp index 8785c897da..6937cd4ba0 100644 --- a/src/frontends/qt4/GuiViewSource.cpp +++ b/src/frontends/qt4/GuiViewSource.cpp @@ -371,9 +371,9 @@ void ViewSourceWidget::resizeEvent (QResizeEvent * event) QWidget::resizeEvent(event); } -void ViewSourceWidget::saveSession(QString const & session_key) const + +void ViewSourceWidget::saveSession(QSettings & settings, QString const & session_key) const { - QSettings settings; settings.setValue(session_key + "/output", toqstr(view_format_)); settings.setValue(session_key + "/contents", contentsCO->currentIndex()); settings.setValue(session_key + "/autoupdate", autoUpdateCB->isChecked()); @@ -457,10 +457,10 @@ void GuiViewSource::updateTitle() } -void GuiViewSource::saveSession() const +void GuiViewSource::saveSession(QSettings & settings) const { - Dialog::saveSession(); - widget_->saveSession(sessionKey()); + Dialog::saveSession(settings); + widget_->saveSession(settings, sessionKey()); } diff --git a/src/frontends/qt4/GuiViewSource.h b/src/frontends/qt4/GuiViewSource.h index b7a5190ce2..dfc302b5d2 100644 --- a/src/frontends/qt4/GuiViewSource.h +++ b/src/frontends/qt4/GuiViewSource.h @@ -43,7 +43,7 @@ public: /// returns true if the string has changed bool setText(QString const & qstr = QString()); /// - void saveSession(QString const & session_key) const; + void saveSession(QSettings & settings, QString const & session_key) const; /// void restoreSession(QString const & session_key); @@ -116,7 +116,7 @@ public: bool canApplyToReadOnly() const { return true; } void updateView(); void enableView(bool enable); - void saveSession() const; + void saveSession(QSettings & settings) const; void restoreSession(); bool wantInitialFocus() const { return false; } ///@} diff --git a/status.22x b/status.22x index 58e47e055e..8128fb882e 100644 --- a/status.22x +++ b/status.22x @@ -26,6 +26,8 @@ What's new - Cache information on exportable formats (bug 9980). +- Shorten the time required to save the session state on exit. + * DOCUMENTATION AND LOCALIZATION