aboutsummaryrefslogtreecommitdiff
path: root/autotests/kconfig_compiler/test_signal.cpp.ref
blob: 8afd674186408d1c583cbd7dc42c9df9dd6c341a (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
// 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 <QtCore/QFile>

class TestSignalHelper
{
  public:
    TestSignalHelper() : q(0) {}
    ~TestSignalHelper() { delete q; }
    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;
  itemEmoticonTheme = new KConfigCompilerSignallingItem(new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "emoticonTheme" ), mEmoticonTheme, QStringLiteral( "Default" ) ), this, notifyFunction, signalEmoticonSettingsChanged);
  addItem( itemEmoticonTheme, QStringLiteral( "emoticonTheme" ) );
  KConfigCompilerSignallingItem  *itemUseEmoticon;
  itemUseEmoticon = new KConfigCompilerSignallingItem(new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "useEmoticon" ), mUseEmoticon, true ), this, notifyFunction, signalEmoticonSettingsChanged);
  addItem( itemUseEmoticon, QStringLiteral( "useEmoticon" ) );
  KConfigCompilerSignallingItem  *itemEmoticonRequireSpace;
  itemEmoticonRequireSpace = new KConfigCompilerSignallingItem(new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "emoticonRequireSpace" ), mEmoticonRequireSpace, true ), this, notifyFunction, signalEmoticonSettingsChanged);
  addItem( itemEmoticonRequireSpace, QStringLiteral( "emoticonRequireSpace" ) );
  KConfigCompilerSignallingItem  *itemStylePath;
  itemStylePath = new KConfigCompilerSignallingItem(new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "stylePath" ), mStylePath ), 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 = 0;
}

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"