settings.h
author insilmaril
Thu, 08 Nov 2007 15:28:03 +0000
changeset 620 24bfecc949a0
parent 619 b48f072a347a
permissions -rw-r--r--
1.11.2 split up of xml helper functions. started to work on attributes
     1 #ifndef SETTINGS_H
     2 #define SETTINGS_H
     3 
     4 #include <qsettings.h>
     5 #include <qstring.h>
     6 #include <qstringlist.h>
     7 
     8 #include "xmlobj.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 getDataXML (const QString &);
    43 
    44 protected:
    45 	QStringList pathlist;
    46 	QStringList keylist;
    47 	QStringList valuelist;
    48 };
    49 
    50 #endif