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

#include "upnppluginsettings.h"

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

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

  return s_globalUPnPPluginSettings()->q;
}

UPnPPluginSettings::UPnPPluginSettings( )
  : KConfigSkeleton( QStringLiteral( "ktorrent_upnprc" ) )
{
  Q_ASSERT(!s_globalUPnPPluginSettings()->q);
  s_globalUPnPPluginSettings()->q = this;
  setCurrentGroup( QStringLiteral( "general" ) );

  KConfigSkeleton::ItemString  *itemDefaultDevice;
  itemDefaultDevice = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "defaultDevice" ), mDefaultDevice );
  addItem( itemDefaultDevice, QStringLiteral( "defaultDevice" ) );
}

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

