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