aboutsummaryrefslogtreecommitdiff
path: root/autotests/kconfig_compiler/test8c.cpp.ref
blob: 0759825c0ce01c3313db9effedd08f8635a88430 (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
// 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 <QtCore/QFile>

#include <QDebug>

class Test8cHelper
{
  public:
    Test8cHelper() : q(nullptr) {}
    ~Test8cHelper() { delete q; }
    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(config);
  s_globalTest8c()->q->read();
}

Test8c::Test8c(  KSharedConfig::Ptr config  )
  : KConfigSkeleton( config )
{
  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()
{
  s_globalTest8c()->q = nullptr;
}