Merge branch 'work/qt6' into calamares
This commit is contained in:
commit
8f836969eb
2
3rdparty/kdsingleapplication/CMakeLists.txt
vendored
2
3rdparty/kdsingleapplication/CMakeLists.txt
vendored
@ -23,4 +23,4 @@ target_include_directories(
|
|||||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(kdsingleapplication Qt5::Core Qt5::Network)
|
target_link_libraries(kdsingleapplication ${qtname}::Core ${qtname}::Network)
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
include(CMakeFindDependencyMacro)
|
|
||||||
|
|
||||||
find_dependency(Qt5Widgets REQUIRED)
|
|
||||||
find_dependency(Qt5Network REQUIRED)
|
|
||||||
|
|
||||||
# Add the targets file
|
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/KDSingleApplicationTargets.cmake")
|
|
@ -19,7 +19,8 @@
|
|||||||
#
|
#
|
||||||
# SKIP_MODULES : a space or semicolon-separated list of directory names
|
# SKIP_MODULES : a space or semicolon-separated list of directory names
|
||||||
# under src/modules that should not be built.
|
# under src/modules that should not be built.
|
||||||
# USE_<foo> : fills in SKIP_MODULES for modules called <foo>-<something>
|
# USE_<foo> : fills in SKIP_MODULES for modules called <foo>-<something>.
|
||||||
|
# WITH_QT6 : use Qt6, rather than Qt5 (default to OFF).
|
||||||
# WITH_<foo> : try to enable <foo> (these usually default to ON). For
|
# WITH_<foo> : try to enable <foo> (these usually default to ON). For
|
||||||
# a list of WITH_<foo> grep CMakeCache.txt after running
|
# a list of WITH_<foo> grep CMakeCache.txt after running
|
||||||
# CMake once. These affect the ABI offered by Calamares.
|
# CMake once. These affect the ABI offered by Calamares.
|
||||||
@ -32,14 +33,14 @@
|
|||||||
# - TESTING (standard CMake option)
|
# - TESTING (standard CMake option)
|
||||||
# - SCHEMA_TESTING (requires Python, see ci/configvalidator.py)
|
# - SCHEMA_TESTING (requires Python, see ci/configvalidator.py)
|
||||||
# - KF5Crash (uses KCrash, rather than Calamares internal, for crash reporting)
|
# - KF5Crash (uses KCrash, rather than Calamares internal, for crash reporting)
|
||||||
# DEBUG_<foo> : special developer flags for debugging
|
# DEBUG_<foo> : special developer flags for debugging.
|
||||||
#
|
#
|
||||||
# Example usage:
|
# Example usage:
|
||||||
#
|
#
|
||||||
# cmake . -DSKIP_MODULES="partition luksbootkeycfg"
|
# cmake . -DSKIP_MODULES="partition luksbootkeycfg"
|
||||||
#
|
#
|
||||||
# One special target is "show-version", which can be built
|
# To obtain the version number of calamares, run CMake in script mode, e.g.
|
||||||
# to obtain the version number from here.
|
# cmake -P CMakeLists.txt
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
|
||||||
|
|
||||||
@ -79,6 +80,7 @@ option(INSTALL_COMPLETION "Install shell completions" OFF)
|
|||||||
# also update libcalamares/CalamaresConfig.h.in
|
# also update libcalamares/CalamaresConfig.h.in
|
||||||
option(WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON)
|
option(WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON)
|
||||||
option(WITH_QML "Enable QML UI options." ON)
|
option(WITH_QML "Enable QML UI options." ON)
|
||||||
|
option(WITH_QT6 "Use Qt6 instead of Qt5" OFF)
|
||||||
#
|
#
|
||||||
# Additional parts to build that do not affect ABI
|
# Additional parts to build that do not affect ABI
|
||||||
option(BUILD_SCHEMA_TESTING "Enable schema-validation-tests" ON)
|
option(BUILD_SCHEMA_TESTING "Enable schema-validation-tests" ON)
|
||||||
@ -161,11 +163,26 @@ set( _tx_incomplete eo es_PR gu ie ja-Hira kk kn lo lv mk ne_NP
|
|||||||
### Required versions
|
### Required versions
|
||||||
#
|
#
|
||||||
# See DEPENDENCIES section below.
|
# See DEPENDENCIES section below.
|
||||||
set(QT_VERSION 5.15.0)
|
if(WITH_QT6)
|
||||||
set(YAMLCPP_VERSION 0.5.1)
|
message(STATUS "Building Calamares with Qt6")
|
||||||
set(ECM_VERSION 5.58)
|
set(qtname "Qt6")
|
||||||
set(PYTHONLIBS_VERSION 3.6)
|
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")
|
||||||
|
set(QT_VERSION 5.15.0)
|
||||||
|
# API that was deprecated before Qt 5.15 causes a compile error
|
||||||
|
add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x050f00)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(BOOSTPYTHON_VERSION 1.72.0)
|
set(BOOSTPYTHON_VERSION 1.72.0)
|
||||||
|
set(ECM_VERSION 5.100)
|
||||||
|
set(PYTHONLIBS_VERSION 3.6)
|
||||||
|
set(YAMLCPP_VERSION 0.5.1)
|
||||||
|
|
||||||
### CMAKE SETUP
|
### CMAKE SETUP
|
||||||
#
|
#
|
||||||
@ -287,30 +304,27 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# API that was deprecated before Qt 5.15 causes a compile error
|
|
||||||
add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x050f00)
|
|
||||||
|
|
||||||
### DEPENDENCIES
|
### DEPENDENCIES
|
||||||
#
|
#
|
||||||
find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED Concurrent Core DBus Gui LinguistTools Network Svg Widgets)
|
find_package(${qtname} ${QT_VERSION} CONFIG REQUIRED Concurrent Core DBus Gui LinguistTools Network Svg Widgets)
|
||||||
if(WITH_QML)
|
if(WITH_QML)
|
||||||
find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED Quick QuickWidgets)
|
find_package(${qtname} ${QT_VERSION} CONFIG REQUIRED Quick QuickWidgets)
|
||||||
endif()
|
endif()
|
||||||
# Note that some modules need more Qt modules, optionally.
|
# Note that some modules need more Qt modules, optionally.
|
||||||
|
|
||||||
find_package(YAMLCPP ${YAMLCPP_VERSION} REQUIRED)
|
find_package(YAMLCPP ${YAMLCPP_VERSION} REQUIRED)
|
||||||
if(INSTALL_POLKIT)
|
if(INSTALL_POLKIT)
|
||||||
find_package(PolkitQt5-1 REQUIRED)
|
find_package(Polkit${qtname}-1 REQUIRED)
|
||||||
else()
|
else()
|
||||||
# Find it anyway, for dependencies-reporting
|
# Find it anyway, for dependencies-reporting
|
||||||
find_package(PolkitQt5-1)
|
find_package(Polkit${qtname}-1)
|
||||||
endif()
|
endif()
|
||||||
set_package_properties(
|
set_package_properties(
|
||||||
PolkitQt5-1
|
Polkit${qtname}-1
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
DESCRIPTION "Qt5 support for Polkit"
|
DESCRIPTION "${qtname} support for Polkit"
|
||||||
URL "https://cgit.kde.org/polkit-qt-1.git"
|
URL "https://cgit.kde.org/polkit-qt-1.git"
|
||||||
PURPOSE "PolkitQt5-1 helps with installing Polkit configuration"
|
PURPOSE "Polkit${qtname}-1 helps with installing Polkit configuration"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Find ECM once, and add it to the module search path; Calamares
|
# Find ECM once, and add it to the module search path; Calamares
|
||||||
@ -322,7 +336,7 @@ if(ECM_FOUND)
|
|||||||
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH})
|
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH})
|
||||||
if(BUILD_TESTING)
|
if(BUILD_TESTING)
|
||||||
# ECM implies that we can build the tests, too
|
# ECM implies that we can build the tests, too
|
||||||
find_package(Qt5 COMPONENTS Test REQUIRED)
|
find_package(${qtname} COMPONENTS Test REQUIRED)
|
||||||
include(ECMAddTests)
|
include(ECMAddTests)
|
||||||
endif()
|
endif()
|
||||||
include(KDEInstallDirs)
|
include(KDEInstallDirs)
|
||||||
@ -409,6 +423,7 @@ endif()
|
|||||||
# when building out-of-tree.
|
# when building out-of-tree.
|
||||||
set(Calamares_WITH_PYTHON ${WITH_PYTHON})
|
set(Calamares_WITH_PYTHON ${WITH_PYTHON})
|
||||||
set(Calamares_WITH_QML ${WITH_QML})
|
set(Calamares_WITH_QML ${WITH_QML})
|
||||||
|
set(Calamares_WITH_QT6 ${WITH_QT6})
|
||||||
|
|
||||||
### Transifex Translation status
|
### Transifex Translation status
|
||||||
#
|
#
|
||||||
@ -625,7 +640,9 @@ endif()
|
|||||||
|
|
||||||
### CMAKE SUMMARY REPORT
|
### CMAKE SUMMARY REPORT
|
||||||
#
|
#
|
||||||
|
if(NOT WITH_QT6) # TODO: Qt6
|
||||||
get_directory_property(SKIPPED_MODULES DIRECTORY src/modules DEFINITION LIST_SKIPPED_MODULES)
|
get_directory_property(SKIPPED_MODULES DIRECTORY src/modules DEFINITION LIST_SKIPPED_MODULES)
|
||||||
|
endif()
|
||||||
calamares_explain_skipped_modules( ${SKIPPED_MODULES} )
|
calamares_explain_skipped_modules( ${SKIPPED_MODULES} )
|
||||||
|
|
||||||
feature_summary(WHAT DISABLED_FEATURES DESCRIPTION "The following features have been disabled:" QUIET_ON_EMPTY)
|
feature_summary(WHAT DISABLED_FEATURES DESCRIPTION "The following features have been disabled:" QUIET_ON_EMPTY)
|
||||||
|
@ -101,7 +101,7 @@ function( calamares_add_branding_translations NAME )
|
|||||||
|
|
||||||
file( GLOB BRANDING_TRANSLATION_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${SUBDIRECTORY}/lang/calamares-${NAME}_*.ts" )
|
file( GLOB BRANDING_TRANSLATION_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${SUBDIRECTORY}/lang/calamares-${NAME}_*.ts" )
|
||||||
if ( BRANDING_TRANSLATION_FILES )
|
if ( BRANDING_TRANSLATION_FILES )
|
||||||
qt5_add_translation( QM_FILES ${BRANDING_TRANSLATION_FILES} )
|
qt_add_translation( QM_FILES ${BRANDING_TRANSLATION_FILES} )
|
||||||
add_custom_target( branding-translation-${NAME} ALL DEPENDS ${QM_FILES}
|
add_custom_target( branding-translation-${NAME} ALL DEPENDS ${QM_FILES}
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/lang/
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/lang/
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${QM_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/lang/
|
COMMAND ${CMAKE_COMMAND} -E copy ${QM_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/lang/
|
||||||
|
@ -86,9 +86,9 @@ function(calamares_add_library)
|
|||||||
# add link targets
|
# add link targets
|
||||||
target_link_libraries(${target}
|
target_link_libraries(${target}
|
||||||
LINK_PUBLIC ${Calamares_LIBRARIES}
|
LINK_PUBLIC ${Calamares_LIBRARIES}
|
||||||
Qt5::Core
|
${qtname}::Core
|
||||||
Qt5::Gui
|
${qtname}::Gui
|
||||||
Qt5::Widgets
|
${qtname}::Widgets
|
||||||
)
|
)
|
||||||
if(LIBRARY_LINK_LIBRARIES)
|
if(LIBRARY_LINK_LIBRARIES)
|
||||||
target_link_libraries(${target} LINK_PUBLIC ${LIBRARY_LINK_LIBRARIES})
|
target_link_libraries(${target} LINK_PUBLIC ${LIBRARY_LINK_LIBRARIES})
|
||||||
|
@ -36,8 +36,8 @@ function(calamares_add_test name)
|
|||||||
LINK_LIBRARIES
|
LINK_LIBRARIES
|
||||||
Calamares::calamares
|
Calamares::calamares
|
||||||
${TEST_LIBRARIES}
|
${TEST_LIBRARIES}
|
||||||
Qt5::Core
|
${qtname}::Core
|
||||||
Qt5::Test
|
${qtname}::Test
|
||||||
)
|
)
|
||||||
calamares_automoc( ${TEST_NAME} )
|
calamares_automoc( ${TEST_NAME} )
|
||||||
# We specifically pass in the source directory of the test-being-
|
# We specifically pass in the source directory of the test-being-
|
||||||
@ -47,7 +47,7 @@ function(calamares_add_test name)
|
|||||||
PRIVATE -DBUILD_AS_TEST="${CMAKE_CURRENT_SOURCE_DIR}" ${TEST_DEFINITIONS}
|
PRIVATE -DBUILD_AS_TEST="${CMAKE_CURRENT_SOURCE_DIR}" ${TEST_DEFINITIONS}
|
||||||
)
|
)
|
||||||
if(TEST_GUI)
|
if(TEST_GUI)
|
||||||
target_link_libraries(${TEST_NAME} Calamares::calamaresui Qt5::Gui)
|
target_link_libraries(${TEST_NAME} Calamares::calamaresui ${qtname}::Gui)
|
||||||
endif()
|
endif()
|
||||||
if(TEST_RESOURCES)
|
if(TEST_RESOURCES)
|
||||||
calamares_autorcc( ${TEST_NAME} ${TEST_RESOURCES} )
|
calamares_autorcc( ${TEST_NAME} ${TEST_RESOURCES} )
|
||||||
|
@ -46,11 +46,18 @@ macro(accumulate_deps outvar target namespace)
|
|||||||
endforeach()
|
endforeach()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# Qt5 infrastructure for translations is required
|
set(Calamares_WITH_QT6 @WITH_QT6@)
|
||||||
set(qt5_required Core Widgets LinguistTools)
|
if(Calamares_WITH_QT6)
|
||||||
accumulate_deps(qt5_required Calamares::calamares Qt5::)
|
set(qtname "Qt6")
|
||||||
accumulate_deps(qt5_required Calamares::calamaresui Qt5::)
|
else()
|
||||||
find_package(Qt5 CONFIG REQUIRED ${qt5_required})
|
set(qtname "Qt5")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Qt infrastructure for translations is required
|
||||||
|
set(qt_required Core Widgets LinguistTools)
|
||||||
|
accumulate_deps(qt_required Calamares::calamares ${qtname}::)
|
||||||
|
accumulate_deps(qt_required Calamares::calamaresui ${qtname}::)
|
||||||
|
find_package(${qtname} CONFIG REQUIRED ${qt_required})
|
||||||
|
|
||||||
set(kf5_required "")
|
set(kf5_required "")
|
||||||
accumulate_deps(kf5_required Calamares::calamares KF5::)
|
accumulate_deps(kf5_required Calamares::calamares KF5::)
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
|
|
||||||
include(CalamaresAddTranslations)
|
include(CalamaresAddTranslations)
|
||||||
|
|
||||||
find_package(Qt5 COMPONENTS Xml)
|
find_package(${qtname} COMPONENTS Xml)
|
||||||
if(Qt5Xml_FOUND)
|
if(TARGET ${qtname}::Xml)
|
||||||
add_executable(txload txload.cpp)
|
add_executable(txload txload.cpp)
|
||||||
target_link_libraries(txload Qt5::Xml)
|
target_link_libraries(txload ${qtname}::Xml)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install_calamares_gettext_translations(python
|
install_calamares_gettext_translations(python
|
||||||
@ -50,7 +50,7 @@ set(CALAMARES_TRANSLATIONS_SOURCE ${trans_outfile})
|
|||||||
|
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/lang/calamares_i18n.qrc.in ${trans_infile} @ONLY)
|
configure_file(${CMAKE_SOURCE_DIR}/lang/calamares_i18n.qrc.in ${trans_infile} @ONLY)
|
||||||
|
|
||||||
qt5_add_translation(QM_FILES ${TS_FILES})
|
qt_add_translation(QM_FILES ${TS_FILES})
|
||||||
|
|
||||||
# Run the resource compiler (rcc_options should already be set)
|
# Run the resource compiler (rcc_options should already be set)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
|
@ -12,7 +12,6 @@ include(CalamaresAddTranslations)
|
|||||||
|
|
||||||
# library
|
# library
|
||||||
add_subdirectory(libcalamares)
|
add_subdirectory(libcalamares)
|
||||||
|
|
||||||
add_subdirectory(libcalamaresui)
|
add_subdirectory(libcalamaresui)
|
||||||
|
|
||||||
# all things qml
|
# all things qml
|
||||||
|
@ -123,10 +123,10 @@ navigation: widget
|
|||||||
strings:
|
strings:
|
||||||
productName: "${NAME}"
|
productName: "${NAME}"
|
||||||
shortProductName: Generic
|
shortProductName: Generic
|
||||||
version: 2020.2 LTS
|
version: 2023.3 LTS
|
||||||
shortVersion: 2020.2
|
shortVersion: 2023.3
|
||||||
versionedName: Fancy GNU/Linux 2020.2 LTS "Turgid Tuba"
|
versionedName: Fancy GNU/Linux 2023.3 LTS "Venomous Vole"
|
||||||
shortVersionedName: FancyGL 2020.2
|
shortVersionedName: FancyGL 2023.3
|
||||||
bootloaderEntryName: FancyGL
|
bootloaderEntryName: FancyGL
|
||||||
productUrl: https://calamares.io/
|
productUrl: https://calamares.io/
|
||||||
supportUrl: https://github.com/calamares/calamares/wiki
|
supportUrl: https://github.com/calamares/calamares/wiki
|
||||||
|
@ -38,8 +38,11 @@ calamares_autorcc( calamares_bin )
|
|||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
calamares_bin
|
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)
|
if(BUILD_KF5Crash)
|
||||||
target_link_libraries(calamares_bin PRIVATE KF5::Crash)
|
target_link_libraries(calamares_bin PRIVATE KF5::Crash)
|
||||||
target_compile_definitions(calamares_bin PRIVATE BUILD_KF5Crash)
|
target_compile_definitions(calamares_bin PRIVATE BUILD_KF5Crash)
|
||||||
@ -59,8 +62,8 @@ install(
|
|||||||
if(BUILD_TESTING)
|
if(BUILD_TESTING)
|
||||||
# Don't install, these are just for enable_testing
|
# Don't install, these are just for enable_testing
|
||||||
add_executable(loadmodule testmain.cpp)
|
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)
|
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()
|
endif()
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#include "utils/Retranslator.h"
|
#include "utils/Retranslator.h"
|
||||||
#include "viewpages/ViewStep.h"
|
#include "viewpages/ViewStep.h"
|
||||||
|
|
||||||
#include <QDesktopWidget>
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
|
@ -27,7 +27,9 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
|
#endif
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
@ -39,6 +41,16 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
|
|
||||||
|
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
|
static inline int
|
||||||
windowDimensionToPixels( const Calamares::Branding::WindowDimension& u )
|
windowDimensionToPixels( const Calamares::Branding::WindowDimension& u )
|
||||||
{
|
{
|
||||||
@ -143,11 +155,9 @@ getWidgetSidebar( Calamares::DebugWindowManager* debug,
|
|||||||
CalamaresUtils::Original,
|
CalamaresUtils::Original,
|
||||||
2 * QSize( defaultFontHeight, defaultFontHeight ) ) );
|
2 * QSize( defaultFontHeight, defaultFontHeight ) ) );
|
||||||
CALAMARES_RETRANSLATE_FOR(
|
CALAMARES_RETRANSLATE_FOR(
|
||||||
aboutDialog,
|
aboutDialog, aboutDialog->setText( QCoreApplication::translate( "calamares-sidebar", "About" ) );
|
||||||
aboutDialog->setText(
|
aboutDialog->setToolTip(
|
||||||
QCoreApplication::translate( "calamares-sidebar", "About" ) );
|
QCoreApplication::translate( "calamares-sidebar", "Show information about Calamares" ) ); );
|
||||||
aboutDialog->setToolTip( QCoreApplication::translate( "calamares-sidebar",
|
|
||||||
"Show information about Calamares" ) ); );
|
|
||||||
extraButtons->addWidget( aboutDialog );
|
extraButtons->addWidget( aboutDialog );
|
||||||
aboutDialog->setFlat( true );
|
aboutDialog->setFlat( true );
|
||||||
aboutDialog->setCheckable( true );
|
aboutDialog->setCheckable( true );
|
||||||
@ -159,11 +169,10 @@ getWidgetSidebar( Calamares::DebugWindowManager* debug,
|
|||||||
debugWindowBtn->setObjectName( "debugButton" );
|
debugWindowBtn->setObjectName( "debugButton" );
|
||||||
debugWindowBtn->setIcon( CalamaresUtils::defaultPixmap(
|
debugWindowBtn->setIcon( CalamaresUtils::defaultPixmap(
|
||||||
CalamaresUtils::Bugs, CalamaresUtils::Original, 2 * QSize( defaultFontHeight, defaultFontHeight ) ) );
|
CalamaresUtils::Bugs, CalamaresUtils::Original, 2 * QSize( defaultFontHeight, defaultFontHeight ) ) );
|
||||||
CALAMARES_RETRANSLATE_FOR( debugWindowBtn,
|
CALAMARES_RETRANSLATE_FOR(
|
||||||
debugWindowBtn->setText( QCoreApplication::translate(
|
debugWindowBtn, debugWindowBtn->setText( QCoreApplication::translate( "calamares-sidebar", "Debug" ) );
|
||||||
"calamares-sidebar", "Debug" ) );
|
debugWindowBtn->setToolTip(
|
||||||
debugWindowBtn->setToolTip( QCoreApplication::translate(
|
QCoreApplication::translate( "calamares-sidebar", "Show debug information" ) ); );
|
||||||
"calamares-sidebar", "Show debug information" ) ); );
|
|
||||||
extraButtons->addWidget( debugWindowBtn );
|
extraButtons->addWidget( debugWindowBtn );
|
||||||
debugWindowBtn->setFlat( true );
|
debugWindowBtn->setFlat( true );
|
||||||
debugWindowBtn->setCheckable( true );
|
debugWindowBtn->setCheckable( true );
|
||||||
@ -409,7 +418,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
|
|||||||
// Needs to match what's checked in DebugWindow
|
// Needs to match what's checked in DebugWindow
|
||||||
this->setObjectName( "mainApp" );
|
this->setObjectName( "mainApp" );
|
||||||
|
|
||||||
QSize availableSize = qApp->desktop()->availableGeometry( this ).size();
|
QSize availableSize = desktopSize( this );
|
||||||
QSize minimumSize( qBound( windowMinimumWidth, availableSize.width(), windowPreferredWidth ),
|
QSize minimumSize( qBound( windowMinimumWidth, availableSize.width(), windowPreferredWidth ),
|
||||||
qBound( windowMinimumHeight, availableSize.height(), windowPreferredHeight ) );
|
qBound( windowMinimumHeight, availableSize.height(), windowPreferredHeight ) );
|
||||||
setMinimumSize( minimumSize );
|
setMinimumSize( minimumSize );
|
||||||
@ -507,7 +516,7 @@ void
|
|||||||
CalamaresWindow::ensureSize( QSize size )
|
CalamaresWindow::ensureSize( QSize size )
|
||||||
{
|
{
|
||||||
auto mainGeometry = this->geometry();
|
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
|
// We only care about vertical sizes that are big enough
|
||||||
int embiggenment = qMax( 0, size.height() - m_viewManager->centralWidget()->size().height() );
|
int embiggenment = qMax( 0, size.height() - m_viewManager->centralWidget()->size().height() );
|
||||||
|
@ -19,7 +19,14 @@
|
|||||||
// From 3rdparty/
|
// From 3rdparty/
|
||||||
#include "kdsingleapplication.h"
|
#include "kdsingleapplication.h"
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
|
||||||
|
// TODO: Qt6
|
||||||
|
// Ignore KAboutData
|
||||||
|
#define HAVE_KABOUTDATA 0
|
||||||
|
#else
|
||||||
#include <KCoreAddons/KAboutData>
|
#include <KCoreAddons/KAboutData>
|
||||||
|
#define HAVE_KABOUTDATA 1
|
||||||
|
#endif
|
||||||
#ifdef BUILD_KF5Crash
|
#ifdef BUILD_KF5Crash
|
||||||
#include <KCrash/KCrash>
|
#include <KCrash/KCrash>
|
||||||
#endif
|
#endif
|
||||||
@ -107,9 +114,13 @@ handle_args( CalamaresApplication& a )
|
|||||||
int
|
int
|
||||||
main( int argc, char* argv[] )
|
main( int argc, char* argv[] )
|
||||||
{
|
{
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||||
|
// Not needed in Qt6
|
||||||
|
QApplication::setAttribute( Qt::AA_EnableHighDpiScaling );
|
||||||
|
#endif
|
||||||
CalamaresApplication a( argc, argv );
|
CalamaresApplication a( argc, argv );
|
||||||
|
|
||||||
|
#if HAVE_KABOUTDATA
|
||||||
KAboutData aboutData( "calamares",
|
KAboutData aboutData( "calamares",
|
||||||
"Calamares",
|
"Calamares",
|
||||||
a.applicationVersion(),
|
a.applicationVersion(),
|
||||||
@ -120,6 +131,7 @@ main( int argc, char* argv[] )
|
|||||||
"https://calamares.io",
|
"https://calamares.io",
|
||||||
"https://github.com/calamares/calamares/issues" );
|
"https://github.com/calamares/calamares/issues" );
|
||||||
KAboutData::setApplicationData( aboutData );
|
KAboutData::setApplicationData( aboutData );
|
||||||
|
#endif
|
||||||
a.setApplicationDisplayName( QString() ); // To avoid putting an extra "Calamares/" into the log-file
|
a.setApplicationDisplayName( QString() ); // To avoid putting an extra "Calamares/" into the log-file
|
||||||
|
|
||||||
#ifdef BUILD_KF5Crash
|
#ifdef BUILD_KF5Crash
|
||||||
|
@ -100,14 +100,17 @@ set_target_properties(
|
|||||||
SOVERSION ${CALAMARES_SOVERSION}
|
SOVERSION ${CALAMARES_SOVERSION}
|
||||||
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_INSTALL_FULL_INCLUDEDIR}/libcalamares
|
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_INSTALL_FULL_INCLUDEDIR}/libcalamares
|
||||||
)
|
)
|
||||||
target_link_libraries(calamares LINK_PUBLIC yamlcpp::yamlcpp Qt5::Core KF5::CoreAddons)
|
target_link_libraries(calamares LINK_PUBLIC yamlcpp::yamlcpp ${qtname}::Core)
|
||||||
|
if(NOT WITH_QT6) # TODO: Qt6
|
||||||
|
target_link_libraries(calamares LINK_PUBLIC KF5::CoreAddons)
|
||||||
|
endif()
|
||||||
|
|
||||||
### OPTIONAL Automount support (requires dbus)
|
### OPTIONAL Automount support (requires dbus)
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
if(Qt5DBus_FOUND)
|
if(TARGET ${qtname}::DBus)
|
||||||
target_sources(calamares PRIVATE partition/AutoMount.cpp)
|
target_sources(calamares PRIVATE partition/AutoMount.cpp)
|
||||||
target_link_libraries(calamares PRIVATE Qt5::DBus)
|
target_link_libraries(calamares PRIVATE ${qtname}::DBus)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
### OPTIONAL Python support
|
### OPTIONAL Python support
|
||||||
@ -121,10 +124,10 @@ endif()
|
|||||||
### OPTIONAL GeoIP XML support
|
### OPTIONAL GeoIP XML support
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
find_package(Qt5 COMPONENTS Xml)
|
find_package(${qtname} ${QT_VERSION} COMPONENTS Xml)
|
||||||
if(Qt5Xml_FOUND)
|
if(TARGET ${qtname}::Xml)
|
||||||
target_sources(calamares PRIVATE geoip/GeoIPXML.cpp)
|
target_sources(calamares PRIVATE geoip/GeoIPXML.cpp)
|
||||||
target_link_libraries(calamares PRIVATE Qt5::Network Qt5::Xml)
|
target_link_libraries(calamares PRIVATE ${qtname}::Network ${qtname}::Xml)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
### OPTIONAL KPMcore support
|
### OPTIONAL KPMcore support
|
||||||
@ -219,7 +222,7 @@ function(calamares_qrc_translations basename)
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/lang/calamares_i18n.qrc.in ${translations_qrc_infile} @ONLY)
|
configure_file(${CMAKE_SOURCE_DIR}/lang/calamares_i18n.qrc.in ${translations_qrc_infile} @ONLY)
|
||||||
qt5_add_translation(QM_FILES ${calamares_i18n_ts_filelist})
|
qt_add_translation(QM_FILES ${calamares_i18n_ts_filelist})
|
||||||
|
|
||||||
# Run the resource compiler (rcc_options should already be set)
|
# Run the resource compiler (rcc_options should already be set)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
@ -274,10 +277,10 @@ calamares_add_test(libcalamaresutilspathstest SOURCES utils/TestPaths.cpp)
|
|||||||
# This is not an actual test, it's a test / demo application
|
# This is not an actual test, it's a test / demo application
|
||||||
# for experimenting with GeoIP.
|
# for experimenting with GeoIP.
|
||||||
add_executable(test_geoip geoip/test_geoip.cpp ${geoip_src})
|
add_executable(test_geoip geoip/test_geoip.cpp ${geoip_src})
|
||||||
target_link_libraries(test_geoip Calamares::calamares Qt5::Network yamlcpp::yamlcpp)
|
target_link_libraries(test_geoip Calamares::calamares ${qtname}::Network yamlcpp::yamlcpp)
|
||||||
calamares_automoc( test_geoip )
|
calamares_automoc( test_geoip )
|
||||||
|
|
||||||
if(Qt5DBus_FOUND)
|
if(TARGET ${qtname}::DBus)
|
||||||
add_executable(test_automount partition/calautomount.cpp)
|
add_executable(test_automount partition/calautomount.cpp)
|
||||||
target_link_libraries(test_automount Calamares::calamares Qt5::DBus)
|
target_link_libraries(test_automount Calamares::calamares ${qtname}::DBus)
|
||||||
endif()
|
endif()
|
||||||
|
@ -20,7 +20,9 @@ static const char s_footer[]
|
|||||||
= QT_TRANSLATE_NOOP( "AboutData",
|
= QT_TRANSLATE_NOOP( "AboutData",
|
||||||
"Thanks to <a href=\"https://calamares.io/team/\">the Calamares team</a> "
|
"Thanks to <a href=\"https://calamares.io/team/\">the Calamares team</a> "
|
||||||
"and the <a href=\"https://app.transifex.com/calamares/calamares/\">Calamares "
|
"and the <a href=\"https://app.transifex.com/calamares/calamares/\">Calamares "
|
||||||
"translators team</a>.<br/><br/>"
|
"translators team</a>." );
|
||||||
|
|
||||||
|
static const char s_sponsor[] = QT_TRANSLATE_NOOP( "AboutData",
|
||||||
"<a href=\"https://calamares.io/\">Calamares</a> "
|
"<a href=\"https://calamares.io/\">Calamares</a> "
|
||||||
"development is sponsored by <br/>"
|
"development is sponsored by <br/>"
|
||||||
"<a href=\"http://www.blue-systems.com/\">Blue Systems</a> - "
|
"<a href=\"http://www.blue-systems.com/\">Blue Systems</a> - "
|
||||||
@ -45,7 +47,7 @@ struct Maintainer
|
|||||||
|
|
||||||
static constexpr const Maintainer maintainers[] = {
|
static constexpr const Maintainer maintainers[] = {
|
||||||
{ 2014, 2017, "Teo Mrnjavac", "teo@kde.org" },
|
{ 2014, 2017, "Teo Mrnjavac", "teo@kde.org" },
|
||||||
{ 2017, 2022, "Adriaan de Groot", "groot@kde.org" },
|
{ 2017, 2023, "Adriaan de Groot", "groot@kde.org" },
|
||||||
};
|
};
|
||||||
|
|
||||||
static QString
|
static QString
|
||||||
@ -70,6 +72,7 @@ substituteVersions( const QString& s )
|
|||||||
const QString
|
const QString
|
||||||
Calamares::aboutString()
|
Calamares::aboutString()
|
||||||
{
|
{
|
||||||
|
Q_UNUSED( s_sponsor )
|
||||||
return substituteVersions( QCoreApplication::translate( "AboutData", s_header ) ) + aboutMaintainers()
|
return substituteVersions( QCoreApplication::translate( "AboutData", s_header ) ) + aboutMaintainers()
|
||||||
+ QCoreApplication::translate( "AboutData", s_footer );
|
+ QCoreApplication::translate( "AboutData", s_footer );
|
||||||
}
|
}
|
||||||
|
@ -11,33 +11,34 @@
|
|||||||
|
|
||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
|
|
||||||
|
#include "compat/Mutex.h"
|
||||||
|
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/Units.h"
|
#include "utils/Units.h"
|
||||||
#include "utils/Yaml.h"
|
#include "utils/Yaml.h"
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QMutexLocker>
|
|
||||||
|
|
||||||
using namespace CalamaresUtils::Units;
|
using namespace CalamaresUtils::Units;
|
||||||
|
|
||||||
namespace Calamares
|
namespace Calamares
|
||||||
{
|
{
|
||||||
|
|
||||||
class GlobalStorage::ReadLock : public QMutexLocker
|
class GlobalStorage::ReadLock : public MutexLocker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ReadLock( const GlobalStorage* gs )
|
ReadLock( const GlobalStorage* gs )
|
||||||
: QMutexLocker( &gs->m_mutex )
|
: MutexLocker( &gs->m_mutex )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class GlobalStorage::WriteLock : public QMutexLocker
|
class GlobalStorage::WriteLock : public MutexLocker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WriteLock( GlobalStorage* gs )
|
WriteLock( GlobalStorage* gs )
|
||||||
: QMutexLocker( &gs->m_mutex )
|
: MutexLocker( &gs->m_mutex )
|
||||||
, m_gs( gs )
|
, m_gs( gs )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
#include "CalamaresConfig.h"
|
#include "CalamaresConfig.h"
|
||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
#include "Job.h"
|
#include "Job.h"
|
||||||
|
#include "compat/Mutex.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QMutexLocker>
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -61,8 +61,8 @@ public:
|
|||||||
void finalize()
|
void finalize()
|
||||||
{
|
{
|
||||||
Q_ASSERT( m_runningJobs->isEmpty() );
|
Q_ASSERT( m_runningJobs->isEmpty() );
|
||||||
QMutexLocker qlock( &m_enqueMutex );
|
Calamares::MutexLocker qlock( &m_enqueMutex );
|
||||||
QMutexLocker rlock( &m_runMutex );
|
Calamares::MutexLocker rlock( &m_runMutex );
|
||||||
std::swap( m_runningJobs, m_queuedJobs );
|
std::swap( m_runningJobs, m_queuedJobs );
|
||||||
m_overallQueueWeight
|
m_overallQueueWeight
|
||||||
= m_runningJobs->isEmpty() ? 0.0 : ( m_runningJobs->last().cumulative + m_runningJobs->last().weight );
|
= m_runningJobs->isEmpty() ? 0.0 : ( m_runningJobs->last().cumulative + m_runningJobs->last().weight );
|
||||||
@ -83,7 +83,7 @@ public:
|
|||||||
|
|
||||||
void enqueue( int moduleWeight, const JobList& jobs )
|
void enqueue( int moduleWeight, const JobList& jobs )
|
||||||
{
|
{
|
||||||
QMutexLocker qlock( &m_enqueMutex );
|
Calamares::MutexLocker qlock( &m_enqueMutex );
|
||||||
|
|
||||||
qreal cumulative
|
qreal cumulative
|
||||||
= m_queuedJobs->isEmpty() ? 0.0 : ( m_queuedJobs->last().cumulative + m_queuedJobs->last().weight );
|
= m_queuedJobs->isEmpty() ? 0.0 : ( m_queuedJobs->last().cumulative + m_queuedJobs->last().weight );
|
||||||
@ -108,7 +108,7 @@ public:
|
|||||||
|
|
||||||
void run() override
|
void run() override
|
||||||
{
|
{
|
||||||
QMutexLocker rlock( &m_runMutex );
|
Calamares::MutexLocker rlock( &m_runMutex );
|
||||||
bool failureEncountered = false;
|
bool failureEncountered = false;
|
||||||
QString message; ///< Filled in with errors
|
QString message; ///< Filled in with errors
|
||||||
QString details;
|
QString details;
|
||||||
@ -159,7 +159,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
QStringList queuedJobs() const
|
QStringList queuedJobs() const
|
||||||
{
|
{
|
||||||
QMutexLocker qlock( &m_enqueMutex );
|
Calamares::MutexLocker qlock( &m_enqueMutex );
|
||||||
QStringList l;
|
QStringList l;
|
||||||
l.reserve( m_queuedJobs->count() );
|
l.reserve( m_queuedJobs->count() );
|
||||||
for ( const auto& j : *m_queuedJobs )
|
for ( const auto& j : *m_queuedJobs )
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "PythonHelper.h"
|
#include "PythonHelper.h"
|
||||||
|
|
||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
|
#include "compat/Variant.h"
|
||||||
#include "utils/Dirs.h"
|
#include "utils/Dirs.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
@ -29,41 +30,56 @@ variantToPyObject( const QVariant& variant )
|
|||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Wswitch-enum"
|
#pragma clang diagnostic ignored "-Wswitch-enum"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||||
|
const auto HashVariantType = QVariant::Hash;
|
||||||
|
const auto IntVariantType = QVariant::Int;
|
||||||
|
const auto UIntVariantType = QVariant::UInt;
|
||||||
|
#else
|
||||||
|
const auto HashVariantType = QMetaType::Type::QVariantHash;
|
||||||
|
const auto IntVariantType = QMetaType::Type::Int;
|
||||||
|
const auto UIntVariantType = QMetaType::Type::UInt;
|
||||||
#endif
|
#endif
|
||||||
// 49 enumeration values not handled
|
// 49 enumeration values not handled
|
||||||
switch ( variant.type() )
|
switch ( Calamares::typeOf( variant ) )
|
||||||
{
|
{
|
||||||
case QVariant::Map:
|
case Calamares::MapVariantType:
|
||||||
return variantMapToPyDict( variant.toMap() );
|
return variantMapToPyDict( variant.toMap() );
|
||||||
|
|
||||||
case QVariant::Hash:
|
case HashVariantType:
|
||||||
return variantHashToPyDict( variant.toHash() );
|
return variantHashToPyDict( variant.toHash() );
|
||||||
|
|
||||||
case QVariant::List:
|
case Calamares::ListVariantType:
|
||||||
case QVariant::StringList:
|
case Calamares::StringListVariantType:
|
||||||
return variantListToPyList( variant.toList() );
|
return variantListToPyList( variant.toList() );
|
||||||
|
|
||||||
case QVariant::Int:
|
case IntVariantType:
|
||||||
return bp::object( variant.toInt() );
|
return bp::object( variant.toInt() );
|
||||||
case QVariant::UInt:
|
case UIntVariantType:
|
||||||
return bp::object( variant.toUInt() );
|
return bp::object( variant.toUInt() );
|
||||||
|
|
||||||
case QVariant::LongLong:
|
case Calamares::LongLongVariantType:
|
||||||
return bp::object( variant.toLongLong() );
|
return bp::object( variant.toLongLong() );
|
||||||
case QVariant::ULongLong:
|
case Calamares::ULongLongVariantType:
|
||||||
return bp::object( variant.toULongLong() );
|
return bp::object( variant.toULongLong() );
|
||||||
|
|
||||||
case QVariant::Double:
|
case Calamares::DoubleVariantType:
|
||||||
return bp::object( variant.toDouble() );
|
return bp::object( variant.toDouble() );
|
||||||
|
|
||||||
case QVariant::Char:
|
case Calamares::CharVariantType:
|
||||||
case QVariant::String:
|
#if QT_VERSION > QT_VERSION_CHECK( 6, 0, 0 )
|
||||||
|
case QMetaType::Type::QChar:
|
||||||
|
#endif
|
||||||
|
case Calamares::StringVariantType:
|
||||||
return bp::object( variant.toString().toStdString() );
|
return bp::object( variant.toString().toStdString() );
|
||||||
|
|
||||||
case QVariant::Bool:
|
case Calamares::BoolVariantType:
|
||||||
return bp::object( variant.toBool() );
|
return bp::object( variant.toBool() );
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||||
case QVariant::Invalid:
|
case QVariant::Invalid:
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return bp::object();
|
return bp::object();
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
|
|
||||||
#include "CalamaresConfig.h"
|
#include "CalamaresConfig.h"
|
||||||
|
#include "compat/Variant.h"
|
||||||
#include "utils/Dirs.h"
|
#include "utils/Dirs.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/Yaml.h"
|
#include "utils/Yaml.h"
|
||||||
@ -157,12 +158,12 @@ interpretInstances( const YAML::Node& node, Settings::InstanceDescriptionList& c
|
|||||||
if ( node )
|
if ( node )
|
||||||
{
|
{
|
||||||
QVariant instancesV = CalamaresUtils::yamlToVariant( node ).toList();
|
QVariant instancesV = CalamaresUtils::yamlToVariant( node ).toList();
|
||||||
if ( instancesV.type() == QVariant::List )
|
if ( typeOf( instancesV ) == ListVariantType )
|
||||||
{
|
{
|
||||||
const auto instances = instancesV.toList();
|
const auto instances = instancesV.toList();
|
||||||
for ( const QVariant& instancesVListItem : instances )
|
for ( const QVariant& instancesVListItem : instances )
|
||||||
{
|
{
|
||||||
if ( instancesVListItem.type() != QVariant::Map )
|
if ( typeOf( instancesVListItem ) != MapVariantType )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -185,7 +186,7 @@ interpretSequence( const YAML::Node& node, Settings::ModuleSequence& moduleSeque
|
|||||||
if ( node )
|
if ( node )
|
||||||
{
|
{
|
||||||
QVariant sequenceV = CalamaresUtils::yamlToVariant( node );
|
QVariant sequenceV = CalamaresUtils::yamlToVariant( node );
|
||||||
if ( !( sequenceV.type() == QVariant::List ) )
|
if ( typeOf( sequenceV ) != ListVariantType )
|
||||||
{
|
{
|
||||||
throw YAML::Exception( YAML::Mark(), "sequence key does not have a list-value" );
|
throw YAML::Exception( YAML::Mark(), "sequence key does not have a list-value" );
|
||||||
}
|
}
|
||||||
@ -193,7 +194,7 @@ interpretSequence( const YAML::Node& node, Settings::ModuleSequence& moduleSeque
|
|||||||
const auto sequence = sequenceV.toList();
|
const auto sequence = sequenceV.toList();
|
||||||
for ( const QVariant& sequenceVListItem : sequence )
|
for ( const QVariant& sequenceVListItem : sequence )
|
||||||
{
|
{
|
||||||
if ( sequenceVListItem.type() != QVariant::Map )
|
if ( typeOf( sequenceVListItem ) != MapVariantType )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
|
#include "compat/Variant.h"
|
||||||
#include "modulesystem/InstanceKey.h"
|
#include "modulesystem/InstanceKey.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
@ -55,7 +56,7 @@ TestLibCalamares::testGSModify()
|
|||||||
gs.insert( key, value );
|
gs.insert( key, value );
|
||||||
QCOMPARE( gs.count(), 1 );
|
QCOMPARE( gs.count(), 1 );
|
||||||
QVERIFY( gs.contains( key ) );
|
QVERIFY( gs.contains( key ) );
|
||||||
QCOMPARE( gs.value( key ).type(), QVariant::Int );
|
QCOMPARE( Calamares::typeOf( gs.value( key ) ), Calamares::IntVariantType );
|
||||||
QCOMPARE( gs.value( key ).toString(), QString( "17" ) ); // It isn't a string, but does convert
|
QCOMPARE( gs.value( key ).toString(), QString( "17" ) ); // It isn't a string, but does convert
|
||||||
QCOMPARE( gs.value( key ).toInt(), value );
|
QCOMPARE( gs.value( key ).toInt(), value );
|
||||||
|
|
||||||
@ -137,8 +138,8 @@ TestLibCalamares::testGSLoadSave2()
|
|||||||
QVERIFY( gs1.loadYaml( filename ) );
|
QVERIFY( gs1.loadYaml( filename ) );
|
||||||
QCOMPARE( gs1.count(), 3 ); // From examining the file
|
QCOMPARE( gs1.count(), 3 ); // From examining the file
|
||||||
QVERIFY( gs1.contains( key ) );
|
QVERIFY( gs1.contains( key ) );
|
||||||
cDebug() << gs1.value( key ).type() << gs1.value( key );
|
cDebug() << Calamares::typeOf( gs1.value( key ) ) << gs1.value( key );
|
||||||
QCOMPARE( gs1.value( key ).type(), QVariant::List );
|
QCOMPARE( Calamares::typeOf( gs1.value( key ) ), Calamares::ListVariantType );
|
||||||
|
|
||||||
const QString yamlfilename( "gs.test.yaml" );
|
const QString yamlfilename( "gs.test.yaml" );
|
||||||
QVERIFY( gs1.saveYaml( yamlfilename ) );
|
QVERIFY( gs1.saveYaml( yamlfilename ) );
|
||||||
@ -146,7 +147,7 @@ TestLibCalamares::testGSLoadSave2()
|
|||||||
Calamares::GlobalStorage gs2;
|
Calamares::GlobalStorage gs2;
|
||||||
QVERIFY( gs2.loadYaml( yamlfilename ) );
|
QVERIFY( gs2.loadYaml( yamlfilename ) );
|
||||||
QVERIFY( gs2.contains( key ) );
|
QVERIFY( gs2.contains( key ) );
|
||||||
QCOMPARE( gs2.value( key ).type(), QVariant::List );
|
QCOMPARE( Calamares::typeOf( gs2.value( key ) ), Calamares::ListVariantType );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -396,6 +397,7 @@ TestLibCalamares::testSettings()
|
|||||||
QVERIFY( s.brandingComponentName().isEmpty() );
|
QVERIFY( s.brandingComponentName().isEmpty() );
|
||||||
QVERIFY( !s.isValid() );
|
QVERIFY( !s.isValid() );
|
||||||
|
|
||||||
|
// *INDENT-OFF*
|
||||||
s.setConfiguration( R"(---
|
s.setConfiguration( R"(---
|
||||||
branding: default # needed for it to be considered valid
|
branding: default # needed for it to be considered valid
|
||||||
instances:
|
instances:
|
||||||
@ -415,6 +417,7 @@ sequence:
|
|||||||
- welcome@hi
|
- welcome@hi
|
||||||
)",
|
)",
|
||||||
QStringLiteral( "<testdata>" ) );
|
QStringLiteral( "<testdata>" ) );
|
||||||
|
// *INDENT-ON*
|
||||||
|
|
||||||
QVERIFY( s.debugMode() );
|
QVERIFY( s.debugMode() );
|
||||||
QCOMPARE( s.moduleInstances().count(), 4 ); // there are 4 module instances mentioned
|
QCOMPARE( s.moduleInstances().count(), 4 ); // there are 4 module instances mentioned
|
||||||
|
30
src/libcalamares/compat/Mutex.h
Normal file
30
src/libcalamares/compat/Mutex.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/* === This file is part of Calamares - <https://calamares.io> ===
|
||||||
|
*
|
||||||
|
* SPDX-FileCopyrightText: 2023 Adriaan de Groot <groot@kde.org>
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*
|
||||||
|
* Calamares is Free Software: see the License-Identifier above.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef CALAMARES_COMPAT_MUTEX_H
|
||||||
|
#define CALAMARES_COMPAT_MUTEX_H
|
||||||
|
|
||||||
|
#include <QMutexLocker>
|
||||||
|
|
||||||
|
namespace Calamares
|
||||||
|
{
|
||||||
|
|
||||||
|
/*
|
||||||
|
* In Qt5, QMutexLocker is a class and operates implicitly on
|
||||||
|
* QMutex but in Qt6 it is a template and needs a specialization.
|
||||||
|
*/
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||||
|
using MutexLocker = QMutexLocker;
|
||||||
|
#else
|
||||||
|
using MutexLocker = QMutexLocker< QMutex >;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} // namespace Calamares
|
||||||
|
|
||||||
|
#endif
|
46
src/libcalamares/compat/Variant.h
Normal file
46
src/libcalamares/compat/Variant.h
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/* === This file is part of Calamares - <https://calamares.io> ===
|
||||||
|
*
|
||||||
|
* SPDX-FileCopyrightText: 2023 Adriaan de Groot <groot@kde.org>
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*
|
||||||
|
* Calamares is Free Software: see the License-Identifier above.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifndef CALAMARES_COMPAT_VARIANT_H
|
||||||
|
#define CALAMARES_COMPAT_VARIANT_H
|
||||||
|
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
|
namespace Calamares
|
||||||
|
{
|
||||||
|
/* Compatibility of QVariant between Qt5 and Qt6 */
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||||
|
const auto typeOf = []( const QVariant& v ) { return v.type(); };
|
||||||
|
const auto ListVariantType = QVariant::List;
|
||||||
|
const auto MapVariantType = QVariant::Map;
|
||||||
|
const auto StringVariantType = QVariant::String;
|
||||||
|
const auto CharVariantType = QVariant::Char;
|
||||||
|
const auto StringListVariantType = QVariant::StringList;
|
||||||
|
const auto BoolVariantType = QVariant::Bool;
|
||||||
|
const auto IntVariantType = QVariant::Int;
|
||||||
|
const auto LongLongVariantType = QVariant::LongLong;
|
||||||
|
const auto ULongLongVariantType = QVariant::ULongLong;
|
||||||
|
const auto DoubleVariantType = QVariant::Double;
|
||||||
|
#else
|
||||||
|
const auto typeOf = []( const QVariant& v ) { return v.typeId(); };
|
||||||
|
const auto ListVariantType = QMetaType::Type::QVariantList;
|
||||||
|
const auto MapVariantType = QMetaType::Type::QVariantMap;
|
||||||
|
const auto StringVariantType = QMetaType::Type::QString;
|
||||||
|
const auto CharVariantType = QMetaType::Type::Char;
|
||||||
|
const auto StringListVariantType = QMetaType::Type::QStringList;
|
||||||
|
const auto BoolVariantType = QMetaType::Type::Bool;
|
||||||
|
const auto IntVariantType = QMetaType::Type::Int;
|
||||||
|
const auto LongLongVariantType = QMetaType::Type::LongLong;
|
||||||
|
const auto ULongLongVariantType = QMetaType::Type::ULongLong;
|
||||||
|
const auto DoubleVariantType = QMetaType::Type::Double;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} // namespace Calamares
|
||||||
|
|
||||||
|
#endif
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "GeoIPJSON.h"
|
#include "GeoIPJSON.h"
|
||||||
|
|
||||||
|
#include "compat/Variant.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/Variant.h"
|
#include "utils/Variant.h"
|
||||||
#include "utils/Yaml.h"
|
#include "utils/Yaml.h"
|
||||||
@ -64,7 +65,7 @@ GeoIPJSON::rawReply( const QByteArray& data )
|
|||||||
YAML::Node doc = YAML::Load( data );
|
YAML::Node doc = YAML::Load( data );
|
||||||
|
|
||||||
QVariant var = CalamaresUtils::yamlToVariant( doc );
|
QVariant var = CalamaresUtils::yamlToVariant( doc );
|
||||||
if ( !var.isNull() && var.isValid() && var.type() == QVariant::Map )
|
if ( !var.isNull() && var.isValid() && Calamares::typeOf( var ) == Calamares::MapVariantType )
|
||||||
{
|
{
|
||||||
return selectMap( var.toMap(), m_element.split( '.' ), 0 );
|
return selectMap( var.toMap(), m_element.split( '.' ), 0 );
|
||||||
}
|
}
|
||||||
|
@ -12,16 +12,19 @@
|
|||||||
|
|
||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
|
|
||||||
#include <QPair>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
class QByteArray;
|
class QByteArray;
|
||||||
|
|
||||||
namespace CalamaresUtils
|
namespace CalamaresUtils
|
||||||
{
|
{
|
||||||
namespace GeoIP
|
namespace GeoIP
|
||||||
{
|
{
|
||||||
|
using RegionZonePairBase = std::pair< QString, QString >;
|
||||||
|
|
||||||
/** @brief A Region, Zone pair of strings
|
/** @brief A Region, Zone pair of strings
|
||||||
*
|
*
|
||||||
* A GeoIP lookup returns a timezone, which is represented as a Region,
|
* A GeoIP lookup returns a timezone, which is represented as a Region,
|
||||||
@ -29,22 +32,22 @@ namespace GeoIP
|
|||||||
* pasting the strings back together with a "/" is the right thing to
|
* pasting the strings back together with a "/" is the right thing to
|
||||||
* do. The Zone **may** contain a "/" (e.g. "Kentucky/Monticello").
|
* do. The Zone **may** contain a "/" (e.g. "Kentucky/Monticello").
|
||||||
*/
|
*/
|
||||||
class DLLEXPORT RegionZonePair : public QPair< QString, QString >
|
class DLLEXPORT RegionZonePair : public RegionZonePairBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** @brief Construct from an existing pair. */
|
/** @brief Construct from an existing pair. */
|
||||||
explicit RegionZonePair( const QPair& p )
|
explicit RegionZonePair( const RegionZonePairBase& p )
|
||||||
: QPair( p )
|
: RegionZonePairBase( p )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
/** @brief Construct from two strings, like qMakePair(). */
|
/** @brief Construct from two strings, like qMakePair(). */
|
||||||
RegionZonePair( const QString& region, const QString& zone )
|
RegionZonePair( const QString& region, const QString& zone )
|
||||||
: QPair( region, zone )
|
: RegionZonePairBase( region, zone )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
/** @brief An invalid zone pair (empty strings). */
|
/** @brief An invalid zone pair (empty strings). */
|
||||||
RegionZonePair()
|
RegionZonePair()
|
||||||
: QPair( QString(), QString() )
|
: RegionZonePairBase( QString(), QString() )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +230,8 @@ LocaleTests::testTranslatableConfig2()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Could be QVERIFY, but then we don't see what language code fails
|
// Could be QVERIFY, but then we don't see what language code fails
|
||||||
QCOMPARE( ts1.get( language ) == QString( "description (language %1)" ).arg( language ) ? language : QString(),
|
QCOMPARE( ts1.get( QLocale( language ) ) == QString( "description (language %1)" ).arg( language ) ? language
|
||||||
|
: QString(),
|
||||||
language );
|
language );
|
||||||
}
|
}
|
||||||
QCOMPARE( ts1.get( QLocale( QLocale::Language::Serbian, QLocale::Script::LatinScript, QLocale::Country::Serbia ) ),
|
QCOMPARE( ts1.get( QLocale( QLocale::Language::Serbian, QLocale::Script::LatinScript, QLocale::Country::Serbia ) ),
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "utils/String.h"
|
#include "utils/String.h"
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QRegularExpression>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
static const char TZ_DATA_FILE[] = "/usr/share/zoneinfo/zone.tab";
|
static const char TZ_DATA_FILE[] = "/usr/share/zoneinfo/zone.tab";
|
||||||
@ -108,7 +109,7 @@ loadTZData( RegionVector& regions, ZoneVector& zones, QTextStream& in )
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList list = line.split( QRegExp( "[\t ]" ), SplitSkipEmptyParts );
|
QStringList list = line.split( QRegularExpression( "[\t ]" ), SplitSkipEmptyParts );
|
||||||
if ( list.size() < 3 )
|
if ( list.size() < 3 )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -140,7 +141,7 @@ loadTZData( RegionVector& regions, ZoneVector& zones, QTextStream& in )
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString position = list.at( 1 );
|
QString position = list.at( 1 );
|
||||||
int cooSplitPos = position.indexOf( QRegExp( "[-+]" ), 1 );
|
int cooSplitPos = position.indexOf( QRegularExpression( "[-+]" ), 1 );
|
||||||
double latitude;
|
double latitude;
|
||||||
double longitude;
|
double longitude;
|
||||||
if ( cooSplitPos > 0 )
|
if ( cooSplitPos > 0 )
|
||||||
|
@ -13,9 +13,10 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QPair>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace Calamares
|
namespace Calamares
|
||||||
{
|
{
|
||||||
namespace ModuleSystem
|
namespace ModuleSystem
|
||||||
@ -34,12 +35,14 @@ namespace ModuleSystem
|
|||||||
* This is supported by the *instances* configuration entry
|
* This is supported by the *instances* configuration entry
|
||||||
* in `settings.conf`.
|
* in `settings.conf`.
|
||||||
*/
|
*/
|
||||||
class InstanceKey : public QPair< QString, QString >
|
class InstanceKey : public std::pair< QString, QString >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
using Base = std::pair< QString, QString >;
|
||||||
|
|
||||||
/// @brief Create an instance key from explicit module and id.
|
/// @brief Create an instance key from explicit module and id.
|
||||||
InstanceKey( const QString& module, const QString& id )
|
InstanceKey( const QString& module, const QString& id )
|
||||||
: QPair( module, id )
|
: Base( module, id )
|
||||||
{
|
{
|
||||||
if ( second.isEmpty() )
|
if ( second.isEmpty() )
|
||||||
{
|
{
|
||||||
@ -50,7 +53,7 @@ public:
|
|||||||
|
|
||||||
/// @brief Create unusual, invalid instance key
|
/// @brief Create unusual, invalid instance key
|
||||||
InstanceKey()
|
InstanceKey()
|
||||||
: QPair( QString(), QString() )
|
: Base( QString(), QString() )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "RequirementsChecker.h"
|
#include "RequirementsChecker.h"
|
||||||
|
|
||||||
|
#include "compat/Mutex.h"
|
||||||
#include "modulesystem/Module.h"
|
#include "modulesystem/Module.h"
|
||||||
#include "modulesystem/Requirement.h"
|
#include "modulesystem/Requirement.h"
|
||||||
#include "modulesystem/RequirementsModel.h"
|
#include "modulesystem/RequirementsModel.h"
|
||||||
@ -48,7 +49,11 @@ RequirementsChecker::run()
|
|||||||
for ( const auto& module : m_modules )
|
for ( const auto& module : m_modules )
|
||||||
{
|
{
|
||||||
Watcher* watcher = new Watcher( this );
|
Watcher* watcher = new Watcher( this );
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||||
watcher->setFuture( QtConcurrent::run( this, &RequirementsChecker::addCheckedRequirements, module ) );
|
watcher->setFuture( QtConcurrent::run( this, &RequirementsChecker::addCheckedRequirements, module ) );
|
||||||
|
#else
|
||||||
|
watcher->setFuture( QtConcurrent::run( &RequirementsChecker::addCheckedRequirements, this, module ) );
|
||||||
|
#endif
|
||||||
watcher->setObjectName( module->name() );
|
watcher->setObjectName( module->name() );
|
||||||
m_watchers.append( watcher );
|
m_watchers.append( watcher );
|
||||||
connect( watcher, &Watcher::finished, this, &RequirementsChecker::finished );
|
connect( watcher, &Watcher::finished, this, &RequirementsChecker::finished );
|
||||||
@ -61,7 +66,7 @@ void
|
|||||||
RequirementsChecker::finished()
|
RequirementsChecker::finished()
|
||||||
{
|
{
|
||||||
static QMutex finishedMutex;
|
static QMutex finishedMutex;
|
||||||
QMutexLocker lock( &finishedMutex );
|
Calamares::MutexLocker lock( &finishedMutex );
|
||||||
|
|
||||||
if ( m_progressTimer
|
if ( m_progressTimer
|
||||||
&& std::all_of(
|
&& std::all_of(
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "RequirementsModel.h"
|
#include "RequirementsModel.h"
|
||||||
|
|
||||||
|
#include "compat/Mutex.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
namespace Calamares
|
namespace Calamares
|
||||||
@ -18,7 +19,7 @@ namespace Calamares
|
|||||||
void
|
void
|
||||||
RequirementsModel::clear()
|
RequirementsModel::clear()
|
||||||
{
|
{
|
||||||
QMutexLocker l( &m_addLock );
|
Calamares::MutexLocker l( &m_addLock );
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_requirements.clear();
|
m_requirements.clear();
|
||||||
endResetModel();
|
endResetModel();
|
||||||
@ -28,7 +29,7 @@ RequirementsModel::clear()
|
|||||||
void
|
void
|
||||||
RequirementsModel::addRequirementsList( const Calamares::RequirementsList& requirements )
|
RequirementsModel::addRequirementsList( const Calamares::RequirementsList& requirements )
|
||||||
{
|
{
|
||||||
QMutexLocker l( &m_addLock );
|
Calamares::MutexLocker l( &m_addLock );
|
||||||
|
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
for ( const auto& r : requirements )
|
for ( const auto& r : requirements )
|
||||||
|
@ -9,11 +9,11 @@
|
|||||||
|
|
||||||
#include "Manager.h"
|
#include "Manager.h"
|
||||||
|
|
||||||
|
#include "compat/Mutex.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
#include <QEventLoop>
|
#include <QEventLoop>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QMutexLocker>
|
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
@ -84,7 +84,7 @@ namMutex()
|
|||||||
QNetworkAccessManager*
|
QNetworkAccessManager*
|
||||||
Manager::Private::nam()
|
Manager::Private::nam()
|
||||||
{
|
{
|
||||||
QMutexLocker lock( namMutex() );
|
Calamares::MutexLocker lock( namMutex() );
|
||||||
|
|
||||||
auto* thread = QThread::currentThread();
|
auto* thread = QThread::currentThread();
|
||||||
for ( const auto& n : m_perThreadNams )
|
for ( const auto& n : m_perThreadNams )
|
||||||
@ -106,7 +106,7 @@ Manager::Private::nam()
|
|||||||
void
|
void
|
||||||
Manager::Private::cleanupNam()
|
Manager::Private::cleanupNam()
|
||||||
{
|
{
|
||||||
QMutexLocker lock( namMutex() );
|
Calamares::MutexLocker lock( namMutex() );
|
||||||
|
|
||||||
auto* thread = QThread::currentThread();
|
auto* thread = QThread::currentThread();
|
||||||
bool cleanupFound = false;
|
bool cleanupFound = false;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "AutoMount.h"
|
#include "AutoMount.h"
|
||||||
|
|
||||||
|
#include "compat/Variant.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
#include <QtDBus>
|
#include <QtDBus>
|
||||||
@ -114,7 +115,7 @@ querySolidAutoMount( QDBusConnection& dbus, AutoMountInfo& info )
|
|||||||
if ( arg.length() == 1 )
|
if ( arg.length() == 1 )
|
||||||
{
|
{
|
||||||
auto v = arg.at( 0 );
|
auto v = arg.at( 0 );
|
||||||
if ( v.isValid() && v.type() == QVariant::Bool )
|
if ( v.isValid() && Calamares::typeOf( v ) == Calamares::BoolVariantType )
|
||||||
{
|
{
|
||||||
result = v.toBool();
|
result = v.toBool();
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
|
|
||||||
// #include "utils/CalamaresUtils.h"
|
#include "compat/Variant.h"
|
||||||
#include "utils/CalamaresUtilsSystem.h"
|
#include "utils/CalamaresUtilsSystem.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/StringExpander.h"
|
#include "utils/StringExpander.h"
|
||||||
@ -46,11 +46,11 @@ get_variant_stringlist( const QVariantList& l )
|
|||||||
unsigned int count = 0;
|
unsigned int count = 0;
|
||||||
for ( const auto& v : l )
|
for ( const auto& v : l )
|
||||||
{
|
{
|
||||||
if ( v.type() == QVariant::String )
|
if ( Calamares::typeOf( v ) == Calamares::StringVariantType )
|
||||||
{
|
{
|
||||||
retl.append( CommandLine( v.toString(), CommandLine::TimeoutNotSet() ) );
|
retl.append( CommandLine( v.toString(), CommandLine::TimeoutNotSet() ) );
|
||||||
}
|
}
|
||||||
else if ( v.type() == QVariant::Map )
|
else if ( Calamares::typeOf( v ) == Calamares::MapVariantType )
|
||||||
{
|
{
|
||||||
auto command( get_variant_object( v.toMap() ) );
|
auto command( get_variant_object( v.toMap() ) );
|
||||||
if ( command.isValid() )
|
if ( command.isValid() )
|
||||||
@ -61,7 +61,7 @@ get_variant_stringlist( const QVariantList& l )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cWarning() << "Bad CommandList element" << count << v.type() << v;
|
cWarning() << "Bad CommandList element" << count << v;
|
||||||
}
|
}
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
@ -119,7 +119,7 @@ CommandList::CommandList( bool doChroot, std::chrono::seconds timeout )
|
|||||||
CommandList::CommandList::CommandList( const QVariant& v, bool doChroot, std::chrono::seconds timeout )
|
CommandList::CommandList::CommandList( const QVariant& v, bool doChroot, std::chrono::seconds timeout )
|
||||||
: CommandList( doChroot, timeout )
|
: CommandList( doChroot, timeout )
|
||||||
{
|
{
|
||||||
if ( v.type() == QVariant::List )
|
if ( Calamares::typeOf( v ) == Calamares::ListVariantType )
|
||||||
{
|
{
|
||||||
const auto v_list = v.toList();
|
const auto v_list = v.toList();
|
||||||
if ( v_list.count() )
|
if ( v_list.count() )
|
||||||
@ -131,11 +131,11 @@ CommandList::CommandList::CommandList( const QVariant& v, bool doChroot, std::ch
|
|||||||
cWarning() << "Empty CommandList";
|
cWarning() << "Empty CommandList";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( v.type() == QVariant::String )
|
else if ( Calamares::typeOf( v ) == Calamares::StringVariantType )
|
||||||
{
|
{
|
||||||
append( { v.toString(), m_timeout } );
|
append( { v.toString(), m_timeout } );
|
||||||
}
|
}
|
||||||
else if ( v.type() == QVariant::Map )
|
else if ( Calamares::typeOf( v ) == Calamares::MapVariantType )
|
||||||
{
|
{
|
||||||
auto c( get_variant_object( v.toMap() ) );
|
auto c( get_variant_object( v.toMap() ) );
|
||||||
if ( c.isValid() )
|
if ( c.isValid() )
|
||||||
@ -146,7 +146,7 @@ CommandList::CommandList::CommandList( const QVariant& v, bool doChroot, std::ch
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cWarning() << "CommandList does not understand variant" << v.type();
|
cWarning() << "CommandList does not understand variant" << Calamares::typeOf( v );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,33 +17,35 @@
|
|||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
class KMacroExpanderBase;
|
class KMacroExpanderBase;
|
||||||
|
|
||||||
namespace CalamaresUtils
|
namespace CalamaresUtils
|
||||||
{
|
{
|
||||||
|
using CommandLineBase = std::pair< QString, std::chrono::seconds >;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Each command can have an associated timeout in seconds. The timeout
|
* Each command can have an associated timeout in seconds. The timeout
|
||||||
* defaults to 10 seconds. Provide some convenience naming and construction.
|
* defaults to 10 seconds. Provide some convenience naming and construction.
|
||||||
*/
|
*/
|
||||||
struct CommandLine : public QPair< QString, std::chrono::seconds >
|
struct CommandLine : public CommandLineBase
|
||||||
{
|
{
|
||||||
static inline constexpr std::chrono::seconds TimeoutNotSet() { return std::chrono::seconds( -1 ); }
|
static inline constexpr std::chrono::seconds TimeoutNotSet() { return std::chrono::seconds( -1 ); }
|
||||||
|
|
||||||
/// An invalid command line
|
/// An invalid command line
|
||||||
CommandLine()
|
CommandLine()
|
||||||
: QPair( QString(), TimeoutNotSet() )
|
: CommandLineBase( QString(), TimeoutNotSet() )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandLine( const QString& s )
|
CommandLine( const QString& s )
|
||||||
: QPair( s, TimeoutNotSet() )
|
: CommandLineBase( s, TimeoutNotSet() )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandLine( const QString& s, std::chrono::seconds t )
|
CommandLine( const QString& s, std::chrono::seconds t )
|
||||||
: QPair( s, t )
|
: CommandLineBase( s, t )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
#include "CalamaresVersionX.h"
|
#include "CalamaresVersionX.h"
|
||||||
|
#include "compat/Mutex.h"
|
||||||
|
#include "compat/Variant.h"
|
||||||
#include "utils/Dirs.h"
|
#include "utils/Dirs.h"
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@ -84,7 +86,7 @@ log_enabled( unsigned int level )
|
|||||||
static void
|
static void
|
||||||
log_implementation( const char* msg, unsigned int debugLevel, const bool withTime )
|
log_implementation( const char* msg, unsigned int debugLevel, const bool withTime )
|
||||||
{
|
{
|
||||||
QMutexLocker lock( &s_mutex );
|
Calamares::MutexLocker lock( &s_mutex );
|
||||||
|
|
||||||
const auto date = QDate::currentDate().toString( Qt::ISODate );
|
const auto date = QDate::currentDate().toString( Qt::ISODate );
|
||||||
const auto time = QTime::currentTime().toString();
|
const auto time = QTime::currentTime().toString();
|
||||||
@ -173,7 +175,7 @@ setupLogfile()
|
|||||||
|
|
||||||
// Lock while (re-)opening the logfile
|
// Lock while (re-)opening the logfile
|
||||||
{
|
{
|
||||||
QMutexLocker lock( &s_mutex );
|
Calamares::MutexLocker lock( &s_mutex );
|
||||||
logfile.open( logFile().toLocal8Bit(), std::ios::app );
|
logfile.open( logFile().toLocal8Bit(), std::ios::app );
|
||||||
if ( logfile.tellp() )
|
if ( logfile.tellp() )
|
||||||
{
|
{
|
||||||
@ -227,9 +229,9 @@ const constexpr Quote_t Quote {};
|
|||||||
QString
|
QString
|
||||||
toString( const QVariant& v )
|
toString( const QVariant& v )
|
||||||
{
|
{
|
||||||
auto t = v.type();
|
auto t = Calamares::typeOf( v );
|
||||||
|
|
||||||
if ( t == QVariant::List )
|
if ( t == Calamares::ListVariantType )
|
||||||
{
|
{
|
||||||
QStringList s;
|
QStringList s;
|
||||||
auto l = v.toList();
|
auto l = v.toList();
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
@ -11,6 +11,16 @@
|
|||||||
#include "StringExpander.h"
|
#include "StringExpander.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
|
||||||
|
// TODO: Qt6
|
||||||
|
KWordMacroExpander::~KWordMacroExpander() {};
|
||||||
|
bool
|
||||||
|
KWordMacroExpander::expandMacro( const QString& str, QStringList& ret )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Calamares
|
namespace Calamares
|
||||||
{
|
{
|
||||||
namespace String
|
namespace String
|
||||||
|
@ -13,7 +13,44 @@
|
|||||||
|
|
||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||||
#include <KMacroExpander>
|
#include <KMacroExpander>
|
||||||
|
#else
|
||||||
|
// TODO: Qt6
|
||||||
|
//
|
||||||
|
// Mock up part of KF6
|
||||||
|
#include <QHash>
|
||||||
|
#include <QString>
|
||||||
|
class KMacroExpanderBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QString expandMacrosShellQuote( const QString& c ) { return c; }
|
||||||
|
};
|
||||||
|
class KMacroExpander
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static QString expandMacros( const QString& source, const QHash< QString, QString > dict, char sep )
|
||||||
|
{
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
class KWordMacroExpander : public KMacroExpanderBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
KWordMacroExpander( QChar c )
|
||||||
|
: m_escape( c )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
virtual ~KWordMacroExpander();
|
||||||
|
virtual bool expandMacro( const QString& str, QStringList& ret );
|
||||||
|
void expandMacros( QString& s ) {}
|
||||||
|
|
||||||
|
QChar escapeChar() const { return m_escape; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
QChar m_escape;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
@ -25,6 +62,7 @@ namespace Calamares
|
|||||||
namespace String
|
namespace String
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/** @brief Expand variables in a string against a dictionary.
|
/** @brief Expand variables in a string against a dictionary.
|
||||||
*
|
*
|
||||||
* This class provides a convenience API for building up a dictionary
|
* This class provides a convenience API for building up a dictionary
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
|
#include "compat/Variant.h"
|
||||||
|
|
||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
|
|
||||||
@ -151,7 +152,7 @@ LibCalamaresTests::testLoadSaveYaml()
|
|||||||
|
|
||||||
auto map = CalamaresUtils::loadYaml( f.fileName() );
|
auto map = CalamaresUtils::loadYaml( f.fileName() );
|
||||||
QVERIFY( map.contains( "sequence" ) );
|
QVERIFY( map.contains( "sequence" ) );
|
||||||
QCOMPARE( map[ "sequence" ].type(), QVariant::List );
|
QCOMPARE( Calamares::typeOf( map[ "sequence" ] ), Calamares::ListVariantType );
|
||||||
|
|
||||||
// The source-repo example `settings.conf` has a show and an exec phase
|
// The source-repo example `settings.conf` has a show and an exec phase
|
||||||
auto sequence = map[ "sequence" ].toList();
|
auto sequence = map[ "sequence" ].toList();
|
||||||
@ -159,7 +160,7 @@ LibCalamaresTests::testLoadSaveYaml()
|
|||||||
for ( const auto& v : sequence )
|
for ( const auto& v : sequence )
|
||||||
{
|
{
|
||||||
cDebug() << Logger::SubEntry << v;
|
cDebug() << Logger::SubEntry << v;
|
||||||
QCOMPARE( v.type(), QVariant::Map );
|
QCOMPARE( Calamares::typeOf( v ), Calamares::MapVariantType );
|
||||||
QVERIFY( v.toMap().contains( "show" ) || v.toMap().contains( "exec" ) );
|
QVERIFY( v.toMap().contains( "show" ) || v.toMap().contains( "exec" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -553,11 +554,11 @@ LibCalamaresTests::testVariantStringListYAMLDashed()
|
|||||||
QTemporaryFile f;
|
QTemporaryFile f;
|
||||||
QVERIFY( f.open() );
|
QVERIFY( f.open() );
|
||||||
f.write( R"(---
|
f.write( R"(---
|
||||||
strings:
|
strings:
|
||||||
- aap
|
- aap
|
||||||
- noot
|
- noot
|
||||||
- mies
|
- mies
|
||||||
)" );
|
)" );
|
||||||
f.close();
|
f.close();
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QVariantMap m = loadYaml( f.fileName(), &ok );
|
QVariantMap m = loadYaml( f.fileName(), &ok );
|
||||||
@ -581,8 +582,8 @@ LibCalamaresTests::testVariantStringListYAMLBracketed()
|
|||||||
QTemporaryFile f;
|
QTemporaryFile f;
|
||||||
QVERIFY( f.open() );
|
QVERIFY( f.open() );
|
||||||
f.write( R"(---
|
f.write( R"(---
|
||||||
strings: [ aap, noot, mies ]
|
strings: [ aap, noot, mies ]
|
||||||
)" );
|
)" );
|
||||||
f.close();
|
f.close();
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QVariantMap m = loadYaml( f.fileName(), &ok );
|
QVariantMap m = loadYaml( f.fileName(), &ok );
|
||||||
@ -604,24 +605,24 @@ LibCalamaresTests::testStringTruncation()
|
|||||||
using namespace Calamares::String;
|
using namespace Calamares::String;
|
||||||
|
|
||||||
const QString longString( R"(---
|
const QString longString( R"(---
|
||||||
--- src/libcalamares/utils/String.h
|
--- src/libcalamares/utils/String.h
|
||||||
+++ src/libcalamares/utils/String.h
|
+++ src/libcalamares/utils/String.h
|
||||||
@@ -62,15 +62,22 @@ DLLEXPORT QString removeDiacritics( const QString& string );
|
@@ -62,15 +62,22 @@ DLLEXPORT QString removeDiacritics( const QString& string );
|
||||||
*/
|
*/
|
||||||
DLLEXPORT QString obscure( const QString& string );
|
DLLEXPORT QString obscure( const QString& string );
|
||||||
|
|
||||||
+/** @brief Parameter for counting lines at beginning and end of string
|
+/** @brief Parameter for counting lines at beginning and end of string
|
||||||
+ *
|
+ *
|
||||||
+ * This is used by truncateMultiLine() to indicate how many lines from
|
+ * This is used by truncateMultiLine() to indicate how many lines from
|
||||||
+ * the beginning and how many from the end should be kept.
|
+ * the beginning and how many from the end should be kept.
|
||||||
+ */
|
+ */
|
||||||
struct LinesStartEnd
|
struct LinesStartEnd
|
||||||
{
|
{
|
||||||
- int atStart;
|
- int atStart;
|
||||||
- int atEnd;
|
- int atEnd;
|
||||||
+ int atStart = 0;
|
+ int atStart = 0;
|
||||||
+ int atEnd = 0;
|
+ int atEnd = 0;
|
||||||
)" );
|
)" );
|
||||||
|
|
||||||
const int sufficientLength = 812;
|
const int sufficientLength = 812;
|
||||||
// There's 18 lines in all
|
// There's 18 lines in all
|
||||||
@ -685,8 +686,8 @@ LibCalamaresTests::testStringTruncationShorter()
|
|||||||
using namespace Calamares::String;
|
using namespace Calamares::String;
|
||||||
|
|
||||||
const QString longString( R"(Some strange string artifacts appeared, leading to `{1?}` being
|
const QString longString( R"(Some strange string artifacts appeared, leading to `{1?}` being
|
||||||
displayed in various user-facing messages. These have been removed
|
displayed in various user-facing messages. These have been removed
|
||||||
and the translations updated.)" );
|
and the translations updated.)" );
|
||||||
const char NEWLINE = '\n';
|
const char NEWLINE = '\n';
|
||||||
|
|
||||||
const int insufficientLength = 42;
|
const int insufficientLength = 42;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "Variant.h"
|
#include "Variant.h"
|
||||||
|
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
#include "compat/Variant.h"
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
@ -29,7 +30,7 @@ getBool( const QVariantMap& map, const QString& key, bool d )
|
|||||||
if ( map.contains( key ) )
|
if ( map.contains( key ) )
|
||||||
{
|
{
|
||||||
auto v = map.value( key );
|
auto v = map.value( key );
|
||||||
if ( v.type() == QVariant::Bool )
|
if ( Calamares::typeOf( v ) == Calamares::BoolVariantType )
|
||||||
{
|
{
|
||||||
return v.toBool();
|
return v.toBool();
|
||||||
}
|
}
|
||||||
@ -43,7 +44,7 @@ getString( const QVariantMap& map, const QString& key, const QString& d )
|
|||||||
if ( map.contains( key ) )
|
if ( map.contains( key ) )
|
||||||
{
|
{
|
||||||
auto v = map.value( key );
|
auto v = map.value( key );
|
||||||
if ( v.type() == QVariant::String )
|
if ( Calamares::typeOf( v ) == Calamares::StringVariantType )
|
||||||
{
|
{
|
||||||
return v.toString();
|
return v.toString();
|
||||||
}
|
}
|
||||||
@ -57,7 +58,7 @@ getStringList( const QVariantMap& map, const QString& key, const QStringList& d
|
|||||||
if ( map.contains( key ) )
|
if ( map.contains( key ) )
|
||||||
{
|
{
|
||||||
auto v = map.value( key );
|
auto v = map.value( key );
|
||||||
if ( v.canConvert( QMetaType::QStringList ) )
|
if ( v.canConvert< QStringList >() )
|
||||||
{
|
{
|
||||||
return v.toStringList();
|
return v.toStringList();
|
||||||
}
|
}
|
||||||
@ -71,7 +72,7 @@ getList( const QVariantMap& map, const QString& key, const QList< QVariant >& d
|
|||||||
if ( map.contains( key ) )
|
if ( map.contains( key ) )
|
||||||
{
|
{
|
||||||
auto v = map.value( key );
|
auto v = map.value( key );
|
||||||
if ( v.canConvert( QVariant::List ) )
|
if ( v.canConvert< QVariantList >() )
|
||||||
{
|
{
|
||||||
return v.toList();
|
return v.toList();
|
||||||
}
|
}
|
||||||
@ -107,11 +108,11 @@ getDouble( const QVariantMap& map, const QString& key, double d )
|
|||||||
if ( map.contains( key ) )
|
if ( map.contains( key ) )
|
||||||
{
|
{
|
||||||
auto v = map.value( key );
|
auto v = map.value( key );
|
||||||
if ( v.type() == QVariant::Int )
|
if ( Calamares::typeOf( v ) == Calamares::IntVariantType )
|
||||||
{
|
{
|
||||||
return v.toInt();
|
return v.toInt();
|
||||||
}
|
}
|
||||||
else if ( v.type() == QVariant::Double )
|
else if ( Calamares::typeOf( v ) == Calamares::DoubleVariantType )
|
||||||
{
|
{
|
||||||
return v.toDouble();
|
return v.toDouble();
|
||||||
}
|
}
|
||||||
@ -126,7 +127,7 @@ getSubMap( const QVariantMap& map, const QString& key, bool& success, const QVar
|
|||||||
if ( map.contains( key ) )
|
if ( map.contains( key ) )
|
||||||
{
|
{
|
||||||
auto v = map.value( key );
|
auto v = map.value( key );
|
||||||
if ( v.type() == QVariant::Map )
|
if ( Calamares::typeOf( v ) == Calamares::MapVariantType )
|
||||||
{
|
{
|
||||||
success = true;
|
success = true;
|
||||||
return v.toMap();
|
return v.toMap();
|
||||||
|
@ -12,12 +12,13 @@
|
|||||||
*/
|
*/
|
||||||
#include "Yaml.h"
|
#include "Yaml.h"
|
||||||
|
|
||||||
|
#include "compat/Variant.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QRegExp>
|
#include <QRegularExpression>
|
||||||
|
|
||||||
void
|
void
|
||||||
operator>>( const YAML::Node& node, QStringList& v )
|
operator>>( const YAML::Node& node, QStringList& v )
|
||||||
@ -31,9 +32,6 @@ operator>>( const YAML::Node& node, QStringList& v )
|
|||||||
namespace CalamaresUtils
|
namespace CalamaresUtils
|
||||||
{
|
{
|
||||||
|
|
||||||
const QRegExp _yamlScalarTrueValues = QRegExp( "true|True|TRUE|on|On|ON" );
|
|
||||||
const QRegExp _yamlScalarFalseValues = QRegExp( "false|False|FALSE|off|Off|OFF" );
|
|
||||||
|
|
||||||
QVariant
|
QVariant
|
||||||
yamlToVariant( const YAML::Node& node )
|
yamlToVariant( const YAML::Node& node )
|
||||||
{
|
{
|
||||||
@ -59,21 +57,26 @@ yamlToVariant( const YAML::Node& node )
|
|||||||
QVariant
|
QVariant
|
||||||
yamlScalarToVariant( const YAML::Node& scalarNode )
|
yamlScalarToVariant( const YAML::Node& scalarNode )
|
||||||
{
|
{
|
||||||
|
static const auto yamlScalarTrueValues = QRegularExpression( "^(true|True|TRUE|on|On|ON)$" );
|
||||||
|
static const auto yamlScalarFalseValues = QRegularExpression( "^(false|False|FALSE|off|Off|OFF)$" );
|
||||||
|
static const auto yamlIntegerValues = QRegularExpression( "^[-+]?\\d+$" );
|
||||||
|
static const auto yamlFloatValues = QRegularExpression( "^[-+]?\\d*\\.?\\d+$" );
|
||||||
|
|
||||||
std::string stdScalar = scalarNode.as< std::string >();
|
std::string stdScalar = scalarNode.as< std::string >();
|
||||||
QString scalarString = QString::fromStdString( stdScalar );
|
QString scalarString = QString::fromStdString( stdScalar );
|
||||||
if ( _yamlScalarTrueValues.exactMatch( scalarString ) )
|
if ( yamlScalarTrueValues.match( scalarString ).hasMatch() )
|
||||||
{
|
{
|
||||||
return QVariant( true );
|
return QVariant( true );
|
||||||
}
|
}
|
||||||
if ( _yamlScalarFalseValues.exactMatch( scalarString ) )
|
if ( yamlScalarFalseValues.match( scalarString ).hasMatch() )
|
||||||
{
|
{
|
||||||
return QVariant( false );
|
return QVariant( false );
|
||||||
}
|
}
|
||||||
if ( QRegExp( "[-+]?\\d+" ).exactMatch( scalarString ) )
|
if ( yamlIntegerValues.match( scalarString ).hasMatch() )
|
||||||
{
|
{
|
||||||
return QVariant( scalarString.toLongLong() );
|
return QVariant( scalarString.toLongLong() );
|
||||||
}
|
}
|
||||||
if ( QRegExp( "[-+]?\\d*\\.?\\d+" ).exactMatch( scalarString ) )
|
if ( yamlFloatValues.match( scalarString ).hasMatch() )
|
||||||
{
|
{
|
||||||
return QVariant( scalarString.toDouble() );
|
return QVariant( scalarString.toDouble() );
|
||||||
}
|
}
|
||||||
@ -204,7 +207,8 @@ loadYaml( const QString& filename, bool* ok )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( yamlContents.isValid() && !yamlContents.isNull() && yamlContents.type() == QVariant::Map )
|
if ( yamlContents.isValid() && !yamlContents.isNull()
|
||||||
|
&& Calamares::typeOf( yamlContents ) == Calamares::MapVariantType )
|
||||||
{
|
{
|
||||||
if ( ok )
|
if ( ok )
|
||||||
{
|
{
|
||||||
@ -237,35 +241,36 @@ static const char newline[] = "\n";
|
|||||||
static void
|
static void
|
||||||
dumpYamlElement( QFile& f, const QVariant& value, int indent )
|
dumpYamlElement( QFile& f, const QVariant& value, int indent )
|
||||||
{
|
{
|
||||||
if ( value.type() == QVariant::Type::Bool )
|
const auto t = Calamares::typeOf( value );
|
||||||
|
if ( t == Calamares::BoolVariantType )
|
||||||
{
|
{
|
||||||
f.write( value.toBool() ? "true" : "false" );
|
f.write( value.toBool() ? "true" : "false" );
|
||||||
}
|
}
|
||||||
else if ( value.type() == QVariant::Type::String )
|
else if ( t == Calamares::StringVariantType )
|
||||||
{
|
{
|
||||||
f.write( quote );
|
f.write( quote );
|
||||||
f.write( value.toString().toUtf8() );
|
f.write( value.toString().toUtf8() );
|
||||||
f.write( quote );
|
f.write( quote );
|
||||||
}
|
}
|
||||||
else if ( value.type() == QVariant::Type::Int )
|
else if ( t == Calamares::IntVariantType )
|
||||||
{
|
{
|
||||||
f.write( QString::number( value.toInt() ).toUtf8() );
|
f.write( QString::number( value.toInt() ).toUtf8() );
|
||||||
}
|
}
|
||||||
else if ( value.type() == QVariant::Type::LongLong )
|
else if ( t == Calamares::LongLongVariantType )
|
||||||
{
|
{
|
||||||
f.write( QString::number( value.toLongLong() ).toUtf8() );
|
f.write( QString::number( value.toLongLong() ).toUtf8() );
|
||||||
}
|
}
|
||||||
else if ( value.type() == QVariant::Type::Double )
|
else if ( t == Calamares::DoubleVariantType )
|
||||||
{
|
{
|
||||||
f.write( QString::number( value.toDouble(), 'f', 2 ).toUtf8() );
|
f.write( QString::number( value.toDouble(), 'f', 2 ).toUtf8() );
|
||||||
}
|
}
|
||||||
else if ( value.canConvert( QVariant::Type::ULongLong ) )
|
else if ( value.canConvert< qulonglong >() )
|
||||||
{
|
{
|
||||||
// This one needs to be *after* bool, int, double to avoid this branch
|
// This one needs to be *after* bool, int, double to avoid this branch
|
||||||
// .. grabbing those convertible types un-necessarily.
|
// .. grabbing those convertible types un-necessarily.
|
||||||
f.write( QString::number( value.toULongLong() ).toUtf8() );
|
f.write( QString::number( value.toULongLong() ).toUtf8() );
|
||||||
}
|
}
|
||||||
else if ( value.type() == QVariant::Type::List )
|
else if ( t == Calamares::ListVariantType )
|
||||||
{
|
{
|
||||||
int c = 0;
|
int c = 0;
|
||||||
for ( const auto& it : value.toList() )
|
for ( const auto& it : value.toList() )
|
||||||
@ -281,7 +286,7 @@ dumpYamlElement( QFile& f, const QVariant& value, int indent )
|
|||||||
f.write( "[]" );
|
f.write( "[]" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( value.type() == QVariant::Type::Map )
|
else if ( t == Calamares::MapVariantType )
|
||||||
{
|
{
|
||||||
f.write( newline );
|
f.write( newline );
|
||||||
dumpYaml( f, value.toMap(), indent + 1 );
|
dumpYaml( f, value.toMap(), indent + 1 );
|
||||||
|
@ -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)
|
||||||
|
@ -287,6 +287,37 @@ isAtVeryEnd( const ViewStepList& steps, int index )
|
|||||||
return ( index >= steps.count() ) || ( index == steps.count() - 1 && steps.last()->isAtEnd() );
|
return ( index >= steps.count() ) || ( index == steps.count() - 1 && steps.last()->isAtEnd() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
questionBox( QWidget* parent,
|
||||||
|
const QString& title,
|
||||||
|
const QString& question,
|
||||||
|
const QString& button0,
|
||||||
|
const QString& button1 )
|
||||||
|
{
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
|
||||||
|
QMessageBox mb( QMessageBox::Question, title, question, QMessageBox::StandardButton::NoButton, parent );
|
||||||
|
const auto* const okButton = mb.addButton( button0, QMessageBox::AcceptRole );
|
||||||
|
mb.addButton( button1, QMessageBox::RejectRole );
|
||||||
|
mb.exec();
|
||||||
|
if ( mb.clickedButton() == okButton )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1; // Cancel
|
||||||
|
#else
|
||||||
|
return QMessageBox::question( parent,
|
||||||
|
title,
|
||||||
|
question,
|
||||||
|
button0,
|
||||||
|
button1,
|
||||||
|
QString(),
|
||||||
|
0 /* default first button, i.e. confirm */,
|
||||||
|
1 /* escape is second button, i.e. cancel */ );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewManager::next()
|
ViewManager::next()
|
||||||
{
|
{
|
||||||
@ -318,15 +349,11 @@ ViewManager::next()
|
|||||||
QString confirm = settings->isSetupMode() ? tr( "&Set up now" ) : tr( "&Install now" );
|
QString confirm = settings->isSetupMode() ? tr( "&Set up now" ) : tr( "&Install now" );
|
||||||
|
|
||||||
const auto* branding = Calamares::Branding::instance();
|
const auto* branding = Calamares::Branding::instance();
|
||||||
int reply
|
int reply = questionBox( m_widget,
|
||||||
= QMessageBox::question( m_widget,
|
|
||||||
title,
|
title,
|
||||||
question.arg( branding->shortProductName(), branding->shortVersionedName() ),
|
question.arg( branding->shortProductName(), branding->shortVersionedName() ),
|
||||||
confirm,
|
confirm,
|
||||||
tr( "Go &back" ),
|
tr( "Go &back" ) );
|
||||||
QString(),
|
|
||||||
0 /* default first button, i.e. confirm */,
|
|
||||||
1 /* escape is second button, i.e. cancel */ );
|
|
||||||
if ( reply == 1 )
|
if ( reply == 1 )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -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 );
|
||||||
}
|
}
|
||||||
|
@ -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 )
|
||||||
{
|
{
|
||||||
|
@ -21,6 +21,10 @@ string(REPLACE " " ";" SKIP_LIST "${SKIP_MODULES}")
|
|||||||
file(GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*")
|
file(GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*")
|
||||||
list(SORT SUBDIRECTORIES)
|
list(SORT SUBDIRECTORIES)
|
||||||
|
|
||||||
|
if(WITH_QT6) # TODO: Qt6
|
||||||
|
set(SUBDIRECTORIES finished finishedq welcome welcomeq)
|
||||||
|
endif()
|
||||||
|
|
||||||
foreach(SUBDIRECTORY ${SUBDIRECTORIES})
|
foreach(SUBDIRECTORY ${SUBDIRECTORIES})
|
||||||
calamares_add_module_subdirectory( ${SUBDIRECTORY} LIST_SKIPPED_MODULES )
|
calamares_add_module_subdirectory( ${SUBDIRECTORY} LIST_SKIPPED_MODULES )
|
||||||
endforeach()
|
endforeach()
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
||||||
# SPDX-License-Identifier: BSD-2-Clause
|
# SPDX-License-Identifier: BSD-2-Clause
|
||||||
#
|
#
|
||||||
find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED DBus Network)
|
find_package(${qtname} ${QT_VERSION} CONFIG REQUIRED DBus Network)
|
||||||
|
|
||||||
include_directories(${PROJECT_BINARY_DIR}/src/libcalamaresui)
|
include_directories(${PROJECT_BINARY_DIR}/src/libcalamaresui)
|
||||||
|
|
||||||
@ -17,6 +17,6 @@ calamares_add_plugin(finished
|
|||||||
UI
|
UI
|
||||||
FinishedPage.ui
|
FinishedPage.ui
|
||||||
LINK_PRIVATE_LIBRARIES
|
LINK_PRIVATE_LIBRARIES
|
||||||
Qt5::DBus
|
${qtname}::DBus
|
||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
)
|
)
|
||||||
|
@ -8,8 +8,8 @@ if(NOT WITH_QML)
|
|||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(Qt5 ${QT_VERSION} CONFIG COMPONENTS DBus Network)
|
find_package(${qtname} ${QT_VERSION} CONFIG COMPONENTS DBus Network)
|
||||||
if(NOT TARGET Qt5::DBus OR NOT TARGET Qt5::Network)
|
if(NOT TARGET ${qtname}::DBus OR NOT TARGET ${qtname}::Network)
|
||||||
calamares_skip_module( "finishedq (missing DBus or Network)" )
|
calamares_skip_module( "finishedq (missing DBus or Network)" )
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
@ -26,6 +26,6 @@ calamares_add_plugin(finishedq
|
|||||||
RESOURCES
|
RESOURCES
|
||||||
finishedq.qrc
|
finishedq.qrc
|
||||||
LINK_PRIVATE_LIBRARIES
|
LINK_PRIVATE_LIBRARIES
|
||||||
Qt5::DBus
|
${qtname}::DBus
|
||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
)
|
)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
||||||
# SPDX-License-Identifier: BSD-2-Clause
|
# SPDX-License-Identifier: BSD-2-Clause
|
||||||
#
|
#
|
||||||
find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED DBus Network)
|
find_package(${qtname} ${QT_VERSION} CONFIG REQUIRED DBus Network)
|
||||||
|
|
||||||
find_package(LIBPARTED)
|
find_package(LIBPARTED)
|
||||||
if(LIBPARTED_FOUND)
|
if(LIBPARTED_FOUND)
|
||||||
@ -34,13 +34,13 @@ calamares_add_plugin(welcome
|
|||||||
welcome.qrc
|
welcome.qrc
|
||||||
LINK_PRIVATE_LIBRARIES
|
LINK_PRIVATE_LIBRARIES
|
||||||
${PARTMAN_LIB}
|
${PARTMAN_LIB}
|
||||||
Qt5::DBus
|
${qtname}::DBus
|
||||||
Qt5::Network
|
${qtname}::Network
|
||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
)
|
)
|
||||||
|
|
||||||
calamares_add_test(
|
calamares_add_test(
|
||||||
welcometest
|
welcometest
|
||||||
SOURCES checker/GeneralRequirements.cpp ${PARTMAN_SRC} Config.cpp Tests.cpp
|
SOURCES checker/GeneralRequirements.cpp ${PARTMAN_SRC} Config.cpp Tests.cpp
|
||||||
LIBRARIES ${PARTMAN_LIB} Qt5::DBus Qt5::Network Qt5::Widgets Calamares::calamaresui
|
LIBRARIES ${PARTMAN_LIB} ${qtname}::DBus ${qtname}::Network ${qtname}::Widgets Calamares::calamaresui
|
||||||
)
|
)
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
|
#include "compat/Variant.h"
|
||||||
#include "geoip/Handler.h"
|
#include "geoip/Handler.h"
|
||||||
#include "locale/Global.h"
|
#include "locale/Global.h"
|
||||||
#include "locale/Lookup.h"
|
#include "locale/Lookup.h"
|
||||||
@ -301,11 +302,11 @@ jobOrBrandingSetting( Calamares::Branding::StringEntry e, const QVariantMap& map
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
auto v = map.value( key );
|
auto v = map.value( key );
|
||||||
if ( v.type() == QVariant::Bool )
|
if ( Calamares::typeOf( v ) == Calamares::BoolVariantType )
|
||||||
{
|
{
|
||||||
return v.toBool() ? ( Calamares::Branding::instance()->string( e ) ) : QString();
|
return v.toBool() ? ( Calamares::Branding::instance()->string( e ) ) : QString();
|
||||||
}
|
}
|
||||||
if ( v.type() == QVariant::String )
|
if ( Calamares::typeOf( v ) == Calamares::StringVariantType )
|
||||||
{
|
{
|
||||||
return v.toString();
|
return v.toString();
|
||||||
}
|
}
|
||||||
@ -417,7 +418,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
::setGeoIP( this, configurationMap );
|
::setGeoIP( this, configurationMap );
|
||||||
|
|
||||||
if ( configurationMap.contains( "requirements" )
|
if ( configurationMap.contains( "requirements" )
|
||||||
&& configurationMap.value( "requirements" ).type() == QVariant::Map )
|
&& Calamares::typeOf( configurationMap.value( "requirements" ) ) == Calamares::MapVariantType )
|
||||||
{
|
{
|
||||||
m_requirementsChecker->setConfigurationMap( configurationMap.value( "requirements" ).toMap() );
|
m_requirementsChecker->setConfigurationMap( configurationMap.value( "requirements" ).toMap() );
|
||||||
}
|
}
|
||||||
|
@ -62,11 +62,11 @@ WelcomeTests::testOneUrl()
|
|||||||
|
|
||||||
// BUILD_AS_TEST is the source-directory path
|
// BUILD_AS_TEST is the source-directory path
|
||||||
QString filename = QStringLiteral( "1a-checkinternet.conf" );
|
QString filename = QStringLiteral( "1a-checkinternet.conf" );
|
||||||
QFile fi( QString( "%1/tests/%2" ).arg( BUILD_AS_TEST, filename ) );
|
QFileInfo fi( QString( "%1/tests/%2" ).arg( BUILD_AS_TEST, filename ) );
|
||||||
QVERIFY( fi.exists() );
|
QVERIFY( fi.exists() );
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
const auto map = CalamaresUtils::loadYaml( fi, &ok );
|
const auto map = CalamaresUtils::loadYaml( QFileInfo( fi ), &ok );
|
||||||
QVERIFY( ok );
|
QVERIFY( ok );
|
||||||
QVERIFY( map.count() > 0 );
|
QVERIFY( map.count() > 0 );
|
||||||
QVERIFY( map.contains( "requirements" ) );
|
QVERIFY( map.contains( "requirements" ) );
|
||||||
@ -100,7 +100,7 @@ WelcomeTests::testUrls()
|
|||||||
Config c;
|
Config c;
|
||||||
|
|
||||||
// BUILD_AS_TEST is the source-directory path
|
// BUILD_AS_TEST is the source-directory path
|
||||||
QFile fi( QString( "%1/tests/%2" ).arg( BUILD_AS_TEST, filename ) );
|
QFileInfo fi( QString( "%1/tests/%2" ).arg( BUILD_AS_TEST, filename ) );
|
||||||
QVERIFY( fi.exists() );
|
QVERIFY( fi.exists() );
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
@ -130,7 +130,7 @@ WelcomeTests::testBadConfigDoesNotResetUrls()
|
|||||||
const QString filename = QStringLiteral( "1b-checkinternet.conf" ); // "none"
|
const QString filename = QStringLiteral( "1b-checkinternet.conf" ); // "none"
|
||||||
|
|
||||||
// BUILD_AS_TEST is the source-directory path
|
// BUILD_AS_TEST is the source-directory path
|
||||||
QFile fi( QString( "%1/tests/%2" ).arg( BUILD_AS_TEST, filename ) );
|
QFileInfo fi( QString( "%1/tests/%2" ).arg( BUILD_AS_TEST, filename ) );
|
||||||
QVERIFY( fi.exists() );
|
QVERIFY( fi.exists() );
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
@ -147,7 +147,7 @@ WelcomeTests::testBadConfigDoesNotResetUrls()
|
|||||||
const QString filename = QStringLiteral( "1d-checkinternet.conf" ); // "bogus"
|
const QString filename = QStringLiteral( "1d-checkinternet.conf" ); // "bogus"
|
||||||
|
|
||||||
// BUILD_AS_TEST is the source-directory path
|
// BUILD_AS_TEST is the source-directory path
|
||||||
QFile fi( QString( "%1/tests/%2" ).arg( BUILD_AS_TEST, filename ) );
|
QFileInfo fi( QString( "%1/tests/%2" ).arg( BUILD_AS_TEST, filename ) );
|
||||||
QVERIFY( fi.exists() );
|
QVERIFY( fi.exists() );
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
|
#include "compat/Variant.h"
|
||||||
#include "modulesystem/Requirement.h"
|
#include "modulesystem/Requirement.h"
|
||||||
#include "network/Manager.h"
|
#include "network/Manager.h"
|
||||||
#include "utils/CalamaresUtilsGui.h"
|
#include "utils/CalamaresUtilsGui.h"
|
||||||
@ -330,7 +331,8 @@ GeneralRequirements::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
{
|
{
|
||||||
bool incompleteConfiguration = false;
|
bool incompleteConfiguration = false;
|
||||||
|
|
||||||
if ( configurationMap.contains( "check" ) && configurationMap.value( "check" ).type() == QVariant::List )
|
if ( configurationMap.contains( "check" )
|
||||||
|
&& Calamares::typeOf( configurationMap.value( "check" ) ) == Calamares::ListVariantType )
|
||||||
{
|
{
|
||||||
m_entriesToCheck.clear();
|
m_entriesToCheck.clear();
|
||||||
m_entriesToCheck.append( configurationMap.value( "check" ).toStringList() );
|
m_entriesToCheck.append( configurationMap.value( "check" ).toStringList() );
|
||||||
@ -341,7 +343,8 @@ GeneralRequirements::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
incompleteConfiguration = true;
|
incompleteConfiguration = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( configurationMap.contains( "required" ) && configurationMap.value( "required" ).type() == QVariant::List )
|
if ( configurationMap.contains( "required" )
|
||||||
|
&& Calamares::typeOf( configurationMap.value( "required" ) ) == Calamares::ListVariantType )
|
||||||
{
|
{
|
||||||
m_entriesToRequire.clear();
|
m_entriesToRequire.clear();
|
||||||
m_entriesToRequire.append( configurationMap.value( "required" ).toStringList() );
|
m_entriesToRequire.append( configurationMap.value( "required" ).toStringList() );
|
||||||
@ -371,8 +374,8 @@ GeneralRequirements::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( configurationMap.contains( "requiredStorage" )
|
if ( configurationMap.contains( "requiredStorage" )
|
||||||
&& ( configurationMap.value( "requiredStorage" ).type() == QVariant::Double
|
&& ( Calamares::typeOf( configurationMap.value( "requiredStorage" ) ) == Calamares::DoubleVariantType
|
||||||
|| configurationMap.value( "requiredStorage" ).type() == QVariant::LongLong ) )
|
|| Calamares::typeOf( configurationMap.value( "requiredStorage" ) ) == Calamares::LongLongVariantType ) )
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
m_requiredStorageGiB = configurationMap.value( "requiredStorage" ).toDouble( &ok );
|
m_requiredStorageGiB = configurationMap.value( "requiredStorage" ).toDouble( &ok );
|
||||||
@ -392,8 +395,8 @@ GeneralRequirements::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( configurationMap.contains( "requiredRam" )
|
if ( configurationMap.contains( "requiredRam" )
|
||||||
&& ( configurationMap.value( "requiredRam" ).type() == QVariant::Double
|
&& ( Calamares::typeOf( configurationMap.value( "requiredRam" ) ) == Calamares::DoubleVariantType
|
||||||
|| configurationMap.value( "requiredRam" ).type() == QVariant::LongLong ) )
|
|| Calamares::typeOf( configurationMap.value( "requiredRam" ) ) == Calamares::LongLongVariantType ) )
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
m_requiredRamGiB = configurationMap.value( "requiredRam" ).toDouble( &ok );
|
m_requiredRamGiB = configurationMap.value( "requiredRam" ).toDouble( &ok );
|
||||||
|
@ -17,7 +17,7 @@ set(_welcome ${CMAKE_CURRENT_SOURCE_DIR}/../welcome)
|
|||||||
include_directories(${_welcome})
|
include_directories(${_welcome})
|
||||||
|
|
||||||
# DUPLICATED WITH WELCOME MODULE
|
# DUPLICATED WITH WELCOME MODULE
|
||||||
find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED DBus Network)
|
find_package(${qtname} ${QT_VERSION} CONFIG REQUIRED DBus Network)
|
||||||
|
|
||||||
find_package(LIBPARTED)
|
find_package(LIBPARTED)
|
||||||
if(LIBPARTED_FOUND)
|
if(LIBPARTED_FOUND)
|
||||||
@ -42,7 +42,7 @@ calamares_add_plugin(welcomeq
|
|||||||
welcomeq.qrc
|
welcomeq.qrc
|
||||||
LINK_PRIVATE_LIBRARIES
|
LINK_PRIVATE_LIBRARIES
|
||||||
${CHECKER_LINK_LIBRARIES}
|
${CHECKER_LINK_LIBRARIES}
|
||||||
Qt5::DBus
|
${qtname}::DBus
|
||||||
Qt5::Network
|
${qtname}::Network
|
||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user