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

#include "prefs.h"

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

class PrefsHelper
{
  public:
    PrefsHelper() : q(nullptr) {}
    ~PrefsHelper() { delete q; }
    Prefs *q;
};
Q_GLOBAL_STATIC(PrefsHelper, s_globalPrefs)
Prefs *Prefs::self()
{
  if (!s_globalPrefs()->q) {
    new Prefs;
    s_globalPrefs()->q->read();
  }

  return s_globalPrefs()->q;
}

Prefs::Prefs(  )
  : KCoreConfigSkeleton( QStringLiteral( "khangmanrc" ) )
{
  Q_ASSERT(!s_globalPrefs()->q);
  s_globalPrefs()->q = this;
  setCurrentGroup( QStringLiteral( "Language" ) );

  KCoreConfigSkeleton::ItemInt  *itemCurrentLevel;
  itemCurrentLevel = new KCoreConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "CurrentLevel" ), mCurrentLevel, 0 );
  addItem( itemCurrentLevel, QStringLiteral( "CurrentLevel" ) );
  KCoreConfigSkeleton::ItemString  *itemLevelFile;
  itemLevelFile = new KCoreConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "LevelFile" ), mLevelFile, QStringLiteral( "\"animals.kvtml\"" ) );
  addItem( itemLevelFile, QStringLiteral( "LevelFile" ) );

                KSharedConfigPtr globalConf = KSharedConfig::openConfig();
                QString userLanguage=globalConf->group("Locale").readEntry("Language", "en");
                if (userLanguage.isEmpty())
                userLanguage = "en";
                else
                //keep only the first 2 characters
                userLanguage = userLanguage.left(2);
            
  KCoreConfigSkeleton::ItemString  *itemSelectedLanguage;
  itemSelectedLanguage = new KCoreConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "SelectedLanguage" ), mSelectedLanguage, QStringLiteral( "userLanguage" ) );
  addItem( itemSelectedLanguage, QStringLiteral( "SelectedLanguage" ) );

  setCurrentGroup( QStringLiteral( "Look" ) );

  KCoreConfigSkeleton::ItemString  *itemTheme;
  itemTheme = new KCoreConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "Theme" ), mTheme, QStringLiteral( "notes" ) );
  addItem( itemTheme, QStringLiteral( "Theme" ) );

  setCurrentGroup( QStringLiteral( "General" ) );

  KCoreConfigSkeleton::ItemBool  *itemOneLetter;
  itemOneLetter = new KCoreConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "OneLetter" ), mOneLetter, false );
  addItem( itemOneLetter, QStringLiteral( "OneLetter" ) );
  KCoreConfigSkeleton::ItemBool  *itemEnableAnimations;
  itemEnableAnimations = new KCoreConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "EnableAnimations" ), mEnableAnimations, false );
  addItem( itemEnableAnimations, QStringLiteral( "EnableAnimations" ) );
  KCoreConfigSkeleton::ItemBool  *itemSound;
  itemSound = new KCoreConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "Sound" ), mSound, false );
  addItem( itemSound, QStringLiteral( "Sound" ) );
  KCoreConfigSkeleton::ItemBool  *itemHint;
  itemHint = new KCoreConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "Hint" ), mHint, false );
  addItem( itemHint, QStringLiteral( "Hint" ) );
  KCoreConfigSkeleton::ItemInt  *itemResolveTime;
  itemResolveTime = new KCoreConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "resolveTime" ), mResolveTime, 120 );
  addItem( itemResolveTime, QStringLiteral( "resolveTime" ) );

  setCurrentGroup( QStringLiteral( "Advanced" ) );

  KCoreConfigSkeleton::ItemBool  *itemAccentedLetters;
  itemAccentedLetters = new KCoreConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "AccentedLetters" ), mAccentedLetters, false );
  addItem( itemAccentedLetters, QStringLiteral( "AccentedLetters" ) );

  setCurrentGroup( QStringLiteral( "KNewStuff" ) );

  KCoreConfigSkeleton::ItemPath  *itemProvidersUrl;
  itemProvidersUrl = new KCoreConfigSkeleton::ItemPath( currentGroup(), QStringLiteral( "ProvidersUrl" ), mProvidersUrl, QStringLiteral( "\"http://edu.kde.org/khangman/downloads/providers.xml\"" ) );
  addItem( itemProvidersUrl, QStringLiteral( "ProvidersUrl" ) );
}

Prefs::~Prefs()
{
  s_globalPrefs()->q = nullptr;
}

