// This file is generated by kconfig_compiler_kf5 from knetwalk.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( QStringLiteral( "knetwalkrc" ) )
{
  Q_ASSERT(!s_globalSettings()->q);
  s_globalSettings()->q = this;
  setCurrentGroup( QStringLiteral( "Preferences" ) );

  KConfigSkeleton::ItemString  *itemUsername;
  itemUsername = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "username" ), mUsername );
  addItem( itemUsername, QStringLiteral( "username" ) );

  setCurrentGroup( QStringLiteral( "General" ) );

  KConfigSkeleton::ItemBool  *itemPlaySounds;
  itemPlaySounds = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "PlaySounds" ), mPlaySounds, true );
  addItem( itemPlaySounds, QStringLiteral( "PlaySounds" ) );
  KConfigSkeleton::ItemBool  *itemAutolock;
  itemAutolock = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "Autolock" ), mAutolock, false );
  addItem( itemAutolock, QStringLiteral( "Autolock" ) );
  KConfigSkeleton::ItemBool  *itemReverseButtons;
  itemReverseButtons = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ReverseButtons" ), mReverseButtons, false );
  addItem( itemReverseButtons, QStringLiteral( "ReverseButtons" ) );
  KConfigSkeleton::ItemInt  *itemRotateDuration;
  itemRotateDuration = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "RotateDuration" ), mRotateDuration, 300 );
  itemRotateDuration->setMinValue(100);
  itemRotateDuration->setMaxValue(500);
  addItem( itemRotateDuration, QStringLiteral( "RotateDuration" ) );

  setCurrentGroup( QStringLiteral( "Custom" ) );

  KConfigSkeleton::ItemInt  *itemWidth;
  itemWidth = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "width" ), mWidth, 6 );
  itemWidth->setMinValue(3);
  itemWidth->setMaxValue(11);
  addItem( itemWidth, QStringLiteral( "Width" ) );
  KConfigSkeleton::ItemInt  *itemHeight;
  itemHeight = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "height" ), mHeight, 6 );
  itemHeight->setMinValue(3);
  itemHeight->setMaxValue(11);
  addItem( itemHeight, QStringLiteral( "Height" ) );
  KConfigSkeleton::ItemBool  *itemWrapping;
  itemWrapping = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "Wrapping" ), mWrapping, false );
  addItem( itemWrapping, QStringLiteral( "Wrapping" ) );
}

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

