1*fe8567ecSFrançois Revol #ifndef SETTINGS_H 2*fe8567ecSFrançois Revol #define SETTINGS_H 3*fe8567ecSFrançois Revol 4*fe8567ecSFrançois Revol 5*fe8567ecSFrançois Revol /*************************************************** 6*fe8567ecSFrançois Revol settings.h 7*fe8567ecSFrançois Revol Mechanisms for managing the settings setting/retireval for AutoRaise 8*fe8567ecSFrançois Revol 9*fe8567ecSFrançois Revol 2002 mmu_man 10*fe8567ecSFrançois Revol from Deskscope: 11*fe8567ecSFrançois Revol 2000 Shamyl Zakariya 12*fe8567ecSFrançois Revol ***************************************************/ 13*fe8567ecSFrançois Revol #include "common.h" 14*fe8567ecSFrançois Revol 15*fe8567ecSFrançois Revol /**************************************** 16*fe8567ecSFrançois Revol AutoRaiseSettings 17*fe8567ecSFrançois Revol Simple class for getting and setting prefs. 18*fe8567ecSFrançois Revol Instantiating will open up settings file 19*fe8567ecSFrançois Revol Destroying will write settings plus any changes 20*fe8567ecSFrançois Revol back into the file. 21*fe8567ecSFrançois Revol 22*fe8567ecSFrançois Revol Settings file won't be updated until AutoRaiseSettings 23*fe8567ecSFrançois Revol destructor is called. Doens't matter if it's allocated off 24*fe8567ecSFrançois Revol heap or stack. I recommend stack, though, to keep likelyhood 25*fe8567ecSFrançois Revol of race conditions down. 26*fe8567ecSFrançois Revol 27*fe8567ecSFrançois Revol File is defined in common.h as SETTINGS_FILE 28*fe8567ecSFrançois Revol 29*fe8567ecSFrançois Revol ****************************************/ 30*fe8567ecSFrançois Revol 31*fe8567ecSFrançois Revol // make adding configuration fields easier 32*fe8567ecSFrançois Revol #define CONF_ADDPROP(_type, _name) \ 33*fe8567ecSFrançois Revol protected:\ 34*fe8567ecSFrançois Revol _type _conf##_name;\ 35*fe8567ecSFrançois Revol public:\ 36*fe8567ecSFrançois Revol void Set##_name(_type value);\ 37*fe8567ecSFrançois Revol _type _name(); 38*fe8567ecSFrançois Revol 39*fe8567ecSFrançois Revol class AutoRaiseSettings 40*fe8567ecSFrançois Revol { 41*fe8567ecSFrançois Revol protected: 42*fe8567ecSFrançois Revol BFile _settingsFile; 43*fe8567ecSFrançois Revol BMessage _settingsMessage; 44*fe8567ecSFrançois Revol 45*fe8567ecSFrançois Revol 46*fe8567ecSFrançois Revol 47*fe8567ecSFrançois Revol BMessage openSettingsFile(); 48*fe8567ecSFrançois Revol void closeSettingsFile(); 49*fe8567ecSFrançois Revol 50*fe8567ecSFrançois Revol public: 51*fe8567ecSFrançois Revol AutoRaiseSettings(); 52*fe8567ecSFrançois Revol ~AutoRaiseSettings(); 53*fe8567ecSFrançois Revol 54*fe8567ecSFrançois Revol CONF_ADDPROP(bool, Active) 55*fe8567ecSFrançois Revol CONF_ADDPROP(bigtime_t, Delay) 56*fe8567ecSFrançois Revol CONF_ADDPROP(int32, Mode) 57*fe8567ecSFrançois Revol 58*fe8567ecSFrançois Revol }; 59*fe8567ecSFrançois Revol 60*fe8567ecSFrançois Revol #undef CONF_ADDPROP 61*fe8567ecSFrançois Revol 62*fe8567ecSFrançois Revol #endif 63