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

#include "slidingpopupsconfig.h"

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

#include <QDebug>

using namespace KWin;

namespace KWin {

class SlidingPopupsConfigHelper
{
  public:
    SlidingPopupsConfigHelper() noexcept : q(nullptr) {}
    ~SlidingPopupsConfigHelper() noexcept { delete q; q = nullptr; }
    SlidingPopupsConfigHelper(const SlidingPopupsConfigHelper&) = delete;
    SlidingPopupsConfigHelper& operator=(const SlidingPopupsConfigHelper&) = delete;
    SlidingPopupsConfig *q;
};

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

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

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

SlidingPopupsConfig::SlidingPopupsConfig( KSharedConfig::Ptr config )
  : KConfigSkeleton( std::move( config ) )
{
  Q_ASSERT(!s_globalSlidingPopupsConfig()->q);
  s_globalSlidingPopupsConfig()->q = this;
  setCurrentGroup( QStringLiteral( "Effect-slidingpopups" ) );

  KConfigSkeleton::ItemInt  *itemSlideInTime;
  itemSlideInTime = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "SlideInTime" ), mSlideInTime, 0 );
  addItem( itemSlideInTime, QStringLiteral( "SlideInTime" ) );
  KConfigSkeleton::ItemInt  *itemSlideOutTime;
  itemSlideOutTime = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "SlideOutTime" ), mSlideOutTime, 0 );
  addItem( itemSlideOutTime, QStringLiteral( "SlideOutTime" ) );
}

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

