// This file is generated by kconfig_compiler_kf6 from kmines.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( "kminesrc" ) )
{
  Q_ASSERT(!s_globalSettings()->q);
  s_globalSettings()->q = this;
  setCurrentGroup( QStringLiteral( "General" ) );

  KConfigSkeleton::ItemBool  *itemUseQuestionMarks;
  itemUseQuestionMarks = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "question mark" ), mUseQuestionMarks, true );
  addItem( itemUseQuestionMarks, QStringLiteral( "UseQuestionMarks" ) );
  KConfigSkeleton::ItemBool  *itemAllowKminesReset;
  itemAllowKminesReset = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "kmines_reset" ), mAllowKminesReset, true );
  addItem( itemAllowKminesReset, QStringLiteral( "AllowKminesReset" ) );
  KConfigSkeleton::ItemBool  *itemDisableScoreOnReset;
  itemDisableScoreOnReset = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "disable_score_on_reset" ), mDisableScoreOnReset, false );
  addItem( itemDisableScoreOnReset, QStringLiteral( "DisableScoreOnReset" ) );
  KConfigSkeleton::ItemBool  *itemExploreWithLeftClickOnNumberCells;
  itemExploreWithLeftClickOnNumberCells = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "explore_with_left_click_on_number_cells" ), mExploreWithLeftClickOnNumberCells, false );
  addItem( itemExploreWithLeftClickOnNumberCells, QStringLiteral( "ExploreWithLeftClickOnNumberCells" ) );
  QList<KConfigSkeleton::ItemEnum::Choice> valuesPlaceFlagOn;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("MouseRelease");
    valuesPlaceFlagOn.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("MousePress");
    valuesPlaceFlagOn.append( choice );
  }
  KConfigSkeleton::ItemEnum  *itemPlaceFlagOn;
  itemPlaceFlagOn = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "place_flag_on" ), mPlaceFlagOn, valuesPlaceFlagOn, EnumPlaceFlagOn::MouseRelease );
  addItem( itemPlaceFlagOn, QStringLiteral( "PlaceFlagOn" ) );

  setCurrentGroup( QStringLiteral( "Options" ) );

  KConfigSkeleton::ItemInt  *itemCustomWidth;
  itemCustomWidth = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "custom width" ), mCustomWidth, 10 );
  itemCustomWidth->setMinValue(5);
  itemCustomWidth->setMaxValue(50);
  addItem( itemCustomWidth, QStringLiteral( "CustomWidth" ) );
  KConfigSkeleton::ItemInt  *itemCustomHeight;
  itemCustomHeight = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "custom height" ), mCustomHeight, 10 );
  itemCustomHeight->setMinValue(5);
  itemCustomHeight->setMaxValue(50);
  addItem( itemCustomHeight, QStringLiteral( "CustomHeight" ) );
  KConfigSkeleton::ItemInt  *itemCustomMines;
  itemCustomMines = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "custom mines" ), mCustomMines, 20 );
  itemCustomMines->setMinValue(1);
  addItem( itemCustomMines, QStringLiteral( "CustomMines" ) );
}

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

