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

#include "magiclampconfig.h"

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

#include <QDebug>

using namespace KWin;

namespace KWin {

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

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

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

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

MagicLampConfig::MagicLampConfig( KSharedConfig::Ptr config )
  : KConfigSkeleton( std::move( config ) )
{
  Q_ASSERT(!s_globalMagicLampConfig()->q);
  s_globalMagicLampConfig()->q = this;
  setCurrentGroup( QStringLiteral( "Effect-MagicLamp" ) );

  KConfigSkeleton::ItemInt  *itemAnimationDuration;
  itemAnimationDuration = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "AnimationDuration" ), mAnimationDuration, 0 );
  addItem( itemAnimationDuration, QStringLiteral( "AnimationDuration" ) );
}

MagicLampConfig::~MagicLampConfig()
{
  s_globalMagicLampConfig()->q = nullptr;
}

