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

#include "settings.h"

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

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

  return s_globalMaximaSettings()->q;
}

MaximaSettings::MaximaSettings( )
  : KConfigSkeleton( QStringLiteral( "cantorrc" ) )
{
  Q_ASSERT(!s_globalMaximaSettings()->q);
  s_globalMaximaSettings()->q = this;
  setCurrentGroup( QStringLiteral( "MaximaBackend" ) );

  KConfigSkeleton::ItemUrl  *itemPath;
  itemPath = new KConfigSkeleton::ItemUrl( currentGroup(), QStringLiteral( "Path" ), mPath, 
          [this] {
                #ifdef Q_OS_WIN
                return QUrl::fromLocalFile(QStandardPaths::findExecutable( QLatin1String("maxima.bat") ));
                #else
                return QUrl::fromLocalFile(QStandardPaths::findExecutable( QLatin1String("maxima") ));
                #endif
            } ()
         );
  addItem( itemPath, QStringLiteral( "Path" ) );
  KConfigSkeleton::ItemBool  *itemIntegratePlots;
  itemIntegratePlots = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "integratePlots" ), mIntegratePlots, true );
  addItem( itemIntegratePlots, QStringLiteral( "integratePlots" ) );
  KConfigSkeleton::ItemBool  *itemVariableManagement;
  itemVariableManagement = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "variableManagement" ), mVariableManagement, true );
  addItem( itemVariableManagement, QStringLiteral( "variableManagement" ) );
  KConfigSkeleton::ItemStringList  *itemAutorunScripts;
  itemAutorunScripts = new KConfigSkeleton::ItemStringList( currentGroup(), QStringLiteral( "autorunScripts" ), mAutorunScripts );
  addItem( itemAutorunScripts, QStringLiteral( "autorunScripts" ) );
}

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

