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

#include "lookingglassconfig.h"

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

#include <QDebug>

using namespace KWin;

namespace KWin {

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

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

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

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

LookingGlassConfig::LookingGlassConfig( KSharedConfig::Ptr config )
  : KConfigSkeleton( std::move( config ) )
{
  Q_ASSERT(!s_globalLookingGlassConfig()->q);
  s_globalLookingGlassConfig()->q = this;
  setCurrentGroup( QStringLiteral( "Effect-LookingGlass" ) );

  KConfigSkeleton::ItemUInt  *itemRadius;
  itemRadius = new KConfigSkeleton::ItemUInt( currentGroup(), QStringLiteral( "Radius" ), mRadius, 200 );
  addItem( itemRadius, QStringLiteral( "Radius" ) );
}

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

