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

#include "settings.h"

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

class LuaSettingsHelper
{
  public:
    LuaSettingsHelper() : q(nullptr) {}
    ~LuaSettingsHelper() { delete q; q = nullptr; }
    LuaSettingsHelper(const LuaSettingsHelper&) = delete;
    LuaSettingsHelper& operator=(const LuaSettingsHelper&) = delete;
    LuaSettings *q;
};
Q_GLOBAL_STATIC(LuaSettingsHelper, s_globalLuaSettings)
LuaSettings *LuaSettings::self()
{
  if (!s_globalLuaSettings()->q) {
    new LuaSettings;
    s_globalLuaSettings()->q->read();
  }

  return s_globalLuaSettings()->q;
}

LuaSettings::LuaSettings( )
  : KConfigSkeleton( QStringLiteral( "cantorrc" ) )
{
  Q_ASSERT(!s_globalLuaSettings()->q);
  s_globalLuaSettings()->q = this;
  setCurrentGroup( QStringLiteral( "LuaBackend" ) );

  KConfigSkeleton::ItemUrl  *itemPath;
  itemPath = new KConfigSkeleton::ItemUrl( currentGroup(), QStringLiteral( "Path" ), mPath, QUrl::fromLocalFile(QStandardPaths::findExecutable(QLatin1String("luajit"))) );
  addItem( itemPath, QStringLiteral( "Path" ) );
  KConfigSkeleton::ItemStringList  *itemAutorunScripts;
  itemAutorunScripts = new KConfigSkeleton::ItemStringList( currentGroup(), QStringLiteral( "autorunScripts" ), mAutorunScripts );
  addItem( itemAutorunScripts, QStringLiteral( "autorunScripts" ) );
}

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

