MythTV  0.26-pre
settings.h
Go to the documentation of this file.
00001 // -*- Mode: c++ -*-
00002 
00003 #ifndef SETTINGS_H
00004 #define SETTINGS_H
00005 
00006 // C++ headers
00007 #include <vector>
00008 using namespace std;
00009 
00010 // Qt headers
00011 #include <QObject>
00012 
00013 // MythTV headers
00014 #include "mythexp.h"
00015 #include "mythwidgets.h"
00016 #include "mythdialogs.h"
00017 #include "mythdbcon.h"
00018 #include "mythstorage.h"
00019 
00020 class QWidget;
00021 class ConfigurationGroup;
00022 class QDir;
00023 class Setting;
00024 
00025 class MPUBLIC Configurable : public QObject
00026 {
00027     Q_OBJECT
00028 
00029   public:
00037     virtual QWidget *configWidget(ConfigurationGroup *cg, QWidget *parent,
00038                                   const char *widgetName = NULL);
00045     virtual void widgetInvalid(QObject*) { }
00046 
00047     // A name for looking up the setting
00048     void setName(const QString &str)
00049     {
00050         configName = str;
00051         if (label.isEmpty())
00052             setLabel(str);
00053     }
00054     QString getName(void) const { return configName; }
00055     virtual Setting *byName(const QString &name) = 0;
00056 
00057     // A label displayed to the user
00058     virtual void setLabel(QString str) { label = str; }
00059     QString getLabel(void) const { return label; }
00060     void setLabelAboveWidget(bool l = true) { labelAboveWidget = l; }
00061 
00062     virtual void setHelpText(const QString &str)
00063         { helptext = str; }
00064     QString getHelpText(void) const { return helptext; }
00065 
00066     void setVisible(bool b) { visible = b; };
00067     bool isVisible(void) const { return visible; };
00068 
00069     virtual void setEnabled(bool b) { enabled = b; }
00070     bool isEnabled() { return enabled; }
00071 
00072     Storage *GetStorage(void) { return storage; }
00073 
00074   public slots:
00075     virtual void enableOnSet(const QString &val);
00076     virtual void enableOnUnset(const QString &val);
00077     virtual void widgetDeleted(QObject *obj);
00078 
00079   protected:
00080     Configurable(Storage *_storage) :
00081         labelAboveWidget(false), enabled(true), storage(_storage),
00082         configName(""), label(""), helptext(""), visible(true) { }
00083     virtual ~Configurable() { }
00084 
00085   protected:
00086     bool labelAboveWidget;
00087     bool enabled;
00088     Storage *storage;
00089     QString configName;
00090     QString label;
00091     QString helptext;
00092     bool visible;
00093 };
00094 
00095 class MPUBLIC Setting : public Configurable, public StorageUser
00096 {
00097     Q_OBJECT
00098 
00099   public:
00100     // Gets
00101     virtual QString getValue(void) const;
00102 
00103     // non-const Gets
00104     virtual Setting *byName(const QString &name)
00105         { return (name == configName) ? this : NULL; }
00106 
00107     // StorageUser
00108     void SetDBValue(const QString &val) { setValue(val); }
00109     QString GetDBValue(void) const { return getValue(); }
00110   public slots:
00111     virtual void setValue(const QString &newValue);
00112 
00113   signals:
00114     void valueChanged(const QString&);
00115 
00116   protected:
00117     Setting(Storage *_storage) : Configurable(_storage) {};
00118     virtual ~Setting() {};
00119 
00120   protected:
00121     QString settingValue;
00122 };
00123 
00125 
00126 // Read-only display of a setting
00127 class MPUBLIC LabelSetting : public Setting
00128 {
00129   protected:
00130     LabelSetting(Storage *_storage) : Setting(_storage) { }
00131   public:
00132     virtual QWidget *configWidget(ConfigurationGroup *cg, QWidget *parent,
00133                                   const char *widgetName = NULL);
00134 };
00135 
00136 class MPUBLIC LineEditSetting : public Setting
00137 {
00138   protected:
00139     LineEditSetting(Storage *_storage, bool readwrite = true) :
00140         Setting(_storage), bxwidget(NULL), edit(NULL),
00141         rw(readwrite), password_echo(false) { }
00142 
00143   public:
00144     virtual QWidget *configWidget(ConfigurationGroup *cg, QWidget *parent,
00145                                   const char *widgetName = NULL);
00146     virtual void widgetInvalid(QObject *obj);
00147 
00148     void setRW(bool readwrite = true)
00149     {
00150         rw = readwrite;
00151         if (edit)
00152             edit->setRW(rw);
00153     }
00154 
00155     void setRO(void) { setRW(false); }
00156 
00157     virtual void setEnabled(bool b);
00158     virtual void setVisible(bool b);
00159     virtual void SetPasswordEcho(bool b);
00160 
00161     virtual void setHelpText(const QString &str);
00162 
00163   private:
00164     QWidget      *bxwidget;
00165     MythLineEdit *edit;
00166     bool rw;
00167     bool password_echo;
00168 };
00169 
00170 // TODO: set things up so that setting the value as a string emits
00171 // the int signal also
00172 class MPUBLIC IntegerSetting : public Setting
00173 {
00174     Q_OBJECT
00175 
00176   protected:
00177     IntegerSetting(Storage *_storage) : Setting(_storage) { }
00178 
00179   public:
00180     int intValue(void) const { return settingValue.toInt(); }
00181 
00182   public slots:
00183     virtual void setValue(int newValue)
00184     {
00185         Setting::setValue(QString::number(newValue));
00186         emit valueChanged(newValue);
00187     }
00188     virtual void setValue(const QString &nv) { setValue(nv.toInt()); }
00189 
00190   signals:
00191     void valueChanged(int newValue);
00192 };
00193 
00194 class MPUBLIC BoundedIntegerSetting : public IntegerSetting
00195 {
00196   protected:
00197     BoundedIntegerSetting(Storage *_storage, int _min, int _max, int _step) :
00198         IntegerSetting(_storage), min(_min), max(_max), step(_step) { }
00199 
00200   public:
00201     virtual void setValue(int newValue);
00202     virtual void setValue(const QString &nv) { setValue(nv.toInt()); }
00203 
00204   protected:
00205     int min;
00206     int max;
00207     int step;
00208 };
00209 
00210 class MPUBLIC SliderSetting: public BoundedIntegerSetting
00211 {
00212     Q_OBJECT
00213 
00214   protected:
00215     SliderSetting(Storage *_storage, int min, int max, int step) :
00216         BoundedIntegerSetting(_storage, min, max, step) { }
00217   public:
00218     virtual QWidget *configWidget(ConfigurationGroup *cg, QWidget *parent,
00219                                   const char *widgetName = NULL);
00220 };
00221 
00222 class MPUBLIC SpinBoxSetting: public BoundedIntegerSetting
00223 {
00224     Q_OBJECT
00225 
00226   public:
00227     SpinBoxSetting(Storage *_storage, int min, int max, int step,
00228                    bool allow_single_step = false,
00229                    QString special_value_text = "");
00230 
00231     virtual QWidget *configWidget(ConfigurationGroup *cg, QWidget *parent,
00232                                   const char *widgetName = NULL);
00233     virtual void widgetInvalid(QObject *obj);
00234 
00235     void setFocus(void);
00236     void clearFocus(void);
00237     bool hasFocus(void) const;
00238 
00239     void SetRelayEnabled(bool enabled) { relayEnabled = enabled; }
00240     bool IsRelayEnabled(void) const { return relayEnabled; }
00241 
00242     virtual void setHelpText(const QString &str);
00243 
00244   public slots:
00245     virtual void setValue(int newValue);
00246     virtual void setValue(const QString &nv) { setValue(nv.toInt()); }
00247 
00248   signals:
00249     void valueChanged(const QString &name, int newValue);
00250 
00251   private slots:
00252     void relayValueChanged(int newValue);
00253 
00254   private:
00255     QWidget     *bxwidget;
00256     MythSpinBox *spinbox;
00257     bool         relayEnabled;
00258     bool         sstep;
00259     QString      svtext;
00260 };
00261 
00262 class MPUBLIC SelectSetting : public Setting
00263 {
00264     Q_OBJECT
00265 
00266   protected:
00267     SelectSetting(Storage *_storage) :
00268         Setting(_storage), current(0), isSet(false) { }
00269 
00270   public:
00271     virtual int  findSelection(  const QString &label,
00272                                  QString        value  = QString::null) const;
00273     virtual void addSelection(   const QString &label,
00274                                  QString        value  = QString::null,
00275                                  bool           select = false);
00276     virtual bool removeSelection(const QString &label,
00277                                  QString        value  = QString::null);
00278 
00279     virtual void clearSelections(void);
00280 
00281     virtual void fillSelectionsFromDir(const QDir &dir, bool absPath=true);
00282 
00283     virtual uint size(void) const { return labels.size(); }
00284 
00285     virtual QString GetLabel(uint i) const
00286         { return (i < labels.size()) ? labels[i] : QString::null; }
00287     virtual QString GetValue(uint i) const
00288         { return (i < values.size()) ? values[i] : QString::null; }
00289 
00290   signals:
00291     void selectionAdded(const QString &label, QString value);
00292     void selectionRemoved(const QString &label, const QString &value);
00293     void selectionsCleared(void);
00294 
00295   public slots:
00296     virtual void setValue(const QString &newValue);
00297     virtual void setValue(int which);
00298 
00299     virtual QString getSelectionLabel(void) const;
00300     virtual int getValueIndex(QString value);
00301 
00302   protected:
00303     virtual bool ReplaceLabel(
00304         const QString &new_label, const QString &value);
00305 
00306     typedef vector<QString> selectionList;
00307     selectionList labels;
00308     selectionList values;
00309     unsigned current;
00310     bool isSet;
00311 };
00312 
00313 class MPUBLIC SelectLabelSetting : public SelectSetting
00314 {
00315   protected:
00316     SelectLabelSetting(Storage *_storage) : SelectSetting(_storage) { }
00317 
00318   public:
00319     virtual QWidget *configWidget(ConfigurationGroup *cg, QWidget *parent,
00320                                   const char *widgetName = NULL);
00321 };
00322 
00323 class MPUBLIC ComboBoxSetting: public SelectSetting
00324 {
00325     Q_OBJECT
00326 
00327   protected:
00328     ComboBoxSetting(Storage *_storage, bool _rw = false, int _step = 1) :
00329         SelectSetting(_storage), rw(_rw),
00330         bxwidget(NULL), cbwidget(NULL), step(_step) { }
00331 
00332   public:
00333     virtual QWidget *configWidget(ConfigurationGroup *cg, QWidget *parent,
00334                                   const char *widgetName = NULL);
00335     virtual void widgetInvalid(QObject *obj);
00336 
00337     void setFocus(void) { if (cbwidget) cbwidget->setFocus(); }
00338     void resetMaxCount(int count)
00339         { if (cbwidget) cbwidget->setMaxCount(count + rw); }
00340 
00341     virtual void setEnabled(bool b);
00342     virtual void setVisible(bool b);
00343 
00344     virtual void setHelpText(const QString &str);
00345 
00346   public slots:
00347     virtual void setValue(const QString &newValue);
00348     virtual void setValue(int which);
00349 
00350     void addSelection(const QString &label,
00351                       QString value = QString::null,
00352                       bool select = false);
00353     bool removeSelection(const QString &label,
00354                          QString value = QString::null);
00355     void editTextChanged(const QString &newText);
00356 
00357   private:
00358     bool rw;
00359     QWidget      *bxwidget;
00360     MythComboBox *cbwidget;
00361 
00362   protected:
00363     int step;
00364 };
00365 
00366 class MPUBLIC ListBoxSetting: public SelectSetting
00367 {
00368     Q_OBJECT
00369 
00370   public:
00371     ListBoxSetting(Storage *_storage) :
00372         SelectSetting(_storage),
00373         bxwidget(NULL), lbwidget(NULL), eventFilter(NULL),
00374         selectionMode(MythListBox::SingleSelection) { }
00375 
00376     virtual QWidget *configWidget(ConfigurationGroup *cg, QWidget *parent,
00377                                   const char *widgetName = NULL);
00378     virtual void widgetInvalid(QObject *obj);
00379 
00380     void setFocus(void)
00381         { if (lbwidget) lbwidget->setFocus(); }
00382     void setSelectionMode(MythListBox::SelectionMode mode);
00383     void setCurrentItem(int i)
00384         { if (lbwidget) lbwidget->setCurrentRow(i); }
00385     void setCurrentItem(const QString &str)
00386         { if (lbwidget) lbwidget->setCurrentItem(str, true, false); }
00387     int currentItem(void)
00388         { return (lbwidget) ? lbwidget->currentRow() : -1; }
00389 
00390     virtual void setEnabled(bool b);
00391 
00392     virtual void clearSelections(void);
00393 
00394     virtual void setHelpText(const QString &str);
00395 
00396     virtual void SetEventFilter(QObject *filter) { eventFilter = filter; }
00397     virtual bool ReplaceLabel(
00398         const QString &new_label, const QString &value);
00399 
00400   signals:
00401     void accepted(int);
00402     void menuButtonPressed(int);
00403     void editButtonPressed(int);
00404     void deleteButtonPressed(int);
00405 
00406   public slots:
00407     void addSelection(const QString &label,
00408                       QString        value  = QString::null,
00409                       bool           select = false);
00410 
00411     void setValueByIndex(int index);
00412 
00413   protected:
00414     QWidget     *bxwidget;
00415     MythListBox *lbwidget;
00416     QObject     *eventFilter;
00417     MythListBox::SelectionMode selectionMode;
00418 };
00419 
00420 class MPUBLIC BooleanSetting : public Setting
00421 {
00422     Q_OBJECT
00423 
00424   public:
00425     BooleanSetting(Storage *_storage) : Setting(_storage) {}
00426 
00427     bool boolValue(void) const { return getValue().toInt(); }
00428 
00429   public slots:
00430     virtual void setValue(bool check)
00431     {
00432         if (check)
00433             Setting::setValue("1");
00434         else
00435             Setting::setValue("0");
00436         emit valueChanged(check);
00437     };
00438 
00439     virtual void setValue(const QString &newValue)
00440     {
00441         setValue((newValue=="1" ||
00442                   newValue.toLower().left(1)=="y" ||
00443                   newValue.toLower().left(1)=="t"));
00444     }
00445 
00446   signals:
00447     void valueChanged(bool);
00448 };
00449 
00450 class MPUBLIC CheckBoxSetting: public BooleanSetting
00451 {
00452     Q_OBJECT
00453 
00454   public:
00455     CheckBoxSetting(Storage *_storage) :
00456         BooleanSetting(_storage), widget(NULL) { }
00457 
00458     virtual QWidget *configWidget(ConfigurationGroup *cg, QWidget *parent,
00459                                   const char *widgetName = NULL);
00460 
00461     virtual void widgetInvalid(QObject*);
00462 
00463     virtual void setVisible(bool b);
00464     virtual void setLabel(QString str);
00465     virtual void setEnabled(bool b);
00466 
00467     virtual void setHelpText(const QString &str);
00468 
00469   protected:
00470     MythCheckBox *widget;
00471 };
00472 
00473 class MPUBLIC PathSetting : public ComboBoxSetting
00474 {
00475     Q_OBJECT
00476 
00477   public:
00478     PathSetting(Storage *_storage, bool _mustexist):
00479         ComboBoxSetting(_storage, true), mustexist(_mustexist) { }
00480 
00481     // TODO: this should support globbing of some sort
00482     virtual void addSelection(const QString &label,
00483                               QString value=QString::null,
00484                               bool select=false);
00485 
00486     // Use a combobox for now, maybe a modified file dialog later
00487     //virtual QWidget *configWidget(ConfigurationGroup *cg, QWidget *parent,
00488     //                              const char *widgetName = NULL);
00489 
00490   protected:
00491     bool mustexist;
00492 };
00493 
00494 class MPUBLIC HostnameSetting : public Setting
00495 {
00496     Q_OBJECT
00497   public:
00498     HostnameSetting(Storage *_storage);
00499 };
00500 
00501 class MPUBLIC ChannelSetting : public SelectSetting
00502 {
00503     Q_OBJECT
00504   public:
00505     ChannelSetting(Storage *_storage) : SelectSetting(_storage)
00506     {
00507         setLabel("Channel");
00508     };
00509 
00510     static void fillSelections(SelectSetting *setting);
00511     virtual void fillSelections(void) { fillSelections(this); }
00512 };
00513 
00514 class QDate;
00515 class MPUBLIC DateSetting : public Setting
00516 {
00517     Q_OBJECT
00518 
00519   public:
00520     DateSetting(Storage *_storage) : Setting(_storage) { }
00521 
00522     QString getValue(void) const;
00523 
00524     QDate dateValue(void) const;
00525 
00526   public slots:
00527     void setValue(const QDate &newValue);
00528     void setValue(const QString &newValue);
00529 };
00530 
00531 class QTime;
00532 class MPUBLIC TimeSetting : public Setting
00533 {
00534     Q_OBJECT
00535 
00536   public:
00537     TimeSetting(Storage *_storage) : Setting(_storage) { }
00538     QTime timeValue(void) const;
00539 
00540   public slots:
00541     void setValue(const QTime &newValue);
00542     void setValue(const QString &newValue);
00543 };
00544 
00545 class MPUBLIC AutoIncrementDBSetting :
00546     public IntegerSetting, public DBStorage
00547 {
00548     Q_OBJECT
00549 
00550   public:
00551     AutoIncrementDBSetting(QString _table, QString _column) :
00552         IntegerSetting(this), DBStorage(this, _table, _column)
00553     {
00554         setValue(0);
00555     }
00556 
00557     virtual void Load(void) { }
00558     virtual void Save(void);
00559     virtual void Save(QString destination);
00560 };
00561 
00562 class MPUBLIC ButtonSetting: public Setting
00563 {
00564     Q_OBJECT
00565 
00566   public:
00567     ButtonSetting(Storage *_storage, QString _name = "button") :
00568         Setting(_storage), name(_name), button(NULL) { }
00569 
00570     virtual QWidget *configWidget(ConfigurationGroup *cg, QWidget *parent,
00571                                   const char *widgetName=0);
00572     virtual void widgetInvalid(QObject *obj);
00573 
00574     virtual void setEnabled(bool b);
00575 
00576     virtual void setLabel(QString);
00577 
00578     virtual void setHelpText(const QString &);
00579 
00580   signals:
00581     void pressed(void);
00582     void pressed(QString name);
00583 
00584   protected slots:
00585     void SendPressedString();
00586 
00587   protected:
00588     QString name;
00589     MythPushButton *button;
00590 };
00591 
00592 class MPUBLIC ProgressSetting : public IntegerSetting
00593 {
00594     Q_OBJECT
00595   public:
00596     ProgressSetting(Storage *_storage, int _totalSteps) :
00597         IntegerSetting(_storage), totalSteps(_totalSteps) { }
00598 
00599     QWidget *configWidget(ConfigurationGroup *cg, QWidget *parent,
00600                           const char *widgetName = NULL);
00601 
00602   private:
00603     int totalSteps;
00604 };
00605 
00607 
00608 class MPUBLIC TransButtonSetting :
00609     public ButtonSetting, public TransientStorage
00610 {
00611     Q_OBJECT
00612   public:
00613     TransButtonSetting(QString name = "button") :
00614         ButtonSetting(this, name), TransientStorage() { }
00615 };
00616 
00617 class MPUBLIC TransLabelSetting :
00618     public LabelSetting, public TransientStorage
00619 {
00620     Q_OBJECT
00621   public:
00622     TransLabelSetting() : LabelSetting(this), TransientStorage() { }
00623 };
00624 
00625 class MPUBLIC TransLineEditSetting :
00626     public LineEditSetting, public TransientStorage
00627 {
00628     Q_OBJECT
00629   public:
00630     TransLineEditSetting(bool rw = true) :
00631         LineEditSetting(this, rw), TransientStorage() { }
00632 };
00633 
00634 class MPUBLIC TransCheckBoxSetting :
00635     public CheckBoxSetting, public TransientStorage
00636 {
00637     Q_OBJECT
00638   public:
00639     TransCheckBoxSetting() : CheckBoxSetting(this), TransientStorage() { }
00640 };
00641 
00642 class MPUBLIC TransComboBoxSetting :
00643     public ComboBoxSetting, public TransientStorage
00644 {
00645     Q_OBJECT
00646   public:
00647     TransComboBoxSetting(bool rw = false, int _step = 1) :
00648         ComboBoxSetting(this, rw, _step), TransientStorage() { }
00649 };
00650 
00651 class MPUBLIC TransSpinBoxSetting :
00652     public SpinBoxSetting, public TransientStorage
00653 {
00654     Q_OBJECT
00655   public:
00656     TransSpinBoxSetting(int minv, int maxv, int step,
00657                         bool allow_single_step = false,
00658                         QString special_value_text = "") :
00659         SpinBoxSetting(this, minv, maxv, step,
00660                        allow_single_step, special_value_text) { }
00661 };
00662 
00663 class MPUBLIC TransListBoxSetting :
00664     public ListBoxSetting, public TransientStorage
00665 {
00666     Q_OBJECT
00667   public:
00668     TransListBoxSetting() : ListBoxSetting(this), TransientStorage() { }
00669 };
00670 
00671 
00673 
00674 class MPUBLIC HostSlider : public SliderSetting, public HostDBStorage
00675 {
00676     Q_OBJECT
00677   public:
00678     HostSlider(const QString &name, int min, int max, int step) :
00679         SliderSetting(this, min, max, step),
00680         HostDBStorage(this, name) { }
00681 };
00682 
00683 class MPUBLIC HostSpinBox: public SpinBoxSetting, public HostDBStorage
00684 {
00685     Q_OBJECT
00686   public:
00687     HostSpinBox(const QString &name, int min, int max, int step,
00688                 bool allow_single_step = false) :
00689         SpinBoxSetting(this, min, max, step, allow_single_step),
00690         HostDBStorage(this, name) { }
00691 };
00692 
00693 class MPUBLIC HostCheckBox : public CheckBoxSetting, public HostDBStorage
00694 {
00695     Q_OBJECT
00696   public:
00697     HostCheckBox(const QString &name) :
00698         CheckBoxSetting(this), HostDBStorage(this, name) { }
00699     virtual ~HostCheckBox() { ; }
00700 };
00701 
00702 class MPUBLIC HostComboBox : public ComboBoxSetting, public HostDBStorage
00703 {
00704     Q_OBJECT
00705   public:
00706     HostComboBox(const QString &name, bool rw = false) :
00707         ComboBoxSetting(this, rw), HostDBStorage(this, name) { }
00708     virtual ~HostComboBox() { ; }
00709 };
00710 
00711 class MPUBLIC HostRefreshRateComboBox : public HostComboBox
00712 {
00713     Q_OBJECT
00714   public:
00715     HostRefreshRateComboBox(const QString &name, bool rw = false) :
00716         HostComboBox(name, rw) { }
00717     virtual ~HostRefreshRateComboBox() { ; }
00718 
00719   public slots:
00720     virtual void ChangeResolution(const QString &resolution);
00721 
00722   private:
00723     static const vector<double> GetRefreshRates(const QString &resolution);
00724 };
00725 
00726 class MPUBLIC HostTimeBox : public ComboBoxSetting, public HostDBStorage
00727 {
00728     Q_OBJECT
00729   public:
00730     HostTimeBox(const QString &name, const QString &defaultTime = "00:00",
00731                 const int interval = 1) :
00732         ComboBoxSetting(this, false, 30 / interval),
00733         HostDBStorage(this, name)
00734     {
00735         int hour;
00736         int minute;
00737         QString timeStr;
00738 
00739         for (hour = 0; hour < 24; hour++)
00740         {
00741             for (minute = 0; minute < 60; minute += interval)
00742             {
00743                 timeStr = timeStr.sprintf("%02d:%02d", hour, minute);
00744                 addSelection(timeStr, timeStr,
00745                              timeStr == defaultTime);
00746             }
00747         }
00748     }
00749 };
00750 
00751 class MPUBLIC HostLineEdit: public LineEditSetting, public HostDBStorage
00752 {
00753     Q_OBJECT
00754   public:
00755     HostLineEdit(const QString &name, bool rw = true) :
00756         LineEditSetting(this, rw), HostDBStorage(this, name) { }
00757 };
00758 
00760 
00761 class MPUBLIC GlobalSlider : public SliderSetting, public GlobalDBStorage
00762 {
00763     Q_OBJECT
00764   public:
00765     GlobalSlider(const QString &name, int min, int max, int step) :
00766         SliderSetting(this, min, max, step), GlobalDBStorage(this, name) { }
00767 };
00768 
00769 class MPUBLIC GlobalSpinBox : public SpinBoxSetting, public GlobalDBStorage
00770 {
00771     Q_OBJECT
00772   public:
00773     GlobalSpinBox(const QString &name, int min, int max, int step,
00774                   bool allow_single_step = false) :
00775         SpinBoxSetting(this, min, max, step, allow_single_step),
00776         GlobalDBStorage(this, name) { }
00777 };
00778 
00779 class MPUBLIC GlobalCheckBox : public CheckBoxSetting, public GlobalDBStorage
00780 {
00781     Q_OBJECT
00782   public:
00783     GlobalCheckBox(const QString &name) :
00784         CheckBoxSetting(this), GlobalDBStorage(this, name) { }
00785 };
00786 
00787 class MPUBLIC GlobalComboBox : public ComboBoxSetting, public GlobalDBStorage
00788 {
00789     Q_OBJECT
00790   public:
00791     GlobalComboBox(const QString &name, bool rw = false) :
00792         ComboBoxSetting(this, rw), GlobalDBStorage(this, name) { }
00793 };
00794 
00795 class MPUBLIC GlobalLineEdit : public LineEditSetting, public GlobalDBStorage
00796 {
00797     Q_OBJECT
00798   public:
00799     GlobalLineEdit(const QString &name, bool rw = true) :
00800         LineEditSetting(this, rw), GlobalDBStorage(this, name) { }
00801 };
00802 
00803 class MPUBLIC GlobalTimeBox : public ComboBoxSetting, public GlobalDBStorage
00804 {
00805     Q_OBJECT
00806   public:
00807     GlobalTimeBox(const QString &name, const QString &defaultTime = "00:00",
00808                   const int interval = 1) :
00809         ComboBoxSetting(this, false, 30 / interval),
00810         GlobalDBStorage(this, name)
00811     {
00812         int hour;
00813         int minute;
00814         QString timeStr;
00815 
00816         for (hour = 0; hour < 24; hour++)
00817         {
00818             for (minute = 0; minute < 60; minute += interval)
00819             {
00820                 timeStr = timeStr.sprintf("%02d:%02d", hour, minute);
00821                 addSelection(timeStr, timeStr,
00822                              timeStr == defaultTime);
00823             }
00824         }
00825     }
00826 };
00827 
00828 #ifndef MYTHCONFIG
00829 #include "mythconfigdialogs.h"
00830 #include "mythconfiggroups.h"
00831 #endif // MYTHCONFIG
00832 
00833 #endif // SETTINGS_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends