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

#include "kcfg_custombuildsystemconfig.h"

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

#include <QDebug>

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

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

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

CustomBuildSystemSettings::CustomBuildSystemSettings( KSharedConfig::Ptr config )
  : KDevelop::ProjectConfigSkeleton( std::move( config ) )
{
  Q_ASSERT(!s_globalCustomBuildSystemSettings()->q);
  s_globalCustomBuildSystemSettings()->q = this;
}

CustomBuildSystemSettings::~CustomBuildSystemSettings()
{
  s_globalCustomBuildSystemSettings()->q = nullptr;
}

