// This file is generated by kconfig_compiler_kf6 from desktopgridconfig.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  *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, 1 );
  addItem( itemLayoutMode, QStringLiteral( "LayoutMode" ) );
  KConfigSkeleton::ItemInt  *itemDesktopLayoutMode;
  itemDesktopLayoutMode = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "DesktopLayoutMode" ), mDesktopLayoutMode, 0 );
  addItem( itemDesktopLayoutMode, QStringLiteral( "DesktopLayoutMode" ) );
  KConfigSkeleton::ItemInt  *itemCustomLayoutRows;
  itemCustomLayoutRows = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "CustomLayoutRows" ), mCustomLayoutRows, 2 );
  addItem( itemCustomLayoutRows, QStringLiteral( "CustomLayoutRows" ) );
  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;
  }
}

