From b86dbe272afa41f78d90ebd8e63b94b9582d60e0 Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Sun, 21 Feb 2016 14:00:19 +0100 Subject: [PATCH] Add saving to last loaded xml settings file --- src/Application/Application.cpp | 3 +-- src/Application/SettingsLoader.cpp | 2 ++ src/Application/SettingsLoader.h | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Application/Application.cpp b/src/Application/Application.cpp index 251245c..0dbdb3c 100644 --- a/src/Application/Application.cpp +++ b/src/Application/Application.cpp @@ -92,8 +92,7 @@ void Application::onKeyPressed(ofKeyEventArgs & args){ break; case 's': - _surfaceManager.saveXmlSettings( - PIMAPPER_USER_SURFACES_XML_FILE); + _surfaceManager.saveXmlSettings(SettingsLoader::instance()->getLastLoadedFilename()); break; case 'z': diff --git a/src/Application/SettingsLoader.cpp b/src/Application/SettingsLoader.cpp index 5e67d69..1f4b545 100644 --- a/src/Application/SettingsLoader.cpp +++ b/src/Application/SettingsLoader.cpp @@ -104,6 +104,8 @@ bool SettingsLoader::load(SurfaceStack & surfaces, MediaServer & mediaServer, st xmlSettings->popTag(); // surfaces } + _lastLoadedFilename = fileName; + return true; } diff --git a/src/Application/SettingsLoader.h b/src/Application/SettingsLoader.h index 1738c90..a39e087 100644 --- a/src/Application/SettingsLoader.h +++ b/src/Application/SettingsLoader.h @@ -17,12 +17,16 @@ class SettingsLoader { bool load(SurfaceStack & surfaces, MediaServer & mediaServer, string fileName); bool save(SurfaceStack & surfaces, string fileName); + string getLastLoadedFilename(){ return _lastLoadedFilename; }; + private: static SettingsLoader * _instance; BaseSurface * getTriangleSurface(ofxXmlSettings * xmlSettings); BaseSurface * getQuadSurface(ofxXmlSettings * xmlSettings); BaseSurface * getGridWarpSurface(ofxXmlSettings * xmlSettings); + + string _lastLoadedFilename; }; }