MythTV  master
mythdisplaymode.h
Go to the documentation of this file.
1 #ifndef MYTHDISPLAYMODE_H_
2 #define MYTHDISPLAYMODE_H_
3 
4 // Qt
5 #include <QSize>
6 #include <QString>
7 
8 // MythTV
9 #include "mythuiexp.h"
10 
11 // Std
12 #include <algorithm>
13 #include <cstdint>
14 #include <map>
15 #include <vector>
16 
17 class MythDisplayMode;
18 using MythDisplayModes = std::vector<MythDisplayMode>;
19 using DisplayModeMap = std::map<uint64_t, MythDisplayMode>;
20 using MythDisplayRates = std::vector<double>;
21 
23 {
24  public:
25  bool operator < (const MythDisplayMode& Other) const;
26  bool operator == (const MythDisplayMode& Other) const;
27 
28  MythDisplayMode() = default;
29  MythDisplayMode(QSize Resolution, QSize PhysicalSize,
30  double AspectRatio, double RefreshRate);
31  MythDisplayMode(int Width, int Height, int MMWidth, int MMHeight,
32  double AspectRatio, double RefreshRate);
33  void Init ();
34  QString ToString () const;
35  QSize Resolution () const;
36  int Width () const;
37  int Height () const;
38  int WidthMM () const;
39  int HeightMM () const;
40  double AspectRatio () const;
41  double RefreshRate () const;
42  void SetAspectRatio(double AspectRatio);
43  void AddRefreshRate(double Rate);
44  void ClearRefreshRates();
45  void SetRefreshRate(double Rate);
46  const MythDisplayRates& RefreshRates() const;
47  static int FindBestMatch (const MythDisplayModes& Modes,
48  const MythDisplayMode& Mode, double& TargetRate);
49  static uint64_t CalcKey (QSize Size, double Rate);
50  static bool CompareRates (double First, double Second, double Precision = 0.01);
51  static uint64_t FindBestScreen(const DisplayModeMap& Map,
52  int Width, int Height, double Rate);
53 
54  private:
55  int m_width { 0 };
56  int m_height { 0 };
57  int m_widthMM { 0 };
58  int m_heightMM { 0 };
59  double m_aspect { -1.0 };
61 };
62 #endif
MUI_PUBLIC
#define MUI_PUBLIC
Definition: mythuiexp.h:9
MythDisplayMode::m_refreshRates
MythDisplayRates m_refreshRates
Definition: mythdisplaymode.h:60
MythDisplayModes
std::vector< MythDisplayMode > MythDisplayModes
Definition: mythdisplaymode.h:18
operator==
bool operator==(MusicMetadata &a, MusicMetadata &b)
Definition: musicmetadata.cpp:40
MythDisplayMode
Definition: mythdisplaymode.h:22
operator<
bool operator<(const ParentalLevel &lhs, const ParentalLevel &rhs)
Definition: parentalcontrols.cpp:143
MythDisplayRates
std::vector< double > MythDisplayRates
Definition: mythdisplaymode.h:20
DisplayModeMap
std::map< uint64_t, MythDisplayMode > DisplayModeMap
Definition: mythdisplaymode.h:19
mythuiexp.h
Mode
Mode
Definition: synaesthesia.h:23