diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2017-04-18 17:11:35 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2017-04-18 17:11:35 +0200 |
commit | 1d27cbf59bb9f4020ed9ff37fa4e9f15082d023b (patch) | |
tree | 3849d44a156fdd840e47e3f777d1bbbca121d75c /plugingui/drumkitframecontent.cc | |
parent | 4cb5fa5b3fd639c0f1f8a6a5bacd1b3380d1967b (diff) |
Restore paths of FileBrowser as per the old UI.
Diffstat (limited to 'plugingui/drumkitframecontent.cc')
-rw-r--r-- | plugingui/drumkitframecontent.cc | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/plugingui/drumkitframecontent.cc b/plugingui/drumkitframecontent.cc index 9a51b11..ea830fa 100644 --- a/plugingui/drumkitframecontent.cc +++ b/plugingui/drumkitframecontent.cc @@ -29,6 +29,7 @@ #include <settings.h> #include "label.h" +#include "pluginconfig.h" namespace GUI { @@ -80,10 +81,12 @@ LineEdit& BrowseFile::getLineEdit() DrumkitframeContent::DrumkitframeContent(Widget* parent, Settings& settings, - SettingsNotifier& settings_notifier) + SettingsNotifier& settings_notifier, + Config& config) : Widget(parent) , settings(settings) , settings_notifier(settings_notifier) + , config(config) { layout.setHAlignment(HAlignment::left); @@ -143,6 +146,18 @@ void DrumkitframeContent::resize(std::size_t width, std::size_t height) void DrumkitframeContent::kitBrowseClick() { + std::string path = drumkit_file.getLineEdit().text(); + if(path == "") + { + path = config.lastkit; + } + + if(path == "") + { + path = midimap_file.getLineEdit().text(); + } + + file_browser.setPath(path); CONNECT(&file_browser, fileSelectNotifier, this, &DrumkitframeContent::selectKitFile); file_browser.show(); @@ -150,6 +165,18 @@ void DrumkitframeContent::kitBrowseClick() void DrumkitframeContent::midimapBrowseClick() { + std::string path = midimap_file.getLineEdit().text(); + if(path == "") + { + path = config.lastmidimap; + } + + if(path == "") + { + path = drumkit_file.getLineEdit().text(); + } + + file_browser.setPath(path); CONNECT(&file_browser, fileSelectNotifier, this, &DrumkitframeContent::selectMapFile); file_browser.show(); @@ -157,18 +184,16 @@ void DrumkitframeContent::midimapBrowseClick() void DrumkitframeContent::selectKitFile(const std::string& filename) { - // TODO: - //config.lastkit = drumkit; - //config.save(); + config.lastkit = filename; + config.save(); settings.drumkit_file.store(filename); } void DrumkitframeContent::selectMapFile(const std::string& filename) { - // TODO: - //config.lastmidimap = midimap; - //config.save(); + config.lastmidimap = filename; + config.save(); settings.midimap_file.store(filename); } |