1 /*
2  * psioptions.h - Psi options class
3  * Copyright (C) 2006  Kevin Smith
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  */
20 
21 #ifndef _PSIOPTIONS_H_
22 #define _PSIOPTIONS_H_
23 
24 #include "optionstree.h"
25 
26 // Some hard coded options
27 #define MINIMUM_OPACITY 10
28 
29 namespace XMPP {
30 	class Client;
31 }
32 class QString;
33 class QTimer;
34 
35 class PsiOptions : public OptionsTree//, QObject
36 {
37 	Q_OBJECT
38 public:
39 	static PsiOptions* instance();
40 	static const PsiOptions* defaults();
41 	static void reset();
42 
43 	static bool exists(QString fileName);
44 	~PsiOptions();
45 	bool load(QString file);
46 	void load(XMPP::Client* client);
47 	bool newProfile();
48 	bool save(QString file);
49 	void autoSave(bool autoSave, QString autoFile = "");
50 	void resetOption(const QString &name);
51 
52 // don't call this normally
53 	PsiOptions();
54 
55 private slots:
56 	void saveToAutoFile();
57 	void getOptionsStorage_finished();
58 
59 private:
60 	QString autoFile_;
61 	QTimer *autoSaveTimer_;
62 	static PsiOptions* instance_;
63 	static PsiOptions* defaults_;
64 };
65 
66 #endif /* _PSIOPTIONS_H_ */
67