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: */
MPUBLIC
#define MPUBLIC
Definition: mythexp.h:10
RawSettingsEditor::m_origValues
QHash< QString, QString > m_origValues
Definition: rawsettingseditor.h:72
RawSettingsEditor::m_settingValues
QHash< QString, QString > m_settingValues
Definition: rawsettingseditor.h:73
mythexp.h
RawSettingsEditor::m_prevNextShapes
QHash< int, MythUIShape * > m_prevNextShapes
Definition: rawsettingseditor.h:69
RawSettingsEditor
An editor screen that allows manipulation of raw settings values.
Definition: rawsettingseditor.h:25
MythScreenStack
Definition: mythscreenstack.h:15
MythScreenType::Create
virtual bool Create(void)
Definition: mythscreentype.cpp:282
MythUITextEdit
A text entry and edit widget.
Definition: mythuitextedit.h:32
RawSettingsEditor::m_title
QString m_title
Definition: rawsettingseditor.h:51
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:44
RawSettingsEditor::m_prevNextTexts
QHash< int, MythUIText * > m_prevNextTexts
Definition: rawsettingseditor.h:68
MythScreenType::Load
virtual void Load(void)
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
Definition: mythscreentype.cpp:297
MythUIButtonListItem
Definition: mythuibuttonlist.h:27
MythUIButton
A single button widget.
Definition: mythuibutton.h:21
MythScreenType::Init
virtual void Init(void)
Used after calling Load() to assign data to widgets and other UI initilisation which is prohibited in...
Definition: mythscreentype.cpp:397
MythUIShape
A widget for rendering primitive shapes and lines.
Definition: mythuishape.h:21
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:30
RawSettingsEditor::m_settings
QMap< QString, QString > m_settings
Definition: rawsettingseditor.h:52
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:151
mythscreentype.h