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

#include "projectfiltersettings.h"

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

#include <QDebug>

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

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

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

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

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

