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 "mythdisplaymode.h"
12 #include "mythedid.h"
13 #include "mythhdr.h"
14 #include "mythvrr.h"
15 #include "mythcommandlineparser.h"
16 
17 // Std
18 #include <cmath>
19 
20 class MythMainWindow;
21 
22 class MUI_PUBLIC MythDisplay : public QObject
23 {
24  Q_OBJECT
25 
26  friend class MythMainWindow;
27 
28  public:
29  virtual bool VideoModesAvailable () { return false; }
30  virtual bool UsingVideoModes () { return false; }
31  virtual bool IsPlanar () { return false; }
32  virtual const MythDisplayModes& GetVideoModes();
33 
34  static void ConfigureQtGUI (int SwapInterval, const MythCommandLineParser& CmdLine);
35  static bool SpanAllScreens ();
36  static QString GetExtraScreenInfo (QScreen *qScreen);
37  QStringList GetDescription ();
38  QRect GetScreenBounds ();
39  QScreen* GetCurrentScreen ();
40  static int GetScreenCount ();
41  double GetPixelAspectRatio ();
42  QSize GetGUIResolution ();
43  bool NextModeIsLarger (QSize Size);
44  void SwitchToDesktop ();
45  bool SwitchToGUI (bool Wait = false);
46  bool SwitchToVideo (QSize Size, double Rate = 0.0);
47  QSize GetResolution ();
48  QSize GetPhysicalSize ();
49  double GetRefreshRate () const;
50  std::chrono::microseconds GetRefreshInterval (std::chrono::microseconds Fallback) const;
51  double GetAspectRatio (QString &Source, bool IgnoreModeOverride = false);
52  double EstimateVirtualAspectRatio();
53  MythEDID& GetEDID ();
54  MythDisplayRates GetRefreshRates (QSize Size);
55  MythHDRPtr GetHDRState ();
56 
57  public slots:
58  virtual void ScreenChanged (QScreen *qScreen);
59  static void PrimaryScreenChanged (QScreen *qScreen);
60  void ScreenAdded (QScreen *qScreen);
61  void ScreenRemoved (QScreen *qScreen);
62  void PhysicalDPIChanged (qreal DPI);
63  static void GeometryChanged (QRect Geometry);
64 
65  signals:
66  void CurrentScreenChanged (QScreen *qScreen);
67  void ScreenCountChanged (int Screens);
68  void CurrentDPIChanged (qreal DPI);
69 
70  protected:
71  static MythDisplay* Create(MythMainWindow* MainWindow);
72  MythDisplay();
73  ~MythDisplay() override;
74 
75  virtual void UpdateCurrentMode ();
76  virtual bool SwitchToVideoMode (QSize Size, double Framerate);
77 
78  void DebugModes () const;
79  void SetWidget (QWidget *MainWindow);
80  static QScreen* GetDesiredScreen ();
81  static void DebugScreen (QScreen *qScreen, const QString &Message);
82  void Initialise ();
83  void InitScreenBounds ();
84  void WaitForScreenChange();
85  void WaitForNewScreen ();
86  void InitHDR ();
87 
88  bool m_waitForModeChanges { true };
89  bool m_modeComplete { false };
90  double m_refreshRate { 0.0 };
91  double m_aspectRatioOverride { 0.0 };
92  QSize m_resolution { 0, 0 };
93  QSize m_physicalSize { 0, 0 };
94  MythEDID m_edid { };
95  QWidget* m_widget { nullptr };
96  QWindow* m_window { nullptr };
97  QScreen* m_screen { nullptr };
98  MythDisplayModes m_videoModes { };
99  MythHDRPtr m_hdrState { nullptr };
100  MythVRRPtr m_vrrState { nullptr };
101 
102  private:
103  Q_DISABLE_COPY(MythDisplay)
104  static void PauseForModeSwitch();
105 
106  bool m_initialised { false };
107  bool m_firstScreenChange{ true };
108  QRect m_screenBounds { };
109  MythDisplayMode m_desktopMode { };
110  MythDisplayMode m_guiMode { };
111  MythDisplayMode m_videoMode { };
112  DisplayModeMap m_overrideVideoModes { };
113 };
114 
115 #endif
mythdisplaymode.h
MythHDRPtr
std::shared_ptr< class MythHDR > MythHDRPtr
Definition: mythhdr.h:30
MythCommandLineParser
Parent class for defining application command line parsers.
Definition: mythcommandlineparser.h:116
MUI_PUBLIC
#define MUI_PUBLIC
Definition: mythuiexp.h:9
MythDisplay::IsPlanar
virtual bool IsPlanar()
Definition: mythdisplay.h:31
MythDisplayModes
std::vector< MythDisplayMode > MythDisplayModes
Definition: mythdisplaymode.h:18
mythvrr.h
Source
Definition: channelsettings.cpp:68
MythDisplay
Definition: mythdisplay.h:22
MythDisplayMode
Definition: mythdisplaymode.h:22
mythhdr.h
MythDisplayRates
std::vector< double > MythDisplayRates
Definition: mythdisplaymode.h:20
MythUIScreenBounds::InitScreenBounds
void InitScreenBounds()
Definition: mythuiscreenbounds.cpp:129
mythedid.h
DisplayModeMap
std::map< uint64_t, MythDisplayMode > DisplayModeMap
Definition: mythdisplaymode.h:19
MythDisplay::UsingVideoModes
virtual bool UsingVideoModes()
Definition: mythdisplay.h:30
MythDisplay::VideoModesAvailable
virtual bool VideoModesAvailable()
Definition: mythdisplay.h:29
mythcommandlineparser.h
mythuiexp.h
MythMainWindow
Definition: mythmainwindow.h:35
MythEDID
Definition: mythedid.h:21
MythVRRPtr
std::shared_ptr< class MythVRR > MythVRRPtr
Definition: mythvrr.h:11