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
add_subdirectory(libcalamares)
if(NOT WITH_QT6) # TODO: Qt6
add_subdirectory(libcalamaresui)
if(NOT WITH_QT6) # TODO: Qt6
# all things qml
add_subdirectory(qml/calamares)

View File

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

View File

@ -12,6 +12,7 @@
#include "Branding.h"
#include "ViewManager.h"
#include "compat/Variant.h"
#include "utils/Dirs.h"
#include "utils/Logger.h"
#include "utils/NamedEnum.h"
@ -52,7 +53,8 @@ changeQMLState( QMLAction action, QQuickItem* item )
CalamaresUtils::callQmlFunction( item, activate ? "onActivate" : "onLeave" );
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 );
}

View File

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