diff --git a/source/ArmarXGui/gui-plugins/StatechartEditorPlugin/StatechartEditorController.cpp b/source/ArmarXGui/gui-plugins/StatechartEditorPlugin/StatechartEditorController.cpp index 54e0c9f3656cf62de4a307f383a210e2c1b11857..e8384a2a7e7eb667af49fc0f865fb51aed9b3760 100644 --- a/source/ArmarXGui/gui-plugins/StatechartEditorPlugin/StatechartEditorController.cpp +++ b/source/ArmarXGui/gui-plugins/StatechartEditorPlugin/StatechartEditorController.cpp @@ -15,9 +15,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * - * @package - * @author - * @date + * @package + * @author + * @date * @copyright http://www.gnu.org/licenses/gpl-2.0.txt * GNU General Public License */ @@ -58,14 +58,22 @@ namespace armarx QSettings s("KIT", "ArmarXStatechartEditor"); config.lockRemoteStates = s.value("lockRemoteStates", true).toBool(); + config.searchPaths = s.value("searchPaths").toStringList(); } + StatechartEditorController::~StatechartEditorController() + { + storeAutoSaveSettings(); + } + + void StatechartEditorController::storeAutoSaveSettings() { QSettings s("KIT", "ArmarXStatechartEditor"); s.setValue("lockRemoteStates", config.lockRemoteStates); + s.setValue("searchPaths", config.searchPaths); } QStringList StatechartEditorController::findAllStatechartGroupDefinitions(const QString& basePath) @@ -230,12 +238,13 @@ namespace armarx void StatechartEditorController::showStatechartEditorSettingsDialog() { StatechartEditorSettingsDialog d; - d.setPaths(searchPaths); + d.setPaths(config.searchPaths); d.setRemoteStatesLocked(config.lockRemoteStates); if (d.exec() == QDialog::Accepted) { - searchPaths = d.getPaths(); - searchAndAddPaths(searchPaths); + config.searchPaths = d.getPaths(); + config.searchPaths.removeDuplicates(); + searchAndAddPaths(config.searchPaths); // d.setPaths(config.searchPaths); // d.setRemoteStatesLocked(config.lockRemoteStates); // if(d.exec() == QDialog::Accepted) @@ -244,7 +253,7 @@ namespace armarx // searchAndAddPaths(config.searchPaths); config.lockRemoteStates = d.getRemoteStatesLocked(); stateEditorController->setLockRemoteStatesByDefault(config.lockRemoteStates); - + storeAutoSaveSettings(); } } @@ -431,11 +440,12 @@ namespace armarx if (boost::filesystem::exists(packageStatechartPath)) { - searchPaths.push_back(packageStatechartPath.c_str()); + config.searchPaths.push_back(packageStatechartPath.c_str()); } } } } + config.searchPaths.removeDuplicates(); QList<QVariant> header; header.push_back(QString("TEST")); @@ -469,7 +479,7 @@ namespace armarx watcher = new QFileSystemWatcher(editor); connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(showCodeFileContent(QString))); - searchAndAddPaths(searchPaths); + searchAndAddPaths(config.searchPaths); // OpenStatechartGroups(config.groupsToLoad); // config.groupsToLoad.clear(); treeController->collapseAll(); diff --git a/source/ArmarXGui/gui-plugins/StatechartEditorPlugin/StatechartEditorController.h b/source/ArmarXGui/gui-plugins/StatechartEditorPlugin/StatechartEditorController.h index 3ece34b0d0ca798af2dba988ad49122d7e9a119e..fd7f89d451cddff6e3c68bd8f2bebe1c2906fca8 100644 --- a/source/ArmarXGui/gui-plugins/StatechartEditorPlugin/StatechartEditorController.h +++ b/source/ArmarXGui/gui-plugins/StatechartEditorPlugin/StatechartEditorController.h @@ -15,9 +15,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * - * @package - * @author - * @date + * @package + * @author + * @date * @copyright http://www.gnu.org/licenses/gpl-2.0.txt * GNU General Public License */ @@ -173,7 +173,6 @@ namespace armarx StateTreeControllerPtr treeController; ArmarXPackageToolInterfacePtr packageTool; QFileSystemWatcher* watcher; - QStringList searchPaths; VariantInfoPtr variantInfo; StatechartProfilesPtr profiles; QPointer<StatechartEditorConfigDialog> dialog; @@ -199,6 +198,7 @@ namespace armarx // ArmarXWidgetController interface public: void configured(); + void storeAutoSaveSettings(); }; }