diff options
author | André Nusser <andre.nusser@googlemail.com> | 2017-04-20 12:11:47 +0200 |
---|---|---|
committer | André Nusser <andre.nusser@googlemail.com> | 2017-04-20 12:11:47 +0200 |
commit | c15331fa4b98ba58b2b500c79088d43ed31a4b4e (patch) | |
tree | 6a97287e48f2d5e756329d73533142cb9e01a088 /plugingui/diskstreamingframecontent.cc | |
parent | 00006863cb9b7438c1259bda9ab0772afe3f39d0 (diff) |
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.
Diffstat (limited to 'plugingui/diskstreamingframecontent.cc')
-rw-r--r-- | plugingui/diskstreamingframecontent.cc | 25 |
1 files changed, 21 insertions, 4 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 } |