settings.h
author insilmaril
Mon Jul 09 10:23:39 2007 +0000 (2007-07-09)
changeset 542 4fdcbccbc1da
parent 366 e95081c21da2
child 619 b48f072a347a
permissions -rw-r--r--
GPL V2. Added settings to documentation
     1 #ifndef SETTINGS_H
     2 #define SETTINGS_H
     3 
     4 #include <qsettings.h>
     5 #include <qstring.h>
     6 #include <qstringlist.h>
     7 
     8 #include "misc.h"
     9 
    10 // Some helper functions and simplified settings class
    11 // to read and parse settings e.g.  in undo/redo directories
    12 
    13 class SimpleSettings
    14 {
    15 public:
    16     SimpleSettings ();
    17 	~SimpleSettings ();
    18 	void clear();
    19 	void readSettings(const QString &);
    20 	void writeSettings(const QString &);
    21 	QString readEntry (const QString &key, const QString &def=QString());
    22 	int readNumEntry (const QString &, const int &def=0);
    23 	void setEntry (const QString &,const QString &);
    24 private:	
    25 	QStringList keylist;
    26 	QStringList valuelist;
    27 };
    28 
    29 
    30 // Overloaded QSettings class, used to save some settings in 
    31 // a map instead of users home directory
    32 class Settings:public QSettings,public xmlObj
    33 {
    34 public:
    35     Settings ();
    36     Settings (const QString & , const QString &);
    37 	~Settings ();
    38 	void clear();
    39 	void clearLocal (const QString &);
    40 	QString readLocalEntry ( const QString &, const QString &, const QString &);
    41 	void setLocalEntry (const QString &, const QString &, const QString &);
    42 	QString getXMLData (const QString &);
    43 
    44 protected:
    45 	QStringList pathlist;
    46 	QStringList keylist;
    47 	QStringList valuelist;
    48 };
    49 
    50 #endif