Rename literal operator

Qt 6.4 introduced `QString operator""_s()` and the previous `""_qs` is
deprecated since Qt 6.8.
This commit is contained in:
Chocobo1
2023-06-18 02:02:02 +08:00
parent f6b58f36e2
commit e6d85a468b
141 changed files with 3610 additions and 3604 deletions

View File

@@ -45,43 +45,43 @@ namespace
switch (state)
{
case BitTorrent::TorrentState::Error:
return u"error"_qs;
return u"error"_s;
case BitTorrent::TorrentState::MissingFiles:
return u"missingFiles"_qs;
return u"missingFiles"_s;
case BitTorrent::TorrentState::Uploading:
return u"uploading"_qs;
return u"uploading"_s;
case BitTorrent::TorrentState::PausedUploading:
return u"pausedUP"_qs;
return u"pausedUP"_s;
case BitTorrent::TorrentState::QueuedUploading:
return u"queuedUP"_qs;
return u"queuedUP"_s;
case BitTorrent::TorrentState::StalledUploading:
return u"stalledUP"_qs;
return u"stalledUP"_s;
case BitTorrent::TorrentState::CheckingUploading:
return u"checkingUP"_qs;
return u"checkingUP"_s;
case BitTorrent::TorrentState::ForcedUploading:
return u"forcedUP"_qs;
return u"forcedUP"_s;
case BitTorrent::TorrentState::Downloading:
return u"downloading"_qs;
return u"downloading"_s;
case BitTorrent::TorrentState::DownloadingMetadata:
return u"metaDL"_qs;
return u"metaDL"_s;
case BitTorrent::TorrentState::ForcedDownloadingMetadata:
return u"forcedMetaDL"_qs;
return u"forcedMetaDL"_s;
case BitTorrent::TorrentState::PausedDownloading:
return u"pausedDL"_qs;
return u"pausedDL"_s;
case BitTorrent::TorrentState::QueuedDownloading:
return u"queuedDL"_qs;
return u"queuedDL"_s;
case BitTorrent::TorrentState::StalledDownloading:
return u"stalledDL"_qs;
return u"stalledDL"_s;
case BitTorrent::TorrentState::CheckingDownloading:
return u"checkingDL"_qs;
return u"checkingDL"_s;
case BitTorrent::TorrentState::ForcedDownloading:
return u"forcedDL"_qs;
return u"forcedDL"_s;
case BitTorrent::TorrentState::CheckingResumeData:
return u"checkingResumeData"_qs;
return u"checkingResumeData"_s;
case BitTorrent::TorrentState::Moving:
return u"moving"_qs;
return u"moving"_s;
default:
return u"unknown"_qs;
return u"unknown"_s;
}
}
}
@@ -128,7 +128,7 @@ QVariantMap serialize(const BitTorrent::Torrent &torrent)
{KEY_TORRENT_FIRST_LAST_PIECE_PRIO, torrent.hasFirstLastPiecePriority()},
{KEY_TORRENT_CATEGORY, torrent.category()},
{KEY_TORRENT_TAGS, torrent.tags().join(u", "_qs)},
{KEY_TORRENT_TAGS, torrent.tags().join(u", "_s)},
{KEY_TORRENT_SUPER_SEEDING, torrent.superSeeding()},
{KEY_TORRENT_FORCE_START, torrent.isForced()},
{KEY_TORRENT_SAVE_PATH, torrent.savePath().toString()},

View File

@@ -39,54 +39,54 @@ namespace BitTorrent
// Torrent keys
// TODO: Rename it to `id`.
inline const QString KEY_TORRENT_ID = u"hash"_qs;
inline const QString KEY_TORRENT_INFOHASHV1 = u"infohash_v1"_qs;
inline const QString KEY_TORRENT_INFOHASHV2 = u"infohash_v2"_qs;
inline const QString KEY_TORRENT_NAME = u"name"_qs;
inline const QString KEY_TORRENT_MAGNET_URI = u"magnet_uri"_qs;
inline const QString KEY_TORRENT_SIZE = u"size"_qs;
inline const QString KEY_TORRENT_PROGRESS = u"progress"_qs;
inline const QString KEY_TORRENT_DLSPEED = u"dlspeed"_qs;
inline const QString KEY_TORRENT_UPSPEED = u"upspeed"_qs;
inline const QString KEY_TORRENT_QUEUE_POSITION = u"priority"_qs;
inline const QString KEY_TORRENT_SEEDS = u"num_seeds"_qs;
inline const QString KEY_TORRENT_NUM_COMPLETE = u"num_complete"_qs;
inline const QString KEY_TORRENT_LEECHS = u"num_leechs"_qs;
inline const QString KEY_TORRENT_NUM_INCOMPLETE = u"num_incomplete"_qs;
inline const QString KEY_TORRENT_RATIO = u"ratio"_qs;
inline const QString KEY_TORRENT_ETA = u"eta"_qs;
inline const QString KEY_TORRENT_STATE = u"state"_qs;
inline const QString KEY_TORRENT_SEQUENTIAL_DOWNLOAD = u"seq_dl"_qs;
inline const QString KEY_TORRENT_FIRST_LAST_PIECE_PRIO = u"f_l_piece_prio"_qs;
inline const QString KEY_TORRENT_CATEGORY = u"category"_qs;
inline const QString KEY_TORRENT_TAGS = u"tags"_qs;
inline const QString KEY_TORRENT_SUPER_SEEDING = u"super_seeding"_qs;
inline const QString KEY_TORRENT_FORCE_START = u"force_start"_qs;
inline const QString KEY_TORRENT_SAVE_PATH = u"save_path"_qs;
inline const QString KEY_TORRENT_DOWNLOAD_PATH = u"download_path"_qs;
inline const QString KEY_TORRENT_CONTENT_PATH = u"content_path"_qs;
inline const QString KEY_TORRENT_ADDED_ON = u"added_on"_qs;
inline const QString KEY_TORRENT_COMPLETION_ON = u"completion_on"_qs;
inline const QString KEY_TORRENT_TRACKER = u"tracker"_qs;
inline const QString KEY_TORRENT_TRACKERS_COUNT = u"trackers_count"_qs;
inline const QString KEY_TORRENT_DL_LIMIT = u"dl_limit"_qs;
inline const QString KEY_TORRENT_UP_LIMIT = u"up_limit"_qs;
inline const QString KEY_TORRENT_AMOUNT_DOWNLOADED = u"downloaded"_qs;
inline const QString KEY_TORRENT_AMOUNT_UPLOADED = u"uploaded"_qs;
inline const QString KEY_TORRENT_AMOUNT_DOWNLOADED_SESSION = u"downloaded_session"_qs;
inline const QString KEY_TORRENT_AMOUNT_UPLOADED_SESSION = u"uploaded_session"_qs;
inline const QString KEY_TORRENT_AMOUNT_LEFT = u"amount_left"_qs;
inline const QString KEY_TORRENT_AMOUNT_COMPLETED = u"completed"_qs;
inline const QString KEY_TORRENT_MAX_RATIO = u"max_ratio"_qs;
inline const QString KEY_TORRENT_MAX_SEEDING_TIME = u"max_seeding_time"_qs;
inline const QString KEY_TORRENT_RATIO_LIMIT = u"ratio_limit"_qs;
inline const QString KEY_TORRENT_SEEDING_TIME_LIMIT = u"seeding_time_limit"_qs;
inline const QString KEY_TORRENT_LAST_SEEN_COMPLETE_TIME = u"seen_complete"_qs;
inline const QString KEY_TORRENT_LAST_ACTIVITY_TIME = u"last_activity"_qs;
inline const QString KEY_TORRENT_TOTAL_SIZE = u"total_size"_qs;
inline const QString KEY_TORRENT_AUTO_TORRENT_MANAGEMENT = u"auto_tmm"_qs;
inline const QString KEY_TORRENT_TIME_ACTIVE = u"time_active"_qs;
inline const QString KEY_TORRENT_SEEDING_TIME = u"seeding_time"_qs;
inline const QString KEY_TORRENT_AVAILABILITY = u"availability"_qs;
inline const QString KEY_TORRENT_ID = u"hash"_s;
inline const QString KEY_TORRENT_INFOHASHV1 = u"infohash_v1"_s;
inline const QString KEY_TORRENT_INFOHASHV2 = u"infohash_v2"_s;
inline const QString KEY_TORRENT_NAME = u"name"_s;
inline const QString KEY_TORRENT_MAGNET_URI = u"magnet_uri"_s;
inline const QString KEY_TORRENT_SIZE = u"size"_s;
inline const QString KEY_TORRENT_PROGRESS = u"progress"_s;
inline const QString KEY_TORRENT_DLSPEED = u"dlspeed"_s;
inline const QString KEY_TORRENT_UPSPEED = u"upspeed"_s;
inline const QString KEY_TORRENT_QUEUE_POSITION = u"priority"_s;
inline const QString KEY_TORRENT_SEEDS = u"num_seeds"_s;
inline const QString KEY_TORRENT_NUM_COMPLETE = u"num_complete"_s;
inline const QString KEY_TORRENT_LEECHS = u"num_leechs"_s;
inline const QString KEY_TORRENT_NUM_INCOMPLETE = u"num_incomplete"_s;
inline const QString KEY_TORRENT_RATIO = u"ratio"_s;
inline const QString KEY_TORRENT_ETA = u"eta"_s;
inline const QString KEY_TORRENT_STATE = u"state"_s;
inline const QString KEY_TORRENT_SEQUENTIAL_DOWNLOAD = u"seq_dl"_s;
inline const QString KEY_TORRENT_FIRST_LAST_PIECE_PRIO = u"f_l_piece_prio"_s;
inline const QString KEY_TORRENT_CATEGORY = u"category"_s;
inline const QString KEY_TORRENT_TAGS = u"tags"_s;
inline const QString KEY_TORRENT_SUPER_SEEDING = u"super_seeding"_s;
inline const QString KEY_TORRENT_FORCE_START = u"force_start"_s;
inline const QString KEY_TORRENT_SAVE_PATH = u"save_path"_s;
inline const QString KEY_TORRENT_DOWNLOAD_PATH = u"download_path"_s;
inline const QString KEY_TORRENT_CONTENT_PATH = u"content_path"_s;
inline const QString KEY_TORRENT_ADDED_ON = u"added_on"_s;
inline const QString KEY_TORRENT_COMPLETION_ON = u"completion_on"_s;
inline const QString KEY_TORRENT_TRACKER = u"tracker"_s;
inline const QString KEY_TORRENT_TRACKERS_COUNT = u"trackers_count"_s;
inline const QString KEY_TORRENT_DL_LIMIT = u"dl_limit"_s;
inline const QString KEY_TORRENT_UP_LIMIT = u"up_limit"_s;
inline const QString KEY_TORRENT_AMOUNT_DOWNLOADED = u"downloaded"_s;
inline const QString KEY_TORRENT_AMOUNT_UPLOADED = u"uploaded"_s;
inline const QString KEY_TORRENT_AMOUNT_DOWNLOADED_SESSION = u"downloaded_session"_s;
inline const QString KEY_TORRENT_AMOUNT_UPLOADED_SESSION = u"uploaded_session"_s;
inline const QString KEY_TORRENT_AMOUNT_LEFT = u"amount_left"_s;
inline const QString KEY_TORRENT_AMOUNT_COMPLETED = u"completed"_s;
inline const QString KEY_TORRENT_MAX_RATIO = u"max_ratio"_s;
inline const QString KEY_TORRENT_MAX_SEEDING_TIME = u"max_seeding_time"_s;
inline const QString KEY_TORRENT_RATIO_LIMIT = u"ratio_limit"_s;
inline const QString KEY_TORRENT_SEEDING_TIME_LIMIT = u"seeding_time_limit"_s;
inline const QString KEY_TORRENT_LAST_SEEN_COMPLETE_TIME = u"seen_complete"_s;
inline const QString KEY_TORRENT_LAST_ACTIVITY_TIME = u"last_activity"_s;
inline const QString KEY_TORRENT_TOTAL_SIZE = u"total_size"_s;
inline const QString KEY_TORRENT_AUTO_TORRENT_MANAGEMENT = u"auto_tmm"_s;
inline const QString KEY_TORRENT_TIME_ACTIVE = u"time_active"_s;
inline const QString KEY_TORRENT_SEEDING_TIME = u"seeding_time"_s;
inline const QString KEY_TORRENT_AVAILABILITY = u"availability"_s;
QVariantMap serialize(const BitTorrent::Torrent &torrent);