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

#include "mouseclickconfig.h"

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

#include <QDebug>

using namespace KWin;

namespace KWin {

class MouseClickConfigHelper
{
  public:
    MouseClickConfigHelper() noexcept : q(nullptr) {}
    ~MouseClickConfigHelper() noexcept { delete q; q = nullptr; }
    MouseClickConfigHelper(const MouseClickConfigHelper&) = delete;
    MouseClickConfigHelper& operator=(const MouseClickConfigHelper&) = delete;
    MouseClickConfig *q;
};

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

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

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

MouseClickConfig::MouseClickConfig( KSharedConfig::Ptr config )
  : KConfigSkeleton( std::move( config ) )
{
  Q_ASSERT(!s_globalMouseClickConfig()->q);
  s_globalMouseClickConfig()->q = this;
  setCurrentGroup( QStringLiteral( "Effect-mouseclick" ) );

  KConfigSkeleton::ItemColor  *itemColor1;
  itemColor1 = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "Color1" ), mColor1, QColor(Qt::red) );
  addItem( itemColor1, QStringLiteral( "Color1" ) );
  KConfigSkeleton::ItemColor  *itemColor2;
  itemColor2 = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "Color2" ), mColor2, QColor(Qt::green) );
  addItem( itemColor2, QStringLiteral( "Color2" ) );
  KConfigSkeleton::ItemColor  *itemColor3;
  itemColor3 = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "Color3" ), mColor3, QColor(Qt::blue) );
  addItem( itemColor3, QStringLiteral( "Color3" ) );
  KConfigSkeleton::ItemDouble  *itemLineWidth;
  itemLineWidth = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "LineWidth" ), mLineWidth, 1.0 );
  addItem( itemLineWidth, QStringLiteral( "LineWidth" ) );
  KConfigSkeleton::ItemUInt  *itemRingLife;
  itemRingLife = new KConfigSkeleton::ItemUInt( currentGroup(), QStringLiteral( "RingLife" ), mRingLife, 300 );
  addItem( itemRingLife, QStringLiteral( "RingLife" ) );
  KConfigSkeleton::ItemUInt  *itemRingSize;
  itemRingSize = new KConfigSkeleton::ItemUInt( currentGroup(), QStringLiteral( "RingSize" ), mRingSize, 20 );
  addItem( itemRingSize, QStringLiteral( "RingSize" ) );
  KConfigSkeleton::ItemUInt  *itemRingCount;
  itemRingCount = new KConfigSkeleton::ItemUInt( currentGroup(), QStringLiteral( "RingCount" ), mRingCount, 2 );
  addItem( itemRingCount, QStringLiteral( "RingCount" ) );
  KConfigSkeleton::ItemBool  *itemShowText;
  itemShowText = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ShowText" ), mShowText, true );
  addItem( itemShowText, QStringLiteral( "ShowText" ) );
  KConfigSkeleton::ItemFont  *itemFont;
  itemFont = new KConfigSkeleton::ItemFont( currentGroup(), QStringLiteral( "Font" ), mFont );
  addItem( itemFont, QStringLiteral( "Font" ) );
}

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

