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

#include "fallapartconfig.h"

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

#include <QDebug>

using namespace KWin;

namespace KWin {

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

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

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

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

FallApartConfig::FallApartConfig( KSharedConfig::Ptr config )
  : KConfigSkeleton( std::move( config ) )
{
  Q_ASSERT(!s_globalFallApartConfig()->q);
  s_globalFallApartConfig()->q = this;
  setCurrentGroup( QStringLiteral( "Effect-FallApart" ) );

  KConfigSkeleton::ItemInt  *itemBlockSize;
  itemBlockSize = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "BlockSize" ), mBlockSize, 40 );
  itemBlockSize->setMinValue(1);
  itemBlockSize->setMaxValue(100000);
  addItem( itemBlockSize, QStringLiteral( "BlockSize" ) );
}

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

