diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2013-03-22 22:42:05 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2013-03-22 22:42:05 +0100 |
commit | 47e1f28f1fe9fecf969d63f059b8ec8c0184605e (patch) | |
tree | 47ac2c6a2256b75601fa7077c994cdbfbeadc62a /plugingui/plugingui.cc | |
parent | 70cc80a11a44c73c3cf548c7cedf2a520a025fb6 (diff) |
Added Engine->Messageing system. Implemented LoadStatus Message. Added ProgressBar widget. Made FileBrowser chdir to old value (needs further fixing). More printf->hugin ports.
Diffstat (limited to 'plugingui/plugingui.cc')
-rw-r--r-- | plugingui/plugingui.cc | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/plugingui/plugingui.cc b/plugingui/plugingui.cc index 3fb5984..e1de5b5 100644 --- a/plugingui/plugingui.cc +++ b/plugingui/plugingui.cc @@ -36,6 +36,7 @@ #include <drumgizmo.h> #include "../src/configuration.h" #else +#include "../src/message.h" class DrumGizmo { public: void loadkit(std::string) {} @@ -88,6 +89,7 @@ static void kitBrowseClick(void *ptr) { PluginGUI *gui = (PluginGUI*)ptr; + fb->setPath(gui->lineedit->text()); fb->registerFileSelectHandler(selectKitFile, gui); fb->show(); } @@ -109,6 +111,7 @@ static void midimapBrowseClick(void *ptr) { PluginGUI *gui = (PluginGUI*)ptr; + fb->setPath(gui->lineedit2->text()); fb->registerFileSelectHandler(selectMapFile, gui); fb->show(); } @@ -168,7 +171,32 @@ void PluginGUI::thread_main() #else usleep(50); #endif/*WIN32*/ - // printf("."); fflush(stdout); + Message *msg; + while((msg = drumgizmo->receiveMessage()) != NULL) { + switch(msg->type()) { + case Message::LoadStatus: + { + Message *pmsg; + while( (pmsg = drumgizmo->peekMessage()) != NULL) { + if(pmsg->type() != Message::LoadStatus) break; + delete msg; + msg = drumgizmo->receiveMessage(); + } + LoadStatus *ls = (LoadStatus*)msg; + DEBUG(gui, "%d of %d (%s)\n", + ls->numer_of_files_loaded, + ls->number_of_files, + ls->current_file.c_str()); + progress->setProgress((float)ls->numer_of_files_loaded / + (float)ls->number_of_files); + } + break; + default: + break; + } + + delete msg; + } } } @@ -274,6 +302,10 @@ void PluginGUI::init() lbl3->move(120, 180); lbl3->resize(70, 20); + progress = new GUI::ProgressBar(window); + progress->move(200, window->height() - 17); + progress->resize(window->width() - 400, 16); + // Create filebrowser filebrowser = new GUI::FileBrowser(window); filebrowser->move(0, 0); |