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

#include "slideconfig.h"

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

#include <QDebug>

using namespace KWin;

namespace KWin {

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

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

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

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

SlideConfig::SlideConfig( KSharedConfig::Ptr config )
  : KConfigSkeleton( std::move( config ) )
{
  Q_ASSERT(!s_globalSlideConfig()->q);
  s_globalSlideConfig()->q = this;
  setCurrentGroup( QStringLiteral( "Effect-Slide" ) );

  KConfigSkeleton::ItemUInt  *itemDuration;
  itemDuration = new KConfigSkeleton::ItemUInt( currentGroup(), QStringLiteral( "Duration" ), mDuration, 0 );
  addItem( itemDuration, QStringLiteral( "Duration" ) );
  KConfigSkeleton::ItemUInt  *itemHorizontalGap;
  itemHorizontalGap = new KConfigSkeleton::ItemUInt( currentGroup(), QStringLiteral( "HorizontalGap" ), mHorizontalGap, 45 );
  addItem( itemHorizontalGap, QStringLiteral( "HorizontalGap" ) );
  KConfigSkeleton::ItemUInt  *itemVerticalGap;
  itemVerticalGap = new KConfigSkeleton::ItemUInt( currentGroup(), QStringLiteral( "VerticalGap" ), mVerticalGap, 20 );
  addItem( itemVerticalGap, QStringLiteral( "VerticalGap" ) );
  KConfigSkeleton::ItemBool  *itemSlideDocks;
  itemSlideDocks = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "SlideDocks" ), mSlideDocks, false );
  addItem( itemSlideDocks, QStringLiteral( "SlideDocks" ) );
  KConfigSkeleton::ItemBool  *itemSlideBackground;
  itemSlideBackground = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "SlideBackground" ), mSlideBackground, true );
  addItem( itemSlideBackground, QStringLiteral( "SlideBackground" ) );
}

SlideConfig::~SlideConfig()
{
  s_globalSlideConfig()->q = nullptr;
}

