Browse Source

Improve function interface

`SettingsStorage` methods require `QString` so make `SettingValue` follow it.
`Path::operator+` can use `QStringView` to accept wider audience.
adaptive-webui-19844
Chocobo1 3 years ago
parent
commit
c6b772da11
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 20
      src/app/application.cpp
  2. 4
      src/app/filelogger.cpp
  3. 4
      src/app/upgrade.cpp
  4. 2
      src/base/bittorrent/portforwarderimpl.cpp
  5. 212
      src/base/bittorrent/session.cpp
  6. 14
      src/base/net/proxyconfigurationmanager.cpp
  7. 22
      src/base/path.cpp
  8. 7
      src/base/path.h
  9. 6
      src/base/rss/rss_autodownloader.cpp
  10. 6
      src/base/rss/rss_session.cpp
  11. 2
      src/base/search/searchpluginmanager.cpp
  12. 8
      src/base/settingvalue.h
  13. 2
      src/base/torrentfileguard.cpp
  14. 2
      src/base/torrentfileswatcher.cpp
  15. 4
      src/gui/aboutdialog.cpp
  16. 26
      src/gui/addnewtorrentdialog.cpp
  17. 4
      src/gui/banlistoptionsdialog.cpp
  18. 8
      src/gui/cookiesdialog.cpp
  19. 4
      src/gui/downloadfromurldialog.cpp
  20. 4
      src/gui/ipsubnetwhitelistoptionsdialog.cpp
  21. 20
      src/gui/mainwindow.cpp
  22. 8
      src/gui/optionsdialog.cpp
  23. 8
      src/gui/previewselectdialog.cpp
  24. 4
      src/gui/search/pluginselectdialog.cpp
  25. 4
      src/gui/search/pluginsourcedialog.cpp
  26. 2
      src/gui/search/searchjobwidget.cpp
  27. 4
      src/gui/speedlimitdialog.cpp
  28. 4
      src/gui/statsdialog.cpp
  29. 30
      src/gui/torrentcreatordialog.cpp
  30. 4
      src/gui/torrentoptionsdialog.cpp
  31. 4
      src/gui/trackerentriesdialog.cpp
  32. 4
      src/gui/transferlistsortmodel.cpp
  33. 4
      src/gui/watchedfolderoptionsdialog.cpp

20
src/app/application.cpp

@ -101,8 +101,8 @@ @@ -101,8 +101,8 @@
namespace
{
#define SETTINGS_KEY(name) "Application/" name
#define FILELOGGER_SETTINGS_KEY(name) (SETTINGS_KEY("FileLogger/") name)
#define SETTINGS_KEY(name) u"Application/" name
#define FILELOGGER_SETTINGS_KEY(name) (SETTINGS_KEY(u"FileLogger/") name)
const QString LOG_FOLDER = u"logs"_qs;
const QChar PARAMS_SEPARATOR = u'|';
@ -124,15 +124,15 @@ Application::Application(int &argc, char **argv) @@ -124,15 +124,15 @@ Application::Application(int &argc, char **argv)
, m_shutdownAct(ShutdownDialogAction::Exit)
, m_commandLineArgs(parseCommandLine(this->arguments()))
#ifdef Q_OS_WIN
, m_storeMemoryWorkingSetLimit(SETTINGS_KEY("MemoryWorkingSetLimit"))
, m_storeMemoryWorkingSetLimit(SETTINGS_KEY(u"MemoryWorkingSetLimit"_qs))
#endif
, m_storeFileLoggerEnabled(FILELOGGER_SETTINGS_KEY("Enabled"))
, m_storeFileLoggerBackup(FILELOGGER_SETTINGS_KEY("Backup"))
, m_storeFileLoggerDeleteOld(FILELOGGER_SETTINGS_KEY("DeleteOld"))
, m_storeFileLoggerMaxSize(FILELOGGER_SETTINGS_KEY("MaxSizeBytes"))
, m_storeFileLoggerAge(FILELOGGER_SETTINGS_KEY("Age"))
, m_storeFileLoggerAgeType(FILELOGGER_SETTINGS_KEY("AgeType"))
, m_storeFileLoggerPath(FILELOGGER_SETTINGS_KEY("Path"))
, m_storeFileLoggerEnabled(FILELOGGER_SETTINGS_KEY(u"Enabled"_qs))
, m_storeFileLoggerBackup(FILELOGGER_SETTINGS_KEY(u"Backup"_qs))
, m_storeFileLoggerDeleteOld(FILELOGGER_SETTINGS_KEY(u"DeleteOld"_qs))
, m_storeFileLoggerMaxSize(FILELOGGER_SETTINGS_KEY(u"MaxSizeBytes"_qs))
, m_storeFileLoggerAge(FILELOGGER_SETTINGS_KEY(u"Age"_qs))
, m_storeFileLoggerAgeType(FILELOGGER_SETTINGS_KEY(u"AgeType"_qs))
, m_storeFileLoggerPath(FILELOGGER_SETTINGS_KEY(u"Path"_qs))
{
qRegisterMetaType<Log::Msg>("Log::Msg");
qRegisterMetaType<Log::Peer>("Log::Peer");

4
src/app/filelogger.cpp

@ -152,12 +152,12 @@ void FileLogger::addLogMessage(const Log::Msg &msg) @@ -152,12 +152,12 @@ void FileLogger::addLogMessage(const Log::Msg &msg)
{
closeLogFile();
int counter = 0;
Path backupLogFilename = m_path + ".bak";
Path backupLogFilename = m_path + u".bak";
while (backupLogFilename.exists())
{
++counter;
backupLogFilename = m_path + ".bak" + QString::number(counter);
backupLogFilename = m_path + u".bak" + QString::number(counter);
}
Utils::Fs::renameFile(m_path, backupLogFilename);

4
src/app/upgrade.cpp

@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
namespace
{
const int MIGRATION_VERSION = 3;
const char MIGRATION_VERSION_KEY[] = "Meta/MigrationVersion";
const QString MIGRATION_VERSION_KEY = u"Meta/MigrationVersion"_qs;
void exportWebUIHttpsFiles()
{
@ -400,7 +400,7 @@ bool upgrade(const bool /*ask*/) @@ -400,7 +400,7 @@ bool upgrade(const bool /*ask*/)
void setCurrentMigrationVersion()
{
SettingsStorage::instance()->storeValue(QString::fromLatin1(MIGRATION_VERSION_KEY), MIGRATION_VERSION);
SettingsStorage::instance()->storeValue(MIGRATION_VERSION_KEY, MIGRATION_VERSION);
}
void handleChangedDefaults(const DefaultPreferencesMode mode)

2
src/base/bittorrent/portforwarderimpl.cpp

@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
PortForwarderImpl::PortForwarderImpl(lt::session *provider, QObject *parent)
: Net::PortForwarder {parent}
, m_storeActive {"Network/PortForwardingEnabled", true}
, m_storeActive {u"Network/PortForwardingEnabled"_qs, true}
, m_provider {provider}
{
if (isEnabled())

212
src/base/bittorrent/session.cpp

@ -361,119 +361,119 @@ const int addTorrentParamsId = qRegisterMetaType<AddTorrentParams>(); @@ -361,119 +361,119 @@ const int addTorrentParamsId = qRegisterMetaType<AddTorrentParams>();
Session *Session::m_instance = nullptr;
#define BITTORRENT_KEY(name) "BitTorrent/" name
#define BITTORRENT_SESSION_KEY(name) BITTORRENT_KEY("Session/") name
#define BITTORRENT_KEY(name) u"BitTorrent/" name
#define BITTORRENT_SESSION_KEY(name) BITTORRENT_KEY(u"Session/") name
Session::Session(QObject *parent)
: QObject(parent)
, m_isDHTEnabled(BITTORRENT_SESSION_KEY("DHTEnabled"), true)
, m_isLSDEnabled(BITTORRENT_SESSION_KEY("LSDEnabled"), true)
, m_isPeXEnabled(BITTORRENT_SESSION_KEY("PeXEnabled"), true)
, m_isIPFilteringEnabled(BITTORRENT_SESSION_KEY("IPFilteringEnabled"), false)
, m_isTrackerFilteringEnabled(BITTORRENT_SESSION_KEY("TrackerFilteringEnabled"), false)
, m_IPFilterFile(BITTORRENT_SESSION_KEY("IPFilter"))
, m_announceToAllTrackers(BITTORRENT_SESSION_KEY("AnnounceToAllTrackers"), false)
, m_announceToAllTiers(BITTORRENT_SESSION_KEY("AnnounceToAllTiers"), true)
, m_asyncIOThreads(BITTORRENT_SESSION_KEY("AsyncIOThreadsCount"), 10)
, m_hashingThreads(BITTORRENT_SESSION_KEY("HashingThreadsCount"), 2)
, m_filePoolSize(BITTORRENT_SESSION_KEY("FilePoolSize"), 5000)
, m_checkingMemUsage(BITTORRENT_SESSION_KEY("CheckingMemUsageSize"), 32)
, m_diskCacheSize(BITTORRENT_SESSION_KEY("DiskCacheSize"), -1)
, m_diskCacheTTL(BITTORRENT_SESSION_KEY("DiskCacheTTL"), 60)
, m_diskQueueSize(BITTORRENT_SESSION_KEY("DiskQueueSize"), (1024 * 1024))
, m_useOSCache(BITTORRENT_SESSION_KEY("UseOSCache"), true)
, m_isDHTEnabled(BITTORRENT_SESSION_KEY(u"DHTEnabled"_qs), true)
, m_isLSDEnabled(BITTORRENT_SESSION_KEY(u"LSDEnabled"_qs), true)
, m_isPeXEnabled(BITTORRENT_SESSION_KEY(u"PeXEnabled"_qs), true)
, m_isIPFilteringEnabled(BITTORRENT_SESSION_KEY(u"IPFilteringEnabled"_qs), false)
, m_isTrackerFilteringEnabled(BITTORRENT_SESSION_KEY(u"TrackerFilteringEnabled"_qs), false)
, m_IPFilterFile(BITTORRENT_SESSION_KEY(u"IPFilter"_qs))
, m_announceToAllTrackers(BITTORRENT_SESSION_KEY(u"AnnounceToAllTrackers"_qs), false)
, m_announceToAllTiers(BITTORRENT_SESSION_KEY(u"AnnounceToAllTiers"_qs), true)
, m_asyncIOThreads(BITTORRENT_SESSION_KEY(u"AsyncIOThreadsCount"_qs), 10)
, m_hashingThreads(BITTORRENT_SESSION_KEY(u"HashingThreadsCount"_qs), 2)
, m_filePoolSize(BITTORRENT_SESSION_KEY(u"FilePoolSize"_qs), 5000)
, m_checkingMemUsage(BITTORRENT_SESSION_KEY(u"CheckingMemUsageSize"_qs), 32)
, m_diskCacheSize(BITTORRENT_SESSION_KEY(u"DiskCacheSize"_qs), -1)
, m_diskCacheTTL(BITTORRENT_SESSION_KEY(u"DiskCacheTTL"_qs), 60)
, m_diskQueueSize(BITTORRENT_SESSION_KEY(u"DiskQueueSize"_qs), (1024 * 1024))
, m_useOSCache(BITTORRENT_SESSION_KEY(u"UseOSCache"_qs), true)
#ifdef Q_OS_WIN
, m_coalesceReadWriteEnabled(BITTORRENT_SESSION_KEY("CoalesceReadWrite"), true)
, m_coalesceReadWriteEnabled(BITTORRENT_SESSION_KEY(u"CoalesceReadWrite"_qs), true)
#else
, m_coalesceReadWriteEnabled(BITTORRENT_SESSION_KEY("CoalesceReadWrite"), false)
, m_coalesceReadWriteEnabled(BITTORRENT_SESSION_KEY(u"CoalesceReadWrite"_qs), false)
#endif
, m_usePieceExtentAffinity(BITTORRENT_SESSION_KEY("PieceExtentAffinity"), false)
, m_isSuggestMode(BITTORRENT_SESSION_KEY("SuggestMode"), false)
, m_sendBufferWatermark(BITTORRENT_SESSION_KEY("SendBufferWatermark"), 500)
, m_sendBufferLowWatermark(BITTORRENT_SESSION_KEY("SendBufferLowWatermark"), 10)
, m_sendBufferWatermarkFactor(BITTORRENT_SESSION_KEY("SendBufferWatermarkFactor"), 50)
, m_connectionSpeed(BITTORRENT_SESSION_KEY("ConnectionSpeed"), 30)
, m_socketBacklogSize(BITTORRENT_SESSION_KEY("SocketBacklogSize"), 30)
, m_isAnonymousModeEnabled(BITTORRENT_SESSION_KEY("AnonymousModeEnabled"), false)
, m_isQueueingEnabled(BITTORRENT_SESSION_KEY("QueueingSystemEnabled"), false)
, m_maxActiveDownloads(BITTORRENT_SESSION_KEY("MaxActiveDownloads"), 3, lowerLimited(-1))
, m_maxActiveUploads(BITTORRENT_SESSION_KEY("MaxActiveUploads"), 3, lowerLimited(-1))
, m_maxActiveTorrents(BITTORRENT_SESSION_KEY("MaxActiveTorrents"), 5, lowerLimited(-1))
, m_ignoreSlowTorrentsForQueueing(BITTORRENT_SESSION_KEY("IgnoreSlowTorrentsForQueueing"), false)
, m_downloadRateForSlowTorrents(BITTORRENT_SESSION_KEY("SlowTorrentsDownloadRate"), 2)
, m_uploadRateForSlowTorrents(BITTORRENT_SESSION_KEY("SlowTorrentsUploadRate"), 2)
, m_slowTorrentsInactivityTimer(BITTORRENT_SESSION_KEY("SlowTorrentsInactivityTimer"), 60)
, m_outgoingPortsMin(BITTORRENT_SESSION_KEY("OutgoingPortsMin"), 0)
, m_outgoingPortsMax(BITTORRENT_SESSION_KEY("OutgoingPortsMax"), 0)
, m_UPnPLeaseDuration(BITTORRENT_SESSION_KEY("UPnPLeaseDuration"), 0)
, m_peerToS(BITTORRENT_SESSION_KEY("PeerToS"), 0x04)
, m_ignoreLimitsOnLAN(BITTORRENT_SESSION_KEY("IgnoreLimitsOnLAN"), false)
, m_includeOverheadInLimits(BITTORRENT_SESSION_KEY("IncludeOverheadInLimits"), false)
, m_announceIP(BITTORRENT_SESSION_KEY("AnnounceIP"))
, m_maxConcurrentHTTPAnnounces(BITTORRENT_SESSION_KEY("MaxConcurrentHTTPAnnounces"), 50)
, m_isReannounceWhenAddressChangedEnabled(BITTORRENT_SESSION_KEY("ReannounceWhenAddressChanged"), false)
, m_stopTrackerTimeout(BITTORRENT_SESSION_KEY("StopTrackerTimeout"), 5)
, m_maxConnections(BITTORRENT_SESSION_KEY("MaxConnections"), 500, lowerLimited(0, -1))
, m_maxUploads(BITTORRENT_SESSION_KEY("MaxUploads"), 20, lowerLimited(0, -1))
, m_maxConnectionsPerTorrent(BITTORRENT_SESSION_KEY("MaxConnectionsPerTorrent"), 100, lowerLimited(0, -1))
, m_maxUploadsPerTorrent(BITTORRENT_SESSION_KEY("MaxUploadsPerTorrent"), 4, lowerLimited(0, -1))
, m_btProtocol(BITTORRENT_SESSION_KEY("BTProtocol"), BTProtocol::Both
, m_usePieceExtentAffinity(BITTORRENT_SESSION_KEY(u"PieceExtentAffinity"_qs), false)
, m_isSuggestMode(BITTORRENT_SESSION_KEY(u"SuggestMode"_qs), false)
, m_sendBufferWatermark(BITTORRENT_SESSION_KEY(u"SendBufferWatermark"_qs), 500)
, m_sendBufferLowWatermark(BITTORRENT_SESSION_KEY(u"SendBufferLowWatermark"_qs), 10)
, m_sendBufferWatermarkFactor(BITTORRENT_SESSION_KEY(u"SendBufferWatermarkFactor"_qs), 50)
, m_connectionSpeed(BITTORRENT_SESSION_KEY(u"ConnectionSpeed"_qs), 30)
, m_socketBacklogSize(BITTORRENT_SESSION_KEY(u"SocketBacklogSize"_qs), 30)
, m_isAnonymousModeEnabled(BITTORRENT_SESSION_KEY(u"AnonymousModeEnabled"_qs), false)
, m_isQueueingEnabled(BITTORRENT_SESSION_KEY(u"QueueingSystemEnabled"_qs), false)
, m_maxActiveDownloads(BITTORRENT_SESSION_KEY(u"MaxActiveDownloads"_qs), 3, lowerLimited(-1))
, m_maxActiveUploads(BITTORRENT_SESSION_KEY(u"MaxActiveUploads"_qs), 3, lowerLimited(-1))
, m_maxActiveTorrents(BITTORRENT_SESSION_KEY(u"MaxActiveTorrents"_qs), 5, lowerLimited(-1))
, m_ignoreSlowTorrentsForQueueing(BITTORRENT_SESSION_KEY(u"IgnoreSlowTorrentsForQueueing"_qs), false)
, m_downloadRateForSlowTorrents(BITTORRENT_SESSION_KEY(u"SlowTorrentsDownloadRate"_qs), 2)
, m_uploadRateForSlowTorrents(BITTORRENT_SESSION_KEY(u"SlowTorrentsUploadRate"_qs), 2)
, m_slowTorrentsInactivityTimer(BITTORRENT_SESSION_KEY(u"SlowTorrentsInactivityTimer"_qs), 60)
, m_outgoingPortsMin(BITTORRENT_SESSION_KEY(u"OutgoingPortsMin"_qs), 0)
, m_outgoingPortsMax(BITTORRENT_SESSION_KEY(u"OutgoingPortsMax"_qs), 0)
, m_UPnPLeaseDuration(BITTORRENT_SESSION_KEY(u"UPnPLeaseDuration"_qs), 0)
, m_peerToS(BITTORRENT_SESSION_KEY(u"PeerToS"_qs), 0x04)
, m_ignoreLimitsOnLAN(BITTORRENT_SESSION_KEY(u"IgnoreLimitsOnLAN"_qs), false)
, m_includeOverheadInLimits(BITTORRENT_SESSION_KEY(u"IncludeOverheadInLimits"_qs), false)
, m_announceIP(BITTORRENT_SESSION_KEY(u"AnnounceIP"_qs))
, m_maxConcurrentHTTPAnnounces(BITTORRENT_SESSION_KEY(u"MaxConcurrentHTTPAnnounces"_qs), 50)
, m_isReannounceWhenAddressChangedEnabled(BITTORRENT_SESSION_KEY(u"ReannounceWhenAddressChanged"_qs), false)
, m_stopTrackerTimeout(BITTORRENT_SESSION_KEY(u"StopTrackerTimeout"_qs), 5)
, m_maxConnections(BITTORRENT_SESSION_KEY(u"MaxConnections"_qs), 500, lowerLimited(0, -1))
, m_maxUploads(BITTORRENT_SESSION_KEY(u"MaxUploads"_qs), 20, lowerLimited(0, -1))
, m_maxConnectionsPerTorrent(BITTORRENT_SESSION_KEY(u"MaxConnectionsPerTorrent"_qs), 100, lowerLimited(0, -1))
, m_maxUploadsPerTorrent(BITTORRENT_SESSION_KEY(u"MaxUploadsPerTorrent"_qs), 4, lowerLimited(0, -1))
, m_btProtocol(BITTORRENT_SESSION_KEY(u"BTProtocol"_qs), BTProtocol::Both
, clampValue(BTProtocol::Both, BTProtocol::UTP))
, m_isUTPRateLimited(BITTORRENT_SESSION_KEY("uTPRateLimited"), true)
, m_utpMixedMode(BITTORRENT_SESSION_KEY("uTPMixedMode"), MixedModeAlgorithm::TCP
, m_isUTPRateLimited(BITTORRENT_SESSION_KEY(u"uTPRateLimited"_qs), true)
, m_utpMixedMode(BITTORRENT_SESSION_KEY(u"uTPMixedMode"_qs), MixedModeAlgorithm::TCP
, clampValue(MixedModeAlgorithm::TCP, MixedModeAlgorithm::Proportional))
, m_IDNSupportEnabled(BITTORRENT_SESSION_KEY("IDNSupportEnabled"), false)
, m_multiConnectionsPerIpEnabled(BITTORRENT_SESSION_KEY("MultiConnectionsPerIp"), false)
, m_validateHTTPSTrackerCertificate(BITTORRENT_SESSION_KEY("ValidateHTTPSTrackerCertificate"), true)
, m_SSRFMitigationEnabled(BITTORRENT_SESSION_KEY("SSRFMitigation"), true)
, m_blockPeersOnPrivilegedPorts(BITTORRENT_SESSION_KEY("BlockPeersOnPrivilegedPorts"), false)
, m_isAddTrackersEnabled(BITTORRENT_SESSION_KEY("AddTrackersEnabled"), false)
, m_additionalTrackers(BITTORRENT_SESSION_KEY("AdditionalTrackers"))
, m_globalMaxRatio(BITTORRENT_SESSION_KEY("GlobalMaxRatio"), -1, [](qreal r) { return r < 0 ? -1. : r;})
, m_globalMaxSeedingMinutes(BITTORRENT_SESSION_KEY("GlobalMaxSeedingMinutes"), -1, lowerLimited(-1))
, m_isAddTorrentPaused(BITTORRENT_SESSION_KEY("AddTorrentPaused"), false)
, m_torrentContentLayout(BITTORRENT_SESSION_KEY("TorrentContentLayout"), TorrentContentLayout::Original)
, m_isAppendExtensionEnabled(BITTORRENT_SESSION_KEY("AddExtensionToIncompleteFiles"), false)
, m_refreshInterval(BITTORRENT_SESSION_KEY("RefreshInterval"), 1500)
, m_isPreallocationEnabled(BITTORRENT_SESSION_KEY("Preallocation"), false)
, m_torrentExportDirectory(BITTORRENT_SESSION_KEY("TorrentExportDirectory"))
, m_finishedTorrentExportDirectory(BITTORRENT_SESSION_KEY("FinishedTorrentExportDirectory"))
, m_globalDownloadSpeedLimit(BITTORRENT_SESSION_KEY("GlobalDLSpeedLimit"), 0, lowerLimited(0))
, m_globalUploadSpeedLimit(BITTORRENT_SESSION_KEY("GlobalUPSpeedLimit"), 0, lowerLimited(0))
, m_altGlobalDownloadSpeedLimit(BITTORRENT_SESSION_KEY("AlternativeGlobalDLSpeedLimit"), 10, lowerLimited(0))
, m_altGlobalUploadSpeedLimit(BITTORRENT_SESSION_KEY("AlternativeGlobalUPSpeedLimit"), 10, lowerLimited(0))
, m_isAltGlobalSpeedLimitEnabled(BITTORRENT_SESSION_KEY("UseAlternativeGlobalSpeedLimit"), false)
, m_isBandwidthSchedulerEnabled(BITTORRENT_SESSION_KEY("BandwidthSchedulerEnabled"), false)
, m_isPerformanceWarningEnabled(BITTORRENT_SESSION_KEY("PerformanceWarning"), false)
, m_saveResumeDataInterval(BITTORRENT_SESSION_KEY("SaveResumeDataInterval"), 60)
, m_port(BITTORRENT_SESSION_KEY("Port"), -1)
, m_networkInterface(BITTORRENT_SESSION_KEY("Interface"))
, m_networkInterfaceName(BITTORRENT_SESSION_KEY("InterfaceName"))
, m_networkInterfaceAddress(BITTORRENT_SESSION_KEY("InterfaceAddress"))
, m_encryption(BITTORRENT_SESSION_KEY("Encryption"), 0)
, m_maxActiveCheckingTorrents(BITTORRENT_SESSION_KEY("MaxActiveCheckingTorrents"), 1)
, m_isProxyPeerConnectionsEnabled(BITTORRENT_SESSION_KEY("ProxyPeerConnections"), false)
, m_chokingAlgorithm(BITTORRENT_SESSION_KEY("ChokingAlgorithm"), ChokingAlgorithm::FixedSlots
, m_IDNSupportEnabled(BITTORRENT_SESSION_KEY(u"IDNSupportEnabled"_qs), false)
, m_multiConnectionsPerIpEnabled(BITTORRENT_SESSION_KEY(u"MultiConnectionsPerIp"_qs), false)
, m_validateHTTPSTrackerCertificate(BITTORRENT_SESSION_KEY(u"ValidateHTTPSTrackerCertificate"_qs), true)
, m_SSRFMitigationEnabled(BITTORRENT_SESSION_KEY(u"SSRFMitigation"_qs), true)
, m_blockPeersOnPrivilegedPorts(BITTORRENT_SESSION_KEY(u"BlockPeersOnPrivilegedPorts"_qs), false)
, m_isAddTrackersEnabled(BITTORRENT_SESSION_KEY(u"AddTrackersEnabled"_qs), false)
, m_additionalTrackers(BITTORRENT_SESSION_KEY(u"AdditionalTrackers"_qs))
, m_globalMaxRatio(BITTORRENT_SESSION_KEY(u"GlobalMaxRatio"_qs), -1, [](qreal r) { return r < 0 ? -1. : r;})
, m_globalMaxSeedingMinutes(BITTORRENT_SESSION_KEY(u"GlobalMaxSeedingMinutes"_qs), -1, lowerLimited(-1))
, m_isAddTorrentPaused(BITTORRENT_SESSION_KEY(u"AddTorrentPaused"_qs), false)
, m_torrentContentLayout(BITTORRENT_SESSION_KEY(u"TorrentContentLayout"_qs), TorrentContentLayout::Original)
, m_isAppendExtensionEnabled(BITTORRENT_SESSION_KEY(u"AddExtensionToIncompleteFiles"_qs), false)
, m_refreshInterval(BITTORRENT_SESSION_KEY(u"RefreshInterval"_qs), 1500)
, m_isPreallocationEnabled(BITTORRENT_SESSION_KEY(u"Preallocation"_qs), false)
, m_torrentExportDirectory(BITTORRENT_SESSION_KEY(u"TorrentExportDirectory"_qs))
, m_finishedTorrentExportDirectory(BITTORRENT_SESSION_KEY(u"FinishedTorrentExportDirectory"_qs))
, m_globalDownloadSpeedLimit(BITTORRENT_SESSION_KEY(u"GlobalDLSpeedLimit"_qs), 0, lowerLimited(0))
, m_globalUploadSpeedLimit(BITTORRENT_SESSION_KEY(u"GlobalUPSpeedLimit"_qs), 0, lowerLimited(0))
, m_altGlobalDownloadSpeedLimit(BITTORRENT_SESSION_KEY(u"AlternativeGlobalDLSpeedLimit"_qs), 10, lowerLimited(0))
, m_altGlobalUploadSpeedLimit(BITTORRENT_SESSION_KEY(u"AlternativeGlobalUPSpeedLimit"_qs), 10, lowerLimited(0))
, m_isAltGlobalSpeedLimitEnabled(BITTORRENT_SESSION_KEY(u"UseAlternativeGlobalSpeedLimit"_qs), false)
, m_isBandwidthSchedulerEnabled(BITTORRENT_SESSION_KEY(u"BandwidthSchedulerEnabled"_qs), false)
, m_isPerformanceWarningEnabled(BITTORRENT_SESSION_KEY(u"PerformanceWarning"_qs), false)
, m_saveResumeDataInterval(BITTORRENT_SESSION_KEY(u"SaveResumeDataInterval"_qs), 60)
, m_port(BITTORRENT_SESSION_KEY(u"Port"_qs), -1)
, m_networkInterface(BITTORRENT_SESSION_KEY(u"Interface"_qs))
, m_networkInterfaceName(BITTORRENT_SESSION_KEY(u"InterfaceName"_qs))
, m_networkInterfaceAddress(BITTORRENT_SESSION_KEY(u"InterfaceAddress"_qs))
, m_encryption(BITTORRENT_SESSION_KEY(u"Encryption"_qs), 0)
, m_maxActiveCheckingTorrents(BITTORRENT_SESSION_KEY(u"MaxActiveCheckingTorrents"_qs), 1)
, m_isProxyPeerConnectionsEnabled(BITTORRENT_SESSION_KEY(u"ProxyPeerConnections"_qs), false)
, m_chokingAlgorithm(BITTORRENT_SESSION_KEY(u"ChokingAlgorithm"_qs), ChokingAlgorithm::FixedSlots
, clampValue(ChokingAlgorithm::FixedSlots, ChokingAlgorithm::RateBased))
, m_seedChokingAlgorithm(BITTORRENT_SESSION_KEY("SeedChokingAlgorithm"), SeedChokingAlgorithm::FastestUpload
, m_seedChokingAlgorithm(BITTORRENT_SESSION_KEY(u"SeedChokingAlgorithm"_qs), SeedChokingAlgorithm::FastestUpload
, clampValue(SeedChokingAlgorithm::RoundRobin, SeedChokingAlgorithm::AntiLeech))
, m_storedTags(BITTORRENT_SESSION_KEY("Tags"))
, m_maxRatioAction(BITTORRENT_SESSION_KEY("MaxRatioAction"), Pause)
, m_savePath(BITTORRENT_SESSION_KEY("DefaultSavePath"), specialFolderLocation(SpecialFolder::Downloads))
, m_downloadPath(BITTORRENT_SESSION_KEY("TempPath"), (savePath() / Path(u"temp"_qs)))
, m_isDownloadPathEnabled(BITTORRENT_SESSION_KEY("TempPathEnabled"), false)
, m_isSubcategoriesEnabled(BITTORRENT_SESSION_KEY("SubcategoriesEnabled"), false)
, m_useCategoryPathsInManualMode(BITTORRENT_SESSION_KEY("UseCategoryPathsInManualMode"), false)
, m_isAutoTMMDisabledByDefault(BITTORRENT_SESSION_KEY("DisableAutoTMMByDefault"), true)
, m_isDisableAutoTMMWhenCategoryChanged(BITTORRENT_SESSION_KEY("DisableAutoTMMTriggers/CategoryChanged"), false)
, m_isDisableAutoTMMWhenDefaultSavePathChanged(BITTORRENT_SESSION_KEY("DisableAutoTMMTriggers/DefaultSavePathChanged"), true)
, m_isDisableAutoTMMWhenCategorySavePathChanged(BITTORRENT_SESSION_KEY("DisableAutoTMMTriggers/CategorySavePathChanged"), true)
, m_isTrackerEnabled(BITTORRENT_KEY("TrackerEnabled"), false)
, m_peerTurnover(BITTORRENT_SESSION_KEY("PeerTurnover"), 4)
, m_peerTurnoverCutoff(BITTORRENT_SESSION_KEY("PeerTurnoverCutOff"), 90)
, m_peerTurnoverInterval(BITTORRENT_SESSION_KEY("PeerTurnoverInterval"), 300)
, m_requestQueueSize(BITTORRENT_SESSION_KEY("RequestQueueSize"), 500)
, m_bannedIPs("State/BannedIPs"
, m_storedTags(BITTORRENT_SESSION_KEY(u"Tags"_qs))
, m_maxRatioAction(BITTORRENT_SESSION_KEY(u"MaxRatioAction"_qs), Pause)
, m_savePath(BITTORRENT_SESSION_KEY(u"DefaultSavePath"_qs), specialFolderLocation(SpecialFolder::Downloads))
, m_downloadPath(BITTORRENT_SESSION_KEY(u"TempPath"_qs), (savePath() / Path(u"temp"_qs)))
, m_isDownloadPathEnabled(BITTORRENT_SESSION_KEY(u"TempPathEnabled"_qs), false)
, m_isSubcategoriesEnabled(BITTORRENT_SESSION_KEY(u"SubcategoriesEnabled"_qs), false)
, m_useCategoryPathsInManualMode(BITTORRENT_SESSION_KEY(u"UseCategoryPathsInManualMode"_qs), false)
, m_isAutoTMMDisabledByDefault(BITTORRENT_SESSION_KEY(u"DisableAutoTMMByDefault"_qs), true)
, m_isDisableAutoTMMWhenCategoryChanged(BITTORRENT_SESSION_KEY(u"DisableAutoTMMTriggers/CategoryChanged"_qs), false)
, m_isDisableAutoTMMWhenDefaultSavePathChanged(BITTORRENT_SESSION_KEY(u"DisableAutoTMMTriggers/DefaultSavePathChanged"_qs), true)
, m_isDisableAutoTMMWhenCategorySavePathChanged(BITTORRENT_SESSION_KEY(u"DisableAutoTMMTriggers/CategorySavePathChanged"_qs), true)
, m_isTrackerEnabled(BITTORRENT_KEY(u"TrackerEnabled"_qs), false)
, m_peerTurnover(BITTORRENT_SESSION_KEY(u"PeerTurnover"_qs), 4)
, m_peerTurnoverCutoff(BITTORRENT_SESSION_KEY(u"PeerTurnoverCutOff"_qs), 90)
, m_peerTurnoverInterval(BITTORRENT_SESSION_KEY(u"PeerTurnoverInterval"_qs), 300)
, m_requestQueueSize(BITTORRENT_SESSION_KEY(u"RequestQueueSize"_qs), 500)
, m_bannedIPs(u"State/BannedIPs"_qs
, QStringList()
, [](const QStringList &value)
{
@ -482,9 +482,9 @@ Session::Session(QObject *parent) @@ -482,9 +482,9 @@ Session::Session(QObject *parent)
return tmp;
}
)
, m_resumeDataStorageType(BITTORRENT_SESSION_KEY("ResumeDataStorageType"), ResumeDataStorageType::Legacy)
, m_resumeDataStorageType(BITTORRENT_SESSION_KEY(u"ResumeDataStorageType"_qs), ResumeDataStorageType::Legacy)
#if defined(Q_OS_WIN)
, m_OSMemoryPriority(BITTORRENT_KEY("OSMemoryPriority"), OSMemoryPriority::BelowNormal)
, m_OSMemoryPriority(BITTORRENT_KEY(u"OSMemoryPriority"_qs), OSMemoryPriority::BelowNormal)
#endif
, m_seedingLimitTimer {new QTimer {this}}
, m_resumeDataTimer {new QTimer {this}}
@ -4330,7 +4330,7 @@ void Session::storeCategories() const @@ -4330,7 +4330,7 @@ void Session::storeCategories() const
void Session::upgradeCategories()
{
const auto legacyCategories = SettingValue<QVariantMap>("BitTorrent/Session/Categories").get();
const auto legacyCategories = SettingValue<QVariantMap>(u"BitTorrent/Session/Categories"_qs).get();
for (auto it = legacyCategories.cbegin(); it != legacyCategories.cend(); ++it)
{
const QString categoryName = it.key();

14
src/base/net/proxyconfigurationmanager.cpp

@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
#include "proxyconfigurationmanager.h"
#define SETTINGS_KEY(name) ("Network/Proxy/" name)
#define SETTINGS_KEY(name) (u"Network/Proxy/" name)
bool Net::operator==(const ProxyConfiguration &left, const ProxyConfiguration &right)
{
@ -50,12 +50,12 @@ ProxyConfigurationManager *ProxyConfigurationManager::m_instance = nullptr; @@ -50,12 +50,12 @@ ProxyConfigurationManager *ProxyConfigurationManager::m_instance = nullptr;
ProxyConfigurationManager::ProxyConfigurationManager(QObject *parent)
: QObject {parent}
, m_storeProxyOnlyForTorrents {SETTINGS_KEY("OnlyForTorrents")}
, m_storeProxyType {SETTINGS_KEY("Type")}
, m_storeProxyIP {SETTINGS_KEY("IP")}
, m_storeProxyPort {SETTINGS_KEY("Port")}
, m_storeProxyUsername {SETTINGS_KEY("Username")}
, m_storeProxyPassword {SETTINGS_KEY("Password")}
, m_storeProxyOnlyForTorrents {SETTINGS_KEY(u"OnlyForTorrents"_qs)}
, m_storeProxyType {SETTINGS_KEY(u"Type"_qs)}
, m_storeProxyIP {SETTINGS_KEY(u"IP"_qs)}
, m_storeProxyPort {SETTINGS_KEY(u"Port"_qs)}
, m_storeProxyUsername {SETTINGS_KEY(u"Username"_qs)}
, m_storeProxyPassword {SETTINGS_KEY(u"Password"_qs)}
{
m_config.type = m_storeProxyType.get(ProxyType::None);
if ((m_config.type < ProxyType::None) || (m_config.type > ProxyType::SOCKS4))

22
src/base/path.cpp

@ -37,6 +37,7 @@ @@ -37,6 +37,7 @@
#include <QList>
#include <QMimeDatabase>
#include <QRegularExpression>
#include <QStringView>
#include "base/global.h"
@ -202,17 +203,12 @@ Path &Path::operator/=(const Path &other) @@ -202,17 +203,12 @@ Path &Path::operator/=(const Path &other)
return *this;
}
Path &Path::operator+=(const QString &str)
Path &Path::operator+=(const QStringView str)
{
*this = *this + str;
return *this;
}
Path &Path::operator+=(const std::string &str)
{
return (*this += QString::fromStdString(str));
}
Path Path::commonPath(const Path &left, const Path &right)
{
if (left.isEmpty() || right.isEmpty())
@ -305,19 +301,9 @@ Path operator/(const Path &lhs, const Path &rhs) @@ -305,19 +301,9 @@ Path operator/(const Path &lhs, const Path &rhs)
return Path(lhs.m_pathStr + u'/' + rhs.m_pathStr);
}
Path operator+(const Path &lhs, const QString &rhs)
{
return Path(lhs.m_pathStr + rhs);
}
Path operator+(const Path &lhs, const char rhs[])
{
return lhs + QString::fromLatin1(rhs);
}
Path operator+(const Path &lhs, const std::string &rhs)
Path operator+(const Path &lhs, const QStringView rhs)
{
return lhs + QString::fromStdString(rhs);
return Path(lhs.data() + rhs);
}
QDataStream &operator<<(QDataStream &out, const Path &path)

7
src/base/path.h

@ -69,8 +69,7 @@ public: @@ -69,8 +69,7 @@ public:
QString toString() const override;
Path &operator/=(const Path &other);
Path &operator+=(const QString &str);
Path &operator+=(const std::string &str);
Path &operator+=(QStringView str);
static Path commonPath(const Path &left, const Path &right);
@ -79,7 +78,6 @@ public: @@ -79,7 +78,6 @@ public:
static void addRootFolder(PathList &filePaths, const Path &rootFolder);
friend Path operator/(const Path &lhs, const Path &rhs);
friend Path operator+(const Path &lhs, const QString &rhs);
private:
// this constructor doesn't perform any checks
@ -93,8 +91,7 @@ Q_DECLARE_METATYPE(Path) @@ -93,8 +91,7 @@ Q_DECLARE_METATYPE(Path)
bool operator==(const Path &lhs, const Path &rhs);
bool operator!=(const Path &lhs, const Path &rhs);
Path operator+(const Path &lhs, const char rhs[]);
Path operator+(const Path &lhs, const std::string &rhs);
Path operator+(const Path &lhs, QStringView rhs);
QDataStream &operator<<(QDataStream &out, const Path &path);
QDataStream &operator>>(QDataStream &in, Path &path);

6
src/base/rss/rss_autodownloader.cpp

@ -98,9 +98,9 @@ QString computeSmartFilterRegex(const QStringList &filters) @@ -98,9 +98,9 @@ QString computeSmartFilterRegex(const QStringList &filters)
}
AutoDownloader::AutoDownloader()
: m_storeProcessingEnabled("RSS/AutoDownloader/EnableProcessing", false)
, m_storeSmartEpisodeFilter("RSS/AutoDownloader/SmartEpisodeFilter")
, m_storeDownloadRepacks("RSS/AutoDownloader/DownloadRepacks")
: m_storeProcessingEnabled(u"RSS/AutoDownloader/EnableProcessing"_qs, false)
, m_storeSmartEpisodeFilter(u"RSS/AutoDownloader/SmartEpisodeFilter"_qs)
, m_storeDownloadRepacks(u"RSS/AutoDownloader/DownloadRepacks"_qs)
, m_processingTimer(new QTimer(this))
, m_ioThread(new QThread(this))
{

6
src/base/rss/rss_session.cpp

@ -58,9 +58,9 @@ using namespace RSS; @@ -58,9 +58,9 @@ using namespace RSS;
QPointer<Session> Session::m_instance = nullptr;
Session::Session()
: m_storeProcessingEnabled("RSS/Session/EnableProcessing")
, m_storeRefreshInterval("RSS/Session/RefreshInterval", 30)
, m_storeMaxArticlesPerFeed("RSS/Session/MaxArticlesPerFeed", 50)
: m_storeProcessingEnabled(u"RSS/Session/EnableProcessing"_qs)
, m_storeRefreshInterval(u"RSS/Session/RefreshInterval"_qs, 30)
, m_storeMaxArticlesPerFeed(u"RSS/Session/MaxArticlesPerFeed"_qs, 50)
, m_workingThread(new QThread(this))
{
Q_ASSERT(!m_instance); // only one instance is allowed

2
src/base/search/searchpluginmanager.cpp

@ -239,7 +239,7 @@ void SearchPluginManager::installPlugin_impl(const QString &name, const Path &pa @@ -239,7 +239,7 @@ void SearchPluginManager::installPlugin_impl(const QString &name, const Path &pa
// Process with install
const Path destPath = pluginPath(name);
const Path backupPath = destPath + ".bak";
const Path backupPath = destPath + u".bak";
bool updated = false;
if (destPath.exists())
{

8
src/base/settingvalue.h

@ -38,8 +38,8 @@ template <typename T> @@ -38,8 +38,8 @@ template <typename T>
class SettingValue
{
public:
explicit SettingValue(const char *keyName)
: m_keyName {QString::fromLatin1(keyName)}
explicit SettingValue(const QString &keyName)
: m_keyName {keyName}
{
}
@ -67,7 +67,7 @@ template <typename T> @@ -67,7 +67,7 @@ template <typename T>
class CachedSettingValue
{
public:
explicit CachedSettingValue(const char *keyName, const T &defaultValue = {})
explicit CachedSettingValue(const QString &keyName, const T &defaultValue = {})
: m_setting {keyName}
, m_cache {m_setting.get(defaultValue)}
{
@ -76,7 +76,7 @@ public: @@ -76,7 +76,7 @@ public:
// The signature of the ProxyFunc should be equivalent to the following:
// T proxyFunc(const T &a);
template <typename ProxyFunc>
explicit CachedSettingValue(const char *keyName, const T &defaultValue, ProxyFunc &&proxyFunc)
explicit CachedSettingValue(const QString &keyName, const T &defaultValue, ProxyFunc &&proxyFunc)
: m_setting {keyName}
, m_cache {proxyFunc(m_setting.get(defaultValue))}
{

2
src/base/torrentfileguard.cpp

@ -83,6 +83,6 @@ void TorrentFileGuard::setAutoDeleteMode(TorrentFileGuard::AutoDeleteMode mode) @@ -83,6 +83,6 @@ void TorrentFileGuard::setAutoDeleteMode(TorrentFileGuard::AutoDeleteMode mode)
SettingValue<TorrentFileGuard::AutoDeleteMode> &TorrentFileGuard::autoDeleteModeSetting()
{
static SettingValue<AutoDeleteMode> setting {"Core/AutoDeleteAddedTorrentFile"};
static SettingValue<AutoDeleteMode> setting {u"Core/AutoDeleteAddedTorrentFile"_qs};
return setting;
}

2
src/base/torrentfileswatcher.cpp

@ -604,7 +604,7 @@ void TorrentFilesWatcher::Worker::processFailedTorrents() @@ -604,7 +604,7 @@ void TorrentFilesWatcher::Worker::processFailedTorrents()
if (value >= MAX_FAILED_RETRIES)
{
LogMsg(tr("Rejecting failed torrent file: %1").arg(torrentPath.toString()));
Utils::Fs::renameFile(torrentPath, (torrentPath + ".qbt_rejected"));
Utils::Fs::renameFile(torrentPath, (torrentPath + u".qbt_rejected"));
return true;
}

4
src/gui/aboutdialog.cpp

@ -39,12 +39,12 @@ @@ -39,12 +39,12 @@
#include "uithememanager.h"
#include "utils.h"
#define SETTINGS_KEY(name) "AboutDialog/" name
#define SETTINGS_KEY(name) u"AboutDialog/" name
AboutDialog::AboutDialog(QWidget *parent)
: QDialog(parent)
, m_ui(new Ui::AboutDialog)
, m_storeDialogSize(SETTINGS_KEY("Size"))
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs))
{
m_ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);

26
src/gui/addnewtorrentdialog.cpp

@ -65,12 +65,12 @@ @@ -65,12 +65,12 @@
namespace
{
#define SETTINGS_KEY(name) "AddNewTorrentDialog/" name
const QString KEY_ENABLED = QStringLiteral(SETTINGS_KEY("Enabled"));
const QString KEY_TOPLEVEL = QStringLiteral(SETTINGS_KEY("TopLevel"));
const QString KEY_SAVEPATHHISTORY = QStringLiteral(SETTINGS_KEY("SavePathHistory"));
const QString KEY_DOWNLOADPATHHISTORY = QStringLiteral(SETTINGS_KEY("DownloadPathHistory"));
const QString KEY_SAVEPATHHISTORYLENGTH = QStringLiteral(SETTINGS_KEY("SavePathHistoryLength"));
#define SETTINGS_KEY(name) u"AddNewTorrentDialog/" name
const QString KEY_ENABLED = SETTINGS_KEY(u"Enabled"_qs);
const QString KEY_TOPLEVEL = SETTINGS_KEY(u"TopLevel"_qs);
const QString KEY_SAVEPATHHISTORY = SETTINGS_KEY(u"SavePathHistory"_qs);
const QString KEY_DOWNLOADPATHHISTORY = SETTINGS_KEY(u"DownloadPathHistory"_qs);
const QString KEY_SAVEPATHHISTORYLENGTH = SETTINGS_KEY(u"SavePathHistoryLength"_qs);
// just a shortcut
inline SettingsStorage *settings()
@ -170,15 +170,15 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP @@ -170,15 +170,15 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::AddTorrentParams &inP
: QDialog(parent)
, m_ui(new Ui::AddNewTorrentDialog)
, m_torrentParams(inParams)
, m_storeDialogSize(SETTINGS_KEY("DialogSize"))
, m_storeDefaultCategory(SETTINGS_KEY("DefaultCategory"))
, m_storeRememberLastSavePath(SETTINGS_KEY("RememberLastSavePath"))
, m_storeDialogSize(SETTINGS_KEY(u"DialogSize"_qs))
, m_storeDefaultCategory(SETTINGS_KEY(u"DefaultCategory"_qs))
, m_storeRememberLastSavePath(SETTINGS_KEY(u"RememberLastSavePath"_qs))
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
, m_storeTreeHeaderState("GUI/Qt6/" SETTINGS_KEY("TreeHeaderState"))
, m_storeSplitterState("GUI/Qt6/" SETTINGS_KEY("SplitterState"))
, m_storeTreeHeaderState(u"GUI/Qt6/" SETTINGS_KEY(u"TreeHeaderState"_qs))
, m_storeSplitterState(u"GUI/Qt6/" SETTINGS_KEY(u"SplitterState"_qs))
#else
, m_storeTreeHeaderState(SETTINGS_KEY("TreeHeaderState"))
, m_storeSplitterState(SETTINGS_KEY("SplitterState"))
, m_storeTreeHeaderState(SETTINGS_KEY(u"TreeHeaderState"_qs))
, m_storeSplitterState(SETTINGS_KEY(u"SplitterState"_qs))
#endif
{
// TODO: set dialog file properties using m_torrentParams.filePriorities

4
src/gui/banlistoptionsdialog.cpp

@ -38,12 +38,12 @@ @@ -38,12 +38,12 @@
#include "ui_banlistoptionsdialog.h"
#include "utils.h"
#define SETTINGS_KEY(name) "BanListOptionsDialog/" name
#define SETTINGS_KEY(name) u"BanListOptionsDialog/" name
BanListOptionsDialog::BanListOptionsDialog(QWidget *parent)
: QDialog(parent)
, m_ui(new Ui::BanListOptionsDialog)
, m_storeDialogSize(SETTINGS_KEY("Size"))
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs))
, m_model(new QStringListModel(BitTorrent::Session::instance()->bannedIPs(), this))
{
m_ui->setupUi(this);

8
src/gui/cookiesdialog.cpp

@ -37,17 +37,17 @@ @@ -37,17 +37,17 @@
#include "uithememanager.h"
#include "utils.h"
#define SETTINGS_KEY(name) "CookiesDialog/" name
#define SETTINGS_KEY(name) u"CookiesDialog/" name
CookiesDialog::CookiesDialog(QWidget *parent)
: QDialog(parent)
, m_ui(new Ui::CookiesDialog)
, m_cookiesModel(new CookiesModel(Net::DownloadManager::instance()->allCookies(), this))
, m_storeDialogSize(SETTINGS_KEY("Size"))
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs))
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
, m_storeViewState("GUI/Qt6/" SETTINGS_KEY("ViewState"))
, m_storeViewState("GUI/Qt6/" SETTINGS_KEY(u"ViewState"_qs))
#else
, m_storeViewState(SETTINGS_KEY("CookiesViewState"))
, m_storeViewState(SETTINGS_KEY(u"CookiesViewState"_qs))
#endif
{
m_ui->setupUi(this);

4
src/gui/downloadfromurldialog.cpp

@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
#include "ui_downloadfromurldialog.h"
#include "utils.h"
#define SETTINGS_KEY(name) "DownloadFromURLDialog/" name
#define SETTINGS_KEY(name) u"DownloadFromURLDialog/" name
namespace
{
@ -61,7 +61,7 @@ namespace @@ -61,7 +61,7 @@ namespace
DownloadFromURLDialog::DownloadFromURLDialog(QWidget *parent)
: QDialog(parent)
, m_ui(new Ui::DownloadFromURLDialog)
, m_storeDialogSize(SETTINGS_KEY("Size"))
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs))
{
m_ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);

4
src/gui/ipsubnetwhitelistoptionsdialog.cpp

@ -38,12 +38,12 @@ @@ -38,12 +38,12 @@
#include "ui_ipsubnetwhitelistoptionsdialog.h"
#include "utils.h"
#define SETTINGS_KEY(name) "IPSubnetWhitelistOptionsDialog/" name
#define SETTINGS_KEY(name) u"IPSubnetWhitelistOptionsDialog/" name
IPSubnetWhitelistOptionsDialog::IPSubnetWhitelistOptionsDialog(QWidget *parent)
: QDialog(parent)
, m_ui(new Ui::IPSubnetWhitelistOptionsDialog)
, m_storeDialogSize(SETTINGS_KEY("Size"))
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs))
{
m_ui->setupUi(this);

20
src/gui/mainwindow.cpp

@ -104,9 +104,9 @@ using namespace std::chrono_literals; @@ -104,9 +104,9 @@ using namespace std::chrono_literals;
namespace
{
#define SETTINGS_KEY(name) "GUI/" name
#define EXECUTIONLOG_SETTINGS_KEY(name) (SETTINGS_KEY("Log/") name)
#define NOTIFICATIONS_SETTINGS_KEY(name) (SETTINGS_KEY("Notifications/") name)
#define SETTINGS_KEY(name) u"GUI/" name
#define EXECUTIONLOG_SETTINGS_KEY(name) (SETTINGS_KEY(u"Log/"_qs) name)
#define NOTIFICATIONS_SETTINGS_KEY(name) (SETTINGS_KEY(u"Notifications/"_qs) name)
const std::chrono::seconds PREVENT_SUSPEND_INTERVAL {60};
#if !defined(Q_OS_MACOS)
@ -125,13 +125,13 @@ namespace @@ -125,13 +125,13 @@ namespace
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, m_ui(new Ui::MainWindow)
, m_storeExecutionLogEnabled(EXECUTIONLOG_SETTINGS_KEY("Enabled"))
, m_storeDownloadTrackerFavicon(SETTINGS_KEY("DownloadTrackerFavicon"))
, m_storeNotificationEnabled(NOTIFICATIONS_SETTINGS_KEY("Enabled"))
, m_storeNotificationTorrentAdded(NOTIFICATIONS_SETTINGS_KEY("TorrentAdded"))
, m_storeExecutionLogTypes(EXECUTIONLOG_SETTINGS_KEY("Types"), Log::MsgType::ALL)
, m_storeExecutionLogEnabled(EXECUTIONLOG_SETTINGS_KEY(u"Enabled"_qs))
, m_storeDownloadTrackerFavicon(SETTINGS_KEY(u"DownloadTrackerFavicon"_qs))
, m_storeNotificationEnabled(NOTIFICATIONS_SETTINGS_KEY(u"Enabled"_qs))
, m_storeNotificationTorrentAdded(NOTIFICATIONS_SETTINGS_KEY(u"TorrentAdded"_qs))
, m_storeExecutionLogTypes(EXECUTIONLOG_SETTINGS_KEY(u"Types"_qs), Log::MsgType::ALL)
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB)
, m_storeNotificationTimeOut(NOTIFICATIONS_SETTINGS_KEY("Timeout"))
, m_storeNotificationTimeOut(NOTIFICATIONS_SETTINGS_KEY(u"Timeout"_qs))
#endif
{
m_ui->setupUi(this);
@ -2148,7 +2148,7 @@ void MainWindow::pythonDownloadFinished(const Net::DownloadResult &result) @@ -2148,7 +2148,7 @@ void MainWindow::pythonDownloadFinished(const Net::DownloadResult &result)
QProcess installer;
qDebug("Launching Python installer in passive mode...");
const Path exePath = result.filePath + ".exe";
const Path exePath = result.filePath + u".exe";
Utils::Fs::renameFile(result.filePath, exePath);
installer.start(exePath.toString(), {u"/passive"_qs});

8
src/gui/optionsdialog.cpp

@ -71,7 +71,7 @@ @@ -71,7 +71,7 @@
#include "watchedfolderoptionsdialog.h"
#include "watchedfoldersmodel.h"
#define SETTINGS_KEY(name) "OptionsDialog/" name
#define SETTINGS_KEY(name) u"OptionsDialog/" name
namespace
{
@ -179,9 +179,9 @@ private: @@ -179,9 +179,9 @@ private:
OptionsDialog::OptionsDialog(QWidget *parent)
: QDialog {parent}
, m_ui {new Ui::OptionsDialog}
, m_storeDialogSize {SETTINGS_KEY("Size")}
, m_storeHSplitterSize {SETTINGS_KEY("HorizontalSplitterSizes")}
, m_storeLastViewedPage {SETTINGS_KEY("LastViewedPage")}
, m_storeDialogSize {SETTINGS_KEY(u"Size"_qs)}
, m_storeHSplitterSize {SETTINGS_KEY(u"HorizontalSplitterSizes"_qs)}
, m_storeLastViewedPage {SETTINGS_KEY(u"LastViewedPage"_qs)}
{
qDebug("-> Constructing Options");
m_ui->setupUi(this);

8
src/gui/previewselectdialog.cpp

@ -46,17 +46,17 @@ @@ -46,17 +46,17 @@
#include "ui_previewselectdialog.h"
#include "utils.h"
#define SETTINGS_KEY(name) "PreviewSelectDialog/" name
#define SETTINGS_KEY(name) u"PreviewSelectDialog/" name
PreviewSelectDialog::PreviewSelectDialog(QWidget *parent, const BitTorrent::Torrent *torrent)
: QDialog(parent)
, m_ui(new Ui::PreviewSelectDialog)
, m_torrent(torrent)
, m_storeDialogSize(SETTINGS_KEY("Size"))
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs))
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
, m_storeTreeHeaderState("GUI/Qt6/" SETTINGS_KEY("HeaderState"))
, m_storeTreeHeaderState(u"GUI/Qt6/" SETTINGS_KEY(u"HeaderState"_qs))
#else
, m_storeTreeHeaderState(SETTINGS_KEY("HeaderState"))
, m_storeTreeHeaderState(SETTINGS_KEY(u"HeaderState"_qs))
#endif
{
m_ui->setupUi(this);

4
src/gui/search/pluginselectdialog.cpp

@ -48,7 +48,7 @@ @@ -48,7 +48,7 @@
#include "searchwidget.h"
#include "ui_pluginselectdialog.h"
#define SETTINGS_KEY(name) "SearchPluginSelectDialog/" name
#define SETTINGS_KEY(name) u"SearchPluginSelectDialog/" name
enum PluginColumns
{
@ -62,7 +62,7 @@ enum PluginColumns @@ -62,7 +62,7 @@ enum PluginColumns
PluginSelectDialog::PluginSelectDialog(SearchPluginManager *pluginManager, QWidget *parent)
: QDialog(parent)
, m_ui(new Ui::PluginSelectDialog)
, m_storeDialogSize(SETTINGS_KEY("Size"))
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs))
, m_pluginManager(pluginManager)
{
m_ui->setupUi(this);

4
src/gui/search/pluginsourcedialog.cpp

@ -31,12 +31,12 @@ @@ -31,12 +31,12 @@
#include "gui/utils.h"
#include "ui_pluginsourcedialog.h"
#define SETTINGS_KEY(name) "SearchPluginSourceDialog/" name
#define SETTINGS_KEY(name) u"SearchPluginSourceDialog/" name
PluginSourceDialog::PluginSourceDialog(QWidget *parent)
: QDialog(parent)
, m_ui(new Ui::PluginSourceDialog)
, m_storeDialogSize(SETTINGS_KEY("Size"))
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs))
{
m_ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);

2
src/gui/search/searchjobwidget.cpp

@ -547,7 +547,7 @@ void SearchJobWidget::appendSearchResults(const QVector<SearchResult> &results) @@ -547,7 +547,7 @@ void SearchJobWidget::appendSearchResults(const QVector<SearchResult> &results)
SettingValue<SearchJobWidget::NameFilteringMode> &SearchJobWidget::nameFilteringModeSetting()
{
static SettingValue<NameFilteringMode> setting {"Search/FilteringMode"};
static SettingValue<NameFilteringMode> setting {u"Search/FilteringMode"_qs};
return setting;
}

4
src/gui/speedlimitdialog.cpp

@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
#include "uithememanager.h"
#include "utils.h"
#define SETTINGS_KEY(name) "SpeedLimitDialog/" name
#define SETTINGS_KEY(name) u"SpeedLimitDialog/" name
namespace
{
@ -52,7 +52,7 @@ namespace @@ -52,7 +52,7 @@ namespace
SpeedLimitDialog::SpeedLimitDialog(QWidget *parent)
: QDialog {parent}
, m_ui {new Ui::SpeedLimitDialog}
, m_storeDialogSize {SETTINGS_KEY("Size")}
, m_storeDialogSize {SETTINGS_KEY(u"Size"_qs)}
{
m_ui->setupUi(this);

4
src/gui/statsdialog.cpp

@ -40,12 +40,12 @@ @@ -40,12 +40,12 @@
#include "ui_statsdialog.h"
#include "utils.h"
#define SETTINGS_KEY(name) "StatisticsDialog/" name
#define SETTINGS_KEY(name) u"StatisticsDialog/" name
StatsDialog::StatsDialog(QWidget *parent)
: QDialog(parent)
, m_ui(new Ui::StatsDialog)
, m_storeDialogSize(SETTINGS_KEY("Size"))
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs))
{
m_ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);

30
src/gui/torrentcreatordialog.cpp

@ -42,29 +42,29 @@ @@ -42,29 +42,29 @@
#include "ui_torrentcreatordialog.h"
#include "utils.h"
#define SETTINGS_KEY(name) "TorrentCreator/" name
#define SETTINGS_KEY(name) u"TorrentCreator/" name
TorrentCreatorDialog::TorrentCreatorDialog(QWidget *parent, const Path &defaultPath)
: QDialog(parent)
, m_ui(new Ui::TorrentCreatorDialog)
, m_creatorThread(new BitTorrent::TorrentCreatorThread(this))
, m_storeDialogSize(SETTINGS_KEY("Size"))
, m_storePieceSize(SETTINGS_KEY("PieceSize"))
, m_storePrivateTorrent(SETTINGS_KEY("PrivateTorrent"))
, m_storeStartSeeding(SETTINGS_KEY("StartSeeding"))
, m_storeIgnoreRatio(SETTINGS_KEY("IgnoreRatio"))
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs))
, m_storePieceSize(SETTINGS_KEY(u"PieceSize"_qs))
, m_storePrivateTorrent(SETTINGS_KEY(u"PrivateTorrent"_qs))
, m_storeStartSeeding(SETTINGS_KEY(u"StartSeeding"_qs))
, m_storeIgnoreRatio(SETTINGS_KEY(u"IgnoreRatio"_qs))
#ifdef QBT_USES_LIBTORRENT2
, m_storeTorrentFormat(SETTINGS_KEY("TorrentFormat"))
, m_storeTorrentFormat(SETTINGS_KEY(u"TorrentFormat"_qs))
#else
, m_storeOptimizeAlignment(SETTINGS_KEY("OptimizeAlignment"))
, m_paddedFileSizeLimit(SETTINGS_KEY("PaddedFileSizeLimit"))
, m_storeOptimizeAlignment(SETTINGS_KEY(u"OptimizeAlignment"_qs))
, m_paddedFileSizeLimit(SETTINGS_KEY(u"PaddedFileSizeLimit"_qs))
#endif
, m_storeLastAddPath(SETTINGS_KEY("LastAddPath"))
, m_storeTrackerList(SETTINGS_KEY("TrackerList"))
, m_storeWebSeedList(SETTINGS_KEY("WebSeedList"))
, m_storeComments(SETTINGS_KEY("Comments"))
, m_storeLastSavePath(SETTINGS_KEY("LastSavePath"))
, m_storeSource(SETTINGS_KEY("Source"))
, m_storeLastAddPath(SETTINGS_KEY(u"LastAddPath"_qs))
, m_storeTrackerList(SETTINGS_KEY(u"TrackerList"_qs))
, m_storeWebSeedList(SETTINGS_KEY(u"WebSeedList"_qs))
, m_storeComments(SETTINGS_KEY(u"Comments"_qs))
, m_storeLastSavePath(SETTINGS_KEY(u"LastSavePath"_qs))
, m_storeSource(SETTINGS_KEY(u"Source"_qs))
{
m_ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);

4
src/gui/torrentoptionsdialog.cpp

@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
#include "ui_torrentoptionsdialog.h"
#include "utils.h"
#define SETTINGS_KEY(name) "TorrentOptionsDialog/" name
#define SETTINGS_KEY(name) u"TorrentOptionsDialog/" name
namespace
{
@ -62,7 +62,7 @@ namespace @@ -62,7 +62,7 @@ namespace
TorrentOptionsDialog::TorrentOptionsDialog(QWidget *parent, const QVector<BitTorrent::Torrent *> &torrents)
: QDialog {parent}
, m_ui {new Ui::TorrentOptionsDialog}
, m_storeDialogSize {SETTINGS_KEY("Size")}
, m_storeDialogSize {SETTINGS_KEY(u"Size"_qs)}
, m_currentCategoriesString {QString::fromLatin1("--%1--").arg(tr("Currently used categories"))}
{
Q_ASSERT(!torrents.empty());

4
src/gui/trackerentriesdialog.cpp

@ -37,12 +37,12 @@ @@ -37,12 +37,12 @@
#include "ui_trackerentriesdialog.h"
#include "utils.h"
#define SETTINGS_KEY(name) "TrackerEntriesDialog/" name
#define SETTINGS_KEY(name) u"TrackerEntriesDialog/" name
TrackerEntriesDialog::TrackerEntriesDialog(QWidget *parent)
: QDialog(parent)
, m_ui(new Ui::TrackerEntriesDialog)
, m_storeDialogSize(SETTINGS_KEY("Size"))
, m_storeDialogSize(SETTINGS_KEY(u"Size"_qs))
{
m_ui->setupUi(this);

4
src/gui/transferlistsortmodel.cpp

@ -93,8 +93,8 @@ namespace @@ -93,8 +93,8 @@ namespace
TransferListSortModel::TransferListSortModel(QObject *parent)
: QSortFilterProxyModel {parent}
, m_subSortColumn {"TransferList/SubSortColumn", TransferListModel::TR_NAME, adjustSubSortColumn}
, m_subSortOrder {"TransferList/SubSortOrder", 0}
, m_subSortColumn {u"TransferList/SubSortColumn"_qs, TransferListModel::TR_NAME, adjustSubSortColumn}
, m_subSortOrder {u"TransferList/SubSortOrder"_qs, 0}
{
setSortRole(TransferListModel::UnderlyingDataRole);
}

4
src/gui/watchedfolderoptionsdialog.cpp

@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
#include "ui_watchedfolderoptionsdialog.h"
#include "utils.h"
#define SETTINGS_KEY(name) "WatchedFolderOptionsDialog/" name
#define SETTINGS_KEY(name) u"WatchedFolderOptionsDialog/" name
WatchedFolderOptionsDialog::WatchedFolderOptionsDialog(
const TorrentFilesWatcher::WatchedFolderOptions &watchedFolderOptions, QWidget *parent)
@ -45,7 +45,7 @@ WatchedFolderOptionsDialog::WatchedFolderOptionsDialog( @@ -45,7 +45,7 @@ WatchedFolderOptionsDialog::WatchedFolderOptionsDialog(
, m_ui {new Ui::WatchedFolderOptionsDialog}
, m_savePath {watchedFolderOptions.addTorrentParams.savePath}
, m_downloadPath {watchedFolderOptions.addTorrentParams.downloadPath}
, m_storeDialogSize {SETTINGS_KEY("DialogSize")}
, m_storeDialogSize {SETTINGS_KEY(u"DialogSize"_qs)}
{
m_ui->setupUi(this);

Loading…
Cancel
Save