libcalamaresui: enable build for Qt6

Compatibility code for mutex and variant is already in place.
This commit is contained in:
Adriaan de Groot 2023-09-03 21:36:13 +02:00
parent bc9d5aae58
commit 159eccbda0
4 changed files with 16 additions and 11 deletions

View File

@ -12,10 +12,9 @@ include(CalamaresAddTranslations)
# library # library
add_subdirectory(libcalamares) add_subdirectory(libcalamares)
if(NOT WITH_QT6) # TODO: Qt6
add_subdirectory(libcalamaresui) add_subdirectory(libcalamaresui)
if(NOT WITH_QT6) # TODO: Qt6
# all things qml # all things qml
add_subdirectory(qml/calamares) add_subdirectory(qml/calamares)

View File

@ -47,7 +47,7 @@ calamares_add_library(calamaresui
SOURCES ${calamaresui_SOURCES} SOURCES ${calamaresui_SOURCES}
EXPORT_MACRO UIDLLEXPORT_PRO EXPORT_MACRO UIDLLEXPORT_PRO
LINK_LIBRARIES LINK_LIBRARIES
Qt5::Svg ${qtname}::Svg
RESOURCES libcalamaresui.qrc RESOURCES libcalamaresui.qrc
EXPORT Calamares EXPORT Calamares
UI UI
@ -56,12 +56,14 @@ calamares_add_library(calamaresui
SOVERSION ${CALAMARES_SOVERSION} SOVERSION ${CALAMARES_SOVERSION}
) )
target_link_libraries(calamaresui PRIVATE yamlcpp::yamlcpp) target_link_libraries(calamaresui PRIVATE yamlcpp::yamlcpp)
if(NOT WITH_QT6) # TODO: Qt6
if(KF5CoreAddons_FOUND AND KF5CoreAddons_VERSION VERSION_GREATER_EQUAL 5.58) if(KF5CoreAddons_FOUND AND KF5CoreAddons_VERSION VERSION_GREATER_EQUAL 5.58)
target_compile_definitions(calamaresui PRIVATE WITH_KOSRelease) target_compile_definitions(calamaresui PRIVATE WITH_KOSRelease)
target_link_libraries(calamaresui PRIVATE KF5::CoreAddons) target_link_libraries(calamaresui PRIVATE KF5::CoreAddons)
endif() endif()
endif()
if(WITH_QML) if(WITH_QML)
target_link_libraries(calamaresui PUBLIC Qt5::QuickWidgets) target_link_libraries(calamaresui PUBLIC ${qtname}::QuickWidgets)
endif() endif()
add_library(Calamares::calamaresui ALIAS calamaresui) add_library(Calamares::calamaresui ALIAS calamaresui)

View File

@ -12,6 +12,7 @@
#include "Branding.h" #include "Branding.h"
#include "ViewManager.h" #include "ViewManager.h"
#include "compat/Variant.h"
#include "utils/Dirs.h" #include "utils/Dirs.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/NamedEnum.h" #include "utils/NamedEnum.h"
@ -52,7 +53,8 @@ changeQMLState( QMLAction action, QQuickItem* item )
CalamaresUtils::callQmlFunction( item, activate ? "onActivate" : "onLeave" ); CalamaresUtils::callQmlFunction( item, activate ? "onActivate" : "onLeave" );
auto property = item->property( propertyName ); auto property = item->property( propertyName );
if ( property.isValid() && ( property.type() == QVariant::Bool ) && ( property.toBool() != activate ) ) if ( property.isValid() && ( Calamares::typeOf( property ) == Calamares::BoolVariantType )
&& ( property.toBool() != activate ) )
{ {
item->setProperty( propertyName, activate ); item->setProperty( propertyName, activate );
} }

View File

@ -12,6 +12,8 @@
#include "Slideshow.h" #include "Slideshow.h"
#include "Branding.h" #include "Branding.h"
#include "compat/Mutex.h"
#include "compat/Variant.h"
#include "utils/Dirs.h" #include "utils/Dirs.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#ifdef WITH_QML #ifdef WITH_QML
@ -79,7 +81,7 @@ SlideshowQML::widget()
void void
SlideshowQML::loadQmlV2() SlideshowQML::loadQmlV2()
{ {
QMutexLocker l( &m_mutex ); Calamares::MutexLocker l( &m_mutex );
if ( !m_qmlComponent && !Calamares::Branding::instance()->slideshowPath().isEmpty() ) if ( !m_qmlComponent && !Calamares::Branding::instance()->slideshowPath().isEmpty() )
{ {
m_qmlComponent = new QQmlComponent( m_qmlShow->engine(), m_qmlComponent = new QQmlComponent( m_qmlShow->engine(),
@ -92,7 +94,7 @@ SlideshowQML::loadQmlV2()
void void
SlideshowQML::loadQmlV2Complete() SlideshowQML::loadQmlV2Complete()
{ {
QMutexLocker l( &m_mutex ); Calamares::MutexLocker l( &m_mutex );
if ( m_qmlComponent && m_qmlComponent->isReady() && !m_qmlObject ) if ( m_qmlComponent && m_qmlComponent->isReady() && !m_qmlObject )
{ {
cDebug() << "QML component complete, API 2"; cDebug() << "QML component complete, API 2";
@ -158,7 +160,7 @@ SlideshowQML::startSlideShow()
void void
SlideshowQML::changeSlideShowState( Action state ) SlideshowQML::changeSlideShowState( Action state )
{ {
QMutexLocker l( &m_mutex ); Calamares::MutexLocker l( &m_mutex );
bool activate = state == Slideshow::Start; bool activate = state == Slideshow::Start;
if ( Branding::instance()->slideshowAPI() == 2 ) if ( Branding::instance()->slideshowAPI() == 2 )
@ -182,7 +184,7 @@ SlideshowQML::changeSlideShowState( Action state )
{ {
static const char propertyName[] = "activatedInCalamares"; static const char propertyName[] = "activatedInCalamares";
auto property = m_qmlObject->property( propertyName ); auto property = m_qmlObject->property( propertyName );
if ( property.isValid() && ( property.type() == QVariant::Bool ) && ( property.toBool() != activate ) ) if ( property.isValid() && ( Calamares::typeOf( property ) == Calamares::BoolVariantType ) && ( property.toBool() != activate ) )
{ {
m_qmlObject->setProperty( propertyName, activate ); m_qmlObject->setProperty( propertyName, activate );
} }
@ -228,7 +230,7 @@ SlideshowPictures::widget()
void void
SlideshowPictures::changeSlideShowState( Calamares::Slideshow::Action a ) SlideshowPictures::changeSlideShowState( Calamares::Slideshow::Action a )
{ {
QMutexLocker l( &m_mutex ); Calamares::MutexLocker l( &m_mutex );
m_state = a; m_state = a;
if ( a == Slideshow::Start ) if ( a == Slideshow::Start )
{ {
@ -253,7 +255,7 @@ SlideshowPictures::changeSlideShowState( Calamares::Slideshow::Action a )
void void
SlideshowPictures::next() SlideshowPictures::next()
{ {
QMutexLocker l( &m_mutex ); Calamares::MutexLocker l( &m_mutex );
if ( m_imageIndex < 0 ) if ( m_imageIndex < 0 )
{ {