diff --git a/CMakeLists.txt b/CMakeLists.txt index a8940c6d7..a943e00fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -169,6 +169,8 @@ if(WITH_QT6) set(QT_VERSION 6.5.0) # API that was deprecated before Qt 5.15 causes a compile error add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x060400) + + set(BUILD_KF5Crash OFF) # TODO: Qt6 else() message(STATUS "Building Calamares with Qt5") set(qtname "Qt5") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a92119d06..0ae829fd4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,13 +14,13 @@ include(CalamaresAddTranslations) add_subdirectory(libcalamares) add_subdirectory(libcalamaresui) -if(NOT WITH_QT6) # TODO: Qt6 # all things qml add_subdirectory(qml/calamares) # application add_subdirectory(calamares) +if(NOT WITH_QT6) # TODO: Qt6 # plugins add_subdirectory(modules) diff --git a/src/calamares/CMakeLists.txt b/src/calamares/CMakeLists.txt index 291297494..db262756e 100644 --- a/src/calamares/CMakeLists.txt +++ b/src/calamares/CMakeLists.txt @@ -38,8 +38,11 @@ calamares_autorcc( calamares_bin ) target_link_libraries( calamares_bin - PRIVATE calamares calamaresui calamares-i18n kdsingleapplication Qt5::Core Qt5::Widgets KF5::CoreAddons + PRIVATE calamares calamaresui calamares-i18n kdsingleapplication ${qtname}::Core ${qtname}::Widgets ) +if(NOT WITH_QT6) # TODO: Qt6 +target_link_libraries(calamares_bin PRIVATE KF5::CoreAddons) +endif() if(BUILD_KF5Crash) target_link_libraries(calamares_bin PRIVATE KF5::Crash) target_compile_definitions(calamares_bin PRIVATE BUILD_KF5Crash) @@ -59,8 +62,8 @@ install( if(BUILD_TESTING) # Don't install, these are just for enable_testing add_executable(loadmodule testmain.cpp) - target_link_libraries(loadmodule PRIVATE Qt5::Core Qt5::Widgets calamares calamaresui) + target_link_libraries(loadmodule PRIVATE ${qtname}::Core ${qtname}::Widgets calamares calamaresui) add_executable(test_conf test_conf.cpp) - target_link_libraries(test_conf PUBLIC yamlcpp::yamlcpp Qt5::Core) + target_link_libraries(test_conf PUBLIC yamlcpp::yamlcpp ${qtname}::Core) endif() diff --git a/src/calamares/CalamaresApplication.cpp b/src/calamares/CalamaresApplication.cpp index 88e8e2919..4495412a7 100644 --- a/src/calamares/CalamaresApplication.cpp +++ b/src/calamares/CalamaresApplication.cpp @@ -30,7 +30,6 @@ #include "utils/Retranslator.h" #include "viewpages/ViewStep.h" -#include #include #include #include diff --git a/src/calamares/CalamaresWindow.cpp b/src/calamares/CalamaresWindow.cpp index e00615bf2..e421de83c 100644 --- a/src/calamares/CalamaresWindow.cpp +++ b/src/calamares/CalamaresWindow.cpp @@ -27,7 +27,9 @@ #include #include #include +#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) #include +#endif #include #include #include @@ -39,6 +41,16 @@ #endif #include +static QSize +desktopSize( QWidget* w ) +{ +#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) + return qApp->desktop()->availableGeometry( w ).size(); +#else + return w->screen()->availableGeometry().size(); +#endif +} + static inline int windowDimensionToPixels( const Calamares::Branding::WindowDimension& u ) { @@ -143,11 +155,9 @@ getWidgetSidebar( Calamares::DebugWindowManager* debug, CalamaresUtils::Original, 2 * QSize( defaultFontHeight, defaultFontHeight ) ) ); CALAMARES_RETRANSLATE_FOR( - aboutDialog, - aboutDialog->setText( - QCoreApplication::translate( "calamares-sidebar", "About" ) ); - aboutDialog->setToolTip( QCoreApplication::translate( "calamares-sidebar", - "Show information about Calamares" ) ); ); + aboutDialog, aboutDialog->setText( QCoreApplication::translate( "calamares-sidebar", "About" ) ); + aboutDialog->setToolTip( + QCoreApplication::translate( "calamares-sidebar", "Show information about Calamares" ) ); ); extraButtons->addWidget( aboutDialog ); aboutDialog->setFlat( true ); aboutDialog->setCheckable( true ); @@ -159,11 +169,10 @@ getWidgetSidebar( Calamares::DebugWindowManager* debug, debugWindowBtn->setObjectName( "debugButton" ); debugWindowBtn->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::Bugs, CalamaresUtils::Original, 2 * QSize( defaultFontHeight, defaultFontHeight ) ) ); - CALAMARES_RETRANSLATE_FOR( debugWindowBtn, - debugWindowBtn->setText( QCoreApplication::translate( - "calamares-sidebar", "Debug" ) ); - debugWindowBtn->setToolTip( QCoreApplication::translate( - "calamares-sidebar", "Show debug information" ) ); ); + CALAMARES_RETRANSLATE_FOR( + debugWindowBtn, debugWindowBtn->setText( QCoreApplication::translate( "calamares-sidebar", "Debug" ) ); + debugWindowBtn->setToolTip( + QCoreApplication::translate( "calamares-sidebar", "Show debug information" ) ); ); extraButtons->addWidget( debugWindowBtn ); debugWindowBtn->setFlat( true ); debugWindowBtn->setCheckable( true ); @@ -409,7 +418,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent ) // Needs to match what's checked in DebugWindow this->setObjectName( "mainApp" ); - QSize availableSize = qApp->desktop()->availableGeometry( this ).size(); + QSize availableSize = desktopSize( this ); QSize minimumSize( qBound( windowMinimumWidth, availableSize.width(), windowPreferredWidth ), qBound( windowMinimumHeight, availableSize.height(), windowPreferredHeight ) ); setMinimumSize( minimumSize ); @@ -507,7 +516,7 @@ void CalamaresWindow::ensureSize( QSize size ) { auto mainGeometry = this->geometry(); - QSize availableSize = qApp->desktop()->availableGeometry( this ).size(); + QSize availableSize = desktopSize( this ); // We only care about vertical sizes that are big enough int embiggenment = qMax( 0, size.height() - m_viewManager->centralWidget()->size().height() );