MythTV  master
rawsettingseditor.h
Go to the documentation of this file.
1 #ifndef RAW_SETTINGS_EDITOR_H_
2 #define RAW_SETTINGS_EDITOR_H_
3 
4 #include <QEvent>
5 #include <QHash>
6 #include <QObject>
7 
8 #include "mythexp.h"
9 #include "mythscreentype.h"
10 
11 class MythUIButtonList;
13 class MythUIText;
14 class MythUITextEdit;
15 class MythUIButton;
16 class MythUIShape;
17 
26 {
27  Q_OBJECT
28 
29  public:
30  // Constructor
31  explicit RawSettingsEditor(MythScreenStack *parent, const char *name = nullptr);
32 
33  // Destructor
34  ~RawSettingsEditor() override = default;
35 
36  // MythScreenType overrides
37  bool Create(void) override; // MythScreenType
38  void Load(void) override; // MythScreenType
39  void Init(void) override; // MythScreenType
40 
41  private slots:
42  // Saves changes
43  void Save(void);
44 
45  // Helpers for keeping track of current value and updating the screen
46  void selectionChanged(MythUIButtonListItem *item);
47  void valueChanged(void);
48 
49  protected:
50  // Protected data, directly accessed by inheritting classes
51  QString m_title;
52  QMap <QString, QString> m_settings;
53 
54  private:
55  // Helper for updating prev/next values on screen
56  void updatePrevNextTexts(void);
57 
58  // UI Widgets on screen
59  MythUIButtonList *m_settingsList {nullptr};
60  MythUITextEdit *m_settingValue {nullptr};
61 
62  MythUIButton *m_saveButton {nullptr};
63  MythUIButton *m_cancelButton {nullptr};
64 
65  MythUIText *m_textLabel {nullptr};
66 
67  // Prev/Next text areas on screen
68  QHash <int, MythUIText*> m_prevNextTexts;
69  QHash <int, MythUIShape*> m_prevNextShapes;
70 
71  // Original and current settings values used for selective saving
72  QHash <QString, QString> m_origValues;
73  QHash <QString, QString> m_settingValues;
74 };
75 
76 #endif
77 
78 /* vim: set expandtab tabstop=4 shiftwidth=4: */
QHash< QString, QString > m_settingValues
unsigned int slots[4]
Definition: element.c:38
#define MPUBLIC
Definition: mythexp.h:10
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
virtual bool Create(void)
QHash< int, MythUIText * > m_prevNextTexts
QHash< int, MythUIShape * > m_prevNextShapes
A text entry and edit widget.
A widget for rendering primitive shapes and lines.
Definition: mythuishape.h:21
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
QMap< QString, QString > m_settings
A single button widget.
Definition: mythuibutton.h:21
An editor screen that allows manipulation of raw settings values.
virtual void Init(void)
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
virtual void Load(void)
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
Screen in which all other widgets are contained and rendered.
QHash< QString, QString > m_origValues