summaryrefslogtreecommitdiff
path: root/plugingui/plugingui.cc
diff options
context:
space:
mode:
authorJonas Suhr Christensen <jsc@umbraculum.org>2014-08-05 20:15:41 +0200
committerJonas Suhr Christensen <jsc@umbraculum.org>2014-08-05 20:15:41 +0200
commitc35e6f3ae438fb63c571f807037417d9d71b2afd (patch)
treeb66e1665fc7557f49ed4c65827b033041cae5d9f /plugingui/plugingui.cc
parente46c013eff23e85d41b04d05663a692143e2977d (diff)
Added global configfile/history file.
Diffstat (limited to 'plugingui/plugingui.cc')
-rw-r--r--plugingui/plugingui.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/plugingui/plugingui.cc b/plugingui/plugingui.cc
index 6601be7..86f3758 100644
--- a/plugingui/plugingui.cc
+++ b/plugingui/plugingui.cc
@@ -33,6 +33,7 @@
#include "verticalline.h"
#include "../version.h"
+#include "config.h"
#include "messagehandler.h"
static void checkClick(void *ptr)
@@ -81,6 +82,12 @@ static void knobChange2(void *ptr)
#endif
}
+static void quit(void *ptr) {
+ PluginGUI *gui = (PluginGUI*)ptr;
+
+ gui->stopThread();
+}
+
GUI::FileBrowser *fb;
static void selectKitFile(void *ptr, std::string filename)
{
@@ -91,6 +98,8 @@ static void selectKitFile(void *ptr, std::string filename)
std::string drumkit = gui->lineedit->text();
+ gui->config->lastkit = drumkit;
+
gui->progress->setProgress(0);
gui->progress->setState(GUI::ProgressBar::blue);
@@ -105,6 +114,7 @@ static void kitBrowseClick(void *ptr)
PluginGUI *gui = (PluginGUI*)ptr;
std::string path = gui->lineedit->text();
+ if(path == "") path = gui->config->lastkit;
if(path == "") path = gui->lineedit2->text();
fb->setPath(path);
@@ -121,6 +131,8 @@ static void selectMapFile(void *ptr, std::string filename)
std::string midimap = gui->lineedit2->text();
+ gui->config->lastmidimap = midimap;
+
LoadMidimapMessage *msg = new LoadMidimapMessage();
msg->midimapfile = midimap;
msghandler.sendMessage(MSGRCV_ENGINE, msg);
@@ -137,6 +149,7 @@ static void midimapBrowseClick(void *ptr)
PluginGUI *gui = (PluginGUI*)ptr;
std::string path = gui->lineedit2->text();
+ if(path == "") path = gui->config->lastmidimap;
if(path == "") path = gui->lineedit->text();
fb->setPath(path);
@@ -269,6 +282,10 @@ void PluginGUI::thread_main()
void PluginGUI::deinit()
{
if(window) delete window;
+ if(config) {
+ config->save();
+ delete config;
+ }
}
void closeEventHandler(void *ptr)
@@ -280,6 +297,10 @@ void closeEventHandler(void *ptr)
void PluginGUI::init()
{
DEBUG(gui, "init");
+
+ config = new Config();
+ config->load();
+
window = new GUI::Window();
window->eventHandler()->registerCloseHandler(closeEventHandler,
(void*)&closing);
@@ -428,6 +449,13 @@ void PluginGUI::init()
filebrowser->hide();
fb = filebrowser;
+ // Enable quit button
+ GUI::Button *btn_quit = new GUI::Button(window);
+ btn_quit->setText("Quit");
+ btn_quit->move(50,280);
+ btn_quit->resize(80,80);
+ btn_quit->registerClickHandler(quit, this);
+
window->show();
sem.post();