1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
9 * Copyright (C) 2007 by Dominik Wenger
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef ENCTTSSETTINGS_H
23 #define ENCTTSSETTINGS_H
27 //! \brief This class stores everything needed to display a Setting.
29 class EncTtsSetting
: public QObject
50 //! constructor for a String or Bool setting
51 EncTtsSetting(QObject
* parent
,ESettingType type
,QString name
,QVariant current
,EButton btn
= eNOBTN
);
52 //! contructor for a Stringlist setting, ie a enumeration
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
55 EncTtsSetting(QObject
* parent
,ESettingType type
,QString name
,QVariant current
,QVariant min
,QVariant max
,EButton
= eNOBTN
);
58 QVariant
current() {return m_currentValue
;}
60 void setCurrent(QVariant current
,bool noticeGui
=true);
62 //! get name of the Setting
63 QString
name() {return m_name
;}
64 //! get the type of the setting
65 ESettingType
type() {return m_type
;}
66 //! get what type of button this setting needs
67 EButton
button() {return m_btn
;}
68 //! get the minValue (only valid for a range setting, ie eDOUBLE or eINT)
69 QVariant
min() {return m_minValue
; }
70 //! get the maxValue (only valid for a range setting, ie eDOUBLE or eINT)
71 QVariant
max() {return m_maxValue
; }
72 //! get the enumerationlist (only valid for eSTRINGLIST settings)
73 QStringList
list() {return m_list
;}
74 //! set the enumeration list
75 void setList(QStringList list
){m_list
= list
;}
78 //! connect to this signal if you want to get noticed when the data changes
80 //! connect to this if you want to react on refresh button
82 //! will be emited when the gui should update this setting
89 QVariant m_currentValue
;
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
99 class EncTtsSettingInterface
: public QObject
103 EncTtsSettingInterface(QObject
* parent
) : QObject(parent
) {}
105 //! get the Settings list
106 QList
<EncTtsSetting
*> getSettings() {generateSettings(); return settingsList
;}
108 //! Chlid class should commit the from SettingsList to permanent storage
109 virtual void saveSettings() = 0;
112 void busy(); // emit this if a operation takes time
113 void busyEnd(); // emit this at the end of a busy section
116 //! Child class should fill in the setttingsList
117 virtual void generateSettings() = 0;
120 void insertSetting(int id
,EncTtsSetting
* setting
);
121 //! retrieve a specific setting
122 EncTtsSetting
* getSetting(int id
);
125 //! The setting storage.
126 QList
<EncTtsSetting
*> settingsList
;