MythTV  master
mythdisplay.h
Go to the documentation of this file.
1 #ifndef MYTHDISPLAY_H
2 #define MYTHDISPLAY_H
3 
4 // Qt
5 #include <QSize>
6 #include <QScreen>
7 #include <QMutex>
8 
9 // MythTV
10 #include "mythuiexp.h"
11 #include "referencecounter.h"
12 #include "mythdisplaymode.h"
13 #include "mythedid.h"
14 
15 // Std
16 #include <cmath>
17 
18 class MUI_PUBLIC MythDisplay : public QObject, public ReferenceCounter
19 {
20  Q_OBJECT
21 
22  friend class MythMainWindow;
23 
24  public:
25  static MythDisplay* AcquireRelease(bool Acquire = true);
26  static QStringList GetDescription(void);
27 
28  virtual bool UsingVideoModes(void) { return false; }
29  virtual const vector<MythDisplayMode>& GetVideoModes(void);
30 
31  static bool SpanAllScreens (void);
32  static QString GetExtraScreenInfo (QScreen *qScreen);
33 
34  QRect GetScreenBounds (void);
35  QScreen* GetCurrentScreen (void);
36  static int GetScreenCount (void);
37  double GetPixelAspectRatio (void);
38  QSize GetGUIResolution (void);
39  bool NextModeIsLarger (QSize Size);
40  void SwitchToDesktop (void);
41  bool SwitchToGUI (bool Wait = false);
42  bool SwitchToVideo (QSize Size, double Rate = 0.0);
43  QSize GetResolution (void);
44  QSize GetPhysicalSize (void);
45  double GetRefreshRate (void);
46  int GetRefreshInterval (int Fallback);
47  double GetAspectRatio (QString &Source, bool IgnoreModeOverride = false);
48  double EstimateVirtualAspectRatio(void);
49  MythEDID& GetEDID (void);
50  std::vector<double> GetRefreshRates(QSize Size);
51 
52  public slots:
53  virtual void ScreenChanged (QScreen *qScreen);
54  static void PrimaryScreenChanged (QScreen *qScreen);
55  void ScreenAdded (QScreen *qScreen);
56  void ScreenRemoved (QScreen *qScreen);
57  void GeometryChanged (const QRect &Geometry);
58 
59  signals:
60  void CurrentScreenChanged (QScreen *qScreen);
61  void ScreenCountChanged (int Screens);
62 
63  protected:
64  MythDisplay();
65  ~MythDisplay() override;
66 
67  virtual void UpdateCurrentMode (void);
68  virtual bool SwitchToVideoMode (QSize Size, double Framerate);
69 
70  void DebugModes (void) const;
71  void SetWidget (QWidget *MainWindow);
72  static QScreen* GetDesiredScreen (void);
73  static void DebugScreen (QScreen *qScreen, const QString &Message);
74  void Initialise (void);
75  void InitScreenBounds (void);
76  void WaitForScreenChange(void);
77  void WaitForNewScreen (void);
78 
79 
80  bool m_waitForModeChanges { true };
81  bool m_modeComplete { false };
82  double m_refreshRate { 0.0 };
83  double m_aspectRatioOverride { 0.0 };
84  QSize m_resolution { 0, 0 };
85  QSize m_physicalSize { 0, 0 };
86  MythEDID m_edid { };
87  QWidget* m_widget { nullptr };
88  QWindow* m_window { nullptr };
89  QScreen* m_screen { nullptr };
90  vector<MythDisplayMode> m_videoModes { };
91 
92  private:
93  Q_DISABLE_COPY(MythDisplay)
94  static void PauseForModeSwitch(void);
95 
96  bool m_initialised { false };
97  bool m_firstScreenChange{ true };
98  QRect m_screenBounds { };
99  MythDisplayMode m_desktopMode { };
100  MythDisplayMode m_guiMode { };
101  MythDisplayMode m_videoMode { };
102  DisplayModeMap m_overrideVideoModes { };
103 };
104 
105 #endif // MYTHDISPLAY_H
map< uint64_t, MythDisplayMode > DisplayModeMap
unsigned int slots[4]
Definition: element.c:38
General purpose reference counter.
virtual bool UsingVideoModes(void)
Definition: mythdisplay.h:28
#define MUI_PUBLIC
Definition: mythuiexp.h:9