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