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

#include "preferences.h"

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

class PreferencesHelper
{
  public:
    PreferencesHelper() noexcept : q(nullptr) {}
    ~PreferencesHelper() noexcept { 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( "ktouch2rc" ) )
{
  Q_ASSERT(!s_globalPreferences()->q);
  s_globalPreferences()->q = this;
  setCurrentGroup( QStringLiteral( "General" ) );

  KConfigSkeleton::ItemString  *itemKeyboardLayoutName;
  itemKeyboardLayoutName = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "KeyboardLayoutName" ), mKeyboardLayoutName, QStringLiteral( "us" ) );
  addItem( itemKeyboardLayoutName, QStringLiteral( "KeyboardLayoutName" ) );

  setCurrentGroup( QStringLiteral( "Training" ) );

  KConfigSkeleton::ItemBool  *itemEnforceTypingErrorCorrection;
  itemEnforceTypingErrorCorrection = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "EnforceTypingErrorCorrection" ), mEnforceTypingErrorCorrection, true );
  addItem( itemEnforceTypingErrorCorrection, QStringLiteral( "EnforceTypingErrorCorrection" ) );
  KConfigSkeleton::ItemBool  *itemShowKeyboard;
  itemShowKeyboard = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ShowKeyboard" ), mShowKeyboard, true );
  addItem( itemShowKeyboard, QStringLiteral( "ShowKeyboard" ) );
  KConfigSkeleton::ItemBool  *itemShowStatistics;
  itemShowStatistics = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ShowStatistics" ), mShowStatistics, true );
  addItem( itemShowStatistics, QStringLiteral( "ShowStatistics" ) );
  KConfigSkeleton::ItemBool  *itemNextLineWithReturn;
  itemNextLineWithReturn = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "NextLineWithReturn" ), mNextLineWithReturn, true );
  addItem( itemNextLineWithReturn, QStringLiteral( "NextLineWithReturn" ) );
  KConfigSkeleton::ItemBool  *itemNextLineWithSpace;
  itemNextLineWithSpace = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "NextLineWithSpace" ), mNextLineWithSpace, false );
  addItem( itemNextLineWithSpace, QStringLiteral( "NextLineWithSpace" ) );
  KConfigSkeleton::ItemInt  *itemRequiredStrokesPerMinute;
  itemRequiredStrokesPerMinute = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "RequiredStrokesPerMinute" ), mRequiredStrokesPerMinute, 180 );
  itemRequiredStrokesPerMinute->setMinValue(0);
  itemRequiredStrokesPerMinute->setMaxValue(360);
  addItem( itemRequiredStrokesPerMinute, QStringLiteral( "RequiredStrokesPerMinute" ) );
  KConfigSkeleton::ItemDouble  *itemRequiredAccuracy;
  itemRequiredAccuracy = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "RequiredAccuracy" ), mRequiredAccuracy, 98 );
  itemRequiredAccuracy->setMinValue(90);
  itemRequiredAccuracy->setMaxValue(100);
  addItem( itemRequiredAccuracy, QStringLiteral( "RequiredAccuracy" ) );

  setCurrentGroup( QStringLiteral( "Colors" ) );

  KConfigSkeleton::ItemColor  *itemFingerColor[8];
  itemFingerColor[0] = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "FingerColor0" ), mFingerColor[0], QColor( "#ff0000" ) );
  addItem( itemFingerColor[0], QStringLiteral( "FingerColor0" ) );
  itemFingerColor[1] = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "FingerColor1" ), mFingerColor[1], QColor( "#0000ff" ) );
  addItem( itemFingerColor[1], QStringLiteral( "FingerColor1" ) );
  itemFingerColor[2] = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "FingerColor2" ), mFingerColor[2], QColor( "#00ff00" ) );
  addItem( itemFingerColor[2], QStringLiteral( "FingerColor2" ) );
  itemFingerColor[3] = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "FingerColor3" ), mFingerColor[3], QColor( "#ffff00" ) );
  addItem( itemFingerColor[3], QStringLiteral( "FingerColor3" ) );
  itemFingerColor[4] = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "FingerColor4" ), mFingerColor[4], QColor( "#ff00ff" ) );
  addItem( itemFingerColor[4], QStringLiteral( "FingerColor4" ) );
  itemFingerColor[5] = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "FingerColor5" ), mFingerColor[5], QColor( "#00ff00" ) );
  addItem( itemFingerColor[5], QStringLiteral( "FingerColor5" ) );
  itemFingerColor[6] = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "FingerColor6" ), mFingerColor[6], QColor( "#0000ff" ) );
  addItem( itemFingerColor[6], QStringLiteral( "FingerColor6" ) );
  itemFingerColor[7] = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "FingerColor7" ), mFingerColor[7], QColor( "#ff0000" ) );
  addItem( itemFingerColor[7], QStringLiteral( "FingerColor7" ) );
  KConfigSkeleton::ItemDouble  *itemFingerOpacity;
  itemFingerOpacity = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "FingerOpacity" ), mFingerOpacity, 12.5 );
  itemFingerOpacity->setMinValue(0);
  itemFingerOpacity->setMaxValue(100);
  addItem( itemFingerOpacity, QStringLiteral( "FingerOpacity" ) );

  setCurrentGroup( QStringLiteral( "Session" ) );

  KConfigSkeleton::ItemInt  *itemLastUsedProfileId;
  itemLastUsedProfileId = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "LastUsedProfileId" ), mLastUsedProfileId, -1 );
  addItem( itemLastUsedProfileId, QStringLiteral( "LastUsedProfileId" ) );
}

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

