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

#include "trackmouseconfig.h"

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

#include <QDebug>

using namespace KWin;

namespace KWin {

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

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

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

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

TrackMouseConfig::TrackMouseConfig( KSharedConfig::Ptr config )
  : KConfigSkeleton( std::move( config ) )
{
  Q_ASSERT(!s_globalTrackMouseConfig()->q);
  s_globalTrackMouseConfig()->q = this;
  setCurrentGroup( QStringLiteral( "Effect-TrackMouse" ) );

  KConfigSkeleton::ItemBool  *itemMeta;
  itemMeta = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "Meta" ), mMeta, true );
  addItem( itemMeta, QStringLiteral( "Meta" ) );
  KConfigSkeleton::ItemBool  *itemControl;
  itemControl = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "Control" ), mControl, true );
  addItem( itemControl, QStringLiteral( "Control" ) );
  KConfigSkeleton::ItemBool  *itemAlt;
  itemAlt = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "Alt" ), mAlt, false );
  addItem( itemAlt, QStringLiteral( "Alt" ) );
  KConfigSkeleton::ItemBool  *itemShift;
  itemShift = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "Shift" ), mShift, false );
  addItem( itemShift, QStringLiteral( "Shift" ) );
}

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

