// This file is generated by kconfig_compiler_kf6 from kclockdsettings.kcfg.
// All changes you do to this file will be lost.

#include "kclockdsettings.h"

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

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

  return s_globalKClockSettings()->q;
}

KClockSettings::KClockSettings( )
  : KConfigSkeleton( QStringLiteral( "kclockrc" ) )
{
  Q_ASSERT(!s_globalKClockSettings()->q);
  s_globalKClockSettings()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&KClockSettings::itemChanged);

  setCurrentGroup( QStringLiteral( "Global" ) );

  KConfigCompilerSignallingItem  *itemTimeFormat;
  KConfigSkeleton::ItemString  *innerItemTimeFormat;
  innerItemTimeFormat = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "timeFormat" ), mTimeFormat, QStringLiteral( "SystemDefault" ) );
  itemTimeFormat = new KConfigCompilerSignallingItem(innerItemTimeFormat, this, notifyFunction, signalTimeFormatChanged);
  addItem( itemTimeFormat, QStringLiteral( "timeFormat" ) );
  QList<KConfigSkeleton::ItemEnum::Choice> valuestimerNotification;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Never");
    valuestimerNotification.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("WhenKClockNotRunning");
    valuestimerNotification.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Always");
    valuestimerNotification.append( choice );
  }
  KConfigCompilerSignallingItem  *itemTimerNotification;
  KConfigSkeleton::ItemEnum  *innerItemTimerNotification;
  innerItemTimerNotification = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "timerNotification" ), mTimerNotification, valuestimerNotification, WhenKClockNotRunning );
  itemTimerNotification = new KConfigCompilerSignallingItem(innerItemTimerNotification, this, notifyFunction, signalTimerNotificationChanged);
  addItem( itemTimerNotification, QStringLiteral( "timerNotification" ) );
}

QString KClockSettings::defaultTimeFormatValue_helper()
{

  return QStringLiteral( "SystemDefault" );
}

int KClockSettings::defaultTimerNotificationValue_helper()
{

  return WhenKClockNotRunning;
}

KClockSettings::~KClockSettings()
{
  if (s_globalKClockSettings.exists() && !s_globalKClockSettings.isDestroyed()) {
    s_globalKClockSettings()->q = nullptr;
  }
}


void KClockSettings::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalTimeFormatChanged:
    Q_EMIT timeFormatChanged();
    break;
  case signalTimerNotificationChanged:
    Q_EMIT timerNotificationChanged();
    break;
  }
}
