// This file is generated by kconfig_compiler_kf6 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() noexcept : q(nullptr) {}
    ~OctaveSettingsHelper() noexcept { 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.exe") ));
                #else
                return QUrl::fromLocalFile(QStandardPaths::findExecutable( QLatin1String("octave") ));
                #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("pdf");
    valuesinlinePlotFormat.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("svg");
    valuesinlinePlotFormat.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("png");
    valuesinlinePlotFormat.append( choice );
  }
  KConfigSkeleton::ItemEnum  *itemInlinePlotFormat;
  itemInlinePlotFormat = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "inlinePlotFormat" ), mInlinePlotFormat, valuesinlinePlotFormat, 0 );
  addItem( itemInlinePlotFormat, QStringLiteral( "inlinePlotFormat" ) );
  KConfigSkeleton::ItemDouble  *itemPlotWidth;
  itemPlotWidth = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "plotWidth" ), mPlotWidth, 12.0 );
  addItem( itemPlotWidth, QStringLiteral( "plotWidth" ) );
  KConfigSkeleton::ItemDouble  *itemPlotHeight;
  itemPlotHeight = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "plotHeight" ), mPlotHeight, 8.0 );
  addItem( itemPlotHeight, QStringLiteral( "plotHeight" ) );
}

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

