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

#include "kscreenconfig.h"

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

#include <QDebug>

using namespace KWin;

namespace KWin {

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

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

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

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

KscreenConfig::KscreenConfig( KSharedConfig::Ptr config )
  : KConfigSkeleton( std::move( config ) )
{
  Q_ASSERT(!s_globalKscreenConfig()->q);
  s_globalKscreenConfig()->q = this;
  setCurrentGroup( QStringLiteral( "Effect-Kscreen" ) );

  KConfigSkeleton::ItemInt  *itemDuration;
  itemDuration = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "Duration" ), mDuration, 0 );
  addItem( itemDuration, QStringLiteral( "Duration" ) );
}

KscreenConfig::~KscreenConfig()
{
  s_globalKscreenConfig()->q = nullptr;
}

