summaryrefslogtreecommitdiffstats
path: root/noatun/modules/kjofol-skin/parser.h
blob: 97e20d99e086c5f324bedbc5cf53a916a02aa4ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef PARSER_H
#define PARSER_H

// system includes
#include <qstringlist.h>
#include <qpixmap.h>
#include <qimage.h>
#include <qdict.h>

class Parser : public QDict<QStringList>
{
	class ImagePixmap
	{
	public:
		ImagePixmap() : mImage(0), mPixmap(0) {}
		~ImagePixmap() {}
		QImage mImage;
		QPixmap mPixmap;
	};

	public:
		Parser();

		void conserveMemory();
		void open(const QString &file);

		QString dir() const;
		QPixmap pixmap(const QString &pixmap) const
			{ return getPair(pixmap)->mPixmap; }
		QImage image(const QString &image) const
			{ return getPair(image)->mImage; }
		QString about() const { return mSkinAbout; };

		QString fileItem(const QString &file) const;

		bool exist(const QString &i) const;

	public:
		QStringList& operator[](const QString &l) { return *find(l);}

	private:
		ImagePixmap *getPair(const QString &i) const;

	private:
		mutable QDict<ImagePixmap> mImageCache;
		QString mDir;
		QString mSkinAbout;
};
#endif // PARSER_H