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

#include "settings.h"

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

class SettingsHelper
{
  public:
    SettingsHelper() : q(nullptr) {}
    ~SettingsHelper() { 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()
{
  Q_ASSERT(!s_globalSettings()->q);
  s_globalSettings()->q = this;
  setCurrentGroup( QStringLiteral( "KGameTheme" ) );

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

  setCurrentGroup( QStringLiteral( "Notification Messages" ) );

  KConfigSkeleton::ItemBool  *itemAskDiscard;
  itemAskDiscard = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "askDiscard" ), mAskDiscard, true );
  addItem( itemAskDiscard, QStringLiteral( "askDiscard" ) );
  KConfigSkeleton::ItemString  *itemDontAskInternal;
  itemDontAskInternal = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "dontAskInternal" ), mDontAskInternal, QStringLiteral( "\"\"" ) );
  addItem( itemDontAskInternal, QStringLiteral( "dontAskInternal" ) );

  setCurrentGroup( QStringLiteral( "Preferences" ) );

  QList<KConfigSkeleton::ItemEnum::Choice> valuesanimationSpeed;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Instant");
    valuesanimationSpeed.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Fast");
    valuesanimationSpeed.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Normal");
    valuesanimationSpeed.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Slow");
    valuesanimationSpeed.append( choice );
  }
  KConfigSkeleton::ItemEnum  *itemAnimationSpeed;
  itemAnimationSpeed = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "animationSpeed" ), mAnimationSpeed, valuesanimationSpeed, EnumAnimationSpeed::Instant );
  addItem( itemAnimationSpeed, QStringLiteral( "animationSpeed" ) );
  KConfigSkeleton::ItemBool  *itemAnimateBoard;
  itemAnimateBoard = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "animateBoard" ), mAnimateBoard, false );
  addItem( itemAnimateBoard, QStringLiteral( "animateBoard" ) );
  KConfigSkeleton::ItemBool  *itemFlipBoard;
  itemFlipBoard = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "flipBoard" ), mFlipBoard, true );
  addItem( itemFlipBoard, QStringLiteral( "flipBoard" ) );
  KConfigSkeleton::ItemBool  *itemPlaySounds;
  itemPlaySounds = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "playSounds" ), mPlaySounds, true );
  addItem( itemPlaySounds, QStringLiteral( "playSounds" ) );
  QList<KConfigSkeleton::ItemEnum::Choice> valuesborderDisplayType;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("None");
    valuesborderDisplayType.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Border");
    valuesborderDisplayType.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Notation");
    valuesborderDisplayType.append( choice );
  }
  KConfigSkeleton::ItemEnum  *itemBorderDisplayType;
  itemBorderDisplayType = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "borderDisplayType" ), mBorderDisplayType, valuesborderDisplayType, EnumBorderDisplayType::None );
  addItem( itemBorderDisplayType, QStringLiteral( "borderDisplayType" ) );
  KConfigSkeleton::ItemBool  *itemShowDanger;
  itemShowDanger = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showDanger" ), mShowDanger, true );
  addItem( itemShowDanger, QStringLiteral( "showDanger" ) );
  KConfigSkeleton::ItemBool  *itemShowMarker;
  itemShowMarker = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showMarker" ), mShowMarker, true );
  addItem( itemShowMarker, QStringLiteral( "showMarker" ) );
  KConfigSkeleton::ItemBool  *itemShowMotion;
  itemShowMotion = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showMotion" ), mShowMotion, true );
  addItem( itemShowMotion, QStringLiteral( "showMotion" ) );
  KConfigSkeleton::ItemBool  *itemShowClock;
  itemShowClock = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showClock" ), mShowClock, true );
  addItem( itemShowClock, QStringLiteral( "showClock" ) );
  KConfigSkeleton::ItemBool  *itemShowChat;
  itemShowChat = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showChat" ), mShowChat, true );
  addItem( itemShowChat, QStringLiteral( "showChat" ) );
  KConfigSkeleton::ItemBool  *itemShowConsole;
  itemShowConsole = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showConsole" ), mShowConsole, false );
  addItem( itemShowConsole, QStringLiteral( "showConsole" ) );
  KConfigSkeleton::ItemBool  *itemShowHistory;
  itemShowHistory = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "showHistory" ), mShowHistory, true );
  addItem( itemShowHistory, QStringLiteral( "showHistory" ) );

  setCurrentGroup( QStringLiteral( "Time Control" ) );

  KConfigSkeleton::ItemInt  *itemTimeLimit;
  itemTimeLimit = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "timeLimit" ), mTimeLimit, 10 );
  addItem( itemTimeLimit, QStringLiteral( "timeLimit" ) );
  KConfigSkeleton::ItemInt  *itemTimeIncrement;
  itemTimeIncrement = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "timeIncrement" ), mTimeIncrement, 0 );
  addItem( itemTimeIncrement, QStringLiteral( "timeIncrement" ) );
  KConfigSkeleton::ItemInt  *itemNumberOfMoves;
  itemNumberOfMoves = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "numberOfMoves" ), mNumberOfMoves, 40 );
  addItem( itemNumberOfMoves, QStringLiteral( "numberOfMoves" ) );
  KConfigSkeleton::ItemBool  *itemTimeEnabled;
  itemTimeEnabled = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "timeEnabled" ), mTimeEnabled, false );
  addItem( itemTimeEnabled, QStringLiteral( "timeEnabled" ) );

  setCurrentGroup( QStringLiteral( "Protocols" ) );

  QList<KConfigSkeleton::ItemEnum::Choice> valuesplayer1Protocol;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Local");
    valuesplayer1Protocol.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("XBoard");
    valuesplayer1Protocol.append( choice );
  }
  KConfigSkeleton::ItemEnum  *itemPlayer1Protocol;
  itemPlayer1Protocol = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "player1Protocol" ), mPlayer1Protocol, valuesplayer1Protocol, EnumPlayer1Protocol::Local );
  addItem( itemPlayer1Protocol, QStringLiteral( "player1Protocol" ) );
  QList<KConfigSkeleton::ItemEnum::Choice> valuesplayer2Protocol;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Local");
    valuesplayer2Protocol.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("XBoard");
    valuesplayer2Protocol.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Fics");
    valuesplayer2Protocol.append( choice );
  }
  KConfigSkeleton::ItemEnum  *itemPlayer2Protocol;
  itemPlayer2Protocol = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "player2Protocol" ), mPlayer2Protocol, valuesplayer2Protocol, EnumPlayer2Protocol::Local );
  addItem( itemPlayer2Protocol, QStringLiteral( "player2Protocol" ) );
  QList<KConfigSkeleton::ItemEnum::Choice> valuescolor;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("NoColor");
    valuescolor.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("White");
    valuescolor.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Black");
    valuescolor.append( choice );
  }
  KConfigSkeleton::ItemEnum  *itemColor;
  itemColor = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "color" ), mColor, valuescolor, EnumColor::NoColor );
  addItem( itemColor, QStringLiteral( "color" ) );
  QStringList defaultprograms;
  defaultprograms.append( QString::fromUtf8( "gnuchess" ) );
  defaultprograms.append( QString::fromUtf8( "crafty" ) );

  KConfigSkeleton::ItemStringList  *itemPrograms;
  itemPrograms = new KConfigSkeleton::ItemStringList( currentGroup(), QStringLiteral( "programs" ), mPrograms, defaultprograms );
  addItem( itemPrograms, QStringLiteral( "programs" ) );
  KConfigSkeleton::ItemString  *itemPlayer1Program;
  itemPlayer1Program = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "player1Program" ), mPlayer1Program, QStringLiteral( "gnuchess" ) );
  addItem( itemPlayer1Program, QStringLiteral( "player1Program" ) );
  KConfigSkeleton::ItemString  *itemPlayer2Program;
  itemPlayer2Program = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "player2Program" ), mPlayer2Program, QStringLiteral( "gnuchess" ) );
  addItem( itemPlayer2Program, QStringLiteral( "player2Program" ) );
  KConfigSkeleton::ItemInt  *itemComputerSearchDepth;
  itemComputerSearchDepth = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "computerSearchDepth" ), mComputerSearchDepth, 29 );
  addItem( itemComputerSearchDepth, QStringLiteral( "computerSearchDepth" ) );
  KConfigSkeleton::ItemInt  *itemComputerMemorySize;
  itemComputerMemorySize = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "computerMemorySize" ), mComputerMemorySize, 50 );
  addItem( itemComputerMemorySize, QStringLiteral( "computerMemorySize" ) );
  QStringList defaultservers;
  defaultservers.append( QString::fromUtf8( "freechess.org" ) );

  KConfigSkeleton::ItemStringList  *itemServers;
  itemServers = new KConfigSkeleton::ItemStringList( currentGroup(), QStringLiteral( "servers" ), mServers, defaultservers );
  addItem( itemServers, QStringLiteral( "servers" ) );
  KConfigSkeleton::ItemString  *itemCurrentServer;
  itemCurrentServer = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "currentServer" ), mCurrentServer, QStringLiteral( "freechess.org" ) );
  addItem( itemCurrentServer, QStringLiteral( "currentServer" ) );
  KConfigSkeleton::ItemString  *itemFicsUsername;
  itemFicsUsername = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "ficsUsername" ), mFicsUsername );
  addItem( itemFicsUsername, QStringLiteral( "ficsUsername" ) );
  KConfigSkeleton::ItemBool  *itemGuest;
  itemGuest = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "guest" ), mGuest, false );
  addItem( itemGuest, QStringLiteral( "guest" ) );
  KConfigSkeleton::ItemBool  *itemAutoLogin;
  itemAutoLogin = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "autoLogin" ), mAutoLogin, false );
  addItem( itemAutoLogin, QStringLiteral( "autoLogin" ) );
  KConfigSkeleton::ItemInt  *itemComputerDelay;
  itemComputerDelay = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "computerDelay" ), mComputerDelay, 500 );
  addItem( itemComputerDelay, QStringLiteral( "computerDelay" ) );
  QStringList defaultengineConfigurations;
  defaultengineConfigurations.append( QString::fromUtf8( "GNU Chess:gnuchess:xboard" ) );
  defaultengineConfigurations.append( QString::fromUtf8( "Crafty:crafty:xboard" ) );
  defaultengineConfigurations.append( QString::fromUtf8( "Stockfish:stockfish:uci" ) );
  defaultengineConfigurations.append( QString::fromUtf8( "Sjeng:sjeng:xboard" ) );

  KConfigSkeleton::ItemStringList  *itemEngineConfigurations;
  itemEngineConfigurations = new KConfigSkeleton::ItemStringList( currentGroup(), QStringLiteral( "engineConfigurations" ), mEngineConfigurations, defaultengineConfigurations );
  addItem( itemEngineConfigurations, QStringLiteral( "engineConfigurations" ) );

  setCurrentGroup( QStringLiteral( "Accessibility" ) );

  KConfigSkeleton::ItemBool  *itemSpeakOpponentsMoves;
  itemSpeakOpponentsMoves = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "speakOpponentsMoves" ), mSpeakOpponentsMoves, true );
  addItem( itemSpeakOpponentsMoves, QStringLiteral( "speakOpponentsMoves" ) );
  KConfigSkeleton::ItemBool  *itemAllowExternalControl;
  itemAllowExternalControl = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "allowExternalControl" ), mAllowExternalControl, true );
  addItem( itemAllowExternalControl, QStringLiteral( "allowExternalControl" ) );
}

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

