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

#include "bittorrentsettings.h"

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

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

  return s_globalBittorrentSettings()->q;
}

BittorrentSettings::BittorrentSettings( )
  : KConfigSkeleton( QStringLiteral( "kget_bittorrentfactory.rc" ) )
{
  Q_ASSERT(!s_globalBittorrentSettings()->q);
  s_globalBittorrentSettings()->q = this;
  setCurrentGroup( QStringLiteral( "General" ) );

  KConfigSkeleton::ItemInt  *itemUploadLimit;
  itemUploadLimit = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "UploadLimit" ), mUploadLimit, 0 );
  addItem( itemUploadLimit, QStringLiteral( "UploadLimit" ) );
  KConfigSkeleton::ItemInt  *itemDownloadLimit;
  itemDownloadLimit = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "DownloadLimit" ), mDownloadLimit, 0 );
  addItem( itemDownloadLimit, QStringLiteral( "DownloadLimit" ) );
  KConfigSkeleton::ItemInt  *itemPort;
  itemPort = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "Port" ), mPort, 6881 );
  addItem( itemPort, QStringLiteral( "Port" ) );
  KConfigSkeleton::ItemBool  *itemEnableUTP;
  itemEnableUTP = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "EnableUTP" ), mEnableUTP, false );
  addItem( itemEnableUTP, QStringLiteral( "EnableUTP" ) );

  setCurrentGroup( QStringLiteral( "Dirs" ) );

  KConfigSkeleton::ItemString  *itemTorrentDir;
  itemTorrentDir = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "TorrentDir" ), mTorrentDir );
  addItem( itemTorrentDir, QStringLiteral( "TorrentDir" ) );
  KConfigSkeleton::ItemString  *itemTmpDir;
  itemTmpDir = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "TmpDir" ), mTmpDir );
  addItem( itemTmpDir, QStringLiteral( "TmpDir" ) );
  KConfigSkeleton::ItemBool  *itemPreAlloc;
  itemPreAlloc = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "PreAlloc" ), mPreAlloc, true );
  addItem( itemPreAlloc, QStringLiteral( "PreAlloc" ) );

  setCurrentGroup( QStringLiteral( "AdvancedDetails" ) );

  QList<int> defaultFileColumnWidths;

  KConfigSkeleton::ItemIntList  *itemFileColumnWidths;
  itemFileColumnWidths = new KConfigSkeleton::ItemIntList( currentGroup(), QStringLiteral( "FileColumnWidths" ), mFileColumnWidths, defaultFileColumnWidths );
  addItem( itemFileColumnWidths, QStringLiteral( "FileColumnWidths" ) );
  QList<int> defaultPeersColumnWidths;

  KConfigSkeleton::ItemIntList  *itemPeersColumnWidths;
  itemPeersColumnWidths = new KConfigSkeleton::ItemIntList( currentGroup(), QStringLiteral( "PeersColumnWidths" ), mPeersColumnWidths, defaultPeersColumnWidths );
  addItem( itemPeersColumnWidths, QStringLiteral( "PeersColumnWidths" ) );
  QList<int> defaultChunksColumnWidths;

  KConfigSkeleton::ItemIntList  *itemChunksColumnWidths;
  itemChunksColumnWidths = new KConfigSkeleton::ItemIntList( currentGroup(), QStringLiteral( "ChunksColumnWidths" ), mChunksColumnWidths, defaultChunksColumnWidths );
  addItem( itemChunksColumnWidths, QStringLiteral( "ChunksColumnWidths" ) );
}

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

