Repository navigation
Expand file tree
/
Copy pathmysettings.cpp
More file actions
66 lines (50 loc) · 1.71 KB
/
Copy pathmysettings.cpp
File metadata and controls
66 lines (50 loc) · 1.71 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "mysettings.h"
#include <QDebug>
MySettings::MySettings(const QString & fileName, Format format, QObject * parent):
QSettings(fileName,format,parent)
{
}
void MySettings::readSplashSettings(QList<SplashDesc *> &splashDescs)
{
beginGroup("SplashScreen");
int count = beginReadArray("SplashDesc");
for(int i = 0; i < count; i++)
{
setArrayIndex(i);
SplashDesc * desc = new SplashDesc;
desc->splashContent = value("splashContent").toString();
desc->scaleX = value("scaleX").toDouble();
desc->scaleY = value("scaleY").toDouble();
desc->scaleWidth = value("scaleW").toDouble();
desc->scaleHeight = value("scaleH").toDouble();
desc->fontSize = value("fontSize").toInt();
desc->fontFamily = value("fontFamily").toString();
desc->isBold = value("isBold").toBool();
desc->fontColor = QColor(value("fontColor").toString());
splashDescs.push_back(desc);
}
endArray();
endGroup();
}
void MySettings::writeSplashSettings(QList<SplashDesc *> &splashDescs)
{
beginGroup("SplashScreen");
remove("SplashDesc");
beginWriteArray("SplashDesc");
int count = 0;
foreach(SplashDesc * desc,splashDescs)
{
setArrayIndex(count++);
setValue("splashContent",desc->splashContent);
setValue("scaleX",desc->scaleX);
setValue("scaleY",desc->scaleY);
setValue("scaleW",desc->scaleWidth);
setValue("scaleH",desc->scaleHeight);
setValue("fontSize",desc->fontSize);
setValue("fontFamily",desc->fontFamily);
setValue("fontColor",desc->fontColor.name());
setValue("isBold",desc->isBold);
}
endArray();
endGroup();
}