MythTV  master
screensaver.cpp
Go to the documentation of this file.
1 // MythTV
2 #include "config.h"
3 #include "screensaver.h"
4 #include "screensaver-null.h"
5 
6 #ifdef USING_DBUS
7 #include "screensaver-dbus.h"
8 #endif // USING_DBUS
9 
10 #ifdef USING_X11
11 #include "screensaver-x11.h"
12 #include "mythxdisplay.h"
13 #endif // USING_X11
14 
15 #if CONFIG_DARWIN
16 #include "screensaver-osx.h"
17 #endif
18 
19 #if ANDROID
20 #include "screensaver-android.h"
21 #endif
22 
23 QEvent::Type ScreenSaverEvent::kEventType =
24  static_cast<QEvent::Type>(QEvent::registerEventType());
25 
27 {
28 #if defined(USING_DBUS)
29  m_screenSavers.push_back(new ScreenSaverDBus());
30 #endif
31 #if defined(USING_X11)
33  if (display)
34  {
35  m_screenSavers.push_back(new ScreenSaverX11());
36  delete display;
37  }
38 #elif CONFIG_DARWIN
39  m_screenSavers.push_back(new ScreenSaverOSX());
40 #endif
41 #if defined(ANDROID)
42  m_screenSavers.push_back(new ScreenSaverAndroid());
43 #endif
44 #if not (defined(USING_DBUS) || defined(USING_X11) || CONFIG_DARWIN || defined(ANDROID))
45  m_screenSavers.push_back(new ScreenSaverNull());
46 #endif
47 }
48 
50 {
51  while (!m_screenSavers.isEmpty())
52  delete m_screenSavers.takeLast();
53 }
54 
56 {
57  QList<ScreenSaver *>::iterator i;
58  for (i = m_screenSavers.begin(); i != m_screenSavers.end(); ++i)
59  (*i)->Disable();
60 }
61 
63 {
64  QList<ScreenSaver *>::iterator i;
65  for (i = m_screenSavers.begin(); i != m_screenSavers.end(); ++i)
66  (*i)->Restore();
67 }
68 
70 {
71  QList<ScreenSaver *>::iterator i;
72  for (i = m_screenSavers.begin(); i != m_screenSavers.end(); ++i)
73  (*i)->Reset();
74 }
75 
77 {
78  QList<ScreenSaver *>::iterator i;
79  for (i = m_screenSavers.begin(); i != m_screenSavers.end(); ++i)
80  if((*i)->Asleep())
81  return true;
82  return false;
83 }
static Type kEventType
Definition: screensaver.h:23
void Disable(void)
Definition: screensaver.cpp:55
static MythXDisplay * OpenMythXDisplay(bool Warn=true)
void Restore(void)
Definition: screensaver.cpp:62
QList< ScreenSaver * > m_screenSavers
Definition: screensaver.h:54