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

#include "settings.h"

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

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

  return s_globalOctaveSettings()->q;
}

OctaveSettings::OctaveSettings( )
  : KConfigSkeleton( QStringLiteral( "cantorrc" ) )
{
  Q_ASSERT(!s_globalOctaveSettings()->q);
  s_globalOctaveSettings()->q = this;
  setCurrentGroup( QStringLiteral( "OctaveBackend" ) );

  KConfigSkeleton::ItemUrl  *itemPath;
  itemPath = new KConfigSkeleton::ItemUrl( currentGroup(), QStringLiteral( "Path" ), mPath, 
          [this] {
                #ifdef Q_OS_WIN
                return QUrl::fromLocalFile(QStandardPaths::findExecutable( QLatin1String("octave-cli.exe") ));
                #else
                return QUrl::fromLocalFile(QStandardPaths::findExecutable( QLatin1String("octave-cli") ));
                #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" ) );
  QList<KConfigSkeleton::ItemEnum::Choice> valuesinlinePlotFormat;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("eps");
    valuesinlinePlotFormat.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("png");
    valuesinlinePlotFormat.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("svg");
    valuesinlinePlotFormat.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("jpeg");
    valuesinlinePlotFormat.append( choice );
  }
  KConfigSkeleton::ItemEnum  *itemInlinePlotFormat;
  itemInlinePlotFormat = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "inlinePlotFormat" ), mInlinePlotFormat, valuesinlinePlotFormat, EnumInlinePlotFormat::eps );
  addItem( itemInlinePlotFormat, QStringLiteral( "inlinePlotFormat" ) );
}

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

