PowerComponent.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef POWERMANAGER
  2. #define POWERMANAGER
  3. #include <QsLog.h>
  4. #include "ComponentManager.h"
  5. class PowerComponent : public ComponentBase
  6. {
  7. Q_OBJECT
  8. public:
  9. static PowerComponent& Get();
  10. PowerComponent(QObject* parent = 0)
  11. : ComponentBase(parent),
  12. m_currentScreensaverEnabled(true),
  13. m_fullscreenState(false),
  14. m_videoPlaying(false)
  15. { }
  16. virtual bool componentInitialize();
  17. virtual bool componentExport() { return true; }
  18. virtual const char* componentName() { return "power"; }
  19. virtual void componentPostInitialize();
  20. void setFullscreenState(bool fullscreen);
  21. public Q_SLOTS:
  22. virtual bool canPowerOff() { return false; }
  23. virtual bool canReboot() { return false; }
  24. virtual bool canSuspend() { return false; }
  25. virtual bool canRelaunch() { return false; }
  26. virtual bool PowerOff() { return false; }
  27. virtual bool Reboot() { return false; }
  28. virtual bool Suspend() { return false; }
  29. private Q_SLOTS:
  30. void playbackStarted();
  31. void playbackEnded();
  32. Q_SIGNALS:
  33. void screenSaverEnabled();
  34. void screenSaverDisabled();
  35. protected:
  36. virtual void doDisableScreensaver() {};
  37. virtual void doEnableScreensaver() {};
  38. private:
  39. void redecideScreeensaverState();
  40. bool m_currentScreensaverEnabled;
  41. bool m_fullscreenState;
  42. bool m_videoPlaying;
  43. };
  44. #endif // POWERMANAGER