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

#include "TellySkoutSettings.h"

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

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

  return s_globalTellySkoutSettings()->q;
}

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

TellySkoutSettings::TellySkoutSettings( )
  : KConfigSkeleton( QStringLiteral( "tellyskoutrc" ) )
{
  Q_ASSERT(!s_globalTellySkoutSettings()->q);
  s_globalTellySkoutSettings()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&TellySkoutSettings::itemChanged);

  setCurrentGroup( QStringLiteral( "General" ) );

  KConfigCompilerSignallingItem  *itemDeleteProgramAfter;
  KConfigSkeleton::ItemUInt  *innerItemDeleteProgramAfter;
  innerItemDeleteProgramAfter = new KConfigSkeleton::ItemUInt( currentGroup(), QStringLiteral( "deleteProgramAfter" ), mDeleteProgramAfter, 1 );
  itemDeleteProgramAfter = new KConfigCompilerSignallingItem(innerItemDeleteProgramAfter, this, notifyFunction, signalDeleteProgramAfterChanged);
  addItem( itemDeleteProgramAfter, QStringLiteral( "deleteProgramAfter" ) );
  QList<KConfigSkeleton::ItemEnum::Choice> valuesfetcher;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("TVSpielfilm");
    valuesfetcher.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("XMLTV");
    valuesfetcher.append( choice );
  }
  KConfigCompilerSignallingItem  *itemFetcher;
  KConfigSkeleton::ItemEnum  *innerItemFetcher;
  innerItemFetcher = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "fetcher" ), mFetcher, valuesfetcher );
  itemFetcher = new KConfigCompilerSignallingItem(innerItemFetcher, this, notifyFunction, signalFetcherChanged);
  innerItemFetcher->setValueForChoice(QStringLiteral( "TVSpielfilm" ), QStringLiteral( "TV Spielfilm" ));
  innerItemFetcher->setValueForChoice(QStringLiteral( "XMLTV" ), QStringLiteral( "XMLTV" ));
  addItem( itemFetcher, QStringLiteral( "fetcher" ) );

  setCurrentGroup( QStringLiteral( "UI" ) );

  KConfigCompilerSignallingItem  *itemProgramHeight;
  KConfigSkeleton::ItemUInt  *innerItemProgramHeight;
  innerItemProgramHeight = new KConfigSkeleton::ItemUInt( currentGroup(), QStringLiteral( "programHeight" ), mProgramHeight, 5 );
  itemProgramHeight = new KConfigCompilerSignallingItem(innerItemProgramHeight, this, notifyFunction, signalProgramHeightChanged);
  addItem( itemProgramHeight, QStringLiteral( "programHeight" ) );
  KConfigCompilerSignallingItem  *itemColumnWidth;
  KConfigSkeleton::ItemUInt  *innerItemColumnWidth;
  innerItemColumnWidth = new KConfigSkeleton::ItemUInt( currentGroup(), QStringLiteral( "columnWidth" ), mColumnWidth, 200 );
  itemColumnWidth = new KConfigCompilerSignallingItem(innerItemColumnWidth, this, notifyFunction, signalColumnWidthChanged);
  addItem( itemColumnWidth, QStringLiteral( "columnWidth" ) );
  KConfigCompilerSignallingItem  *itemFontSize;
  KConfigSkeleton::ItemUInt  *innerItemFontSize;
  innerItemFontSize = new KConfigSkeleton::ItemUInt( currentGroup(), QStringLiteral( "fontSize" ), mFontSize, 12 );
  itemFontSize = new KConfigCompilerSignallingItem(innerItemFontSize, this, notifyFunction, signalFontSizeChanged);
  addItem( itemFontSize, QStringLiteral( "fontSize" ) );
  KConfigCompilerSignallingItem  *itemShowDateSelection;
  KConfigSkeleton::ItemBool  *innerItemShowDateSelection;
  innerItemShowDateSelection = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showDateSelection" ), mShowDateSelection, true );
  itemShowDateSelection = new KConfigCompilerSignallingItem(innerItemShowDateSelection, this, notifyFunction, signalShowDateSelectionChanged);
  addItem( itemShowDateSelection, QStringLiteral( "showDateSelection" ) );

  setCurrentGroup( QStringLiteral( "TVSpielfilm" ) );

  KConfigCompilerSignallingItem  *itemTvSpielfilmPrefetch;
  KConfigSkeleton::ItemUInt  *innerItemTvSpielfilmPrefetch;
  innerItemTvSpielfilmPrefetch = new KConfigSkeleton::ItemUInt( currentGroup(), QStringLiteral( "tvSpielfilmPrefetch" ), mTvSpielfilmPrefetch, 0 );
  itemTvSpielfilmPrefetch = new KConfigCompilerSignallingItem(innerItemTvSpielfilmPrefetch, this, notifyFunction, signalTvSpielfilmPrefetchChanged);
  addItem( itemTvSpielfilmPrefetch, QStringLiteral( "tvSpielfilmPrefetch" ) );

  setCurrentGroup( QStringLiteral( "XMLTV" ) );

  KConfigCompilerSignallingItem  *itemXmltvFile;
  KConfigSkeleton::ItemString  *innerItemXmltvFile;
  innerItemXmltvFile = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "xmltvFile" ), mXmltvFile );
  itemXmltvFile = new KConfigCompilerSignallingItem(innerItemXmltvFile, this, notifyFunction, signalXmltvFileChanged);
  addItem( itemXmltvFile, QStringLiteral( "xmltvFile" ) );
}

uint TellySkoutSettings::defaultDeleteProgramAfterValue_helper()
{

  return 1;
}

uint TellySkoutSettings::defaultProgramHeightValue_helper()
{

  return 5;
}

uint TellySkoutSettings::defaultColumnWidthValue_helper()
{

  return 200;
}

uint TellySkoutSettings::defaultFontSizeValue_helper()
{

  return 12;
}

bool TellySkoutSettings::defaultShowDateSelectionValue_helper()
{

  return true;
}

uint TellySkoutSettings::defaultTvSpielfilmPrefetchValue_helper()
{

  return 0;
}

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


void TellySkoutSettings::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalDeleteProgramAfterChanged:
    Q_EMIT deleteProgramAfterChanged();
    break;
  case signalFetcherChanged:
    Q_EMIT fetcherChanged();
    break;
  case signalProgramHeightChanged:
    Q_EMIT programHeightChanged();
    break;
  case signalColumnWidthChanged:
    Q_EMIT columnWidthChanged();
    break;
  case signalFontSizeChanged:
    Q_EMIT fontSizeChanged();
    break;
  case signalShowDateSelectionChanged:
    Q_EMIT showDateSelectionChanged();
    break;
  case signalTvSpielfilmPrefetchChanged:
    Q_EMIT tvSpielfilmPrefetchChanged();
    break;
  case signalXmltvFileChanged:
    Q_EMIT xmltvFileChanged();
    break;
  }
}
