Browse Source

Merge pull request #14162 from Chocobo1/flags

Disable compiler flags
adaptive-webui-19844
sledgehammer999 4 years ago committed by GitHub
parent
commit
613fd1bcf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      .github/workflows/ci.yaml
  2. 14
      cmake/Modules/MacroQbtCommonConfig.cmake
  3. 7
      src/base/unicodestrings.h
  4. 2
      src/gui/addnewtorrentdialog.cpp
  5. 4
      src/gui/log/logmodel.cpp
  6. 8
      src/gui/properties/propertieswidget.cpp
  7. 2
      src/gui/rss/rsswidget.cpp
  8. 6
      src/gui/transferlistmodel.cpp
  9. 2
      src/src.pro
  10. 2
      winconf.pri

6
.github/workflows/ci.yaml

@ -72,7 +72,7 @@ jobs:
- name: upload artifact as zip - name: upload artifact as zip
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: qBittorrent-CI-Ubuntu_${{ matrix.os }}-${{ matrix.qbt_gui }} name: qBittorrent-CI_${{ matrix.os }}-x64_${{ matrix.qbt_gui }}
path: | path: |
build/compile_commands.json build/compile_commands.json
build/target_graph.dot build/target_graph.dot
@ -151,7 +151,7 @@ jobs:
- name: upload artifact as zip - name: upload artifact as zip
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: qBittorrent-CI-Windows_x64-static-release name: qBittorrent-CI_Windows-x64
path: | path: |
build/compile_commands.json build/compile_commands.json
build/target_graph.dot build/target_graph.dot
@ -236,7 +236,7 @@ jobs:
- name: upload artifact as zip - name: upload artifact as zip
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: qBittorrent-CI-macOS_x64-static-release_${{ matrix.qbt_gui }} name: qBittorrent-CI_macOS_${{ matrix.qbt_gui }}
path: | path: |
build/compile_commands.json build/compile_commands.json
build/target_graph.dot build/target_graph.dot

14
cmake/Modules/MacroQbtCommonConfig.cmake

@ -59,6 +59,12 @@ macro(qbt_common_config)
endif() endif()
endif() endif()
if ((CXX_COMPILER_ID STREQUAL "Clang") OR (CXX_COMPILER_ID STREQUAL "AppleClang"))
target_compile_options(qbt_common_cfg INTERFACE
-Wno-range-loop-analysis
)
endif()
if (MINGW) if (MINGW)
target_link_options(qbt_common_cfg INTERFACE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:LINKER:--dynamicbase>) target_link_options(qbt_common_cfg INTERFACE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:LINKER:--dynamicbase>)
endif() endif()
@ -70,8 +76,12 @@ macro(qbt_common_config)
endif() endif()
if (MSVC) if (MSVC)
target_compile_options(qbt_common_cfg INTERFACE /guard:cf) target_compile_options(qbt_common_cfg INTERFACE
target_link_options(qbt_common_cfg INTERFACE /guard:cf /guard:cf
/utf-8
)
target_link_options(qbt_common_cfg INTERFACE
/guard:cf
$<$<NOT:$<CONFIG:Debug>>:/OPT:REF /OPT:ICF> $<$<NOT:$<CONFIG:Debug>>:/OPT:REF /OPT:ICF>
# suppress linking warning due to /INCREMENTAL and /OPT:ICF being both ON # suppress linking warning due to /INCREMENTAL and /OPT:ICF being both ON
$<$<CONFIG:RelWithDebInfo>:/INCREMENTAL:NO> $<$<CONFIG:RelWithDebInfo>:/INCREMENTAL:NO>

7
src/base/unicodestrings.h

@ -1,4 +1,4 @@
/* /*
* Bittorrent Client using Qt and libtorrent. * Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2015 Mike Tzou * Copyright (C) 2015 Mike Tzou
* *
@ -28,11 +28,6 @@
#pragma once #pragma once
// This file must be encoded in "UTF-8 with BOM"
#ifdef _MSC_VER
#pragma execution_character_set("utf-8")
#endif
// Because of the poor handling of UTF-8 characters in MSVC (emits warning C4819), // Because of the poor handling of UTF-8 characters in MSVC (emits warning C4819),
// we put all problematic UTF-8 chars/strings in this file. // we put all problematic UTF-8 chars/strings in this file.
// See issue #3059 for more details (https://github.com/qbittorrent/qBittorrent/issues/3059). // See issue #3059 for more details (https://github.com/qbittorrent/qBittorrent/issues/3059).

2
src/gui/addnewtorrentdialog.cpp

@ -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);

4
src/gui/log/logmodel.cpp

@ -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);

8
src/gui/properties/propertieswidget.cpp

@ -319,7 +319,7 @@ void PropertiesWidget::loadTorrentInfos(BitTorrent::Torrent *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())
{ {

2
src/gui/rss/rsswidget.cpp

@ -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>"

6
src/gui/transferlistmodel.cpp

@ -361,9 +361,9 @@ QString TransferListModel::displayValue(const BitTorrent::Torrent *torrent, cons
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::Torrent *torrent, cons
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:

2
src/src.pro

@ -9,6 +9,8 @@ unix:!macx: include(../unixconf.pri)
QT += network xml QT += network xml
macx|*-clang*: QMAKE_CXXFLAGS_WARN_ON += -Wno-range-loop-analysis
nogui { nogui {
TARGET = qbittorrent-nox TARGET = qbittorrent-nox
QT -= gui QT -= gui

2
winconf.pri

@ -40,7 +40,7 @@ win32-g++* {
} }
else:win32-msvc* { else:win32-msvc* {
CONFIG -= embed_manifest_exe CONFIG -= embed_manifest_exe
QMAKE_CXXFLAGS += /std:c++17 QMAKE_CXXFLAGS += /std:c++17 /utf-8
QMAKE_LFLAGS += "/MANIFEST:EMBED /MANIFESTINPUT:$$quote($${PWD}/src/qbittorrent.exe.manifest) /STACK:0x800000" QMAKE_LFLAGS += "/MANIFEST:EMBED /MANIFESTINPUT:$$quote($${PWD}/src/qbittorrent.exe.manifest) /STACK:0x800000"
RC_FILE = qbittorrent.rc RC_FILE = qbittorrent.rc

Loading…
Cancel
Save