summaryrefslogtreecommitdiff
path: root/plugingui/statusframecontent.cc
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2017-04-21 16:35:08 +0200
committerAndré Nusser <andre.nusser@googlemail.com>2017-04-21 16:35:08 +0200
commita96587e4737ea617188f13370331072322adb0ad (patch)
treeb826ea7d3e811dcfca7704c2a19ad655987d45e9 /plugingui/statusframecontent.cc
parent392dbed3af5d9bfd1e71244426697915321df89c (diff)
Introduce first content of status frame.
This is just an initial version and not the final one.
Diffstat (limited to 'plugingui/statusframecontent.cc')
-rw-r--r--plugingui/statusframecontent.cc93
1 files changed, 91 insertions, 2 deletions
diff --git a/plugingui/statusframecontent.cc b/plugingui/statusframecontent.cc
index 33a1367..196c0d3 100644
--- a/plugingui/statusframecontent.cc
+++ b/plugingui/statusframecontent.cc
@@ -29,11 +29,25 @@
namespace GUI
{
-StatusframeContent::StatusframeContent(Widget* parent) : Widget(parent)
+StatusframeContent::StatusframeContent(
+ Widget* parent, SettingsNotifier& settings_notifier)
+ : Widget(parent), settings_notifier(settings_notifier)
{
+ CONNECT(this, settings_notifier.drumkit_load_status,
+ this, &StatusframeContent::updateDrumkitLoadStatus);
+ CONNECT(this, settings_notifier.midimap_load_status,
+ this, &StatusframeContent::updateMidimapLoadStatus);
+ CONNECT(this, settings_notifier.samplerate,
+ this, &StatusframeContent::updateSamplerate);
+ CONNECT(this, settings_notifier.enable_resampling,
+ this, &StatusframeContent::updateResamplingEnabled);
+ CONNECT(this, settings_notifier.number_of_underruns,
+ this, &StatusframeContent::updateNumberOfUnderruns);
+
text_field.move(0, 0);
- text_field.setText("This is a status message.");
text_field.setReadOnly(true);
+
+ updateContent();
text_field.show();
}
@@ -43,4 +57,79 @@ void StatusframeContent::resize(std::size_t width, std::size_t height)
text_field.resize(width, height);
}
+void StatusframeContent::updateContent()
+{
+ text_field.setText(
+ "Drumkit load status: " + drumkit_load_status + "\n"
+ "Midimap load status: " + midimap_load_status + "\n"
+ "Samplerate: " + samplerate + "\n"
+ "Resampling enabled: " + resampling_enabled + "\n"
+ "Number of underruns: " + number_of_underruns + "\n"
+ );
+}
+
+void StatusframeContent::updateDrumkitLoadStatus(LoadStatus load_status)
+{
+ switch(load_status)
+ {
+ case LoadStatus::Idle:
+ drumkit_load_status = "idle";
+ break;
+ case LoadStatus::Loading:
+ drumkit_load_status = "loading";
+ break;
+ case LoadStatus::Done:
+ drumkit_load_status = "done";
+ break;
+ case LoadStatus::Error:
+ drumkit_load_status = "error";
+ break;
+ }
+
+ updateContent();
+}
+
+void StatusframeContent::updateMidimapLoadStatus(LoadStatus load_status)
+{
+ switch(load_status)
+ {
+ case LoadStatus::Idle:
+ midimap_load_status = "idle";
+ break;
+ case LoadStatus::Loading:
+ midimap_load_status = "loading";
+ break;
+ case LoadStatus::Done:
+ midimap_load_status = "done";
+ break;
+ case LoadStatus::Error:
+ midimap_load_status = "error";
+ break;
+ }
+
+ updateContent();
+}
+
+void StatusframeContent::updateSamplerate(double samplerate)
+{
+ this->samplerate = std::to_string((std::size_t)samplerate);
+
+ updateContent();
+}
+
+void StatusframeContent::updateResamplingEnabled(bool enable_resampling)
+{
+ this->resampling_enabled = enable_resampling ? "yes" : "no";
+
+ updateContent();
+}
+
+void StatusframeContent::updateNumberOfUnderruns(
+ std::size_t number_of_underruns)
+{
+ this->number_of_underruns = std::to_string(number_of_underruns);
+
+ updateContent();
+}
+
} // GUI::