2009-07-24 02:35:30 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef SETTINGS_MANAGER_H
|
|
|
|
#define SETTINGS_MANAGER_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <Locker.h>
|
|
|
|
#include <Path.h>
|
|
|
|
|
|
|
|
#include <ObjectList.h>
|
|
|
|
|
|
|
|
|
|
|
|
class TeamSettings;
|
2016-05-22 15:40:46 -04:00
|
|
|
class TeamUiSettingsFactory;
|
2009-07-24 02:35:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SettingsManager {
|
|
|
|
public:
|
|
|
|
SettingsManager();
|
|
|
|
~SettingsManager();
|
|
|
|
|
2016-05-22 15:40:46 -04:00
|
|
|
status_t Init(TeamUiSettingsFactory* factory);
|
2009-07-24 02:35:30 +00:00
|
|
|
|
|
|
|
status_t LoadTeamSettings(const char* teamName,
|
|
|
|
TeamSettings& settings);
|
|
|
|
status_t SaveTeamSettings(const TeamSettings& settings);
|
|
|
|
|
|
|
|
private:
|
|
|
|
typedef BObjectList<TeamSettings> TeamSettingsList;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void _Unset();
|
|
|
|
|
|
|
|
status_t _LoadSettings();
|
|
|
|
status_t _SaveSettings();
|
|
|
|
|
|
|
|
int32 _TeamSettingsIndex(const char* teamName) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
BLocker fLock;
|
|
|
|
BPath fSettingsPath;
|
|
|
|
TeamSettingsList fRecentTeamSettings; // oldest is first
|
2016-05-22 15:40:46 -04:00
|
|
|
TeamUiSettingsFactory* fUiSettingsFactory;
|
2009-07-24 02:35:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // SETTINGS_MANAGER_H
|