blob: a0878b86648336d0e6d58b4e9b9822a3a3be51f3 (
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
// This file is generated by kconfig_compiler_kf5 from test8c.kcfg.
// All changes you do to this file will be lost.
#include "test8c.h"
#include <qglobal.h>
#include <QFile>
#include <QDebug>
class Test8cHelper
{
public:
Test8cHelper() : q(nullptr) {}
~Test8cHelper() { delete q; q = nullptr; }
Test8cHelper(const Test8cHelper&) = delete;
Test8cHelper& operator=(const Test8cHelper&) = delete;
Test8c *q;
};
Q_GLOBAL_STATIC(Test8cHelper, s_globalTest8c)
Test8c *Test8c::self()
{
if (!s_globalTest8c()->q)
qFatal("you need to call Test8c::instance before using");
return s_globalTest8c()->q;
}
void Test8c::instance(const QString& cfgfilename)
{
if (s_globalTest8c()->q) {
qDebug() << "Test8c::instance called after the first use - ignoring";
return;
}
new Test8c(KSharedConfig::openConfig(cfgfilename));
s_globalTest8c()->q->read();
}
void Test8c::instance(KSharedConfig::Ptr config)
{
if (s_globalTest8c()->q) {
qDebug() << "Test8c::instance called after the first use - ignoring";
return;
}
new Test8c(std::move(config));
s_globalTest8c()->q->read();
}
Test8c::Test8c( KSharedConfig::Ptr config, QObject *parent )
: KConfigSkeleton( std::move( config ) )
{
setParent(parent);
Q_ASSERT(!s_globalTest8c()->q);
s_globalTest8c()->q = this;
setCurrentGroup( QStringLiteral( "Group" ) );
KConfigSkeleton::ItemFont *itemFont;
itemFont = new KConfigSkeleton::ItemFont( currentGroup(), QStringLiteral( "Font" ), mFont, QFont() );
addItem( itemFont, QStringLiteral( "Font" ) );
KConfigSkeleton::ItemFont *itemTitleFont;
itemTitleFont = new KConfigSkeleton::ItemFont( currentGroup(), QStringLiteral( "TitleFont" ), mTitleFont, QFont() );
addItem( itemTitleFont, QStringLiteral( "TitleFont" ) );
}
Test8c::~Test8c()
{
if (s_globalTest8c.exists() && !s_globalTest8c.isDestroyed()) {
s_globalTest8c()->q = nullptr;
}
}
|