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

#include "glideconfig.h"

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

#include <QDebug>

using namespace KWin;

namespace KWin {

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

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

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

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

GlideConfig::GlideConfig(  KSharedConfig::Ptr config  )
  : KConfigSkeleton( config )
{
  Q_ASSERT(!s_globalGlideConfig()->q);
  s_globalGlideConfig()->q = this;
  setCurrentGroup( QStringLiteral( "Effect-Glide" ) );

  KConfigSkeleton::ItemUInt  *itemDuration;
  itemDuration = new KConfigSkeleton::ItemUInt( currentGroup(), QStringLiteral( "Duration" ), mDuration, 0 );
  addItem( itemDuration, QStringLiteral( "Duration" ) );
  KConfigSkeleton::ItemInt  *itemInRotationEdge;
  itemInRotationEdge = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "InRotationEdge" ), mInRotationEdge, 0 );
  addItem( itemInRotationEdge, QStringLiteral( "InRotationEdge" ) );
  KConfigSkeleton::ItemDouble  *itemInRotationAngle;
  itemInRotationAngle = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "InRotationAngle" ), mInRotationAngle, 3.0 );
  addItem( itemInRotationAngle, QStringLiteral( "InRotationAngle" ) );
  KConfigSkeleton::ItemDouble  *itemInDistance;
  itemInDistance = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "InDistance" ), mInDistance, 30.0 );
  addItem( itemInDistance, QStringLiteral( "InDistance" ) );
  KConfigSkeleton::ItemDouble  *itemInOpacity;
  itemInOpacity = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "InOpacity" ), mInOpacity, 0.4 );
  itemInOpacity->setMinValue(0.0);
  itemInOpacity->setMaxValue(1.0);
  addItem( itemInOpacity, QStringLiteral( "InOpacity" ) );
  KConfigSkeleton::ItemInt  *itemOutRotationEdge;
  itemOutRotationEdge = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "OutRotationEdge" ), mOutRotationEdge, 2 );
  addItem( itemOutRotationEdge, QStringLiteral( "OutRotationEdge" ) );
  KConfigSkeleton::ItemDouble  *itemOutRotationAngle;
  itemOutRotationAngle = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "OutRotationAngle" ), mOutRotationAngle, 3.0 );
  addItem( itemOutRotationAngle, QStringLiteral( "OutRotationAngle" ) );
  KConfigSkeleton::ItemDouble  *itemOutDistance;
  itemOutDistance = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "OutDistance" ), mOutDistance, 30.0 );
  addItem( itemOutDistance, QStringLiteral( "OutDistance" ) );
  KConfigSkeleton::ItemDouble  *itemOutOpacity;
  itemOutOpacity = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "OutOpacity" ), mOutOpacity, 0.0 );
  itemOutOpacity->setMinValue(0.0);
  itemOutOpacity->setMaxValue(1.0);
  addItem( itemOutOpacity, QStringLiteral( "OutOpacity" ) );
}

GlideConfig::~GlideConfig()
{
  s_globalGlideConfig()->q = nullptr;
}

