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

#include "mousemarkconfig.h"

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

#include <QDebug>

using namespace KWin;

namespace KWin {

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

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

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

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

MouseMarkConfig::MouseMarkConfig( KSharedConfig::Ptr config )
  : KConfigSkeleton( std::move( config ) )
{
  Q_ASSERT(!s_globalMouseMarkConfig()->q);
  s_globalMouseMarkConfig()->q = this;
  setCurrentGroup( QStringLiteral( "Effect-MouseMark" ) );

  KConfigSkeleton::ItemUInt  *itemLineWidth;
  itemLineWidth = new KConfigSkeleton::ItemUInt( currentGroup(), QStringLiteral( "LineWidth" ), mLineWidth, 3 );
  addItem( itemLineWidth, QStringLiteral( "LineWidth" ) );
  KConfigSkeleton::ItemColor  *itemColor;
  itemColor = new KConfigSkeleton::ItemColor( currentGroup(), QStringLiteral( "Color" ), mColor, QColor( 255,0,0 ) );
  addItem( itemColor, QStringLiteral( "Color" ) );
}

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

