// 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>
#include <QQmlEngine>

class ConfigHelper
{
  public:
    ConfigHelper() noexcept : q(nullptr) {}
    ~ConfigHelper() noexcept { 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::create(QQmlEngine *, QJSEngine *)
{
  QQmlEngine::setObjectOwnership(self(), QQmlEngine::CppOwnership);
  return self();
}

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

  setCurrentGroup( QStringLiteral( "General" ) );

  KConfigCompilerSignallingItem  *itemShowPostStats;
  KConfigSkeleton::ItemBool  *innerItemShowPostStats;
  innerItemShowPostStats = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ShowPostStats" ), mShowPostStats, false );
  itemShowPostStats = new KConfigCompilerSignallingItem(innerItemShowPostStats, this, notifyFunction, signalShowPostStatsChanged);
  addItem( itemShowPostStats, QStringLiteral( "ShowPostStats" ) );
  KConfigCompilerSignallingItem  *itemShowLinkPreview;
  KConfigSkeleton::ItemBool  *innerItemShowLinkPreview;
  innerItemShowLinkPreview = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ShowLinkPreview" ), mShowLinkPreview, true );
  itemShowLinkPreview = new KConfigCompilerSignallingItem(innerItemShowLinkPreview, this, notifyFunction, signalShowLinkPreviewChanged);
  addItem( itemShowLinkPreview, QStringLiteral( "ShowLinkPreview" ) );
  KConfigCompilerSignallingItem  *itemPopOutByDefault;
  KConfigSkeleton::ItemBool  *innerItemPopOutByDefault;
  innerItemPopOutByDefault = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "PopOutByDefault" ), mPopOutByDefault, false );
  itemPopOutByDefault = new KConfigCompilerSignallingItem(innerItemPopOutByDefault, this, notifyFunction, signalPopOutByDefaultChanged);
  addItem( itemPopOutByDefault, QStringLiteral( "PopOutByDefault" ) );
  KConfigCompilerSignallingItem  *itemContinueReading;
  KConfigSkeleton::ItemBool  *innerItemContinueReading;
  innerItemContinueReading = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "ContinueReading" ), mContinueReading, false );
  itemContinueReading = new KConfigCompilerSignallingItem(innerItemContinueReading, this, notifyFunction, signalContinueReadingChanged);
  addItem( itemContinueReading, QStringLiteral( "ContinueReading" ) );
  KConfigCompilerSignallingItem  *itemAutoUpdate;
  KConfigSkeleton::ItemBool  *innerItemAutoUpdate;
  innerItemAutoUpdate = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "AutoUpdate" ), mAutoUpdate, true );
  itemAutoUpdate = new KConfigCompilerSignallingItem(innerItemAutoUpdate, this, notifyFunction, signalAutoUpdateChanged);
  addItem( itemAutoUpdate, QStringLiteral( "AutoUpdate" ) );
  KConfigCompilerSignallingItem  *itemCropMedia;
  KConfigSkeleton::ItemBool  *innerItemCropMedia;
  innerItemCropMedia = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "CropMedia" ), mCropMedia, true );
  itemCropMedia = new KConfigCompilerSignallingItem(innerItemCropMedia, this, notifyFunction, signalCropMediaChanged);
  addItem( itemCropMedia, QStringLiteral( "CropMedia" ) );
  KConfigCompilerSignallingItem  *itemAutoPlayGif;
  KConfigSkeleton::ItemBool  *innerItemAutoPlayGif;
  innerItemAutoPlayGif = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "AutoPlayGif" ), mAutoPlayGif, true );
  itemAutoPlayGif = new KConfigCompilerSignallingItem(innerItemAutoPlayGif, this, notifyFunction, signalAutoPlayGifChanged);
  addItem( itemAutoPlayGif, QStringLiteral( "AutoPlayGif" ) );
  KConfigCompilerSignallingItem  *itemLastUsedAccount;
  KConfigSkeleton::ItemString  *innerItemLastUsedAccount;
  innerItemLastUsedAccount = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "LastUsedAccount" ), mLastUsedAccount );
  itemLastUsedAccount = new KConfigCompilerSignallingItem(innerItemLastUsedAccount, this, notifyFunction, signalLastUsedAccountChanged);
  addItem( itemLastUsedAccount, QStringLiteral( "LastUsedAccount" ) );
  KConfigCompilerSignallingItem  *itemColorScheme;
  KConfigSkeleton::ItemString  *innerItemColorScheme;
  innerItemColorScheme = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "ColorScheme" ), mColorScheme );
  itemColorScheme = new KConfigCompilerSignallingItem(innerItemColorScheme, this, notifyFunction, signalColorSchemeChanged);
  addItem( itemColorScheme, QStringLiteral( "ColorScheme" ) );

        Kirigami::Platform::PlatformTheme theme;
      
  KConfigCompilerSignallingItem  *itemDefaultFont;
  KConfigSkeleton::ItemFont  *innerItemDefaultFont;
  innerItemDefaultFont = new KConfigSkeleton::ItemFont( currentGroup(), QStringLiteral( "defaultFont" ), mDefaultFont, theme.defaultFont() );
  itemDefaultFont = new KConfigCompilerSignallingItem(innerItemDefaultFont, this, notifyFunction, signalDefaultFontChanged);
  addItem( itemDefaultFont, QStringLiteral( "defaultFont" ) );
  KConfigCompilerSignallingItem  *itemPromptedNotificationPermission;
  KConfigSkeleton::ItemBool  *innerItemPromptedNotificationPermission;
  innerItemPromptedNotificationPermission = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "PromptedNotificationPermission" ), mPromptedNotificationPermission, false );
  itemPromptedNotificationPermission = new KConfigCompilerSignallingItem(innerItemPromptedNotificationPermission, this, notifyFunction, signalPromptedNotificationPermissionChanged);
  addItem( itemPromptedNotificationPermission, QStringLiteral( "PromptedNotificationPermission" ) );
  KConfigCompilerSignallingItem  *itemAskBeforeBoosting;
  KConfigSkeleton::ItemBool  *innerItemAskBeforeBoosting;
  innerItemAskBeforeBoosting = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "AskBeforeBoosting" ), mAskBeforeBoosting, false );
  itemAskBeforeBoosting = new KConfigCompilerSignallingItem(innerItemAskBeforeBoosting, this, notifyFunction, signalAskBeforeBoostingChanged);
  addItem( itemAskBeforeBoosting, QStringLiteral( "AskBeforeBoosting" ) );

  setCurrentGroup( QStringLiteral( "NetworkProxy" ) );

  QList<KConfigSkeleton::ItemEnum::Choice> valuesProxyType;
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("System");
    valuesProxyType.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("HTTP");
    valuesProxyType.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("Socks5");
    valuesProxyType.append( choice );
  }
  {
    KConfigSkeleton::ItemEnum::Choice choice;
    choice.name = QStringLiteral("NoProxy");
    valuesProxyType.append( choice );
  }
  KConfigCompilerSignallingItem  *itemProxyType;
  KConfigSkeleton::ItemEnum  *innerItemProxyType;
  innerItemProxyType = new KConfigSkeleton::ItemEnum( currentGroup(), QStringLiteral( "ProxyType" ), mProxyType, valuesProxyType, EnumProxyType::System );
  itemProxyType = new KConfigCompilerSignallingItem(innerItemProxyType, this, notifyFunction, signalProxyTypeChanged);
  addItem( itemProxyType, QStringLiteral( "ProxyType" ) );
  KConfigCompilerSignallingItem  *itemProxyHost;
  KConfigSkeleton::ItemString  *innerItemProxyHost;
  innerItemProxyHost = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "ProxyHost" ), mProxyHost, QStringLiteral( "127.0.0.1" ) );
  itemProxyHost = new KConfigCompilerSignallingItem(innerItemProxyHost, this, notifyFunction, signalProxyHostChanged);
  addItem( itemProxyHost, QStringLiteral( "ProxyHost" ) );
  KConfigCompilerSignallingItem  *itemProxyPort;
  KConfigSkeleton::ItemInt  *innerItemProxyPort;
  innerItemProxyPort = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "ProxyPort" ), mProxyPort, 1080 );
  itemProxyPort = new KConfigCompilerSignallingItem(innerItemProxyPort, this, notifyFunction, signalProxyPortChanged);
  addItem( itemProxyPort, QStringLiteral( "ProxyPort" ) );
  KConfigCompilerSignallingItem  *itemProxyUser;
  KConfigSkeleton::ItemString  *innerItemProxyUser;
  innerItemProxyUser = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "ProxyUser" ), mProxyUser );
  itemProxyUser = new KConfigCompilerSignallingItem(innerItemProxyUser, this, notifyFunction, signalProxyUserChanged);
  addItem( itemProxyUser, QStringLiteral( "ProxyUser" ) );
  KConfigCompilerSignallingItem  *itemProxyPassword;
  KConfigSkeleton::ItemPassword  *innerItemProxyPassword;
  innerItemProxyPassword = new KConfigSkeleton::ItemPassword( currentGroup(), QStringLiteral( "ProxyPassword" ), mProxyPassword );
  itemProxyPassword = new KConfigCompilerSignallingItem(innerItemProxyPassword, this, notifyFunction, signalProxyPasswordChanged);
  addItem( itemProxyPassword, QStringLiteral( "ProxyPassword" ) );

  setCurrentGroup( QStringLiteral( "Network" ) );

  KConfigCompilerSignallingItem  *itemTimeout;
  KConfigSkeleton::ItemInt  *innerItemTimeout;
  innerItemTimeout = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "Timeout" ), mTimeout, (int)QNetworkRequest::DefaultTransferTimeoutConstant );
  itemTimeout = new KConfigCompilerSignallingItem(innerItemTimeout, this, notifyFunction, signalTimeoutChanged);
  addItem( itemTimeout, QStringLiteral( "Timeout" ) );
}

bool Config::defaultShowPostStatsValue_helper()
{

  return false;
}

bool Config::defaultShowLinkPreviewValue_helper()
{

  return true;
}

bool Config::defaultPopOutByDefaultValue_helper()
{

  return false;
}

bool Config::defaultContinueReadingValue_helper()
{

  return false;
}

bool Config::defaultAutoUpdateValue_helper()
{

  return true;
}

bool Config::defaultCropMediaValue_helper()
{

  return true;
}

bool Config::defaultAutoPlayGifValue_helper()
{

  return true;
}

QFont Config::defaultDefaultFontValue_helper()
{

        Kirigami::Platform::PlatformTheme theme;
      
  return theme.defaultFont();
}

bool Config::defaultPromptedNotificationPermissionValue_helper()
{

  return false;
}

bool Config::defaultAskBeforeBoostingValue_helper()
{

  return false;
}

int Config::defaultProxyTypeValue_helper()
{

  return EnumProxyType::System;
}

QString Config::defaultProxyHostValue_helper()
{

  return QStringLiteral( "127.0.0.1" );
}

int Config::defaultProxyPortValue_helper()
{

  return 1080;
}

int Config::defaultTimeoutValue_helper()
{

  return (int)QNetworkRequest::DefaultTransferTimeoutConstant;
}

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


void Config::itemChanged(quint64 signalFlag) {

  switch (signalFlag) {
  case signalShowPostStatsChanged:
    Q_EMIT ShowPostStatsChanged();
    break;
  case signalShowLinkPreviewChanged:
    Q_EMIT ShowLinkPreviewChanged();
    break;
  case signalPopOutByDefaultChanged:
    Q_EMIT PopOutByDefaultChanged();
    break;
  case signalContinueReadingChanged:
    Q_EMIT ContinueReadingChanged();
    break;
  case signalAutoUpdateChanged:
    Q_EMIT AutoUpdateChanged();
    break;
  case signalCropMediaChanged:
    Q_EMIT CropMediaChanged();
    break;
  case signalAutoPlayGifChanged:
    Q_EMIT AutoPlayGifChanged();
    break;
  case signalLastUsedAccountChanged:
    Q_EMIT LastUsedAccountChanged();
    break;
  case signalColorSchemeChanged:
    Q_EMIT ColorSchemeChanged();
    break;
  case signalDefaultFontChanged:
    Q_EMIT defaultFontChanged();
    break;
  case signalPromptedNotificationPermissionChanged:
    Q_EMIT PromptedNotificationPermissionChanged();
    break;
  case signalAskBeforeBoostingChanged:
    Q_EMIT AskBeforeBoostingChanged();
    break;
  case signalProxyTypeChanged:
    Q_EMIT ProxyTypeChanged();
    break;
  case signalProxyHostChanged:
    Q_EMIT ProxyHostChanged();
    break;
  case signalProxyPortChanged:
    Q_EMIT ProxyPortChanged();
    break;
  case signalProxyUserChanged:
    Q_EMIT ProxyUserChanged();
    break;
  case signalProxyPasswordChanged:
    Q_EMIT ProxyPasswordChanged();
    break;
  case signalTimeoutChanged:
    Q_EMIT TimeoutChanged();
    break;
  }
}
