From 922ed4e17017f8e87c021fcd276ac847ae2cd9fa Mon Sep 17 00:00:00 2001 From: Joseph Mirabel <jmirabel@laas.fr> Date: Thu, 15 Mar 2018 10:46:51 +0100 Subject: [PATCH] Add Settings::restoreDockWidgetsState --- include/gepetto/gui/settings.hh | 1 + src/gui/mainwindow.cc | 1 + src/gui/settings.cc | 14 ++++++++++++++ 3 files changed, 16 insertions(+) diff --git a/include/gepetto/gui/settings.hh b/include/gepetto/gui/settings.hh index c023077..9cd4979 100644 --- a/include/gepetto/gui/settings.hh +++ b/include/gepetto/gui/settings.hh @@ -114,6 +114,7 @@ namespace gepetto { void saveState () const; void restoreState () const; + void restoreDockWidgetsState () const; private: void writeRobotFile (); diff --git a/src/gui/mainwindow.cc b/src/gui/mainwindow.cc index 74be490..6907c93 100644 --- a/src/gui/mainwindow.cc +++ b/src/gui/mainwindow.cc @@ -275,6 +275,7 @@ namespace gepetto { actionSearchBar_->addAction(new NodeAction("Attach camera " + osgWidget->objectName() + " to selected node", osgWidget, this)); osgWidget->addAction(actionSearchBar_->showAction()); osgWindows_.append(osgWidget); + settings_->restoreDockWidgetsState (); } void MainWindow::openLoadRobotDialog() diff --git a/src/gui/settings.cc b/src/gui/settings.cc index 3474a11..618cad8 100644 --- a/src/gui/settings.cc +++ b/src/gui/settings.cc @@ -218,6 +218,20 @@ namespace gepetto { } } + void Settings::restoreDockWidgetsState () const + { + QSettings settings (QSettings::SystemScope, + QCoreApplication::organizationName (), + getQSettingsFileName (stateConf)); + if (settings.status() != QSettings::NoError) { + qDebug () << "Could not restore the dock widget state from" << settings.fileName(); + } else { + settings.beginGroup("mainWindow"); + mw->restoreState (settings.value("state").toByteArray()); + settings.endGroup(); + } + } + void Settings::saveState () const { QSettings settings (QSettings::SystemScope, -- GitLab