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

#include "options.h"

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

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

  return s_globalOptions()->q;
}

Options::Options( )
  : KConfigSkeleton( QStringLiteral( "kspaceduelrc" ) )
{
  Q_ASSERT(!s_globalOptions()->q);
  s_globalOptions()->q = this;
  setCurrentGroup( QStringLiteral( "Game" ) );

  KConfigSkeleton::ItemDouble  *itemTimeAfterKill;
  itemTimeAfterKill = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "timeAfterKill" ), mTimeAfterKill, 42.9 );
  addItem( itemTimeAfterKill, QStringLiteral( "TimeAfterKill" ) );
  KConfigSkeleton::ItemInt  *itemStartHitPoints[2];
  itemStartHitPoints[0] = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "startHitPointsP0" ), mStartHitPoints[0], 99 );
  itemStartHitPoints[0]->setMinValue(1);
  itemStartHitPoints[0]->setMaxValue(99);
  addItem( itemStartHitPoints[0], QStringLiteral( "StartHitPoints0" ) );
  itemStartHitPoints[1] = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "startHitPointsP1" ), mStartHitPoints[1], 99 );
  itemStartHitPoints[1]->setMinValue(1);
  itemStartHitPoints[1]->setMaxValue(99);
  addItem( itemStartHitPoints[1], QStringLiteral( "StartHitPoints1" ) );
  KConfigSkeleton::ItemBool  *itemPlayerIsAi[2];
  itemPlayerIsAi[0] = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "player0IsAi" ), mPlayerIsAi[0], false );
  addItem( itemPlayerIsAi[0], QStringLiteral( "Player0IsAi" ) );
  itemPlayerIsAi[1] = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "player1IsAi" ), mPlayerIsAi[1], true );
  addItem( itemPlayerIsAi[1], QStringLiteral( "Player1IsAi" ) );
  QList<KConfigSkeleton::ItemEnum::Choice> valuesAiDifficulty;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Trainee");
    valuesAiDifficulty.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Normal");
    valuesAiDifficulty.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Hard");
    valuesAiDifficulty.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Insane");
    valuesAiDifficulty.append( choice );
  }
  KConfigSkeleton::ItemEnum  *itemAiDifficulty[2];
  itemAiDifficulty[0] = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "ai0Difficulty" ), mAiDifficulty[0], valuesAiDifficulty, EnumAiDifficulty::Normal );
  addItem( itemAiDifficulty[0], QStringLiteral( "AiDifficulty0" ) );
  itemAiDifficulty[1] = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "ai1Difficulty" ), mAiDifficulty[1], valuesAiDifficulty, EnumAiDifficulty::Normal );
  addItem( itemAiDifficulty[1], QStringLiteral( "AiDifficulty1" ) );
  KConfigSkeleton::ItemInt  *itemLastConfig;
  itemLastConfig = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "lastConfig" ), mLastConfig, 0 );
  addItem( itemLastConfig, QStringLiteral( "LastConfig" ) );
  KConfigSkeleton::ItemInt  *itemRefreshTime;
  itemRefreshTime = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "refreshTime" ), mRefreshTime, 33 );
  itemRefreshTime->setMinValue(10);
  itemRefreshTime->setMaxValue(100);
  addItem( itemRefreshTime, QStringLiteral( "RefreshTime" ) );
}

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

