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

#include "alligatorsettings.h"

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

class AlligatorSettingsHelper
{
  public:
    AlligatorSettingsHelper() noexcept : q(nullptr) {}
    ~AlligatorSettingsHelper() noexcept { delete q; q = nullptr; }
    AlligatorSettingsHelper(const AlligatorSettingsHelper&) = delete;
    AlligatorSettingsHelper& operator=(const AlligatorSettingsHelper&) = delete;
    AlligatorSettings *q;
};
Q_GLOBAL_STATIC(AlligatorSettingsHelper, s_globalAlligatorSettings)
AlligatorSettings *AlligatorSettings::self()
{
  if (!s_globalAlligatorSettings()->q) {
    new AlligatorSettings;
    s_globalAlligatorSettings()->q->read();
  }

  return s_globalAlligatorSettings()->q;
}

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

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

  setCurrentGroup( QStringLiteral( "General" ) );

  KConfigCompilerSignallingItem  *itemDeleteAfterCount;
  KConfigSkeleton::ItemInt  *innerItemDeleteAfterCount;
  innerItemDeleteAfterCount = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "deleteAfterCount" ), mDeleteAfterCount, 2 );
  itemDeleteAfterCount = new KConfigCompilerSignallingItem(innerItemDeleteAfterCount, this, notifyFunction, signalDeleteAfterCountChanged);
  addItem( itemDeleteAfterCount, QStringLiteral( "deleteAfterCount" ) );
  KConfigCompilerSignallingItem  *itemArticleFontSize;
  KConfigSkeleton::ItemInt  *innerItemArticleFontSize;
  innerItemArticleFontSize = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "articleFontSize" ), mArticleFontSize, 10 );
  itemArticleFontSize = new KConfigCompilerSignallingItem(innerItemArticleFontSize, this, notifyFunction, signalArticleFontSizeChanged);
  addItem( itemArticleFontSize, QStringLiteral( "articleFontSize" ) );
  KConfigCompilerSignallingItem  *itemArticleFontUseSystem;
  KConfigSkeleton::ItemBool  *innerItemArticleFontUseSystem;
  innerItemArticleFontUseSystem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "articleFontUseSystem" ), mArticleFontUseSystem, true );
  itemArticleFontUseSystem = new KConfigCompilerSignallingItem(innerItemArticleFontUseSystem, this, notifyFunction, signalArticleFontUseSystemChanged);
  addItem( itemArticleFontUseSystem, QStringLiteral( "articleFontUseSystem" ) );
  KConfigCompilerSignallingItem  *itemDeleteAfterType;
  KConfigSkeleton::ItemInt  *innerItemDeleteAfterType;
  innerItemDeleteAfterType = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "deleteAfterType" ), mDeleteAfterType, 3 );
  itemDeleteAfterType = new KConfigCompilerSignallingItem(innerItemDeleteAfterType, this, notifyFunction, signalDeleteAfterTypeChanged);
  addItem( itemDeleteAfterType, QStringLiteral( "deleteAfterType" ) );
  KConfigCompilerSignallingItem  *itemSidebarCollapsed;
  KConfigSkeleton::ItemBool  *innerItemSidebarCollapsed;
  innerItemSidebarCollapsed = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "sidebarCollapsed" ), mSidebarCollapsed, false );
  itemSidebarCollapsed = new KConfigCompilerSignallingItem(innerItemSidebarCollapsed, this, notifyFunction, signalSidebarCollapsedChanged);
  addItem( itemSidebarCollapsed, QStringLiteral( "sidebarCollapsed" ) );
}

int AlligatorSettings::defaultDeleteAfterCountValue_helper()
{

  return 2;
}

int AlligatorSettings::defaultArticleFontSizeValue_helper()
{

  return 10;
}

bool AlligatorSettings::defaultArticleFontUseSystemValue_helper()
{

  return true;
}

int AlligatorSettings::defaultDeleteAfterTypeValue_helper()
{

  return 3;
}

bool AlligatorSettings::defaultSidebarCollapsedValue_helper()
{

  return false;
}

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


void AlligatorSettings::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalDeleteAfterCountChanged:
    Q_EMIT deleteAfterCountChanged();
    break;
  case signalArticleFontSizeChanged:
    Q_EMIT articleFontSizeChanged();
    break;
  case signalArticleFontUseSystemChanged:
    Q_EMIT articleFontUseSystemChanged();
    break;
  case signalDeleteAfterTypeChanged:
    Q_EMIT deleteAfterTypeChanged();
    break;
  case signalSidebarCollapsedChanged:
    Q_EMIT sidebarCollapsedChanged();
    break;
  }
}
