summaryrefslogtreecommitdiff
path: root/noncore/applets/keyhelper/keyhelperapplet/misc/KeyNames.h
blob: 3e80763ec7eed7ee7282fe57c09b285a2060c1ea (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
#ifndef _KEY_NAMES_H_
#define _KEY_NAMES_H_

#include <qstring.h>
#include <qmap.h>
#include <qnamespace.h>

class KeyNames
{
public:
	static const QString& getName(int code);
	static int getCode(const QString& s);

	static void clearName(){
		namemap.clear();
	}
	static void setCode(const QString& s, int code){
		if(codemap.contains(s) == false){
			codemap.insert(s, code);
		}
	}
	static void clearCode(){
		codemap.clear();
	}
	static void reset(){
		clearCode();
	}
private:
	static QMap<QString, int> codemap;
	static QMap<int, QString> namemap;
	static QString tmpname;

	static void setCodeMap();
	static void setNameMap();
};

#endif /* _KEY_NAMES_H_ */