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 VideoModesAvailable(void) { return false; }
29  virtual bool UsingVideoModes(void) { return false; }
30  virtual const vector<MythDisplayMode>& GetVideoModes(void);
31 
32  static void ConfigureQtGUI (int SwapInterval = 1);
33  static bool SpanAllScreens (void);
34  static QString GetExtraScreenInfo (QScreen *qScreen);
35 
36  QRect GetScreenBounds (void);
37  QScreen* GetCurrentScreen (void);
38  static int GetScreenCount (void);
39  double GetPixelAspectRatio (void);
40  QSize GetGUIResolution (void);
41  bool NextModeIsLarger (QSize Size);
42  void SwitchToDesktop (void);
43  bool SwitchToGUI (bool Wait = false);
44  bool SwitchToVideo (QSize Size, double Rate = 0.0);
45  QSize GetResolution (void);
46  QSize GetPhysicalSize (void);
47  double GetRefreshRate (void);
48  int GetRefreshInterval (int Fallback);
49  double GetAspectRatio (QString &Source, bool IgnoreModeOverride = false);
50  double EstimateVirtualAspectRatio(void);
51  MythEDID& GetEDID (void);
52  std::vector<double> GetRefreshRates(QSize Size);
53 
54  public slots:
55  virtual void ScreenChanged (QScreen *qScreen);
56  static void PrimaryScreenChanged (QScreen *qScreen);
57  void ScreenAdded (QScreen *qScreen);
58  void ScreenRemoved (QScreen *qScreen);
59  void GeometryChanged (const QRect &Geometry);
60 
61  signals:
62  void CurrentScreenChanged (QScreen *qScreen);
63  void ScreenCountChanged (int Screens);
64 
65  protected:
66  MythDisplay();
67  ~MythDisplay() override;
68 
69  virtual void UpdateCurrentMode (void);
70  virtual bool SwitchToVideoMode (QSize Size, double Framerate);
71 
72  void DebugModes (void) const;
73  void SetWidget (QWidget *MainWindow);
74  static QScreen* GetDesiredScreen (void);
75  static void DebugScreen (QScreen *qScreen, const QString &Message);
76  void Initialise (void);
77  void InitScreenBounds (void);
78  void WaitForScreenChange(void);
79  void WaitForNewScreen (void);
80 
81 
82  bool m_waitForModeChanges { true };
83  bool m_modeComplete { false };
84  double m_refreshRate { 0.0 };
85  double m_aspectRatioOverride { 0.0 };
86  QSize m_resolution { 0, 0 };
87  QSize m_physicalSize { 0, 0 };
88  MythEDID m_edid { };
89  QWidget* m_widget { nullptr };
90  QWindow* m_window { nullptr };
91  QScreen* m_screen { nullptr };
92  vector<MythDisplayMode> m_videoModes { };
93 
94  private:
95  Q_DISABLE_COPY(MythDisplay)
96  static void PauseForModeSwitch(void);
97 
98  bool m_initialised { false };
99  bool m_firstScreenChange{ true };
100  QRect m_screenBounds { };
101  MythDisplayMode m_desktopMode { };
102  MythDisplayMode m_guiMode { };
103  MythDisplayMode m_videoMode { };
104  DisplayModeMap m_overrideVideoModes { };
105 };
106 
107 #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:29
#define MUI_PUBLIC
Definition: mythuiexp.h:9
virtual bool VideoModesAvailable(void)
Definition: mythdisplay.h:28