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

#include "thumbnailasideconfig.h"

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

#include <QDebug>

using namespace KWin;

namespace KWin {

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

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

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

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

ThumbnailAsideConfig::ThumbnailAsideConfig( KSharedConfig::Ptr config )
  : KConfigSkeleton( std::move( config ) )
{
  Q_ASSERT(!s_globalThumbnailAsideConfig()->q);
  s_globalThumbnailAsideConfig()->q = this;
  setCurrentGroup( QStringLiteral( "Effect-thumbnailaside" ) );

  KConfigSkeleton::ItemInt  *itemMaxWidth;
  itemMaxWidth = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "MaxWidth" ), mMaxWidth, 200 );
  addItem( itemMaxWidth, QStringLiteral( "MaxWidth" ) );
  KConfigSkeleton::ItemInt  *itemSpacing;
  itemSpacing = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "Spacing" ), mSpacing, 10 );
  addItem( itemSpacing, QStringLiteral( "Spacing" ) );
  KConfigSkeleton::ItemDouble  *itemOpacity;
  itemOpacity = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "Opacity" ), mOpacity, 50 );
  addItem( itemOpacity, QStringLiteral( "Opacity" ) );
  KConfigSkeleton::ItemInt  *itemScreen;
  itemScreen = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "Screen" ), mScreen, -1 );
  addItem( itemScreen, QStringLiteral( "Screen" ) );
}

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

