aboutsummaryrefslogtreecommitdiff
path: root/autotests/kconfig_compiler/test_signal.cpp.ref
blob: 71ab7a0975e51a7b5054dae86727dc6e7a2cdc91 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// This file is generated by kconfig_compiler_kf5 from test_signal.kcfg.
// All changes you do to this file will be lost.

#include "test_signal.h"

#include <qglobal.h>
#include <QFile>

class TestSignalHelper
{
  public:
    TestSignalHelper() : q(nullptr) {}
    ~TestSignalHelper() { delete q; }
    TestSignalHelper(const TestSignalHelper&) = delete;
    TestSignalHelper& operator=(const TestSignalHelper&) = delete;
    TestSignal *q;
};
Q_GLOBAL_STATIC(TestSignalHelper, s_globalTestSignal)
TestSignal *TestSignal::self()
{
  if (!s_globalTestSignal()->q) {
    new TestSignal;
    s_globalTestSignal()->q->read();
  }

  return s_globalTestSignal()->q;
}

TestSignal::TestSignal( )
  : KConfigSkeleton( QStringLiteral( "kconfig_compiler_kf5_test_rc" ) )
  , mSettingsChanged(0)
{
  Q_ASSERT(!s_globalTestSignal()->q);
  s_globalTestSignal()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&TestSignal::itemChanged);

  setCurrentGroup( QStringLiteral( "Appearance" ) );

  KConfigCompilerSignallingItem  *itemEmoticonTheme;
  KConfigSkeleton::ItemString  *innerItemEmoticonTheme;
  innerItemEmoticonTheme = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "emoticonTheme" ), mEmoticonTheme, QStringLiteral( "Default" ) );
  itemEmoticonTheme = new KConfigCompilerSignallingItem(innerItemEmoticonTheme, this, notifyFunction, signalEmoticonSettingsChanged);
  addItem( itemEmoticonTheme, QStringLiteral( "emoticonTheme" ) );
  KConfigCompilerSignallingItem  *itemUseEmoticon;
  KConfigSkeleton::ItemBool  *innerItemUseEmoticon;
  innerItemUseEmoticon = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "useEmoticon" ), mUseEmoticon, true );
  itemUseEmoticon = new KConfigCompilerSignallingItem(innerItemUseEmoticon, this, notifyFunction, signalEmoticonSettingsChanged);
  addItem( itemUseEmoticon, QStringLiteral( "useEmoticon" ) );
  KConfigCompilerSignallingItem  *itemEmoticonRequireSpace;
  KConfigSkeleton::ItemBool  *innerItemEmoticonRequireSpace;
  innerItemEmoticonRequireSpace = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "emoticonRequireSpace" ), mEmoticonRequireSpace, true );
  itemEmoticonRequireSpace = new KConfigCompilerSignallingItem(innerItemEmoticonRequireSpace, this, notifyFunction, signalEmoticonSettingsChanged);
  addItem( itemEmoticonRequireSpace, QStringLiteral( "emoticonRequireSpace" ) );
  KConfigCompilerSignallingItem  *itemStylePath;
  KConfigSkeleton::ItemString  *innerItemStylePath;
  innerItemStylePath = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "stylePath" ), mStylePath );
  itemStylePath = new KConfigCompilerSignallingItem(innerItemStylePath, this, notifyFunction, signalStyleChanged);
  addItem( itemStylePath, QStringLiteral( "stylePath" ) );
  KConfigSkeleton::ItemString  *itemStyleCSSVariant;
  itemStyleCSSVariant = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "styleVariant" ), mStyleCSSVariant );
  addItem( itemStyleCSSVariant, QStringLiteral( "StyleCSSVariant" ) );
}

TestSignal::~TestSignal()
{
  s_globalTestSignal()->q = nullptr;
}

bool TestSignal::usrSave()
{
  const bool res = KConfigSkeleton::usrSave();
  if (!res) return false;

  if ( mSettingsChanged & signalEmoticonSettingsChanged )
    Q_EMIT emoticonSettingsChanged();
  if ( mSettingsChanged & signalStyleChanged )
    Q_EMIT styleChanged(mStylePath, mStyleCSSVariant);
  mSettingsChanged = 0;
  return true;
}

void TestSignal::itemChanged(quint64 flags) {
  mSettingsChanged |= flags;

}

#include "test_signal.moc"