Merge pull request #16738 from Chocobo1/qstring

Improve function interface
This commit is contained in:
Chocobo1 2022-03-28 12:28:28 +08:00 committed by GitHub
commit 746fe7ba09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 234 additions and 250 deletions

View file

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

View file

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

View file

@ -45,7 +45,7 @@
namespace namespace
{ {
const int MIGRATION_VERSION = 3; const int MIGRATION_VERSION = 3;
const char MIGRATION_VERSION_KEY[] = "Meta/MigrationVersion"; const QString MIGRATION_VERSION_KEY = u"Meta/MigrationVersion"_qs;
void exportWebUIHttpsFiles() void exportWebUIHttpsFiles()
{ {
@ -400,7 +400,7 @@ bool upgrade(const bool /*ask*/)
void setCurrentMigrationVersion() 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) void handleChangedDefaults(const DefaultPreferencesMode mode)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -232,14 +232,14 @@ void SearchPluginManager::installPlugin_impl(const QString &name, const Path &pa
const PluginInfo *plugin = pluginInfo(name); const PluginInfo *plugin = pluginInfo(name);
if (plugin && !(plugin->version < newVersion)) if (plugin && !(plugin->version < newVersion))
{ {
LogMsg(tr("Plugin already at version %1, which is greater than %2").arg(plugin->version, newVersion), Log::INFO); LogMsg(tr("Plugin already at version %1, which is greater than %2").arg(plugin->version.toString(), newVersion.toString()), Log::INFO);
emit pluginUpdateFailed(name, tr("A more recent version of this plugin is already installed.")); emit pluginUpdateFailed(name, tr("A more recent version of this plugin is already installed."));
return; return;
} }
// Process with install // Process with install
const Path destPath = pluginPath(name); const Path destPath = pluginPath(name);
const Path backupPath = destPath + ".bak"; const Path backupPath = destPath + u".bak";
bool updated = false; bool updated = false;
if (destPath.exists()) if (destPath.exists())
{ {
@ -536,7 +536,7 @@ void SearchPluginManager::parseVersionInfo(const QByteArray &info)
++numCorrectData; ++numCorrectData;
if (isUpdateNeeded(pluginName, version)) if (isUpdateNeeded(pluginName, version))
{ {
LogMsg(tr("Plugin \"%1\" is outdated, updating to version %2").arg(pluginName, version), Log::INFO); LogMsg(tr("Plugin \"%1\" is outdated, updating to version %2").arg(pluginName, version.toString()), Log::INFO);
updateInfo[pluginName] = version; updateInfo[pluginName] = version;
} }
} }

View file

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

View file

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

View file

@ -604,7 +604,7 @@ void TorrentFilesWatcher::Worker::processFailedTorrents()
if (value >= MAX_FAILED_RETRIES) if (value >= MAX_FAILED_RETRIES)
{ {
LogMsg(tr("Rejecting failed torrent file: %1").arg(torrentPath.toString())); 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; return true;
} }

View file

@ -83,7 +83,7 @@ namespace
} }
LogMsg(QCoreApplication::translate("Utils::ForeignApps", "Python detected, executable name: '%1', version: %2") LogMsg(QCoreApplication::translate("Utils::ForeignApps", "Python detected, executable name: '%1', version: %2")
.arg(info.executableName, info.version), Log::INFO); .arg(info.executableName, info.version.toString()), Log::INFO);
return true; return true;
} }

View file

@ -35,11 +35,12 @@
#include "base/exceptions.h" #include "base/exceptions.h"
#include "base/global.h" #include "base/global.h"
#include "base/interfaces/istringable.h"
namespace Utils namespace Utils
{ {
template <typename T, std::size_t N, std::size_t Mandatory = N> template <typename T, std::size_t N, std::size_t Mandatory = N>
class Version class Version final : public IStringable
{ {
static_assert(N > 0, "The number of version components may not be smaller than 1"); static_assert(N > 0, "The number of version components may not be smaller than 1");
static_assert(N >= Mandatory, static_assert(N >= Mandatory,
@ -108,7 +109,7 @@ namespace Utils
return m_components.at(i); return m_components.at(i);
} }
operator QString() const QString toString() const override
{ {
// find the last one non-zero component // find the last one non-zero component
std::size_t lastSignificantIndex = N - 1; std::size_t lastSignificantIndex = N - 1;

View file

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

View file

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

View file

@ -38,12 +38,12 @@
#include "ui_banlistoptionsdialog.h" #include "ui_banlistoptionsdialog.h"
#include "utils.h" #include "utils.h"
#define SETTINGS_KEY(name) "BanListOptionsDialog/" name #define SETTINGS_KEY(name) u"BanListOptionsDialog/" name
BanListOptionsDialog::BanListOptionsDialog(QWidget *parent) BanListOptionsDialog::BanListOptionsDialog(QWidget *parent)
: QDialog(parent) : QDialog(parent)
, m_ui(new Ui::BanListOptionsDialog) , 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_model(new QStringListModel(BitTorrent::Session::instance()->bannedIPs(), this))
{ {
m_ui->setupUi(this); m_ui->setupUi(this);

View file

@ -37,17 +37,17 @@
#include "uithememanager.h" #include "uithememanager.h"
#include "utils.h" #include "utils.h"
#define SETTINGS_KEY(name) "CookiesDialog/" name #define SETTINGS_KEY(name) u"CookiesDialog/" name
CookiesDialog::CookiesDialog(QWidget *parent) CookiesDialog::CookiesDialog(QWidget *parent)
: QDialog(parent) : QDialog(parent)
, m_ui(new Ui::CookiesDialog) , m_ui(new Ui::CookiesDialog)
, m_cookiesModel(new CookiesModel(Net::DownloadManager::instance()->allCookies(), this)) , 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)) #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 #else
, m_storeViewState(SETTINGS_KEY("CookiesViewState")) , m_storeViewState(SETTINGS_KEY(u"CookiesViewState"_qs))
#endif #endif
{ {
m_ui->setupUi(this); m_ui->setupUi(this);

View file

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

View file

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

View file

@ -104,9 +104,9 @@ using namespace std::chrono_literals;
namespace namespace
{ {
#define SETTINGS_KEY(name) "GUI/" name #define SETTINGS_KEY(name) u"GUI/" name
#define EXECUTIONLOG_SETTINGS_KEY(name) (SETTINGS_KEY("Log/") name) #define EXECUTIONLOG_SETTINGS_KEY(name) (SETTINGS_KEY(u"Log/"_qs) name)
#define NOTIFICATIONS_SETTINGS_KEY(name) (SETTINGS_KEY("Notifications/") name) #define NOTIFICATIONS_SETTINGS_KEY(name) (SETTINGS_KEY(u"Notifications/"_qs) name)
const std::chrono::seconds PREVENT_SUSPEND_INTERVAL {60}; const std::chrono::seconds PREVENT_SUSPEND_INTERVAL {60};
#if !defined(Q_OS_MACOS) #if !defined(Q_OS_MACOS)
@ -125,13 +125,13 @@ namespace
MainWindow::MainWindow(QWidget *parent) MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent) : QMainWindow(parent)
, m_ui(new Ui::MainWindow) , m_ui(new Ui::MainWindow)
, m_storeExecutionLogEnabled(EXECUTIONLOG_SETTINGS_KEY("Enabled")) , m_storeExecutionLogEnabled(EXECUTIONLOG_SETTINGS_KEY(u"Enabled"_qs))
, m_storeDownloadTrackerFavicon(SETTINGS_KEY("DownloadTrackerFavicon")) , m_storeDownloadTrackerFavicon(SETTINGS_KEY(u"DownloadTrackerFavicon"_qs))
, m_storeNotificationEnabled(NOTIFICATIONS_SETTINGS_KEY("Enabled")) , m_storeNotificationEnabled(NOTIFICATIONS_SETTINGS_KEY(u"Enabled"_qs))
, m_storeNotificationTorrentAdded(NOTIFICATIONS_SETTINGS_KEY("TorrentAdded")) , m_storeNotificationTorrentAdded(NOTIFICATIONS_SETTINGS_KEY(u"TorrentAdded"_qs))
, m_storeExecutionLogTypes(EXECUTIONLOG_SETTINGS_KEY("Types"), Log::MsgType::ALL) , m_storeExecutionLogTypes(EXECUTIONLOG_SETTINGS_KEY(u"Types"_qs), Log::MsgType::ALL)
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) && defined(QT_DBUS_LIB) #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 #endif
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
@ -1892,14 +1892,14 @@ void MainWindow::on_actionSearchWidget_triggered()
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
const QMessageBox::StandardButton buttonPressed = QMessageBox::question(this, tr("Old Python Runtime") const QMessageBox::StandardButton buttonPressed = QMessageBox::question(this, tr("Old Python Runtime")
, tr("Your Python version (%1) is outdated. Minimum requirement: %2.\nDo you want to install a newer version now?") , tr("Your Python version (%1) is outdated. Minimum requirement: %2.\nDo you want to install a newer version now?")
.arg(pyInfo.version, QLatin1String("3.5.0")) .arg(pyInfo.version.toString(), u"3.5.0")
, (QMessageBox::Yes | QMessageBox::No), QMessageBox::Yes); , (QMessageBox::Yes | QMessageBox::No), QMessageBox::Yes);
if (buttonPressed == QMessageBox::Yes) if (buttonPressed == QMessageBox::Yes)
installPython(); installPython();
#else #else
QMessageBox::information(this, tr("Old Python Runtime") QMessageBox::information(this, tr("Old Python Runtime")
, tr("Your Python version (%1) is outdated. Please upgrade to latest version for search engines to work.\nMinimum requirement: %2.") , tr("Your Python version (%1) is outdated. Please upgrade to latest version for search engines to work.\nMinimum requirement: %2.")
.arg(pyInfo.version, QLatin1String("3.5.0"))); .arg(pyInfo.version.toString(), u"3.5.0"));
#endif #endif
return; return;
} }
@ -2148,7 +2148,7 @@ void MainWindow::pythonDownloadFinished(const Net::DownloadResult &result)
QProcess installer; QProcess installer;
qDebug("Launching Python installer in passive mode..."); 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); Utils::Fs::renameFile(result.filePath, exePath);
installer.start(exePath.toString(), {u"/passive"_qs}); installer.start(exePath.toString(), {u"/passive"_qs});

View file

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

View file

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

View file

@ -48,7 +48,7 @@
#include "searchwidget.h" #include "searchwidget.h"
#include "ui_pluginselectdialog.h" #include "ui_pluginselectdialog.h"
#define SETTINGS_KEY(name) "SearchPluginSelectDialog/" name #define SETTINGS_KEY(name) u"SearchPluginSelectDialog/" name
enum PluginColumns enum PluginColumns
{ {
@ -62,7 +62,7 @@ enum PluginColumns
PluginSelectDialog::PluginSelectDialog(SearchPluginManager *pluginManager, QWidget *parent) PluginSelectDialog::PluginSelectDialog(SearchPluginManager *pluginManager, QWidget *parent)
: QDialog(parent) : QDialog(parent)
, m_ui(new Ui::PluginSelectDialog) , m_ui(new Ui::PluginSelectDialog)
, m_storeDialogSize(SETTINGS_KEY("Size")) , m_storeDialogSize(SETTINGS_KEY(u"Size"_qs))
, m_pluginManager(pluginManager) , m_pluginManager(pluginManager)
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
@ -315,7 +315,7 @@ void PluginSelectDialog::addNewPlugin(const QString &pluginName)
DownloadRequest(plugin->url + u"/favicon.ico").saveToFile(true) DownloadRequest(plugin->url + u"/favicon.ico").saveToFile(true)
, this, &PluginSelectDialog::iconDownloadFinished); , this, &PluginSelectDialog::iconDownloadFinished);
} }
item->setText(PLUGIN_VERSION, plugin->version); item->setText(PLUGIN_VERSION, plugin->version.toString());
} }
void PluginSelectDialog::startAsyncOp() void PluginSelectDialog::startAsyncOp()
@ -483,7 +483,7 @@ void PluginSelectDialog::pluginUpdated(const QString &name)
finishAsyncOp(); finishAsyncOp();
PluginVersion version = m_pluginManager->pluginInfo(name)->version; PluginVersion version = m_pluginManager->pluginInfo(name)->version;
QTreeWidgetItem *item = findItemWithID(name); QTreeWidgetItem *item = findItemWithID(name);
item->setText(PLUGIN_VERSION, version); item->setText(PLUGIN_VERSION, version.toString());
m_updatedPlugins.append(name); m_updatedPlugins.append(name);
finishPluginUpdate(); finishPluginUpdate();
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -63,7 +63,7 @@
void AppController::webapiVersionAction() void AppController::webapiVersionAction()
{ {
setResult(static_cast<QString>(API_VERSION)); setResult(API_VERSION.toString());
} }
void AppController::versionAction() void AppController::versionAction()

View file

@ -388,7 +388,7 @@ QJsonArray SearchController::getPluginsInfo(const QStringList &plugins) const
pluginsArray << QJsonObject pluginsArray << QJsonObject
{ {
{u"name"_qs, pluginInfo->name}, {u"name"_qs, pluginInfo->name},
{u"version"_qs, QString(pluginInfo->version)}, {u"version"_qs, pluginInfo->version.toString()},
{u"fullName"_qs, pluginInfo->fullName}, {u"fullName"_qs, pluginInfo->fullName},
{u"url"_qs, pluginInfo->url}, {u"url"_qs, pluginInfo->url},
{u"supportedCategories"_qs, getPluginCategories(pluginInfo->supportedCategories)}, {u"supportedCategories"_qs, getPluginCategories(pluginInfo->supportedCategories)},