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

#include "windowgeometryconfig.h"

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

#include <QDebug>

using namespace KWin;

namespace KWin {

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

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

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

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

WindowGeometryConfiguration::WindowGeometryConfiguration(  KSharedConfig::Ptr config  )
  : KConfigSkeleton( config )
{
  Q_ASSERT(!s_globalWindowGeometryConfiguration()->q);
  s_globalWindowGeometryConfiguration()->q = this;
  setCurrentGroup( QStringLiteral( "Effect-WindowGeometry" ) );

  KConfigSkeleton::ItemBool  *itemMove;
  itemMove = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "Move" ), mMove, true );
  addItem( itemMove, QStringLiteral( "Move" ) );
  KConfigSkeleton::ItemBool  *itemResize;
  itemResize = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "Resize" ), mResize, true );
  addItem( itemResize, QStringLiteral( "Resize" ) );
}

WindowGeometryConfiguration::~WindowGeometryConfiguration()
{
  s_globalWindowGeometryConfiguration()->q = nullptr;
}

