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 namespace std;
19 using DisplayModeMap = map<uint64_t, MythDisplayMode>;
20 
22 {
23  public:
24  bool operator < (const MythDisplayMode& Other) const;
25  bool operator == (const MythDisplayMode& Other) const;
26 
27  MythDisplayMode() = default;
28  MythDisplayMode(QSize Resolution, QSize PhysicalSize,
29  double AspectRatio, double RefreshRate);
30  MythDisplayMode(int Width, int Height, int MMWidth, int MMHeight,
31  double AspectRatio, double RefreshRate);
32  void Init (void);
33  QSize Resolution (void) const;
34  int Width (void) const;
35  int Height (void) const;
36  int WidthMM (void) const;
37  int HeightMM (void) const;
38  double AspectRatio (void) const;
39  double RefreshRate (void) const;
40  void SetAspectRatio(double AspectRatio);
41  void AddRefreshRate(double Rate);
42  void ClearRefreshRates(void);
43  void SetRefreshRate(double Rate);
44  const std::vector<double>& RefreshRates(void) const;
45  static int FindBestMatch (const vector<MythDisplayMode>& Modes,
46  const MythDisplayMode& Mode, double& TargetRate);
47  static uint64_t CalcKey (QSize Size, double Rate);
48  static bool CompareRates (double First, double Second, double Precision = 0.01);
49  static uint64_t FindBestScreen(const DisplayModeMap& Map,
50  int Width, int Height, double Rate);
51 
52  private:
53  int m_width { 0 };
54  int m_height { 0 };
55  int m_widthMM { 0 };
56  int m_heightMM { 0 };
57  double m_aspect { -1.0 };
58  vector<double> m_refreshRates { };
59 };
60 #endif // MYTHDISPLAYMODE_H_
MUI_PUBLIC
#define MUI_PUBLIC
Definition: mythuiexp.h:9
MythDisplayMode::MythDisplayMode
MythDisplayMode()=default
DisplayModeMap
map< uint64_t, MythDisplayMode > DisplayModeMap
Definition: mythdisplaymode.h:19
operator==
bool operator==(MusicMetadata &a, MusicMetadata &b)
Definition: musicmetadata.cpp:49
MythDisplayMode
Definition: mythdisplaymode.h:22
operator<
bool operator<(const ParentalLevel &lhs, const ParentalLevel &rhs)
Definition: parentalcontrols.cpp:143
mythuiexp.h