MythTV master
mythdisplaywindows.cpp
Go to the documentation of this file.
1#include "windows.h"
2
3// MythTV
5#include "mythmainwindow.h"
6
9{
10 Initialise();
11}
12
14{
15}
16
18{
19 QWidget* widget = m_widget;
20
21 if (!widget)
22 {
23 if (!HasMythMainWindow())
24 {
26 return;
27 }
28 widget = qobject_cast<QWidget*>(MythMainWindow::getMainWindow());
29 }
30 WId win = 0;
31 if (widget)
32 win = widget->winId();
33
34 HDC hdc = GetDC((HWND)win);
35 if (!hdc)
36 {
38 return;
39 }
40
41 int rate = GetDeviceCaps(hdc, VREFRESH);
42 m_physicalSize = QSize(GetDeviceCaps(hdc, HORZSIZE),
43 GetDeviceCaps(hdc, VERTSIZE));
44 m_resolution = QSize(GetDeviceCaps(hdc, HORZRES),
45 GetDeviceCaps(hdc, VERTRES));
46 m_modeComplete = true;
47
48 // see http://support.microsoft.com/kb/2006076
49 switch (rate)
50 {
51 case 23: m_refreshRate = 23.976; break;
52 case 29: m_refreshRate = 29.970; break;
53 case 47: m_refreshRate = 47.952; break;
54 case 59: m_refreshRate = 59.940; break;
55 case 71: m_refreshRate = 71.928; break;
56 case 119: m_refreshRate = 119.880; break;
57 default: m_refreshRate = static_cast<double>(rate);
58 }
59}
void UpdateCurrentMode(void) override
Retrieve screen details.
QWidget * m_widget
Definition: mythdisplay.h:95
QSize m_resolution
Definition: mythdisplay.h:92
virtual void UpdateCurrentMode()
Retrieve screen details.
QSize m_physicalSize
Definition: mythdisplay.h:93
void Initialise()
double m_refreshRate
Definition: mythdisplay.h:90
bool m_modeComplete
Definition: mythdisplay.h:89
static MythMainWindow * getMainWindow(bool UseDB=true)
Return the existing main window, or create one.
bool HasMythMainWindow(void)