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

#include "zoomconfig.h"

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

#include <QDebug>

using namespace KWin;

namespace KWin {

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

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

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

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

ZoomConfig::ZoomConfig( KSharedConfig::Ptr config )
  : KConfigSkeleton( std::move( config ) )
{
  Q_ASSERT(!s_globalZoomConfig()->q);
  s_globalZoomConfig()->q = this;
  setCurrentGroup( QStringLiteral( "Effect-zoom" ) );

  KConfigSkeleton::ItemDouble  *itemZoomFactor;
  itemZoomFactor = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "ZoomFactor" ), mZoomFactor, 1.2 );
  addItem( itemZoomFactor, QStringLiteral( "ZoomFactor" ) );
  KConfigSkeleton::ItemUInt  *itemMousePointer;
  itemMousePointer = new KConfigSkeleton::ItemUInt( currentGroup(), QStringLiteral( "MousePointer" ), mMousePointer, 0 );
  addItem( itemMousePointer, QStringLiteral( "MousePointer" ) );
  KConfigSkeleton::ItemUInt  *itemMouseTracking;
  itemMouseTracking = new KConfigSkeleton::ItemUInt( currentGroup(), QStringLiteral( "MouseTracking" ), mMouseTracking, 0 );
  addItem( itemMouseTracking, QStringLiteral( "MouseTracking" ) );
  KConfigSkeleton::ItemBool  *itemEnableFocusTracking;
  itemEnableFocusTracking = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "EnableFocusTracking" ), mEnableFocusTracking, false );
  addItem( itemEnableFocusTracking, QStringLiteral( "EnableFocusTracking" ) );
  KConfigSkeleton::ItemBool  *itemEnableTextCaretTracking;
  itemEnableTextCaretTracking = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "EnableTextCaretTracking" ), mEnableTextCaretTracking, false );
  addItem( itemEnableTextCaretTracking, QStringLiteral( "EnableTextCaretTracking" ) );
  KConfigSkeleton::ItemUInt  *itemFocusDelay;
  itemFocusDelay = new KConfigSkeleton::ItemUInt( currentGroup(), QStringLiteral( "FocusDelay" ), mFocusDelay, 350 );
  addItem( itemFocusDelay, QStringLiteral( "FocusDelay" ) );
  KConfigSkeleton::ItemDouble  *itemMoveFactor;
  itemMoveFactor = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "MoveFactor" ), mMoveFactor, 20.0 );
  addItem( itemMoveFactor, QStringLiteral( "MoveFactor" ) );
  KConfigSkeleton::ItemDouble  *itemInitialZoom;
  itemInitialZoom = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "InitialZoom" ), mInitialZoom, 1.0 );
  addItem( itemInitialZoom, QStringLiteral( "InitialZoom" ) );
}

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

