rbutil: Qt6 fixes.

Change-Id: Ied6bdf1c5269b53ccfedc1d80f3f3f0d6b4011da
This commit is contained in:
Dominik Riebeling 2022-03-23 19:28:55 +01:00
parent 948637c42c
commit 00ec195c26
4 changed files with 22 additions and 6 deletions

View file

@ -48,13 +48,15 @@ enable_testing()
# Qt
find_package(QT NAMES Qt6 Qt5 REQUIRED)
if(QT_VERSION_MAJOR EQUAL 5)
find_package(Qt5 COMPONENTS Core Widgets Svg Multimedia Network Test LinguistTools REQUIRED)
find_package(Qt5 REQUIRED COMPONENTS
Core Widgets Svg Multimedia Network Test LinguistTools)
else()
find_package(Qt6 REQUIRED COMPONENTS Core Core5Compat Widgets Svg Multimedia Network LinguistTools
find_package(Qt6 REQUIRED COMPONENTS
Core Core5Compat Widgets Svg Multimedia Network LinguistTools SvgWidgets
OPTIONAL_COMPONENTS Test)
endif()
get_target_property(_qmake_executable Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION)
get_filename_component(QT_BINDIR "${_qmake_executable}" DIRECTORY)
get_target_property(_moc_executable Qt${QT_VERSION_MAJOR}::moc IMPORTED_LOCATION)
get_filename_component(QT_BINDIR "${_moc_executable}" DIRECTORY)
message("-- Found Qt${QT_VERSION_MAJOR}: ${Qt${QT_VERSION_MAJOR}_DIR}")
# If we're on Linux, try to find the used libs in the system.

View file

@ -125,6 +125,9 @@ endif()
target_link_libraries(RockboxUtility rbbase cutelogger gitversion
Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Multimedia
Qt${QT_VERSION_MAJOR}::Svg)
if(QT_VERSION_MAJOR EQUAL 6)
target_link_libraries(RockboxUtility Qt${QT_VERSION_MAJOR}::SvgWidgets)
endif()
target_include_directories(RockboxUtility PRIVATE
${CMAKE_CURRENT_LIST_DIR}/gui

View file

@ -39,7 +39,7 @@ Q_IMPORT_PLUGIN(AccessibleFactory)
int main( int argc, char ** argv ) {
#if QT_VERSION >= 0x050600
#if QT_VERSION >= 0x050600 && QT_VERSION < 0x060000
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
@ -83,7 +83,12 @@ int main( int argc, char ** argv ) {
if(!translator.load("rbutil_" + applang, absolutePath))
translator.load("rbutil_" + applang, ":/lang");
if(!qttrans.load("qt_" + applang,
QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
#if QT_VERSION >= 0x060000
QLibraryInfo::path(QLibraryInfo::TranslationsPath)
#else
QLibraryInfo::location(QLibraryInfo::TranslationsPath)
#endif
))
qttrans.load("qt_" + applang, ":/lang");
QLocale::setDefault(QLocale(applang));

View file

@ -109,7 +109,9 @@ void ThemesInstallWindow::downloadDone(QNetworkReply::NetworkError error)
themesInfo.open();
QSettings iniDetails(themesInfo.fileName(), QSettings::IniFormat, this);
#if QT_VERSION < 0x060000
iniDetails.setIniCodec(QTextCodec::codecForName("UTF-8"));
#endif
QStringList tl = iniDetails.childGroups();
LOG_INFO() << "Theme site result:"
<< iniDetails.value("error/code").toString()
@ -183,7 +185,9 @@ void ThemesInstallWindow::updateSize(void)
long size = 0;
// sum up size for all selected themes
QSettings iniDetails(themesInfo.fileName(), QSettings::IniFormat, this);
#if QT_VERSION < 0x060000
iniDetails.setIniCodec(QTextCodec::codecForName("UTF-8"));
#endif
int items = ui.listThemes->selectedItems().size();
for(int i = 0; i < items; i++) {
iniDetails.beginGroup(ui.listThemes->selectedItems()
@ -202,7 +206,9 @@ void ThemesInstallWindow::updateDetails(QListWidgetItem* cur, QListWidgetItem* p
return;
QSettings iniDetails(themesInfo.fileName(), QSettings::IniFormat, this);
#if QT_VERSION < 0x060000
iniDetails.setIniCodec(QTextCodec::codecForName("UTF-8"));
#endif
QCoreApplication::processEvents();
ui.themeDescription->setText(tr("fetching details for %1")