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

#include "magnifierconfig.h"

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

#include <QDebug>

using namespace KWin;

namespace KWin {

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

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

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

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

MagnifierConfig::MagnifierConfig( KSharedConfig::Ptr config )
  : KConfigSkeleton( std::move( config ) )
{
  Q_ASSERT(!s_globalMagnifierConfig()->q);
  s_globalMagnifierConfig()->q = this;
  setCurrentGroup( QStringLiteral( "Effect-Magnifier" ) );

  KConfigSkeleton::ItemUInt  *itemWidth;
  itemWidth = new KConfigSkeleton::ItemUInt( currentGroup(), QStringLiteral( "Width" ), mWidth, 200 );
  addItem( itemWidth, QStringLiteral( "Width" ) );
  KConfigSkeleton::ItemUInt  *itemHeight;
  itemHeight = new KConfigSkeleton::ItemUInt( currentGroup(), QStringLiteral( "Height" ), mHeight, 200 );
  addItem( itemHeight, QStringLiteral( "Height" ) );
  KConfigSkeleton::ItemDouble  *itemInitialZoom;
  itemInitialZoom = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "InitialZoom" ), mInitialZoom, 1.0 );
  addItem( itemInitialZoom, QStringLiteral( "InitialZoom" ) );
}

MagnifierConfig::~MagnifierConfig()
{
  s_globalMagnifierConfig()->q = nullptr;
}

