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

#include "desktopgridconfig.h"

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

#include <QDebug>

using namespace KWin;

namespace KWin {

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

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

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

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

DesktopGridConfig::DesktopGridConfig( KSharedConfig::Ptr config )
  : KConfigSkeleton( std::move( config ) )
{
  Q_ASSERT(!s_globalDesktopGridConfig()->q);
  s_globalDesktopGridConfig()->q = this;
  setCurrentGroup( QStringLiteral( "Effect-DesktopGrid" ) );

  QList<int> defaultBorderActivate;

  KConfigSkeleton::ItemIntList  *itemBorderActivate;
  itemBorderActivate = new KConfigSkeleton::ItemIntList( currentGroup(), QStringLiteral( "BorderActivate" ), mBorderActivate, defaultBorderActivate );
  addItem( itemBorderActivate, QStringLiteral( "BorderActivate" ) );
  QList<int> defaultTouchBorderActivate;

  KConfigSkeleton::ItemIntList  *itemTouchBorderActivate;
  itemTouchBorderActivate = new KConfigSkeleton::ItemIntList( currentGroup(), QStringLiteral( "TouchBorderActivate" ), mTouchBorderActivate, defaultTouchBorderActivate );
  addItem( itemTouchBorderActivate, QStringLiteral( "TouchBorderActivate" ) );
  KConfigSkeleton::ItemInt  *itemZoomDuration;
  itemZoomDuration = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "ZoomDuration" ), mZoomDuration, 0 );
  addItem( itemZoomDuration, QStringLiteral( "ZoomDuration" ) );
  KConfigSkeleton::ItemInt  *itemBorderWidth;
  itemBorderWidth = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "BorderWidth" ), mBorderWidth, 10 );
  addItem( itemBorderWidth, QStringLiteral( "BorderWidth" ) );
  KConfigSkeleton::ItemInt  *itemDesktopNameAlignment;
  itemDesktopNameAlignment = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "DesktopNameAlignment" ), mDesktopNameAlignment, 0 );
  addItem( itemDesktopNameAlignment, QStringLiteral( "DesktopNameAlignment" ) );
  KConfigSkeleton::ItemInt  *itemLayoutMode;
  itemLayoutMode = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "LayoutMode" ), mLayoutMode, 0 );
  addItem( itemLayoutMode, QStringLiteral( "LayoutMode" ) );
  KConfigSkeleton::ItemInt  *itemCustomLayoutRows;
  itemCustomLayoutRows = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "CustomLayoutRows" ), mCustomLayoutRows, 2 );
  addItem( itemCustomLayoutRows, QStringLiteral( "CustomLayoutRows" ) );
  KConfigSkeleton::ItemInt  *itemClickBehavior;
  itemClickBehavior = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "ClickBehavior" ), mClickBehavior, 0 );
  addItem( itemClickBehavior, QStringLiteral( "ClickBehavior" ) );
  KConfigSkeleton::ItemBool  *itemShowAddRemove;
  itemShowAddRemove = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ShowAddRemove" ), mShowAddRemove, true );
  addItem( itemShowAddRemove, QStringLiteral( "ShowAddRemove" ) );
}

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

