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

#include "blurconfig.h"

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

#include <QDebug>

using namespace KWin;

namespace KWin {

class BlurConfigHelper
{
  public:
    BlurConfigHelper() : q(nullptr) {}
    ~BlurConfigHelper() { delete q; }
    BlurConfigHelper(const BlurConfigHelper&) = delete;
    BlurConfigHelper& operator=(const BlurConfigHelper&) = delete;
    BlurConfig *q;
};
}

Q_GLOBAL_STATIC(BlurConfigHelper, s_globalBlurConfig)
BlurConfig *BlurConfig::self()
{
  if (!s_globalBlurConfig()->q)
     qFatal("you need to call BlurConfig::instance before using");
  return s_globalBlurConfig()->q;
}

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

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

BlurConfig::BlurConfig(  KSharedConfig::Ptr config  )
  : KConfigSkeleton( config )
{
  Q_ASSERT(!s_globalBlurConfig()->q);
  s_globalBlurConfig()->q = this;
  setCurrentGroup( QStringLiteral( "Effect-Blur" ) );

  KConfigSkeleton::ItemInt  *itemBlurStrength;
  itemBlurStrength = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "BlurStrength" ), mBlurStrength, 10 );
  addItem( itemBlurStrength, QStringLiteral( "BlurStrength" ) );
  KConfigSkeleton::ItemInt  *itemNoiseStrength;
  itemNoiseStrength = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "NoiseStrength" ), mNoiseStrength, 5 );
  addItem( itemNoiseStrength, QStringLiteral( "NoiseStrength" ) );
}

BlurConfig::~BlurConfig()
{
  s_globalBlurConfig()->q = nullptr;
}

