summaryrefslogtreecommitdiff
path: root/utils/rbutilqt/base/encttssettings.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/rbutilqt/base/encttssettings.h')
-rw-r--r--utils/rbutilqt/base/encttssettings.h128
1 files changed, 128 insertions, 0 deletions
diff --git a/utils/rbutilqt/base/encttssettings.h b/utils/rbutilqt/base/encttssettings.h
new file mode 100644
index 0000000000..1258d81d57
--- /dev/null
+++ b/utils/rbutilqt/base/encttssettings.h
@@ -0,0 +1,128 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2007 by Dominik Wenger
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20
21#ifndef ENCTTSSETTINGS_H
22#define ENCTTSSETTINGS_H
23
24#include <QtCore>
25
26//! \brief This class stores everything needed to display a Setting.
27//!
28class EncTtsSetting : public QObject
29{
30 Q_OBJECT
31public:
32 enum ESettingType
33 {
34 eBASE,
35 eBOOL,
36 eDOUBLE,
37 eINT,
38 eSTRING,
39 eREADONLYSTRING,
40 eSTRINGLIST,
41 };
42 enum EButton
43 {
44 eNOBTN,
45 eBROWSEBTN,
46 eREFRESHBTN
47 };
48
49 //! constructor for a String or Bool setting
50 EncTtsSetting(QObject* parent,ESettingType type,QString name,QVariant current,EButton btn = eNOBTN);
51 //! contructor for a Stringlist setting, ie a enumeration
52 EncTtsSetting(QObject* parent,ESettingType type,QString name,QVariant current,QStringList list,EButton btn = eNOBTN);
53 //! constructor for a setting with a min-max range
54 EncTtsSetting(QObject* parent,ESettingType type,QString name,QVariant current,QVariant min,QVariant max,EButton = eNOBTN);
55
56 //! get currentValue
57 QVariant current() {return m_currentValue;}
58 //! set currentValue
59 void setCurrent(QVariant current,bool noticeGui=true);
60
61 //! get name of the Setting
62 QString name() {return m_name;}
63 //! get the type of the setting
64 ESettingType type() {return m_type;}
65 //! get what type of button this setting needs
66 EButton button() {return m_btn;}
67 //! get the minValue (only valid for a range setting, ie eDOUBLE or eINT)
68 QVariant min() {return m_minValue; }
69 //! get the maxValue (only valid for a range setting, ie eDOUBLE or eINT)
70 QVariant max() {return m_maxValue; }
71 //! get the enumerationlist (only valid for eSTRINGLIST settings)
72 QStringList list() {return m_list;}
73 //! set the enumeration list
74 void setList(QStringList list){m_list = list;}
75
76signals:
77 //! connect to this signal if you want to get noticed when the data changes
78 void dataChanged();
79 //! connect to this if you want to react on refresh button
80 void refresh();
81 //! will be emited when the gui should update this setting
82 void updateGui();
83
84private:
85 ESettingType m_type;
86 EButton m_btn;
87 QString m_name;
88 QVariant m_currentValue;
89 QVariant m_minValue;
90 QVariant m_maxValue;
91 QStringList m_list;
92};
93
94
95//! \brief this class is the Interface for Encoder and TTS engines, to display settings
96//! It wraps nearly everything needed, only updateModel() and commitModel() needs to be reimplemented
97//!
98class EncTtsSettingInterface : public QObject
99{
100 Q_OBJECT
101public:
102 EncTtsSettingInterface(QObject* parent) : QObject(parent) {}
103
104 //! get the Settings list
105 QList<EncTtsSetting*> getSettings() {generateSettings(); return settingsList;}
106
107 //! Chlid class should commit the from SettingsList to permanent storage
108 virtual void saveSettings() = 0;
109
110signals:
111 void busy(); // emit this if a operation takes time
112 void busyEnd(); // emit this at the end of a busy section
113
114protected:
115 //! Child class should fill in the setttingsList
116 virtual void generateSettings() = 0;
117
118 //! insert a setting
119 void insertSetting(int id,EncTtsSetting* setting);
120 //! retrieve a specific setting
121 EncTtsSetting* getSetting(int id);
122
123private:
124 //! The setting storage.
125 QList<EncTtsSetting*> settingsList;
126
127};
128#endif