// This file is generated by kconfig_compiler_kf6 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; q = nullptr; }
    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  *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  *itemSlideBackground;
  itemSlideBackground = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "SlideBackground" ), mSlideBackground, true );
  addItem( itemSlideBackground, QStringLiteral( "SlideBackground" ) );
}

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

