haiku/headers/private/screen_saver/ScreenSaverPrefs.h
Axel Dörfler 7cae4a1ee0 * Big time cleanup of the screen saver stuff, not yet finished yet, though.
Renamed lots of things, like ScreenSaverThread to ScreenSaverRunner,
  refactored code, etc. Much cleaner interfaces and code.
* Fixed a couple of bugs and in the add-on handling, especially some settings
  related bugs (ie. testing a screen saver will now use its latest settings,
  etc.).
* Correctly implemented DPMS support in ScreenSaverPrefs and the ScreenSaver
  preferences application - screen_blanker still ignores them, though.
* It's not yet font sensitive either.
* Changed the input_server add-on to not switch to the screen blanker immediately
  when it's in the "blank corner" - doesn't seem to work yet, though (only tested
  under Qemu).
* Correctly implemented the "preview" function (before, a screen saver would
  never know it rendered a preview).
* Evaluates the return value of BScreenSaver::StartSaver().
* The screen saver thread is no longer killed without notice - it's now
  always shut down properly.
* Made the code more robust against failure.
* Introduced some new bugs as well (the screen saver list view doesn't jump to
  the selection anymore, for some reason), those will be fixed later (as the
  remaining issues).
* Probably some more I forgot about.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17731 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-06-06 08:16:46 +00:00

102 lines
3.0 KiB
C++

/*
* Copyright 2003-2006, Michael Phipps. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef SCREEN_SAVER_PREFS_H
#define SCREEN_SAVER_PREFS_H
#include <Message.h>
#include <Path.h>
#include <String.h>
enum screen_corner {
NONE = -1,
UPLEFT,
UPRIGHT,
DOWNRIGHT,
DOWNLEFT,
CENTER
};
// time flags
enum {
SAVER_DISABLED = 0x00,
ENABLE_SAVER = 0x01,
ENABLE_DPMS_STAND_BY = 0x02,
ENABLE_DPMS_SUSPEND = 0x04,
ENABLE_DPMS_OFF = 0x08,
ENABLE_DPMS_MASK = ENABLE_DPMS_STAND_BY | ENABLE_DPMS_SUSPEND | ENABLE_DPMS_OFF
};
#define SCREEN_BLANKER_SIG "application/x-vnd.Haiku.screenblanker"
class ScreenSaverPrefs {
public:
ScreenSaverPrefs();
bool LoadSettings();
void Defaults();
BPath& Path() { return fSettingsPath; }
BRect WindowFrame() { return fWindowFrame; }
int32 WindowTab() { return fWindowTab; }
int32 TimeFlags() { return fTimeFlags; }
bigtime_t BlankTime() { return fBlankTime; }
bigtime_t StandbyTime() { return fStandByTime; }
bigtime_t SuspendTime() { return fSuspendTime; }
bigtime_t OffTime() { return fOffTime; }
screen_corner GetBlankCorner() { return fBlankCorner; }
screen_corner GetNeverBlankCorner() { return fNeverBlankCorner; }
bool LockEnable() { return fLockEnabled; }
bigtime_t PasswordTime() { return fPasswordTime; }
const char *Password() { return fPassword.String(); }
const char *LockMethod() { return fLockMethod.String(); }
bool IsNetworkPassword() { return strcmp(fLockMethod.String(), "custom") != 0; }
const char *ModuleName() { return fModuleName.String(); }
status_t GetState(const char *name, BMessage *stateMsg);
void SetWindowFrame(const BRect &fr) { fWindowFrame = fr; }
void SetWindowTab(int32 tab) { fWindowTab = tab; }
void SetTimeFlags(int32 tf) { fTimeFlags = tf; }
void SetBlankTime(bigtime_t bt) { fBlankTime = bt; }
void SetStandbyTime(bigtime_t time) { fStandByTime = time; }
void SetSuspendTime(bigtime_t time) { fSuspendTime = time; }
void SetOffTime(bigtime_t intime) { fOffTime = intime; }
void SetBlankCorner(screen_corner in) { fBlankCorner = in; }
void SetNeverBlankCorner(screen_corner in) { fNeverBlankCorner = in; }
void SetLockEnable(bool en) { fLockEnabled = en; }
void SetPasswordTime(bigtime_t pt) { fPasswordTime = pt; }
void SetPassword(const char *pw) { fPassword = pw; }
// Cannot set network password from here.
void SetLockMethod(const char *method) { fLockMethod = method; }
void SetModuleName(const char *mn) { fModuleName = mn; }
void SetState(const char *name, BMessage *stateMsg);
void SaveSettings();
BMessage& GetSettings();
private:
BRect fWindowFrame;
int32 fWindowTab;
int32 fTimeFlags;
bigtime_t fBlankTime;
bigtime_t fStandByTime;
bigtime_t fSuspendTime;
bigtime_t fOffTime;
screen_corner fBlankCorner;
screen_corner fNeverBlankCorner;
bool fLockEnabled;
bigtime_t fPasswordTime;
BString fPassword;
BString fModuleName;
BString fLockMethod;
BMessage fSettings;
BPath fSettingsPath, fNetworkPath;
};
#endif // SCREEN_SAVER_PREFS_H