From c15331fa4b98ba58b2b500c79088d43ed31a4b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Nusser?= Date: Thu, 20 Apr 2017 12:11:47 +0200 Subject: Remove diskstreaming frame switch and add "Unlimited" to slider. Also propagate this to the settings. Additionally, added two TODOs where to change the grayout state (which still has to be implemented) of the "Apply" button. --- plugingui/diskstreamingframecontent.cc | 25 +++++++++++++++++++++---- plugingui/maintab.h | 2 +- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/plugingui/diskstreamingframecontent.cc b/plugingui/diskstreamingframecontent.cc index 75666c2..35ab8d8 100644 --- a/plugingui/diskstreamingframecontent.cc +++ b/plugingui/diskstreamingframecontent.cc @@ -28,6 +28,8 @@ #include +#include + namespace GUI { @@ -83,19 +85,34 @@ void DiskstreamingframeContent::resize(std::size_t width, std::size_t height) void DiskstreamingframeContent::limitSettingsValueChanged(std::size_t value) { - int value_in_mb = value/(1024 * 1024); - label_size.setText(std::to_string(value_in_mb) + " MB"); - slider.setValue((float)value/max_limit); + float new_slider_value = (float)value/max_limit; + slider.setValue(new_slider_value); + + if (new_slider_value < 0.99) { + int value_in_mb = value/(1024 * 1024); + label_size.setText(std::to_string(value_in_mb) + " MB"); + } + else { + label_size.setText("Unlimited"); + } + + // TODO: un-grayout "Apply" button } void DiskstreamingframeContent::limitValueChanged(float value) { - settings.disk_cache_upper_limit.store(value * max_limit); + std::size_t new_limit = value < 0.99 ? + value * max_limit : + std::numeric_limits::max(); + + settings.disk_cache_upper_limit.store(new_limit); } void DiskstreamingframeContent::reloadClicked() { settings.reload_counter++; + + // TODO: grayout "Apply" button } diff --git a/plugingui/maintab.h b/plugingui/maintab.h index 4e1e1e2..941932f 100644 --- a/plugingui/maintab.h +++ b/plugingui/maintab.h @@ -59,7 +59,7 @@ private: FrameWidget drumkit_frame{this, false}; FrameWidget status_frame{this, false}; FrameWidget humanizer_frame{this, true}; - FrameWidget diskstreaming_frame{this, true}; + FrameWidget diskstreaming_frame{this, false}; DrumkitframeContent drumkitframe_content; StatusframeContent statusframe_content{this}; -- cgit v1.2.3