From af01e8e8031bc9c0c29cc3afe17a63fded5dbeeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Nusser?= Date: Fri, 21 Apr 2017 09:16:02 +0200 Subject: Add minimum memory value to the diskstreaming slider. --- plugingui/diskstreamingframecontent.cc | 4 ++-- plugingui/diskstreamingframecontent.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/plugingui/diskstreamingframecontent.cc b/plugingui/diskstreamingframecontent.cc index e423538..87e8b8b 100644 --- a/plugingui/diskstreamingframecontent.cc +++ b/plugingui/diskstreamingframecontent.cc @@ -90,7 +90,7 @@ void DiskstreamingframeContent::resize(std::size_t width, std::size_t height) void DiskstreamingframeContent::limitSettingsValueChanged(std::size_t value) { - float new_slider_value = (float)value/max_limit; + float new_slider_value = (float)(value - min_limit)/(max_limit - min_limit); slider.setValue(new_slider_value); if (new_slider_value < 0.99) { @@ -109,7 +109,7 @@ void DiskstreamingframeContent::limitSettingsValueChanged(std::size_t value) void DiskstreamingframeContent::limitValueChanged(float value) { std::size_t new_limit = value < 0.99 ? - value * max_limit : + value * (max_limit - min_limit) + min_limit : std::numeric_limits::max(); settings.disk_cache_upper_limit.store(new_limit); diff --git a/plugingui/diskstreamingframecontent.h b/plugingui/diskstreamingframecontent.h index 7b17408..bc26806 100644 --- a/plugingui/diskstreamingframecontent.h +++ b/plugingui/diskstreamingframecontent.h @@ -53,6 +53,7 @@ private: void reloadClicked(); // For now the maximum disk streaming limit is 4GB + static constexpr std::size_t min_limit = 1024.0 * 1024.0 * 32; static constexpr std::size_t max_limit = 1024.0 * 1024.0 * 1024.0 * 4.0 - 1; Label label_text{this}; -- cgit v1.2.3