Drop support of Qt 5

Also remove usage of some deprecated stuff.

PR #19338.
This commit is contained in:
Vladimir Golovnev
2023-07-20 11:17:27 +03:00
committed by GitHub
parent 5e610cfdcf
commit dbe79484d2
55 changed files with 48 additions and 462 deletions

View File

@@ -248,9 +248,6 @@ Application::Application(int &argc, char **argv)
setOrganizationDomain(u"qbittorrent.org"_s);
#if !defined(DISABLE_GUI)
setDesktopFileName(u"org.qbittorrent.qBittorrent"_s);
#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
@@ -1037,11 +1034,15 @@ void Application::initializeTranslation()
// Load translation
const QString localeStr = pref->getLocale();
if (m_qtTranslator.load((u"qtbase_" + localeStr), QLibraryInfo::location(QLibraryInfo::TranslationsPath)) ||
m_qtTranslator.load((u"qt_" + localeStr), QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
qDebug("Qt %s locale recognized, using translation.", qUtf8Printable(localeStr));
if (m_qtTranslator.load((u"qtbase_" + localeStr), QLibraryInfo::path(QLibraryInfo::TranslationsPath))
|| m_qtTranslator.load((u"qt_" + localeStr), QLibraryInfo::path(QLibraryInfo::TranslationsPath)))
{
qDebug("Qt %s locale recognized, using translation.", qUtf8Printable(localeStr));
}
else
{
qDebug("Qt %s locale unrecognized, using default (en).", qUtf8Printable(localeStr));
}
installTranslator(&m_qtTranslator);

View File

@@ -127,9 +127,6 @@ void FileLogger::addLogMessage(const Log::Msg &msg)
if (!m_logFile.isOpen()) return;
QTextStream stream(&m_logFile);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
stream.setCodec("UTF-8");
#endif
switch (msg.type)
{

View File

@@ -105,15 +105,6 @@ int main(int argc, char *argv[])
// We must save it here because QApplication constructor may change it
bool isOneArg = (argc == 2);
#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);
// HighDPI scale factor policy must be set before QGuiApplication is created
if (qgetenv("QT_SCALE_FACTOR_ROUNDING_POLICY").isEmpty())
Application::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
#endif
try
{
// Create Application
@@ -212,10 +203,6 @@ int main(int argc, char *argv[])
// 3. https://bugreports.qt.io/browse/QTBUG-46015
qputenv("QT_BEARER_POLL_TIMEOUT", QByteArray::number(-1));
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && !defined(DISABLE_GUI)
// this is the default in Qt6
app->setAttribute(Qt::AA_DisableWindowContextHelpButton);
#endif
#endif // Q_OS_WIN
#ifdef Q_OS_MACOS