diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2019-02-01 18:05:18 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2019-02-01 18:05:18 +0100 |
commit | 7a8e610ddde160950839f3af9356d4c416b39396 (patch) | |
tree | ea3ba79c11677dd97fa6b5cb567f8ef5628c039a /plugingui/drumkitframecontent.cc | |
parent | 5ca1c40c92f074315bbdfe328c00484ff18146f2 (diff) |
Add 'Set default path' button in filebrowser.
Diffstat (limited to 'plugingui/drumkitframecontent.cc')
-rw-r--r-- | plugingui/drumkitframecontent.cc | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/plugingui/drumkitframecontent.cc b/plugingui/drumkitframecontent.cc index 46ea67c..1da7201 100644 --- a/plugingui/drumkitframecontent.cc +++ b/plugingui/drumkitframecontent.cc @@ -124,6 +124,9 @@ DrumkitframeContent::DrumkitframeContent(Widget* parent, CONNECT(this, settings_notifier.number_of_files_loaded, &drumkit_file_progress, &ProgressBar::setValue); + CONNECT(this, file_browser. defaultPathChangedNotifier, + this, &DrumkitframeContent::defaultPathChanged); + midimap_file_progress.setTotal(2); file_browser.resize(450, 350); @@ -148,14 +151,15 @@ void DrumkitframeContent::resize(std::size_t width, std::size_t height) void DrumkitframeContent::kitBrowseClick() { std::string path = drumkit_file.getLineEdit().getText(); + if(path == "") { - path = config.lastkit; + path = midimap_file.getLineEdit().getText(); } if(path == "") { - path = midimap_file.getLineEdit().getText(); + path = config.defaultKitPath; } file_browser.setPath(path); @@ -169,14 +173,15 @@ void DrumkitframeContent::kitBrowseClick() void DrumkitframeContent::midimapBrowseClick() { std::string path = midimap_file.getLineEdit().getText(); + if(path == "") { - path = config.lastmidimap; + path = drumkit_file.getLineEdit().getText(); } if(path == "") { - path = drumkit_file.getLineEdit().getText(); + path = config.defaultKitPath; } file_browser.setPath(path); @@ -186,9 +191,14 @@ void DrumkitframeContent::midimapBrowseClick() file_browser.show(); } +void DrumkitframeContent::defaultPathChanged(const std::string& path) +{ + config.defaultKitPath = path; + config.save(); +} + void DrumkitframeContent::selectKitFile(const std::string& filename) { - config.lastkit = filename; config.save(); settings.drumkit_file.store(filename); @@ -197,7 +207,6 @@ void DrumkitframeContent::selectKitFile(const std::string& filename) void DrumkitframeContent::selectMapFile(const std::string& filename) { - config.lastmidimap = filename; config.save(); settings.midimap_file.store(filename); |