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

#include "colorblindnesscorrectionconfig.h"

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

#include <QDebug>

using namespace KWin;

namespace KWin {

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

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

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

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

ColorBlindnessCorrectionSettings::ColorBlindnessCorrectionSettings( KSharedConfig::Ptr config )
  : KConfigSkeleton( std::move( config ) )
{
  Q_ASSERT(!s_globalColorBlindnessCorrectionSettings()->q);
  s_globalColorBlindnessCorrectionSettings()->q = this;
  setCurrentGroup( QStringLiteral( "Effect-colorblindnesscorrection" ) );

  KConfigSkeleton::ItemUInt  *itemMode;
  itemMode = new KConfigSkeleton::ItemUInt( currentGroup(), QStringLiteral( "Mode" ), mMode, 0 );
  addItem( itemMode, QStringLiteral( "Mode" ) );
  KConfigSkeleton::ItemDouble  *itemIntensity;
  itemIntensity = new KConfigSkeleton::ItemDouble( currentGroup(), QStringLiteral( "Intensity" ), mIntensity, 1.0 );
  addItem( itemIntensity, QStringLiteral( "Intensity" ) );
}

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

