From caac531de1b4f6ea7f01158a1dbd7f17116be1eb Mon Sep 17 00:00:00 2001 From: Simon De Backer Date: Sat, 3 Oct 2020 09:25:29 +0200 Subject: [PATCH] QT6: Mod QLibraryInfo::location use QLibraryInfo::path --- sources/machine_info.cpp | 49 +++++++++++++++++++++++++++++++++------- sources/qetapp.cpp | 7 ++++++ 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/sources/machine_info.cpp b/sources/machine_info.cpp index 7da28a5a8..fc9c873cc 100644 --- a/sources/machine_info.cpp +++ b/sources/machine_info.cpp @@ -46,9 +46,9 @@ void Machine_info::send_info_to_debug() { qInfo()<<"debugging enabled:" << QLibraryInfo::isDebugBuild(); - qInfo()<< "Qt library version:" << QLibraryInfo::version(); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove qInfo()<< "Qt library location default prefix:" << QLibraryInfo::location(QLibraryInfo::PrefixPath); qInfo()<< "Qt library location documentation:" @@ -77,6 +77,39 @@ void Machine_info::send_info_to_debug() << QLibraryInfo::location(QLibraryInfo::ExamplesPath); qInfo()<< "Qt library location Qt testcases:" << QLibraryInfo::location(QLibraryInfo::TestsPath); +#else +#if TODO_LIST +#pragma message("@TODO remove code for QT 6 or later") +#endif + qInfo()<< "Qt library path default prefix:" + << QLibraryInfo::path(QLibraryInfo::PrefixPath); + qInfo()<< "Qt library path documentation:" + << QLibraryInfo::path(QLibraryInfo::DocumentationPath); + qInfo()<< "Qt library path headers:" + << QLibraryInfo::path(QLibraryInfo::HeadersPath); + qInfo()<< "Qt library path libraries:" + << QLibraryInfo::path(QLibraryInfo::LibrariesPath); + qInfo()<< "Qt library path executables:" + << QLibraryInfo::path(QLibraryInfo::LibraryExecutablesPath); + qInfo()<< "Qt library path Qt binaries:" + << QLibraryInfo::path(QLibraryInfo::BinariesPath); + qInfo()<< "Qt library path Qt plugins:" + << QLibraryInfo::path(QLibraryInfo::PluginsPath); +// qInfo()<< "Qt library path installed QML extensions:" +// << QLibraryInfo::path(QLibraryInfo::ImportsPath); + qInfo()<< "Qt library path installed QML extensions:" + << QLibraryInfo::path(QLibraryInfo::Qml2ImportsPath); + qInfo()<< "Qt library path dependent Qt data:" + << QLibraryInfo::path(QLibraryInfo::ArchDataPath); + qInfo()<< "Qt library path independent Qt data:" + << QLibraryInfo::path(QLibraryInfo::DataPath); + qInfo()<< "Qt library path translation:" + << QLibraryInfo::path(QLibraryInfo::TranslationsPath); + qInfo()<< "Qt library path examples:" + << QLibraryInfo::path(QLibraryInfo::ExamplesPath); + qInfo()<< "Qt library path Qt testcases:" + << QLibraryInfo::path(QLibraryInfo::TestsPath); +#endif #ifndef Q_OS_WIN qInfo()<< "Qt library location Qt settings:" << QLibraryInfo::location(QLibraryInfo::SettingsPath); @@ -224,17 +257,17 @@ void Machine_info::init_get_cpu_info_winnt() QProcess wingpuraminfo; wingpuraminfo.start("wmic", - QStringList() - << "PATH" - << "Win32_videocontroller" - << "get" - << "AdapterRAM "); + QStringList() + << "PATH" + << "Win32_videocontroller" + << "get" + << "AdapterRAM "); wingpuraminfo.waitForFinished(); QString WinGPURAMOutput = wingpuraminfo.readAllStandardOutput(); pc.gpu.RAM=QString("RAM Total : %1 B").arg( WinGPURAMOutput.toLocal8Bit().constData()); wingpuraminfo.close(); - + #ifdef Q_OS_WIN MEMORYSTATUSEX memory_status; ZeroMemory(&memory_status, sizeof(MEMORYSTATUSEX)); @@ -266,7 +299,7 @@ void Machine_info::init_get_cpu_info_macos() macoscpuinfo.waitForFinished(); QString macosOutput = macoscpuinfo.readAllStandardOutput(); pc.cpu.info=QString(macosOutput.toLocal8Bit().constData()); - + QProcess macosraminfo; macosraminfo.start("bash", QStringList() diff --git a/sources/qetapp.cpp b/sources/qetapp.cpp index 03f3360b5..ded7ddade 100644 --- a/sources/qetapp.cpp +++ b/sources/qetapp.cpp @@ -167,7 +167,14 @@ void QETApp::setLanguage(const QString &desired_language) { QString languages_path = languagesPath(); // load Qt library translations +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove QString qt_l10n_path = QLibraryInfo::location(QLibraryInfo::TranslationsPath); +#else +#if TODO_LIST +#pragma message("@TODO remove code for QT 6 or later") +#endif + QString qt_l10n_path = QLibraryInfo::path(QLibraryInfo::TranslationsPath); +#endif if (!qtTranslator.load("qt_" + desired_language, qt_l10n_path)) { qtTranslator.load("qt_" + desired_language, languages_path); }