summaryrefslogtreecommitdiff
path: root/plugingui/plugingui.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2013-03-31 12:44:00 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2013-03-31 12:44:00 +0200
commit8f4881f262f9e1f76d4c947aa10586ad2be72ba9 (patch)
tree00418431bc67438376cbfc394c7f4129e98c755a /plugingui/plugingui.cc
parentfa0e229e7228129099f3e772e0b2844a3f146240 (diff)
Use progress bar colours to indicate errors.
Diffstat (limited to 'plugingui/plugingui.cc')
-rw-r--r--plugingui/plugingui.cc25
1 files changed, 19 insertions, 6 deletions
diff --git a/plugingui/plugingui.cc b/plugingui/plugingui.cc
index 132b884..10632ee 100644
--- a/plugingui/plugingui.cc
+++ b/plugingui/plugingui.cc
@@ -39,8 +39,8 @@
#include "../src/message.h"
class DrumGizmo {
public:
- void loadkit(std::string) {}
- void init(bool) {}
+ bool loadkit(std::string) { return true; }
+ bool init(bool) { return true; }
std::string drumkitfile() { return ""; }
std::string midimapfile;
Message *receiveMessage() { return NULL; }
@@ -64,6 +64,7 @@ static void knobChange(void *ptr)
{
PluginGUI *gui = (PluginGUI*)ptr;
Conf::velocity_modifier_weight = gui->knob->value();
+#ifdef STANDALONE
int i = gui->knob->value() * 5;
switch(i) {
case 0: gui->progress->setState(GUI::ProgressBar::off); break;
@@ -72,13 +73,16 @@ static void knobChange(void *ptr)
case 3: gui->progress->setState(GUI::ProgressBar::red); break;
default: break;
}
+#endif
}
static void knobChange2(void *ptr)
{
PluginGUI *gui = (PluginGUI*)ptr;
Conf::velocity_modifier_falloff = gui->knob2->value();
+#ifdef STANDALONE
gui->progress->setProgress(gui->knob2->value());
+#endif
}
GUI::FileBrowser *fb;
@@ -90,10 +94,16 @@ static void selectKitFile(void *ptr, std::string filename)
fb->hide();
std::string drumkit = gui->lineedit->text();
- if(!gui->drumgizmo) return;
- gui->drumgizmo->loadkit(drumkit);
- gui->drumgizmo->init(true);
- gui->progress->setState(GUI::ProgressBar::green);
+
+ gui->progress->setProgress(1);
+
+ if(!gui->drumgizmo ||
+ !gui->drumgizmo->loadkit(drumkit) ||
+ !gui->drumgizmo->init(true)) {
+ gui->progress->setState(GUI::ProgressBar::red);
+ } else {
+ gui->progress->setState(GUI::ProgressBar::blue);
+ }
}
static void kitBrowseClick(void *ptr)
@@ -200,6 +210,9 @@ void PluginGUI::thread_main()
ls->current_file.c_str());
progress->setProgress((float)ls->numer_of_files_loaded /
(float)ls->number_of_files);
+ if(ls->numer_of_files_loaded == ls->number_of_files) {
+ progress->setState(GUI::ProgressBar::green);
+ }
}
break;
default: