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

#include "settings.h"

#include <klocalizedstring.h>

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

using namespace Killbots;

namespace Killbots {

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()
{
  Q_ASSERT(!s_globalSettings()->q);
  s_globalSettings()->q = this;
  setCurrentGroup( QStringLiteral( "General" ) );

  QList<KConfigSkeleton::ItemEnum::Choice> valuesMiddleClickAction;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Nothing");
    valuesMiddleClickAction.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Step");
    valuesMiddleClickAction.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("RepeatedStep");
    valuesMiddleClickAction.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Teleport");
    valuesMiddleClickAction.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("TeleportSafely");
    valuesMiddleClickAction.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("TeleportSafelyIfPossible");
    valuesMiddleClickAction.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("WaitOutRound");
    valuesMiddleClickAction.append( choice );
  }
  mMiddleClickActionItem = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "MiddleClickAction" ), mMiddleClickAction, valuesMiddleClickAction, RepeatedStep );
  mMiddleClickActionItem->setLabel( i18n("MiddleClickAction") );
  mMiddleClickActionItem->setToolTip( i18n("The action performed on a middle-click") );
  mMiddleClickActionItem->setWhatsThis( i18n("Selects the action performed when middle-clicking on the main game area. If a middle mouse button is not available, this action can be performed by left- and right-clicking simultaneously or by left-clicking while holding the control key.") );
  addItem( mMiddleClickActionItem, QStringLiteral( "MiddleClickAction" ) );
  QList<KConfigSkeleton::ItemEnum::Choice> valuesRightClickAction;
  mRightClickActionItem = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "RightClickAction" ), mRightClickAction, valuesRightClickAction, TeleportSafelyIfPossible );
  mRightClickActionItem->setLabel( i18n("RightClickAction") );
  mRightClickActionItem->setToolTip( i18n("The action performed on a right-click") );
  mRightClickActionItem->setWhatsThis( i18n("Selects the action performed when right-clicking on the main game area.") );
  addItem( mRightClickActionItem, QStringLiteral( "RightClickAction" ) );
  mAnimationSpeedItem = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "AnimationSpeed" ), mAnimationSpeed, 5 );
  mAnimationSpeedItem->setMinValue(0);
  mAnimationSpeedItem->setMaxValue(10);
  mAnimationSpeedItem->setLabel( i18n("AnimationSpeed") );
  mAnimationSpeedItem->setToolTip( i18n("The speed used to display animations") );
  mAnimationSpeedItem->setWhatsThis( i18n("Adjusts the speed at which the in game animations are displayed.") );
  addItem( mAnimationSpeedItem, QStringLiteral( "AnimationSpeed" ) );
  mPreventUnsafeMovesItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "PreventUnsafeMoves" ), mPreventUnsafeMoves, true );
  mPreventUnsafeMovesItem->setLabel( i18n("PreventUnsafeMoves") );
  mPreventUnsafeMovesItem->setToolTip( i18n("Prevent the player from making fatal moves") );
  mPreventUnsafeMovesItem->setWhatsThis( i18n("If checked, the game will ignore any move that would result in the immediate death of the hero (other than random teleports and waiting out the round).") );
  addItem( mPreventUnsafeMovesItem, QStringLiteral( "PreventUnsafeMoves" ) );
  mRulesetItem = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "Ruleset" ), mRuleset, QStringLiteral( "default.desktop" ) );
  mRulesetItem->setLabel( i18n("Ruleset") );
  mRulesetItem->setToolTip( i18n("The selected set of game rules") );
  mRulesetItem->setWhatsThis( i18n("Selects the set of game rules to be used in the next game.") );
  addItem( mRulesetItem, QStringLiteral( "Ruleset" ) );
}

QString Settings::defaultRulesetValue_helper()
{

  return QStringLiteral( "default.desktop" );
}

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

