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

#include "settings.h"

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

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

  return s_globalSettings()->q;
}

Settings::Settings( )
  : KConfigSkeleton( QStringLiteral( "ksnakeduelrc" ) )
{
  Q_ASSERT(!s_globalSettings()->q);
  s_globalSettings()->q = this;
  setCurrentGroup( QStringLiteral( "General" ) );

  KConfigSkeleton::ItemString  *itemTheme;
  itemTheme = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "Theme" ), mTheme, QStringLiteral( "themes/default.desktop" ) );
  addItem( itemTheme, QStringLiteral( "Theme" ) );

  setCurrentGroup( QStringLiteral( "Game" ) );

  KConfigSkeleton::ItemBool  *itemAcceleratorBlocked;
  itemAcceleratorBlocked = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "AcceleratorBlocked" ), mAcceleratorBlocked, false );
  addItem( itemAcceleratorBlocked, QStringLiteral( "AcceleratorBlocked" ) );
  KConfigSkeleton::ItemString  *itemNamePlayer1;
  itemNamePlayer1 = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "Name_Pl1" ), mNamePlayer1 );
  addItem( itemNamePlayer1, QStringLiteral( "NamePlayer1" ) );
  KConfigSkeleton::ItemString  *itemNamePlayer2;
  itemNamePlayer2 = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "Name_Pl2" ), mNamePlayer2 );
  addItem( itemNamePlayer2, QStringLiteral( "NamePlayer2" ) );
  QList<KConfigSkeleton::ItemEnum::Choice> valuesGameType;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("PlayerVSComputer");
    valuesGameType.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("PlayerVSPlayer");
    valuesGameType.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Snake");
    valuesGameType.append( choice );
  }
  KConfigSkeleton::ItemEnum  *itemGameType;
  itemGameType = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "GameType" ), mGameType, valuesGameType, EnumGameType::PlayerVSComputer );
  addItem( itemGameType, QStringLiteral( "GameType" ) );
  KConfigSkeleton::ItemInt  *itemRounds;
  itemRounds = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "Rounds" ), mRounds, 5 );
  addItem( itemRounds, QStringLiteral( "Rounds" ) );
}

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

