From 1d27cbf59bb9f4020ed9ff37fa4e9f15082d023b Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 18 Apr 2017 17:11:35 +0200 Subject: Restore paths of FileBrowser as per the old UI. --- plugingui/drumkitframecontent.cc | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) (limited to 'plugingui/drumkitframecontent.cc') 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 #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); } -- cgit v1.2.3