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

#include "sheetconfig.h"

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

#include <QDebug>

using namespace KWin;

namespace KWin {

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

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

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

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

SheetConfig::SheetConfig(  KSharedConfig::Ptr config  )
  : KConfigSkeleton( config )
{
  Q_ASSERT(!s_globalSheetConfig()->q);
  s_globalSheetConfig()->q = this;
  setCurrentGroup( QStringLiteral( "Effect-Sheet" ) );

  KConfigSkeleton::ItemInt  *itemAnimationTime;
  itemAnimationTime = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "AnimationTime" ), mAnimationTime, 0 );
  addItem( itemAnimationTime, QStringLiteral( "AnimationTime" ) );
}

SheetConfig::~SheetConfig()
{
  s_globalSheetConfig()->q = nullptr;
}

