summaryrefslogtreecommitdiff
path: root/plugingui
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui')
-rw-r--r--plugingui/drumkitframecontent.cc39
-rw-r--r--plugingui/drumkitframecontent.h6
-rw-r--r--plugingui/maintab.cc5
-rw-r--r--plugingui/maintab.h4
-rw-r--r--plugingui/mainwindow.cc11
-rw-r--r--plugingui/mainwindow.h4
6 files changed, 53 insertions, 16 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);
}
diff --git a/plugingui/drumkitframecontent.h b/plugingui/drumkitframecontent.h
index 425898d..1eb495f 100644
--- a/plugingui/drumkitframecontent.h
+++ b/plugingui/drumkitframecontent.h
@@ -38,6 +38,8 @@
namespace GUI
{
+class Config;
+
class BrowseFile
: public Widget
{
@@ -69,7 +71,8 @@ class DrumkitframeContent
public:
DrumkitframeContent(Widget* parent,
Settings& settings,
- SettingsNotifier& settings_notifier);
+ SettingsNotifier& settings_notifier,
+ Config& config);
// From Widget
virtual void resize(std::size_t width, std::size_t height) override;
@@ -97,6 +100,7 @@ private:
Settings& settings;
SettingsNotifier& settings_notifier;
+ Config& config;
};
} // GUI::
diff --git a/plugingui/maintab.cc b/plugingui/maintab.cc
index c87defe..0811f06 100644
--- a/plugingui/maintab.cc
+++ b/plugingui/maintab.cc
@@ -31,9 +31,10 @@ namespace GUI
MainTab::MainTab(Widget* parent,
Settings& settings,
- SettingsNotifier& settings_notifier)
+ SettingsNotifier& settings_notifier,
+ Config& config)
: Widget(parent)
- , drumkitframe_content{this, settings, settings_notifier}
+ , drumkitframe_content{this, settings, settings_notifier, config}
, humanizerframe_content{this, settings, settings_notifier}
, diskstreamingframe_content{this, settings, settings_notifier}
, settings(settings)
diff --git a/plugingui/maintab.h b/plugingui/maintab.h
index f60afcc..4e1e1e2 100644
--- a/plugingui/maintab.h
+++ b/plugingui/maintab.h
@@ -36,6 +36,7 @@
struct Settings;
class SettingsNotifier;
+class Config;
namespace GUI
{
@@ -46,7 +47,8 @@ class MainTab
public:
MainTab(Widget* parent,
Settings& settings,
- SettingsNotifier& settings_notifier);
+ SettingsNotifier& settings_notifier,
+ Config& config);
private:
void humanizerOnChange(bool on);
diff --git a/plugingui/mainwindow.cc b/plugingui/mainwindow.cc
index e57008d..e00b18b 100644
--- a/plugingui/mainwindow.cc
+++ b/plugingui/mainwindow.cc
@@ -38,12 +38,10 @@ namespace GUI
MainWindow::MainWindow(Settings& settings, void* native_window)
: Window(native_window)
- , settings(settings)
, settings_notifier(settings)
- , main_tab(this, settings, settings_notifier)
+ , main_tab(this, settings, settings_notifier, config)
{
- // FIXME: remove this when settings are actually used in this class
- (void)this->settings;
+ config.load();
CONNECT(this, sizeChangeNotifier, this, &MainWindow::sizeChanged);
CONNECT(eventHandler(), closeNotifier, this, &MainWindow::closeEventHandler);
@@ -59,6 +57,11 @@ MainWindow::MainWindow(Settings& settings, void* native_window)
about_text_field.setReadOnly(true);
}
+MainWindow::~MainWindow()
+{
+ config.save();
+}
+
bool MainWindow::processEvents()
{
// if(!initialised)
diff --git a/plugingui/mainwindow.h b/plugingui/mainwindow.h
index 8e2c8c4..9a9359c 100644
--- a/plugingui/mainwindow.h
+++ b/plugingui/mainwindow.h
@@ -36,6 +36,7 @@
#include "window.h"
#include "maintab.h"
#include "font.h"
+#include "pluginconfig.h"
namespace GUI
{
@@ -45,6 +46,7 @@ class MainWindow
{
public:
MainWindow(Settings& settings, void* native_window);
+ ~MainWindow();
//! Process all events and messages in queue
//! \return true if not closing, returns false if closing.
@@ -64,7 +66,7 @@ private:
TabWidget tabs{this};
- Settings& settings;
+ Config config;
SettingsNotifier settings_notifier;
MainTab main_tab;