summaryrefslogtreecommitdiff
path: root/plugingui/diskstreamingframecontent.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-04-17 17:44:05 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2017-04-17 17:44:05 +0200
commitcce58a93617507a4f2e6927de4445e30b7b46617 (patch)
tree5b6fb81171028d46c3a147275a74226444133809 /plugingui/diskstreamingframecontent.cc
parent5186102ef5f44b72f655528a45df9f0fa5c49545 (diff)
Connected streaming controls.
Diffstat (limited to 'plugingui/diskstreamingframecontent.cc')
-rw-r--r--plugingui/diskstreamingframecontent.cc47
1 files changed, 44 insertions, 3 deletions
diff --git a/plugingui/diskstreamingframecontent.cc b/plugingui/diskstreamingframecontent.cc
index bb4cfc3..53e2c9d 100644
--- a/plugingui/diskstreamingframecontent.cc
+++ b/plugingui/diskstreamingframecontent.cc
@@ -26,19 +26,41 @@
*/
#include "diskstreamingframecontent.h"
+#include <settings.h>
+
namespace GUI
{
-DiskstreamingframeContent::DiskstreamingframeContent(Widget* parent)
- : Widget(parent), slider_width{250}
+DiskstreamingframeContent::DiskstreamingframeContent(Widget* parent,
+ Settings& settings,
+ SettingsNotifier& settings_notifier)
+ : Widget(parent)
+ , slider_width{250}
+ , settings(settings)
+ , settings_notifier(settings_notifier)
{
label_text.setText("Cache limit (max memory usage):");
label_text.setAlignment(TextAlignment::center);
button.setText("Apply"); // TODO connect
- label_size.setText("600 MB"); // TODO connect
+ label_size.setText("0 MB");
label_size.setAlignment(TextAlignment::center);
+
+ CONNECT(this, settings_notifier.disk_cache_upper_limit,
+ this, &DiskstreamingframeContent::limitSettingsValueChanged);
+
+ CONNECT(&slider, valueChangedNotifier,
+ this, &DiskstreamingframeContent::limitValueChanged);
+
+ CONNECT(&button, clickNotifier,
+ this, &DiskstreamingframeContent::reloadClicked);
+
+ // TODO:
+ // CONNECT(this, settings_notifier.disk_cache_chunk_size,
+ // this, &DGWindow::chunkSettingsValueChanged);
+ // CONNECT(this, settings_notifier.number_of_underruns,
+ // this, &DGWindow::underrunsChanged);
}
void DiskstreamingframeContent::resize(std::size_t width, std::size_t height)
@@ -59,4 +81,23 @@ void DiskstreamingframeContent::resize(std::size_t width, std::size_t height)
label_size.resize(slider_width, 15);
}
+void DiskstreamingframeContent::limitSettingsValueChanged(float value)
+{
+ char buf[32];
+ snprintf(buf, sizeof(buf) - 1, "%.2f MB", value / (1024 * 1024));
+ label_size.setText(buf);
+ slider.setValue(value);
+}
+
+void DiskstreamingframeContent::limitValueChanged(float value)
+{
+ settings.disk_cache_upper_limit.store(value);
+}
+
+void DiskstreamingframeContent::reloadClicked()
+{
+ settings.reload_counter++;
+}
+
+
} // GUI::