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

#include "globalscalesettings.h"

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

class GlobalScaleSettingsHelper
{
  public:
    GlobalScaleSettingsHelper() noexcept : q(nullptr) {}
    ~GlobalScaleSettingsHelper() noexcept { delete q; q = nullptr; }
    GlobalScaleSettingsHelper(const GlobalScaleSettingsHelper&) = delete;
    GlobalScaleSettingsHelper& operator=(const GlobalScaleSettingsHelper&) = delete;
    GlobalScaleSettings *q;
};
Q_GLOBAL_STATIC(GlobalScaleSettingsHelper, s_globalGlobalScaleSettings)
GlobalScaleSettings *GlobalScaleSettings::self()
{
  if (!s_globalGlobalScaleSettings()->q) {
    new GlobalScaleSettings;
    s_globalGlobalScaleSettings()->q->read();
  }

  return s_globalGlobalScaleSettings()->q;
}

GlobalScaleSettings::GlobalScaleSettings( )
  : KConfigSkeleton( QStringLiteral( "kdeglobals" ) )
{
  Q_ASSERT(!s_globalGlobalScaleSettings()->q);
  s_globalGlobalScaleSettings()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&GlobalScaleSettings::itemChanged);

  setCurrentGroup( QStringLiteral( "KScreen" ) );

  KConfigCompilerSignallingItem  *itemScaleFactor;
  KConfigSkeleton::ItemDouble  *innerItemScaleFactor;
  innerItemScaleFactor = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "ScaleFactor" ), mScaleFactor, 1.0 );
  itemScaleFactor = new KConfigCompilerSignallingItem(innerItemScaleFactor, this, notifyFunction, signalScaleFactorChanged);
  itemScaleFactor->setWriteFlags(KConfigBase::Notify);
  addItem( itemScaleFactor, QStringLiteral( "scaleFactor" ) );
  KConfigCompilerSignallingItem  *itemXwaylandClientsScale;
  KConfigSkeleton::ItemBool  *innerItemXwaylandClientsScale;
  innerItemXwaylandClientsScale = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "XwaylandClientsScale" ), mXwaylandClientsScale, true );
  itemXwaylandClientsScale = new KConfigCompilerSignallingItem(innerItemXwaylandClientsScale, this, notifyFunction, signalXwaylandClientsScaleChanged);
  itemXwaylandClientsScale->setWriteFlags(KConfigBase::Notify);
  addItem( itemXwaylandClientsScale, QStringLiteral( "xwaylandClientsScale" ) );
}

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


void GlobalScaleSettings::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalScaleFactorChanged:
    Q_EMIT scaleFactorChanged();
    break;
  case signalXwaylandClientsScaleChanged:
    Q_EMIT xwaylandClientsScaleChanged();
    break;
  }
}
