summaryrefslogtreecommitdiff
path: root/plugingui
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui')
-rw-r--r--plugingui/maintab.cc1
-rw-r--r--plugingui/maintab.h2
-rw-r--r--plugingui/statusframecontent.cc93
-rw-r--r--plugingui/statusframecontent.h21
4 files changed, 113 insertions, 4 deletions
diff --git a/plugingui/maintab.cc b/plugingui/maintab.cc
index 7680bcd..d93fd5f 100644
--- a/plugingui/maintab.cc
+++ b/plugingui/maintab.cc
@@ -35,6 +35,7 @@ MainTab::MainTab(Widget* parent,
Config& config)
: Widget(parent)
, drumkitframe_content{this, settings, settings_notifier, config}
+ , statusframe_content{this, settings_notifier}
, 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 941932f..abb7e8d 100644
--- a/plugingui/maintab.h
+++ b/plugingui/maintab.h
@@ -62,7 +62,7 @@ private:
FrameWidget diskstreaming_frame{this, false};
DrumkitframeContent drumkitframe_content;
- StatusframeContent statusframe_content{this};
+ StatusframeContent statusframe_content;
HumanizerframeContent humanizerframe_content;
DiskstreamingframeContent diskstreamingframe_content;
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::
diff --git a/plugingui/statusframecontent.h b/plugingui/statusframecontent.h
index 020855c..0ca5bfe 100644
--- a/plugingui/statusframecontent.h
+++ b/plugingui/statusframecontent.h
@@ -26,22 +26,41 @@
*/
#pragma once
+#include "settings.h"
#include "textedit.h"
#include "widget.h"
+class SettingsNotifier;
+
namespace GUI
{
class StatusframeContent : public Widget
{
public:
- StatusframeContent(Widget* parent);
+ StatusframeContent(Widget* parent, SettingsNotifier& settings_notifier);
// From Widget
virtual void resize(std::size_t width, std::size_t height) override;
+ void updateContent();
+
+ void updateDrumkitLoadStatus(LoadStatus load_status);
+ void updateMidimapLoadStatus(LoadStatus load_status);
+ void updateSamplerate(double samplerate);
+ void updateResamplingEnabled(bool enable_resampling);
+ void updateNumberOfUnderruns(std::size_t number_of_underruns);
+
private:
TextEdit text_field{this};
+
+ SettingsNotifier& settings_notifier;
+
+ std::string drumkit_load_status;
+ std::string midimap_load_status;
+ std::string samplerate;
+ std::string resampling_enabled;
+ std::string number_of_underruns;
};
} // GUI::