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

#include "ipfilterpluginsettings.h"

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

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

  return s_globalIPBlockingPluginSettings()->q;
}

IPBlockingPluginSettings::IPBlockingPluginSettings( )
  : KConfigSkeleton( QStringLiteral( "ktorrent_ipfilterrc" ) )
{
  Q_ASSERT(!s_globalIPBlockingPluginSettings()->q);
  s_globalIPBlockingPluginSettings()->q = this;
  setCurrentGroup( QStringLiteral( "general" ) );

  KConfigSkeleton::ItemUrl  *itemFilterURL;
  itemFilterURL = new KConfigSkeleton::ItemUrl( currentGroup(), QStringLiteral( "filterURL" ), mFilterURL, QUrl(QStringLiteral("http://list.iblocklist.com/?list=bt_level1&fileformat=p2p&archiveformat=gz")) );
  addItem( itemFilterURL, QStringLiteral( "filterURL" ) );
  KConfigSkeleton::ItemBool  *itemUseLevel1;
  itemUseLevel1 = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "useLevel1" ), mUseLevel1, false );
  addItem( itemUseLevel1, QStringLiteral( "useLevel1" ) );
  KConfigSkeleton::ItemBool  *itemAutoUpdate;
  itemAutoUpdate = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "autoUpdate" ), mAutoUpdate, false );
  addItem( itemAutoUpdate, QStringLiteral( "autoUpdate" ) );
  KConfigSkeleton::ItemInt  *itemAutoUpdateInterval;
  itemAutoUpdateInterval = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "autoUpdateInterval" ), mAutoUpdateInterval, 7 );
  itemAutoUpdateInterval->setMinValue(1);
  itemAutoUpdateInterval->setMaxValue(1000);
  addItem( itemAutoUpdateInterval, QStringLiteral( "autoUpdateInterval" ) );
}

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

