Browse Source

Merge pull request #15567 from Chocobo1/qt6

Fix Qt6 compiling issues
adaptive-webui-19844
Chocobo1 3 years ago committed by GitHub
parent
commit
cd3635985e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/app/application.cpp
  2. 2
      src/app/main.cpp
  3. 3
      src/base/bittorrent/bencoderesumedatastorage.cpp
  4. 2
      src/base/bittorrent/session.cpp
  5. 7
      src/gui/addnewtorrentdialog.ui
  6. 2
      src/gui/properties/piecesbar.cpp
  7. 28
      src/gui/properties/propertieswidget.cpp
  8. 2
      src/src.pro

2
src/app/application.cpp

@ -141,7 +141,9 @@ Application::Application(int &argc, char **argv) @@ -141,7 +141,9 @@ Application::Application(int &argc, char **argv)
setOrganizationDomain("qbittorrent.org");
#if !defined(DISABLE_GUI)
setDesktopFileName("org.qbittorrent.qBittorrent");
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
setAttribute(Qt::AA_UseHighDpiPixmaps, true); // opt-in to the high DPI pixmap support
#endif
setQuitOnLastWindowClosed(false);
QPixmapCache::setCacheLimit(PIXMAP_CACHE_SIZE);
#endif

2
src/app/main.cpp

@ -134,7 +134,7 @@ int main(int argc, char *argv[]) @@ -134,7 +134,7 @@ int main(int argc, char *argv[])
// We must save it here because QApplication constructor may change it
bool isOneArg = (argc == 2);
#if !defined(DISABLE_GUI)
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && !defined(DISABLE_GUI)
// Attribute Qt::AA_EnableHighDpiScaling must be set before QCoreApplication is created
if (qgetenv("QT_ENABLE_HIGHDPI_SCALING").isEmpty() && qgetenv("QT_AUTO_SCREEN_SCALE_FACTOR").isEmpty())
Application::setAttribute(Qt::AA_EnableHighDpiScaling, true);

3
src/base/bittorrent/bencoderesumedatastorage.cpp

@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
#include <libtorrent/write_resume_data.hpp>
#include <QByteArray>
#include <QDebug>
#include <QRegularExpression>
#include <QThread>
@ -113,7 +114,7 @@ BitTorrent::BencodeResumeDataStorage::BencodeResumeDataStorage(const QString &pa @@ -113,7 +114,7 @@ BitTorrent::BencodeResumeDataStorage::BencodeResumeDataStorage(const QString &pa
loadQueue(m_resumeDataDir.absoluteFilePath(QLatin1String("queue")));
qDebug("Registered torrents count: %d", m_registeredTorrents.size());
qDebug() << "Registered torrents count: " << m_registeredTorrents.size();
m_asyncWorker->moveToThread(m_ioThread);
connect(m_ioThread, &QThread::finished, m_asyncWorker, &QObject::deleteLater);

2
src/base/bittorrent/session.cpp

@ -2523,7 +2523,7 @@ QStringList Session::getListeningIPs() const @@ -2523,7 +2523,7 @@ QStringList Session::getListeningIPs() const
}
const QList<QNetworkAddressEntry> addresses = networkIFace.addressEntries();
qDebug("This network interface has %d IP addresses", addresses.size());
qDebug() << "This network interface has " << addresses.size() << " IP addresses";
for (const QNetworkAddressEntry &entry : addresses)
checkAndAddIP(entry.ip(), configuredAddr);

7
src/gui/addnewtorrentdialog.ui

@ -326,9 +326,6 @@ @@ -326,9 +326,6 @@
</item>
<item row="2" column="1">
<widget class="QLabel" name="labelInfohash1Data">
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::TextSelectableByMouse</set>
</property>
@ -350,8 +347,8 @@ @@ -350,8 +347,8 @@
</item>
<item row="3" column="1">
<widget class="QLabel" name="labelInfohash2Data">
<property name="text">
<string/>
<property name="textInteractionFlags">
<set>Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>

2
src/gui/properties/piecesbar.cpp

@ -186,7 +186,7 @@ void PiecesBar::paintEvent(QPaintEvent *) @@ -186,7 +186,7 @@ void PiecesBar::paintEvent(QPaintEvent *)
if (!m_highlightedRegion.isNull())
{
QColor highlightColor {this->palette().color(QPalette::Active, QPalette::Highlight)};
highlightColor.setAlphaF(0.35);
highlightColor.setAlphaF(0.35f);
QRect targetHighlightRect {m_highlightedRegion.adjusted(borderWidth, borderWidth, borderWidth, height() - 2 * borderWidth)};
painter.fillRect(targetHighlightRect, highlightColor);
}

28
src/gui/properties/propertieswidget.cpp

@ -412,7 +412,7 @@ void PropertiesWidget::saveSettings() @@ -412,7 +412,7 @@ void PropertiesWidget::saveSettings()
sizes = hSplitter->sizes();
else
sizes = m_slideSizes;
qDebug("Sizes: %d", sizes.size());
if (sizes.size() == 2)
pref->setPropSplitterSizes(QString::number(sizes.first()) + ',' + QString::number(sizes.last()));
pref->setPropFileListState(m_ui->filesList->header()->saveState());
@ -752,21 +752,31 @@ void PropertiesWidget::configure() @@ -752,21 +752,31 @@ void PropertiesWidget::configure()
// Speed widget
if (Preferences::instance()->isSpeedWidgetEnabled())
{
if (!m_speedWidget || !qobject_cast<SpeedWidget *>(m_speedWidget))
if (!qobject_cast<SpeedWidget *>(m_speedWidget))
{
m_ui->speedLayout->removeWidget(m_speedWidget);
delete m_speedWidget;
m_speedWidget = new SpeedWidget {this};
if (m_speedWidget)
{
m_ui->speedLayout->removeWidget(m_speedWidget);
delete m_speedWidget;
}
m_speedWidget = new SpeedWidget(this);
m_ui->speedLayout->addWidget(m_speedWidget);
}
}
else
{
if (!m_speedWidget || !qobject_cast<QLabel *>(m_speedWidget))
if (!qobject_cast<QLabel *>(m_speedWidget))
{
m_ui->speedLayout->removeWidget(m_speedWidget);
delete m_speedWidget;
auto *label = new QLabel(tr("<center><b>Speed graphs are disabled</b><p>You may change this setting in Advanced Options </center>"), this);
if (m_speedWidget)
{
m_ui->speedLayout->removeWidget(m_speedWidget);
delete m_speedWidget;
}
const auto displayText = QString::fromLatin1("<center><b>%1</b><p>%2</p></center>")
.arg(tr("Speed graphs are disabled"), tr("You can enable it in Advanced Options"));
auto *label = new QLabel(displayText, this);
label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
m_speedWidget = label;
m_ui->speedLayout->addWidget(m_speedWidget);

2
src/src.pro

@ -23,7 +23,7 @@ nogui { @@ -23,7 +23,7 @@ nogui {
DEFINES += QBT_STATIC_QT
QTPLUGIN += qico
}
win32: lessThan(QT_VERSION_MAJOR, 6) {
win32: lessThan(QT_MAJOR_VERSION, 6) {
QT += winextras
}
macx {

Loading…
Cancel
Save