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

#include "config.h"

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

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

  return s_globalConfig()->q;
}

Config *Config::create(QQmlEngine *, QJSEngine *)
{
  QQmlEngine::setObjectOwnership(self(), QQmlEngine::CppOwnership);
  return self();
}

Config::Config( QObject *parent )
  : KConfigSkeleton( QStringLiteral( "francisrc" ) )
{
  setParent(parent);
  Q_ASSERT(!s_globalConfig()->q);
  s_globalConfig()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&Config::itemChanged);

  setCurrentGroup( QStringLiteral( "General" ) );

  KConfigCompilerSignallingItem  *itemIntervalTime;
  KConfigSkeleton::ItemInt  *innerItemIntervalTime;
  innerItemIntervalTime = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "IntervalTime" ), mIntervalTime, 25 );
  itemIntervalTime = new KConfigCompilerSignallingItem(innerItemIntervalTime, this, notifyFunction, signalIntervalTimeChanged);
  addItem( itemIntervalTime, QStringLiteral( "IntervalTime" ) );
  KConfigCompilerSignallingItem  *itemBreakTime;
  KConfigSkeleton::ItemInt  *innerItemBreakTime;
  innerItemBreakTime = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "BreakTime" ), mBreakTime, 5 );
  itemBreakTime = new KConfigCompilerSignallingItem(innerItemBreakTime, this, notifyFunction, signalBreakTimeChanged);
  addItem( itemBreakTime, QStringLiteral( "BreakTime" ) );
  KConfigCompilerSignallingItem  *itemLongBreakTime;
  KConfigSkeleton::ItemInt  *innerItemLongBreakTime;
  innerItemLongBreakTime = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "LongBreakTime" ), mLongBreakTime, 20 );
  itemLongBreakTime = new KConfigCompilerSignallingItem(innerItemLongBreakTime, this, notifyFunction, signalLongBreakTimeChanged);
  addItem( itemLongBreakTime, QStringLiteral( "LongBreakTime" ) );
  KConfigCompilerSignallingItem  *itemCriticalUrgencyNotification;
  KConfigSkeleton::ItemBool  *innerItemCriticalUrgencyNotification;
  innerItemCriticalUrgencyNotification = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "CriticalUrgencyNotification" ), mCriticalUrgencyNotification, true );
  itemCriticalUrgencyNotification = new KConfigCompilerSignallingItem(innerItemCriticalUrgencyNotification, this, notifyFunction, signalCriticalUrgencyNotificationChanged);
  addItem( itemCriticalUrgencyNotification, QStringLiteral( "CriticalUrgencyNotification" ) );
}

int Config::defaultIntervalTimeValue_helper()
{

  return 25;
}

int Config::defaultBreakTimeValue_helper()
{

  return 5;
}

int Config::defaultLongBreakTimeValue_helper()
{

  return 20;
}

bool Config::defaultCriticalUrgencyNotificationValue_helper()
{

  return true;
}

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


void Config::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalIntervalTimeChanged:
    Q_EMIT IntervalTimeChanged();
    break;
  case signalBreakTimeChanged:
    Q_EMIT BreakTimeChanged();
    break;
  case signalLongBreakTimeChanged:
    Q_EMIT LongBreakTimeChanged();
    break;
  case signalCriticalUrgencyNotificationChanged:
    Q_EMIT CriticalUrgencyNotificationChanged();
    break;
  }
}
