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