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

#include "config.h"

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

class ConfigHelper
{
  public:
    ConfigHelper() : q(nullptr) {}
    ~ConfigHelper() { delete q; q = nullptr; }
    ConfigHelper(const ConfigHelper&) = delete;
    ConfigHelper& operator=(const ConfigHelper&) = delete;
    Config *q;
};
Q_GLOBAL_STATIC(ConfigHelper, s_globalConfig)
Config *Config::self()
{
  if (!s_globalConfig()->q) {
    new Config;
    s_globalConfig()->q->read();
  }

  return s_globalConfig()->q;
}

Config::Config( QObject *parent )
  : KConfigSkeleton( QStringLiteral( "optiimagerc" ) )
{
  setParent(parent);
  Q_ASSERT(!s_globalConfig()->q);
  s_globalConfig()->q = this;
  KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&Config::itemChanged);

  setCurrentGroup( QStringLiteral( "General" ) );

  KConfigCompilerSignallingItem  *itemSafeMode;
  KConfigSkeleton::ItemBool  *innerItemSafeMode;
  innerItemSafeMode = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "SafeMode" ), mSafeMode, true );
  itemSafeMode = new KConfigCompilerSignallingItem(innerItemSafeMode, this, notifyFunction, signalSafeModeChanged);
  addItem( itemSafeMode, QStringLiteral( "SafeMode" ) );
  KConfigCompilerSignallingItem  *itemSuffix;
  KConfigSkeleton::ItemString  *innerItemSuffix;
  innerItemSuffix = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "Suffix" ), mSuffix, QStringLiteral( "-min" ) );
  itemSuffix = new KConfigCompilerSignallingItem(innerItemSuffix, this, notifyFunction, signalSuffixChanged);
  addItem( itemSuffix, QStringLiteral( "Suffix" ) );
  KConfigCompilerSignallingItem  *itemKeepMetadata;
  KConfigSkeleton::ItemBool  *innerItemKeepMetadata;
  innerItemKeepMetadata = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "keepMetadata" ), mKeepMetadata, false );
  itemKeepMetadata = new KConfigCompilerSignallingItem(innerItemKeepMetadata, this, notifyFunction, signalKeepMetadataChanged);
  addItem( itemKeepMetadata, QStringLiteral( "keepMetadata" ) );

  setCurrentGroup( QStringLiteral( "jpg" ) );

  KConfigCompilerSignallingItem  *itemJpgLossless;
  KConfigSkeleton::ItemBool  *innerItemJpgLossless;
  innerItemJpgLossless = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "jpgLossless" ), mJpgLossless, true );
  itemJpgLossless = new KConfigCompilerSignallingItem(innerItemJpgLossless, this, notifyFunction, signalJpgLosslessChanged);
  addItem( itemJpgLossless, QStringLiteral( "jpgLossless" ) );
  KConfigCompilerSignallingItem  *itemJpgLossyLevel;
  KConfigSkeleton::ItemInt  *innerItemJpgLossyLevel;
  innerItemJpgLossyLevel = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "jpgLossyLevel" ), mJpgLossyLevel, 90 );
  itemJpgLossyLevel = new KConfigCompilerSignallingItem(innerItemJpgLossyLevel, this, notifyFunction, signalJpgLossyLevelChanged);
  addItem( itemJpgLossyLevel, QStringLiteral( "jpgLossyLevel" ) );
  KConfigCompilerSignallingItem  *itemJpgProgressive;
  KConfigSkeleton::ItemBool  *innerItemJpgProgressive;
  innerItemJpgProgressive = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "jpgProgressive" ), mJpgProgressive, false );
  itemJpgProgressive = new KConfigCompilerSignallingItem(innerItemJpgProgressive, this, notifyFunction, signalJpgProgressiveChanged);
  addItem( itemJpgProgressive, QStringLiteral( "jpgProgressive" ) );

  setCurrentGroup( QStringLiteral( "png" ) );

  KConfigCompilerSignallingItem  *itemPngLosslessLevel;
  KConfigSkeleton::ItemInt  *innerItemPngLosslessLevel;
  innerItemPngLosslessLevel = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "pngLosslessLevel" ), mPngLosslessLevel, 4 );
  itemPngLosslessLevel = new KConfigCompilerSignallingItem(innerItemPngLosslessLevel, this, notifyFunction, signalPngLosslessLevelChanged);
  addItem( itemPngLosslessLevel, QStringLiteral( "pngLosslessLevel" ) );
  KConfigCompilerSignallingItem  *itemPngLossyLevel;
  KConfigSkeleton::ItemInt  *innerItemPngLossyLevel;
  innerItemPngLossyLevel = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "pngLossyLevel" ), mPngLossyLevel, 4 );
  itemPngLossyLevel = new KConfigCompilerSignallingItem(innerItemPngLossyLevel, this, notifyFunction, signalPngLossyLevelChanged);
  addItem( itemPngLossyLevel, QStringLiteral( "pngLossyLevel" ) );

  setCurrentGroup( QStringLiteral( "svg" ) );

  KConfigCompilerSignallingItem  *itemSvgMaximumLevel;
  KConfigSkeleton::ItemBool  *innerItemSvgMaximumLevel;
  innerItemSvgMaximumLevel = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "svgMaximumLevel" ), mSvgMaximumLevel, false );
  itemSvgMaximumLevel = new KConfigCompilerSignallingItem(innerItemSvgMaximumLevel, this, notifyFunction, signalSvgMaximumLevelChanged);
  addItem( itemSvgMaximumLevel, QStringLiteral( "svgMaximumLevel" ) );

  setCurrentGroup( QStringLiteral( "webp" ) );

  KConfigCompilerSignallingItem  *itemWebpLossless;
  KConfigSkeleton::ItemBool  *innerItemWebpLossless;
  innerItemWebpLossless = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "webpLossless" ), mWebpLossless, true );
  itemWebpLossless = new KConfigCompilerSignallingItem(innerItemWebpLossless, this, notifyFunction, signalWebpLosslessChanged);
  addItem( itemWebpLossless, QStringLiteral( "webpLossless" ) );
  KConfigCompilerSignallingItem  *itemWebpLossyLevel;
  KConfigSkeleton::ItemInt  *innerItemWebpLossyLevel;
  innerItemWebpLossyLevel = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "webpLossyLevel" ), mWebpLossyLevel, 90 );
  itemWebpLossyLevel = new KConfigCompilerSignallingItem(innerItemWebpLossyLevel, this, notifyFunction, signalWebpLossyLevelChanged);
  addItem( itemWebpLossyLevel, QStringLiteral( "webpLossyLevel" ) );
  KConfigCompilerSignallingItem  *itemWebpLosslessLevel;
  KConfigSkeleton::ItemInt  *innerItemWebpLosslessLevel;
  innerItemWebpLosslessLevel = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "webpLosslessLevel" ), mWebpLosslessLevel, 6 );
  itemWebpLosslessLevel = new KConfigCompilerSignallingItem(innerItemWebpLosslessLevel, this, notifyFunction, signalWebpLosslessLevelChanged);
  addItem( itemWebpLosslessLevel, QStringLiteral( "webpLosslessLevel" ) );
}

bool Config::defaultSafeModeValue_helper()
{

  return true;
}

QString Config::defaultSuffixValue_helper()
{

  return QStringLiteral( "-min" );
}

bool Config::defaultKeepMetadataValue_helper()
{

  return false;
}

bool Config::defaultJpgLosslessValue_helper()
{

  return true;
}

int Config::defaultJpgLossyLevelValue_helper()
{

  return 90;
}

bool Config::defaultJpgProgressiveValue_helper()
{

  return false;
}

int Config::defaultPngLosslessLevelValue_helper()
{

  return 4;
}

int Config::defaultPngLossyLevelValue_helper()
{

  return 4;
}

bool Config::defaultSvgMaximumLevelValue_helper()
{

  return false;
}

bool Config::defaultWebpLosslessValue_helper()
{

  return true;
}

int Config::defaultWebpLossyLevelValue_helper()
{

  return 90;
}

int Config::defaultWebpLosslessLevelValue_helper()
{

  return 6;
}

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


void Config::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalSafeModeChanged:
    Q_EMIT SafeModeChanged();
    break;
  case signalSuffixChanged:
    Q_EMIT SuffixChanged();
    break;
  case signalKeepMetadataChanged:
    Q_EMIT keepMetadataChanged();
    break;
  case signalJpgLosslessChanged:
    Q_EMIT jpgLosslessChanged();
    break;
  case signalJpgLossyLevelChanged:
    Q_EMIT jpgLossyLevelChanged();
    break;
  case signalJpgProgressiveChanged:
    Q_EMIT jpgProgressiveChanged();
    break;
  case signalPngLosslessLevelChanged:
    Q_EMIT pngLosslessLevelChanged();
    break;
  case signalPngLossyLevelChanged:
    Q_EMIT pngLossyLevelChanged();
    break;
  case signalSvgMaximumLevelChanged:
    Q_EMIT svgMaximumLevelChanged();
    break;
  case signalWebpLosslessChanged:
    Q_EMIT webpLosslessChanged();
    break;
  case signalWebpLossyLevelChanged:
    Q_EMIT webpLossyLevelChanged();
    break;
  case signalWebpLosslessLevelChanged:
    Q_EMIT webpLosslessLevelChanged();
    break;
  }
}
