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

#include "settings.h"

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

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

  return s_globalSettings()->q;
}

Settings::Settings( )
  : KConfigSkeleton()
{
  Q_ASSERT(!s_globalSettings()->q);
  s_globalSettings()->q = this;
  setCurrentGroup( QStringLiteral( "Options" ) );

  mWaitTimeItem = new KConfigSkeleton::ItemUInt( currentGroup(), QStringLiteral( "WaitTime" ), mWaitTime, 1 );
  mWaitTimeItem->setMinValue(0);
  mWaitTimeItem->setMaxValue(60);
  mWaitTimeItem->setLabel( QCoreApplication::translate("Settings", "Wait time:") );
  mWaitTimeItem->setToolTip( QCoreApplication::translate("Settings", "The wait time between item requests, to reduce web server load") );
  addItem( mWaitTimeItem, QStringLiteral( "WaitTime" ) );
  mNoProxyItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "NoProxy" ), mNoProxy, false );
  mNoProxyItem->setLabel( QCoreApplication::translate("Settings", "Do not use proxy") );
  mNoProxyItem->setToolTip( QCoreApplication::translate("Settings", "Do not use the system proxy settings to fetch the web page") );
  addItem( mNoProxyItem, QStringLiteral( "NoProxy" ) );
  mRandomWaitItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "RandomWait" ), mRandomWait, false );
  mRandomWaitItem->setLabel( QCoreApplication::translate("Settings", "Randomise wait time") );
  mRandomWaitItem->setToolTip( QCoreApplication::translate("Settings", "Vary the wait time between requests, to confuse server log analysis") );
  addItem( mRandomWaitItem, QStringLiteral( "RandomWait" ) );
  mFixExtensionsItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "FixExtensions" ), mFixExtensions, true );
  mFixExtensionsItem->setLabel( QCoreApplication::translate("Settings", "Save in standard web archive format") );
  mFixExtensionsItem->setToolTip( QCoreApplication::translate("Settings", "<p>Save downloaded files all in a single directory, with file name extensions suitable for local browsing.\n"
"                        For example, the main HTML page will always be called \"index.html\" and a remote .php page will be saved with the standard .html extension.</p>\n"
"               <p>Leave this option turned on to produce a standard web archive (.war) file.</p>\n"
"               <p>If this option is turned off, then the files will be saved exactly as downloaded.\n"
"                        This means that they may be in subdirectories reflecting the structure of the original web site, and extensions will not be adjusted.\n"
"                        Note that the download may not work correctly if the original URL refers to a directory but does not end with a slash.</p>\n"
"      ") );
  addItem( mFixExtensionsItem, QStringLiteral( "FixExtensions" ) );
  mRunInTerminalItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "RunInTerminal" ), mRunInTerminal, false );
  mRunInTerminalItem->setLabel( QCoreApplication::translate("Settings", "Run in terminal") );
  mRunInTerminalItem->setToolTip( QCoreApplication::translate("Settings", "<p>Run the download process in a terminal window. Close the terminal window when the download has finished.</p>\n"
"               <p>If this option is turned off then the download will run in the background. Its progress output should appear in the session log file.</p>\n"
"      ") );
  addItem( mRunInTerminalItem, QStringLiteral( "RunInTerminal" ) );
  mCloseWhenFinishedItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "CloseWhenFinished" ), mCloseWhenFinished, false );
  mCloseWhenFinishedItem->setLabel( QCoreApplication::translate("Settings", "Close when finished") );
  mCloseWhenFinishedItem->setToolTip( QCoreApplication::translate("Settings", "Close this window when the download has finished successfully") );
  addItem( mCloseWhenFinishedItem, QStringLiteral( "CloseWhenFinished" ) );
  mArchiveTypeItem = new KConfigSkeleton::ItemString( currentGroup(), QStringLiteral( "ArchiveType" ), mArchiveType, QStringLiteral( "application/x-webarchive" ) );
  mArchiveTypeItem->setLabel( QCoreApplication::translate("Settings", "Archive &type:") );
  mArchiveTypeItem->setToolTip( QCoreApplication::translate("Settings", "The type of web archive to save") );
  addItem( mArchiveTypeItem, QStringLiteral( "ArchiveType" ) );
}

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

