mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
Migrate away from deprecated Qt functions
`QString QDateTime::toString(Qt::DateFormat format = Qt::TextDate)` will be removed in Qt6.
This commit is contained in:
parent
89559eae2b
commit
cede5ac9d2
@ -655,7 +655,7 @@ void AddNewTorrentDialog::setupTreeview()
|
|||||||
|
|
||||||
// Set torrent information
|
// Set torrent information
|
||||||
m_ui->labelCommentData->setText(Utils::Misc::parseHtmlLinks(m_torrentInfo.comment().toHtmlEscaped()));
|
m_ui->labelCommentData->setText(Utils::Misc::parseHtmlLinks(m_torrentInfo.comment().toHtmlEscaped()));
|
||||||
m_ui->labelDateData->setText(!m_torrentInfo.creationDate().isNull() ? m_torrentInfo.creationDate().toString(Qt::DefaultLocaleShortDate) : tr("Not available"));
|
m_ui->labelDateData->setText(!m_torrentInfo.creationDate().isNull() ? QLocale().toString(m_torrentInfo.creationDate(), QLocale::ShortFormat) : tr("Not available"));
|
||||||
|
|
||||||
// Prepare content tree
|
// Prepare content tree
|
||||||
m_contentModel = new TorrentContentFilterModel(this);
|
m_contentModel = new TorrentContentFilterModel(this);
|
||||||
|
@ -155,7 +155,7 @@ LogMessageModel::LogMessageModel(QObject *parent)
|
|||||||
|
|
||||||
void LogMessageModel::handleNewMessage(const Log::Msg &message)
|
void LogMessageModel::handleNewMessage(const Log::Msg &message)
|
||||||
{
|
{
|
||||||
const QString time = QDateTime::fromMSecsSinceEpoch(message.timestamp).toString(Qt::SystemLocaleShortDate);
|
const QString time = QLocale::system().toString(QDateTime::fromMSecsSinceEpoch(message.timestamp), QLocale::ShortFormat);
|
||||||
const QString messageText = message.message;
|
const QString messageText = message.message;
|
||||||
const QColor foreground = m_foregroundForMessageTypes[message.type];
|
const QColor foreground = m_foregroundForMessageTypes[message.type];
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ LogPeerModel::LogPeerModel(QObject *parent)
|
|||||||
|
|
||||||
void LogPeerModel::handleNewMessage(const Log::Peer &peer)
|
void LogPeerModel::handleNewMessage(const Log::Peer &peer)
|
||||||
{
|
{
|
||||||
const QString time = QDateTime::fromMSecsSinceEpoch(peer.timestamp).toString(Qt::SystemLocaleShortDate);
|
const QString time = QLocale::system().toString(QDateTime::fromMSecsSinceEpoch(peer.timestamp), QLocale::ShortFormat);
|
||||||
const QString message = peer.blocked
|
const QString message = peer.blocked
|
||||||
? tr("%1 was blocked. Reason: %2.", "0.0.0.0 was blocked. Reason: reason for blocking.").arg(peer.ip, peer.reason)
|
? tr("%1 was blocked. Reason: %2.", "0.0.0.0 was blocked. Reason: reason for blocking.").arg(peer.ip, peer.reason)
|
||||||
: tr("%1 was banned", "0.0.0.0 was banned").arg(peer.ip);
|
: tr("%1 was banned", "0.0.0.0 was banned").arg(peer.ip);
|
||||||
|
@ -319,7 +319,7 @@ void PropertiesWidget::loadTorrentInfos(BitTorrent::TorrentHandle *const torrent
|
|||||||
if (m_torrent->hasMetadata())
|
if (m_torrent->hasMetadata())
|
||||||
{
|
{
|
||||||
// Creation date
|
// Creation date
|
||||||
m_ui->labelCreatedOnVal->setText(m_torrent->creationDate().toString(Qt::DefaultLocaleShortDate));
|
m_ui->labelCreatedOnVal->setText(QLocale().toString(m_torrent->creationDate(), QLocale::ShortFormat));
|
||||||
|
|
||||||
m_ui->labelTotalSizeVal->setText(Utils::Misc::friendlyUnit(m_torrent->totalSize()));
|
m_ui->labelTotalSizeVal->setText(Utils::Misc::friendlyUnit(m_torrent->totalSize()));
|
||||||
|
|
||||||
@ -457,11 +457,11 @@ void PropertiesWidget::loadDynamicData()
|
|||||||
m_ui->labelUpSpeedVal->setText(tr("%1 (%2 avg.)", "%1 and %2 are speed rates, e.g. 200KiB/s (100KiB/s avg.)")
|
m_ui->labelUpSpeedVal->setText(tr("%1 (%2 avg.)", "%1 and %2 are speed rates, e.g. 200KiB/s (100KiB/s avg.)")
|
||||||
.arg(Utils::Misc::friendlyUnit(m_torrent->uploadPayloadRate(), true), ulAvg));
|
.arg(Utils::Misc::friendlyUnit(m_torrent->uploadPayloadRate(), true), ulAvg));
|
||||||
|
|
||||||
m_ui->labelLastSeenCompleteVal->setText(m_torrent->lastSeenComplete().isValid() ? m_torrent->lastSeenComplete().toString(Qt::DefaultLocaleShortDate) : tr("Never"));
|
m_ui->labelLastSeenCompleteVal->setText(m_torrent->lastSeenComplete().isValid() ? QLocale().toString(m_torrent->lastSeenComplete(), QLocale::ShortFormat) : tr("Never"));
|
||||||
|
|
||||||
m_ui->labelCompletedOnVal->setText(m_torrent->completedTime().isValid() ? m_torrent->completedTime().toString(Qt::DefaultLocaleShortDate) : "");
|
m_ui->labelCompletedOnVal->setText(m_torrent->completedTime().isValid() ? QLocale().toString(m_torrent->completedTime(), QLocale::ShortFormat) : QString {});
|
||||||
|
|
||||||
m_ui->labelAddedOnVal->setText(m_torrent->addedTime().toString(Qt::DefaultLocaleShortDate));
|
m_ui->labelAddedOnVal->setText(QLocale().toString(m_torrent->addedTime(), QLocale::ShortFormat));
|
||||||
|
|
||||||
if (m_torrent->hasMetadata())
|
if (m_torrent->hasMetadata())
|
||||||
{
|
{
|
||||||
|
@ -486,7 +486,7 @@ void RSSWidget::handleCurrentArticleItemChanged(QListWidgetItem *currentItem, QL
|
|||||||
QString::fromLatin1("<div style='border: 2px solid red; margin-left: 5px; margin-right: 5px; margin-bottom: 5px;'>") +
|
QString::fromLatin1("<div style='border: 2px solid red; margin-left: 5px; margin-right: 5px; margin-bottom: 5px;'>") +
|
||||||
QString::fromLatin1("<div style='background-color: \"%1\"; font-weight: bold; color: \"%2\";'>%3</div>").arg(highlightedBaseColor, highlightedBaseTextColor, article->title());
|
QString::fromLatin1("<div style='background-color: \"%1\"; font-weight: bold; color: \"%2\";'>%3</div>").arg(highlightedBaseColor, highlightedBaseTextColor, article->title());
|
||||||
if (article->date().isValid())
|
if (article->date().isValid())
|
||||||
html += QString::fromLatin1("<div style='background-color: \"%1\";'><b>%2</b>%3</div>").arg(alternateBaseColor, tr("Date: "), article->date().toLocalTime().toString(Qt::SystemLocaleLongDate));
|
html += QString::fromLatin1("<div style='background-color: \"%1\";'><b>%2</b>%3</div>").arg(alternateBaseColor, tr("Date: "), QLocale::system().toString(article->date().toLocalTime()));
|
||||||
if (!article->author().isEmpty())
|
if (!article->author().isEmpty())
|
||||||
html += QString::fromLatin1("<div style='background-color: \"%1\";'><b>%2</b>%3</div>").arg(alternateBaseColor, tr("Author: "), article->author());
|
html += QString::fromLatin1("<div style='background-color: \"%1\";'><b>%2</b>%3</div>").arg(alternateBaseColor, tr("Author: "), article->author());
|
||||||
html += "</div>"
|
html += "</div>"
|
||||||
|
@ -361,9 +361,9 @@ QString TransferListModel::displayValue(const BitTorrent::TorrentHandle *torrent
|
|||||||
case TR_TAGS:
|
case TR_TAGS:
|
||||||
return tagsString(torrent->tags());
|
return tagsString(torrent->tags());
|
||||||
case TR_ADD_DATE:
|
case TR_ADD_DATE:
|
||||||
return torrent->addedTime().toLocalTime().toString(Qt::DefaultLocaleShortDate);
|
return QLocale().toString(torrent->addedTime().toLocalTime(), QLocale::ShortFormat);
|
||||||
case TR_SEED_DATE:
|
case TR_SEED_DATE:
|
||||||
return torrent->completedTime().toLocalTime().toString(Qt::DefaultLocaleShortDate);
|
return QLocale().toString(torrent->completedTime().toLocalTime(), QLocale::ShortFormat);
|
||||||
case TR_TRACKER:
|
case TR_TRACKER:
|
||||||
return torrent->currentTracker();
|
return torrent->currentTracker();
|
||||||
case TR_DLLIMIT:
|
case TR_DLLIMIT:
|
||||||
@ -387,7 +387,7 @@ QString TransferListModel::displayValue(const BitTorrent::TorrentHandle *torrent
|
|||||||
case TR_COMPLETED:
|
case TR_COMPLETED:
|
||||||
return unitString(torrent->completedSize());
|
return unitString(torrent->completedSize());
|
||||||
case TR_SEEN_COMPLETE_DATE:
|
case TR_SEEN_COMPLETE_DATE:
|
||||||
return torrent->lastSeenComplete().toLocalTime().toString(Qt::DefaultLocaleShortDate);
|
return QLocale().toString(torrent->lastSeenComplete().toLocalTime(), QLocale::ShortFormat);
|
||||||
case TR_LAST_ACTIVITY:
|
case TR_LAST_ACTIVITY:
|
||||||
return lastActivityString((torrent->isPaused() || torrent->isChecking()) ? -1 : torrent->timeSinceActivity());
|
return lastActivityString((torrent->isPaused() || torrent->isChecking()) ? -1 : torrent->timeSinceActivity());
|
||||||
case TR_AVAILABILITY:
|
case TR_AVAILABILITY:
|
||||||
|
Loading…
Reference in New Issue
Block a user