-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlng.cpp
More file actions
50 lines (43 loc) · 811 Bytes
/
lng.cpp
File metadata and controls
50 lines (43 loc) · 811 Bytes
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
#include "lng.h"
#include <qtextcodec.h>
#include <qtextstream.h>
Lng::Lng(QString &lngFile)
{
#ifdef DEBUG
qDebug("====== creat lng \n");
#endif
lngCfg = new ZConfig(lngFile);
}
Lng::Lng(const char *lngFile)
{
#ifdef DEBUG
qDebug("====== creat lng \n");
#endif
lngCfg = new ZConfig(QString(lngFile));
}
Lng::~Lng()
{
#ifdef DEBUG
qDebug("====== delete lng cfg \n");
#endif
delete lngCfg;
#ifdef DEBUG
qDebug("====== delete lng \n");
#endif
}
void Lng::changeLngFile(QString &lngFile)
{
if( NULL != lngCfg ) {
delete lngCfg;
lngCfg = new ZConfig(lngFile);
}
}
QString Lng::tr( const char * sourceText)
{
QString tmp = lngCfg->readEntry("LNG", QString(sourceText), "");
if(tmp == "") {
tmp = QString(sourceText);
printf("%s = \n", sourceText);
}
return tmp;
}