1 /* -*- Mode: c++ -*- */
2 /***************************************************************************
3  *            diskstreamingframecontent.h
4  *
5  *  Fri Mar 24 21:50:07 CET 2017
6  *  Copyright 2017 André Nusser
7  *  andre.nusser@googlemail.com
8  ****************************************************************************/
9 
10 /*
11  *  This file is part of DrumGizmo.
12  *
13  *  DrumGizmo is free software; you can redistribute it and/or modify
14  *  it under the terms of the GNU Lesser General Public License as published by
15  *  the Free Software Foundation; either version 3 of the License, or
16  *  (at your option) any later version.
17  *
18  *  DrumGizmo is distributed in the hope that it will be useful,
19  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  *  GNU Lesser General Public License for more details.
22  *
23  *  You should have received a copy of the GNU Lesser General Public License
24  *  along with DrumGizmo; if not, write to the Free Software
25  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
26  */
27 #pragma once
28 
29 #include "button.h"
30 #include "label.h"
31 #include "slider.h"
32 #include "widget.h"
33 
34 struct Settings;
35 class SettingsNotifier;
36 
37 namespace GUI
38 {
39 
40 class DiskstreamingframeContent : public Widget
41 {
42 public:
43 	DiskstreamingframeContent(Widget* parent,
44 	                          Settings& settings,
45 	                          SettingsNotifier& settings_notifier);
46 
47 	// From Widget
48 	virtual void resize(std::size_t width, std::size_t height) override;
49 
50 private:
51 	void limitSettingsValueChanged(std::size_t value);
52 	void limitValueChanged(float value);
53 	void reloadClicked();
54 	void reloaded(std::size_t);
55 
56 	// For now the maximum disk streaming limit is 4GB
57 	static constexpr std::size_t min_limit = 1024.0 * 1024.0 * 32;
58 	static constexpr std::size_t max_limit = 1024.0 * 1024.0 * 1024.0 * 4.0 - 1;
59 
60 	Label label_text{this};
61 	Label label_value{this};
62 
63 	Slider slider{this};
64 	Button button{this};
65 
66 	int slider_width;
67 	int button_width;
68 
69 	Settings& settings;
70 	SettingsNotifier& settings_notifier;
71 };
72 
73 } // GUI::
74