MythTV  master
mythdialogs.h
Go to the documentation of this file.
1 #ifndef MYTHDIALOGS_H_
2 #define MYTHDIALOGS_H_
3 
4 #include <QDialog>
5 #include <QObject>
6 #include <QFrame>
7 
8 #include "mythexp.h"
9 #include "mythmainwindow.h"
10 
11 class MythMediaDevice;
12 class MythLineEdit;
13 class MythRemoteLineEdit;
14 class MythListBox;
15 class MythLabel;
16 struct fontProp;
17 class QVBoxLayout;
18 class QProgressBar;
19 class QAbstractButton;
20 
21 typedef enum DialogCode
22 {
23  kDialogCodeRejected = QDialog::Rejected,
24  kDialogCodeAccepted = QDialog::Accepted,
26 } DialogCode;
27 
28 inline bool operator==(const DialogCode &a, const QDialog::DialogCode &b)
29 { return ((int)a) == ((int)b); }
30 inline bool operator==(const QDialog::DialogCode &a, const DialogCode &b)
31 { return ((int)a) == ((int)b); }
32 inline bool operator!=(const DialogCode &a, const QDialog::DialogCode &b)
33 { return ((int)a) == ((int)b); }
34 inline bool operator!=(const QDialog::DialogCode &a, const DialogCode &b)
35 { return ((int)a) == ((int)b); }
36 
40 class MPUBLIC MythDialog : public QFrame
41 {
42  Q_OBJECT
43 
44  public:
45  MythDialog(MythMainWindow *parent, const char *name = "MythDialog",
46  bool setsize = true);
47 
48  // these are for backward compatibility..
49  static const DialogCode Rejected = kDialogCodeRejected;
50  static const DialogCode Accepted = kDialogCodeAccepted;
51  static const DialogCode ListStart = kDialogCodeListStart;
52 
53  DialogCode result(void) const { return m_rescode; }
54 
55  // QFrame::Show is not virtual, so this isn't an override.
56  virtual void Show(void);
57 
58  void hide(void);
59 
60  void setNoErase(void);
61 
62  virtual bool onMediaEvent(MythMediaDevice * mediadevice);
63 
64  void setResult(DialogCode r);
65 
66  // Not an override because the underlying QObject::deleteLater
67  // function isn't virtual. This is a new virtual function, which
68  // calls QFrame::deleteLater.
69  virtual void deleteLater(void);
70 
71  static int CalcItemIndex(DialogCode code);
72 
73  signals:
74  void menuButtonPressed();
75  void leaveModality();
76 
77  public slots:
78  DialogCode exec(void);
79  virtual void done(int); // Must be given a valid DialogCode
80  virtual void AcceptItem(int);
81  virtual void accept();
82  virtual void reject();
83 
84  protected:
85  ~MythDialog();
86  void TeardownAll(void);
87 
88  void keyPressEvent(QKeyEvent *e) override; // QWidget
89 
90  float m_dlgwmult {0.0F};
91  float m_dlghmult {0.0F};
92  int m_screenwidth {0};
93  int m_screenheight {0};
94  int m_xbase {0};
95  int m_ybase {0};
96 
97  MythMainWindow *m_parent {nullptr};
98 
100 
101  bool m_in_loop {false};
102 
103  QFont m_defaultBigFont, m_defaultMediumFont, m_defaultSmallFont;
104 };
105 
106 #endif
unsigned int slots[4]
Definition: element.c:38
#define MPUBLIC
Definition: mythexp.h:10
DialogCode result(void) const
Definition: mythdialogs.h:53
unsigned char r
Definition: ParseText.cpp:329
unsigned char b
Definition: ParseText.cpp:329
DialogCode
Definition: mythdialogs.h:21
const char * name
Definition: ParseText.cpp:328
bool operator!=(const DialogCode &a, const QDialog::DialogCode &b)
Definition: mythdialogs.h:32
Base dialog for most dialogs in MythTV using the old UI.
Definition: mythdialogs.h:40
QFont m_defaultSmallFont
Definition: mythdialogs.h:103
bool operator==(const DialogCode &a, const QDialog::DialogCode &b)
Definition: mythdialogs.h:28