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, const QString& Display = QString());
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) const;
48  int GetRefreshInterval (int Fallback) const;
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 PhysicalDPIChanged (qreal DPI);
60  static void GeometryChanged (const QRect &Geometry);
61 
62  signals:
63  void CurrentScreenChanged (QScreen *qScreen);
64  void ScreenCountChanged (int Screens);
65  void CurrentDPIChanged (qreal DPI);
66 
67  protected:
68  MythDisplay();
69  ~MythDisplay() override;
70 
71  virtual void UpdateCurrentMode (void);
72  virtual bool SwitchToVideoMode (QSize Size, double Framerate);
73 
74  void DebugModes (void) const;
75  void SetWidget (QWidget *MainWindow);
76  static QScreen* GetDesiredScreen (void);
77  static void DebugScreen (QScreen *qScreen, const QString &Message);
78  void Initialise (void);
79  void InitScreenBounds (void);
80  void WaitForScreenChange(void);
81  void WaitForNewScreen (void);
82 
83 
84  bool m_waitForModeChanges { true };
85  bool m_modeComplete { false };
86  double m_refreshRate { 0.0 };
87  double m_aspectRatioOverride { 0.0 };
88  QSize m_resolution { 0, 0 };
89  QSize m_physicalSize { 0, 0 };
90  MythEDID m_edid { };
91  QWidget* m_widget { nullptr };
92  QWindow* m_window { nullptr };
93  QScreen* m_screen { nullptr };
94  vector<MythDisplayMode> m_videoModes { };
95 
96  private:
97  Q_DISABLE_COPY(MythDisplay)
98  static void PauseForModeSwitch(void);
99 
100  bool m_initialised { false };
101  bool m_firstScreenChange{ true };
102  QRect m_screenBounds { };
103  MythDisplayMode m_desktopMode { };
104  MythDisplayMode m_guiMode { };
105  MythDisplayMode m_videoMode { };
106  DisplayModeMap m_overrideVideoModes { };
107 };
108 
109 #endif // MYTHDISPLAY_H
mythdisplaymode.h
slots
std::array< unsigned int, 4 > slots
Definition: element.cpp:38
MUI_PUBLIC
#define MUI_PUBLIC
Definition: mythuiexp.h:9
MythDisplay::VideoModesAvailable
virtual bool VideoModesAvailable(void)
Definition: mythdisplay.h:28
DisplayModeMap
map< uint64_t, MythDisplayMode > DisplayModeMap
Definition: mythdisplaymode.h:19
MythDisplay::CurrentScreenChanged
void CurrentScreenChanged(QScreen *qScreen)
Source
Definition: channelsettings.cpp:69
MythDisplay::UsingVideoModes
virtual bool UsingVideoModes(void)
Definition: mythdisplay.h:29
MythDisplay
Definition: mythdisplay.h:19
referencecounter.h
MythDisplayMode
Definition: mythdisplaymode.h:22
mythedid.h
MythDisplay::ScreenCountChanged
void ScreenCountChanged(int Screens)
mythuiexp.h
MythMainWindow
Definition: mythmainwindow.h:33
ReferenceCounter
General purpose reference counter.
Definition: referencecounter.h:27
MythEDID
Definition: mythedid.h:18
MythDisplay::CurrentDPIChanged
void CurrentDPIChanged(qreal DPI)