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

#include "preferences.h"

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

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

  return s_globalPreferences()->q;
}

Preferences::Preferences( )
  : KConfigSkeleton( QStringLiteral( "kigorc" ) )
{
  Q_ASSERT(!s_globalPreferences()->q);
  s_globalPreferences()->q = this;
  setCurrentGroup( QStringLiteral( "Backend" ) );

  KConfigSkeleton::ItemString  *itemEngineCommand;
  itemEngineCommand = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "EngineCommand" ), mEngineCommand, 
                QStandardPaths::findExecutable(QStringLiteral("gnugo")) + QStringLiteral(" --mode gtp")
             );
  addItem( itemEngineCommand, QStringLiteral( "EngineCommand" ) );
  KConfigSkeleton::ItemBool  *itemEngineWorking;
  itemEngineWorking = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "EngineWorking" ), mEngineWorking, true );
  addItem( itemEngineWorking, QStringLiteral( "EngineWorking" ) );

  setCurrentGroup( QStringLiteral( "UserInterface" ) );

  KConfigSkeleton::ItemString  *itemTheme;
  itemTheme = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "Theme" ), mTheme, QStringLiteral( "default" ) );
  addItem( itemTheme, QStringLiteral( "Theme" ) );
  KConfigSkeleton::ItemBool  *itemShowBoardLabels;
  itemShowBoardLabels = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ShowBoardLabels" ), mShowBoardLabels, true );
  addItem( itemShowBoardLabels, QStringLiteral( "ShowBoardLabels" ) );
  KConfigSkeleton::ItemBool  *itemShowMoveNumbers;
  itemShowMoveNumbers = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ShowMoveNumbers" ), mShowMoveNumbers, false );
  addItem( itemShowMoveNumbers, QStringLiteral( "ShowMoveNumbers" ) );
  KConfigSkeleton::ItemDouble  *itemHintVisibleTime;
  itemHintVisibleTime = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "HintVisibleTime" ), mHintVisibleTime, 3.0 );
  itemHintVisibleTime->setMinValue(1.0);
  itemHintVisibleTime->setMaxValue(5.0);
  addItem( itemHintVisibleTime, QStringLiteral( "HintVisibleTime" ) );

  setCurrentGroup( QStringLiteral( "Game" ) );

  KConfigSkeleton::ItemBool  *itemBlackPlayerHuman;
  itemBlackPlayerHuman = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "BlackPlayerHuman" ), mBlackPlayerHuman, true );
  addItem( itemBlackPlayerHuman, QStringLiteral( "BlackPlayerHuman" ) );
  KConfigSkeleton::ItemString  *itemBlackPlayerName;
  itemBlackPlayerName = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "BlackPlayerName" ), mBlackPlayerName, i18n("Black Player") );
  addItem( itemBlackPlayerName, QStringLiteral( "BlackPlayerName" ) );
  KConfigSkeleton::ItemInt  *itemBlackPlayerStrength;
  itemBlackPlayerStrength = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "BlackPlayerStrength" ), mBlackPlayerStrength, 10 );
  itemBlackPlayerStrength->setMinValue(1);
  itemBlackPlayerStrength->setMaxValue(10);
  addItem( itemBlackPlayerStrength, QStringLiteral( "BlackPlayerStrength" ) );
  KConfigSkeleton::ItemBool  *itemWhitePlayerHuman;
  itemWhitePlayerHuman = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "WhitePlayerHuman" ), mWhitePlayerHuman, false );
  addItem( itemWhitePlayerHuman, QStringLiteral( "WhitePlayerHuman" ) );
  KConfigSkeleton::ItemString  *itemWhitePlayerName;
  itemWhitePlayerName = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "WhitePlayerName" ), mWhitePlayerName, i18n("White Player") );
  addItem( itemWhitePlayerName, QStringLiteral( "WhitePlayerName" ) );
  KConfigSkeleton::ItemInt  *itemWhitePlayerStrength;
  itemWhitePlayerStrength = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "WhitePlayerStrength" ), mWhitePlayerStrength, 1 );
  itemWhitePlayerStrength->setMinValue(1);
  itemWhitePlayerStrength->setMaxValue(10);
  addItem( itemWhitePlayerStrength, QStringLiteral( "WhitePlayerStrength" ) );
  KConfigSkeleton::ItemInt  *itemBoardSize;
  itemBoardSize = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "BoardSize" ), mBoardSize, 9 );
  itemBoardSize->setMinValue(3);
  itemBoardSize->setMaxValue(19);
  addItem( itemBoardSize, QStringLiteral( "BoardSize" ) );
  KConfigSkeleton::ItemDouble  *itemKomi;
  itemKomi = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "Komi" ), mKomi, 4.5 );
  itemKomi->setMinValue(0);
  itemKomi->setMaxValue(50);
  addItem( itemKomi, QStringLiteral( "Komi" ) );
  KConfigSkeleton::ItemInt  *itemFixedHandicapValue;
  itemFixedHandicapValue = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "FixedHandicapValue" ), mFixedHandicapValue, 4 );
  itemFixedHandicapValue->setMinValue(1);
  itemFixedHandicapValue->setMaxValue(9);
  addItem( itemFixedHandicapValue, QStringLiteral( "FixedHandicapValue" ) );
}

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

