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

#include "settings.h"

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

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

  return s_globalSageSettings()->q;
}

SageSettings::SageSettings( )
  : KConfigSkeleton( QStringLiteral( "cantorrc" ) )
{
  Q_ASSERT(!s_globalSageSettings()->q);
  s_globalSageSettings()->q = this;
  setCurrentGroup( QStringLiteral( "SageBackend" ) );

  KConfigSkeleton::ItemUrl  *itemPath;
  itemPath = new KConfigSkeleton::ItemUrl( currentGroup(), QStringLiteral( "Path" ), mPath, QUrl::fromLocalFile(QStandardPaths::findExecutable( QLatin1String("sage") )) );
  addItem( itemPath, QStringLiteral( "Path" ) );
  KConfigSkeleton::ItemBool  *itemAllowLatex;
  itemAllowLatex = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "allowLatex" ), mAllowLatex, true );
  addItem( itemAllowLatex, QStringLiteral( "allowLatex" ) );
  KConfigSkeleton::ItemStringList  *itemAutorunScripts;
  itemAutorunScripts = new KConfigSkeleton::ItemStringList( currentGroup(), QStringLiteral( "autorunScripts" ), mAutorunScripts );
  addItem( itemAutorunScripts, QStringLiteral( "autorunScripts" ) );
}

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

