MPEGPlayer: Skip to next file when there is a problem with a video file in all-play...
[kugel-rb.git] / rbutil / rbutilqt / base / encttssettings.h
blobea563412f02633c46c447cb80ec2fa1d11e22693
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id$
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
25 #include <QtCore>
27 //! \brief This class stores everything needed to display a Setting.
28 //!
29 class EncTtsSetting : public QObject
31 Q_OBJECT
32 public:
33 enum ESettingType
35 eBASE,
36 eBOOL,
37 eDOUBLE,
38 eINT,
39 eSTRING,
40 eREADONLYSTRING,
41 eSTRINGLIST,
43 enum EButton
45 eNOBTN,
46 eBROWSEBTN,
47 eREFRESHBTN
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);
57 //! get currentValue
58 QVariant current() {return m_currentValue;}
59 //! set 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;}
77 signals:
78 //! connect to this signal if you want to get noticed when the data changes
79 void dataChanged();
80 //! connect to this if you want to react on refresh button
81 void refresh();
82 //! will be emited when the gui should update this setting
83 void updateGui();
85 private:
86 ESettingType m_type;
87 EButton m_btn;
88 QString m_name;
89 QVariant m_currentValue;
90 QVariant m_minValue;
91 QVariant m_maxValue;
92 QStringList m_list;
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
98 //!
99 class EncTtsSettingInterface : public QObject
101 Q_OBJECT
102 public:
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;
111 signals:
112 void busy(); // emit this if a operation takes time
113 void busyEnd(); // emit this at the end of a busy section
115 protected:
116 //! Child class should fill in the setttingsList
117 virtual void generateSettings() = 0;
119 //! insert a setting
120 void insertSetting(int id,EncTtsSetting* setting);
121 //! retrieve a specific setting
122 EncTtsSetting* getSetting(int id);
124 private:
125 //! The setting storage.
126 QList<EncTtsSetting*> settingsList;
129 #endif