diff --git a/include/gepetto/gui/settings.hh b/include/gepetto/gui/settings.hh index c023077f087845c955eaf0e2191e06891c0ab708..9cd4979d95ca13702249f2eb853507bc19392e8b 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 74be4901911bd84ac11738418f923c19a41985cd..6907c93faa561edc4940babb12bbe2345b6aca08 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 3474a11d07186c652ef0715ba6e4bf8c07b6065f..618cad86b7765da8ca58ae5702abb9e4d3de103c 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,