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