diff options
-rw-r--r-- | plugingui/diskstreamingframecontent.cc | 25 | ||||
-rw-r--r-- | 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 <settings.h> +#include <limits> + 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<std::size_t>::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}; |