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

#include "ninjabuilderconfig.h"

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

#include <QDebug>

class NinjaBuilderSettingsHelper
{
  public:
    NinjaBuilderSettingsHelper() noexcept : q(nullptr) {}
    ~NinjaBuilderSettingsHelper() noexcept { delete q; q = nullptr; }
    NinjaBuilderSettingsHelper(const NinjaBuilderSettingsHelper&) = delete;
    NinjaBuilderSettingsHelper& operator=(const NinjaBuilderSettingsHelper&) = delete;
    NinjaBuilderSettings *q;
};
Q_GLOBAL_STATIC(NinjaBuilderSettingsHelper, s_globalNinjaBuilderSettings)
NinjaBuilderSettings *NinjaBuilderSettings::self()
{
  if (!s_globalNinjaBuilderSettings()->q)
     qFatal("you need to call NinjaBuilderSettings::instance before using");
  return s_globalNinjaBuilderSettings()->q;
}

void NinjaBuilderSettings::instance(const QString& cfgfilename)
{
  if (s_globalNinjaBuilderSettings()->q) {
     qDebug() << "NinjaBuilderSettings::instance called after the first use - ignoring";
     return;
  }
  new NinjaBuilderSettings(KSharedConfig::openConfig(cfgfilename));
  s_globalNinjaBuilderSettings()->q->read();
}

void NinjaBuilderSettings::instance(KSharedConfig::Ptr config)
{
  if (s_globalNinjaBuilderSettings()->q) {
     qDebug() << "NinjaBuilderSettings::instance called after the first use - ignoring";
     return;
  }
  new NinjaBuilderSettings(std::move(config));
  s_globalNinjaBuilderSettings()->q->read();
}

NinjaBuilderSettings::NinjaBuilderSettings( KSharedConfig::Ptr config )
  : KDevelop::ProjectConfigSkeleton( std::move( config ) )
{
  Q_ASSERT(!s_globalNinjaBuilderSettings()->q);
  s_globalNinjaBuilderSettings()->q = this;
  setCurrentGroup( QStringLiteral( "NinjaBuilder" ) );

  KDevelop::ProjectConfigSkeleton::ItemBool  *itemDisplayOnly;
  itemDisplayOnly = new KDevelop::ProjectConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "Display Only" ), mDisplayOnly, false );
  addItem( itemDisplayOnly, QStringLiteral( "displayOnly" ) );
  KDevelop::ProjectConfigSkeleton::ItemBool  *itemInstallAsRoot;
  itemInstallAsRoot = new KDevelop::ProjectConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "Install As Root" ), mInstallAsRoot, false );
  addItem( itemInstallAsRoot, QStringLiteral( "installAsRoot" ) );
  KDevelop::ProjectConfigSkeleton::ItemBool  *itemOverrideNumberOfJobs;
  itemOverrideNumberOfJobs = new KDevelop::ProjectConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "Override Number Of Jobs" ), mOverrideNumberOfJobs, false );
  addItem( itemOverrideNumberOfJobs, QStringLiteral( "overrideNumberOfJobs" ) );
  KDevelop::ProjectConfigSkeleton::ItemInt  *itemSuCommand;
  itemSuCommand = new KDevelop::ProjectConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "Su Command" ), mSuCommand );
  addItem( itemSuCommand, QStringLiteral( "suCommand" ) );
  KDevelop::ProjectConfigSkeleton::ItemUInt  *itemNumberOfJobs;
  itemNumberOfJobs = new KDevelop::ProjectConfigSkeleton::ItemUInt( currentGroup(), QStringLiteral( "Number Of Jobs" ), mNumberOfJobs, 1 );
  addItem( itemNumberOfJobs, QStringLiteral( "numberOfJobs" ) );
  KDevelop::ProjectConfigSkeleton::ItemUInt  *itemNumberOfErrors;
  itemNumberOfErrors = new KDevelop::ProjectConfigSkeleton::ItemUInt( currentGroup(), QStringLiteral( "Number Of Errors" ), mNumberOfErrors, 1 );
  addItem( itemNumberOfErrors, QStringLiteral( "numberOfErrors" ) );
  KDevelop::ProjectConfigSkeleton::ItemString  *itemAdditionalOptions;
  itemAdditionalOptions = new KDevelop::ProjectConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "Additional Options" ), mAdditionalOptions );
  addItem( itemAdditionalOptions, QStringLiteral( "additionalOptions" ) );
  KDevelop::ProjectConfigSkeleton::ItemString  *itemEnvironmentProfile;
  itemEnvironmentProfile = new KDevelop::ProjectConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "Default Ninja Environment Profile" ), mEnvironmentProfile );
  addItem( itemEnvironmentProfile, QStringLiteral( "environmentProfile" ) );
}

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

