MythTV  master
mythscreensaver.cpp
Go to the documentation of this file.
1 // Qt
2 #include <QGuiApplication>
3 
4 // MythTV
5 #include "config.h"
6 #include "mythmainwindow.h"
7 #include "mythscreensaver.h"
8 
9 #ifdef USING_DRM
11 #endif
12 
13 #ifdef USING_DBUS
15 #endif
16 
17 #if CONFIG_DARWIN
19 #endif
20 
21 #ifdef Q_OS_ANDROID
23 #endif
24 
25 #ifdef USING_WAYLANDEXTRAS
27 #endif
28 
29 #ifdef USING_X11
31 #include "platforms/mythxdisplay.h"
32 #endif
33 
41 {
42 #if defined(USING_DBUS)
43  m_screenSavers.push_back(new MythScreenSaverDBus(this));
44 #endif
45 #if defined(USING_X11)
47  if (display)
48  {
49  m_screenSavers.push_back(new MythScreenSaverX11(this));
50  delete display;
51  }
52 #elif CONFIG_DARWIN
53  m_screenSavers.push_back(new MythScreenSaverOSX(this));
54 #endif
55 #if defined(ANDROID)
56  m_screenSavers.push_back(new MythScreenSaverAndroid(this));
57 #endif
58 #ifdef USING_DRM
59  MythScreenSaverDRM* drmsaver = MythScreenSaverDRM::Create(this, mDisplay);
60  if (drmsaver)
61  m_screenSavers.push_back(drmsaver);
62 #else
63  (void)mDisplay;
64 #endif
65 #ifdef USING_WAYLANDEXTRAS
66  if (QGuiApplication::platformName().toLower().contains("wayland"))
67  m_screenSavers.push_back(new MythScreenSaverWayland(this, MainWin));
68 #else
69  (void)MainWin;
70 #endif
71 
72  for (auto * screensaver : m_screenSavers)
73  {
74  connect(this, &MythScreenSaverControl::Disable, screensaver, &MythScreenSaver::Disable);
75  connect(this, &MythScreenSaverControl::Reset, screensaver, &MythScreenSaver::Reset);
76  connect(this, &MythScreenSaverControl::Restore, screensaver, &MythScreenSaver::Restore);
77  }
78 }
79 
81 {
82  for (auto * screensaver : m_screenSavers)
83  if (screensaver->Asleep())
84  return true;
85  return false;
86 }
MythScreenSaverX11
Definition: mythscreensaverx11.h:10
mythscreensaverx11.h
MythScreenSaverControl::MythScreenSaverControl
MythScreenSaverControl(MythMainWindow *MainWin, MythDisplay *mDisplay)
Definition: mythscreensaver.cpp:40
MythScreenSaverControl::Reset
void Reset()
MythScreenSaverControl::Restore
void Restore()
MythScreenSaverDRM
Definition: mythscreensaverdrm.h:8
MythXDisplay::OpenMythXDisplay
static MythXDisplay * OpenMythXDisplay(bool Warn=true)
Definition: mythxdisplay.cpp:25
MythScreenSaverAndroid
Definition: mythscreensaverandroid.h:10
mythscreensaverdbus.h
MythScreenSaverControl::Asleep
bool Asleep()
Definition: mythscreensaver.cpp:80
MythScreenSaverDBus
Definition: mythscreensaverdbus.h:10
MythScreenSaverControl::m_screenSavers
std::vector< MythScreenSaver * > m_screenSavers
Definition: mythscreensaver.h:51
mythscreensaver.h
mythscreensaverdrm.h
mythscreensaverandroid.h
MythScreenSaver::Disable
virtual void Disable()=0
mythscreensaverwayland.h
MythDisplay
Definition: mythdisplay.h:22
mythxdisplay.h
mythscreensaverosx.h
MythScreenSaverControl::Disable
void Disable()
MythScreenSaver::Restore
virtual void Restore()=0
MythScreenSaver::Reset
virtual void Reset()=0
MythScreenSaverDRM::Create
static MythScreenSaverDRM * Create(QObject *Parent, MythDisplay *mDisplay)
Definition: mythscreensaverdrm.cpp:7
MythXDisplay
Definition: mythxdisplay.h:17
MythScreenSaverWayland
Definition: mythscreensaverwayland.h:12
MythScreenSaverOSX
Definition: mythscreensaverosx.h:10
mythmainwindow.h
MythMainWindow
Definition: mythmainwindow.h:35