Merge branch 'master' of https://github.com/calamares/calamares into development

This commit is contained in:
Philip Müller 2020-06-15 12:10:15 +02:00
commit 216caf9130
35 changed files with 298 additions and 210 deletions

1
.gitignore vendored
View File

@ -50,3 +50,4 @@ CMakeLists.txt.user
# Kate
*.kate-swp
tags

12
CHANGES
View File

@ -6,14 +6,18 @@ website will have to do for older versions.
# 3.2.26 (unreleased) #
This release contains contributions from (alphabetically by first name):
- No external contributors yet
- Pablo Ovelleiro Corral
## Core ##
- No core changes yet
- External modules can now be built again, outside of the Calamares
source and build-tree.
## Modules ##
- No module changes yet
- *locale* put some more places into the correct timezone **visually**;
for instance Norfolk Island gave up UTC+11.5 in 2015 and is now
UTC+11, but Calamares still showed it in a zone separate from UTC+11.
- *packages* gained support for the Void Linux package manager,
*xbps*. (thanks Pablo)
# 3.2.25 (2020-06-06) #

View File

@ -162,7 +162,13 @@ if(NOT CMAKE_VERSION VERSION_LESS "3.10.0")
)
endif()
# CMake Modules
include( CMakePackageConfigHelpers )
include( CTest )
include( FeatureSummary )
# Calamares Modules
include( CMakeColors )
### C++ SETUP
#
@ -248,9 +254,6 @@ if( CMAKE_COMPILER_IS_GNUCXX )
endif()
endif()
include( FeatureSummary )
include( CMakeColors )
### DEPENDENCIES
#
@ -520,16 +523,10 @@ endif()
# make predefined install dirs available everywhere
include( GNUInstallDirs )
# make uninstall support
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY
)
# Early configure these files as we need them later on
set( CALAMARES_CMAKE_DIR "${CMAKE_SOURCE_DIR}/CMakeModules" )
set( CALAMARES_LIBRARIES calamares )
# This is used by CalamaresAddLibrary; once Calamares is installed,
# the CalamaresConfig.cmake module sets this variable to the IMPORTED
# libraries for Calamares.
set( Calamares_LIBRARIES calamares )
add_subdirectory( src )
@ -539,32 +536,39 @@ add_feature_info(Config ${INSTALL_CONFIG} "Install Calamares configuration")
add_feature_info(KCrash ${WITH_KF5Crash} "Crash dumps via KCrash")
add_feature_info(KDBusAddons ${WITH_KF5DBus} "Unique-application via DBus")
# Add all targets to the build-tree export set
### CMake infrastructure installation
#
#
set( CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/Calamares" CACHE PATH "Installation directory for CMake files" )
set( CMAKE_INSTALL_FULL_CMAKEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}" )
export( TARGETS calamares
FILE "${PROJECT_BINARY_DIR}/CalamaresLibraryDepends.cmake" )
# Export the package for use from the build-tree
# (this registers the build-tree with a global CMake-registry)
export( PACKAGE Calamares )
# Create a CalamaresBuildTreeSettings.cmake file for the use from the build tree
configure_file( CalamaresBuildTreeSettings.cmake.in "${PROJECT_BINARY_DIR}/CalamaresBuildTreeSettings.cmake" @ONLY )
# Create the CalamaresConfig.cmake and CalamaresConfigVersion files
file( RELATIVE_PATH CONF_REL_INCLUDE_DIR "${CMAKE_INSTALL_FULL_CMAKEDIR}" "${CMAKE_INSTALL_FULL_INCLUDEDIR}" )
configure_file( CalamaresConfig.cmake.in "${PROJECT_BINARY_DIR}/CalamaresConfig.cmake" @ONLY )
configure_file( CalamaresConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/CalamaresConfigVersion.cmake" @ONLY )
configure_file( CalamaresUse.cmake.in "${PROJECT_BINARY_DIR}/CalamaresUse.cmake" @ONLY )
configure_package_config_file(
"CalamaresConfig.cmake.in"
"${PROJECT_BINARY_DIR}/CalamaresConfig.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
PATH_VARS
CMAKE_INSTALL_INCLUDEDIR
CMAKE_INSTALL_LIBDIR
CMAKE_INSTALL_DATADIR
)
write_basic_package_version_file(
${PROJECT_BINARY_DIR}/CalamaresConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)
install(
EXPORT Calamares
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
FILE "CalamaresTargets.cmake"
NAMESPACE Calamares::
)
# Install the cmake files
install(
FILES
"${PROJECT_BINARY_DIR}/CalamaresConfig.cmake"
"${PROJECT_BINARY_DIR}/CalamaresConfigVersion.cmake"
"${PROJECT_BINARY_DIR}/CalamaresUse.cmake"
"CMakeModules/CalamaresAddBrandingSubdirectory.cmake"
"CMakeModules/CalamaresAddLibrary.cmake"
"CMakeModules/CalamaresAddModuleSubdirectory.cmake"
@ -573,48 +577,36 @@ install(
"CMakeModules/CalamaresAddTranslations.cmake"
"CMakeModules/CalamaresAutomoc.cmake"
"CMakeModules/CMakeColors.cmake"
"CMakeModules/FindYAMLCPP.cmake"
DESTINATION
"${CMAKE_INSTALL_CMAKEDIR}"
)
# Install the export set for use with the install-tree
install(
EXPORT
CalamaresLibraryDepends
DESTINATION
"${CMAKE_INSTALL_CMAKEDIR}"
)
### Miscellaneous installs
#
#
if( INSTALL_CONFIG )
install(
FILES
settings.conf
DESTINATION
share/calamares
FILES settings.conf
DESTINATIONshare/calamares
)
endif()
if( INSTALL_POLKIT )
install(
FILES
com.github.calamares.calamares.policy
DESTINATION
"${POLKITQT-1_POLICY_FILES_INSTALL_DIR}"
FILES com.github.calamares.calamares.policy
DESTINATION "${POLKITQT-1_POLICY_FILES_INSTALL_DIR}"
)
endif()
install(
FILES
calamares.desktop
DESTINATION
${CMAKE_INSTALL_DATADIR}/applications
FILES calamares.desktop
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications
)
install(
FILES
man/calamares.8
DESTINATION
${CMAKE_INSTALL_MANDIR}/man8/
FILES man/calamares.8
DESTINATION ${CMAKE_INSTALL_MANDIR}/man8/
)
# uninstall target

View File

@ -93,11 +93,10 @@ function(calamares_add_library)
# add link targets
target_link_libraries(${target}
LINK_PUBLIC ${CALAMARES_LIBRARIES}
LINK_PUBLIC ${Calamares_LIBRARIES}
Qt5::Core
Qt5::Gui
Qt5::Widgets
${LIBRARY_QT5_MODULES}
)
if(LIBRARY_LINK_LIBRARIES)
target_link_libraries(${target} LINK_PUBLIC ${LIBRARY_LINK_LIBRARIES})

View File

@ -1,4 +0,0 @@
set(CALAMARES_INCLUDE_DIRS
"@PROJECT_SOURCE_DIR@/src/libcalamares"
"@PROJECT_BINARY_DIR@/src/libcalamares"
)

View File

@ -1,32 +1,78 @@
# Config file for the Calamares package
#
# It defines the following variables
# CALAMARES_INCLUDE_DIRS - include directories for Calamares
# CALAMARES_LIBRARIES - libraries to link against
# CALAMARES_USE_FILE - name of a convenience include
# CALAMARES_APPLICATION_NAME - human-readable application name
#
# Typical use is:
#
# find_package(Calamares REQUIRED)
# include("${CALAMARES_USE_FILE}")
# The following IMPORTED targets are defined:
# - Calamares::calamares - the core library
# - Calamares::calamaresui - the UI (and QML) library
#
# For legacy use it defines the following variables:
# - Calamares_INCLUDE_DIRS - include directories for Calamares
# - Calamares_LIB_DIRS - library directories
# - Calamares_LIBRARIES - libraries to link against
# Compute paths
get_filename_component(CALAMARES_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
if(EXISTS "${CALAMARES_CMAKE_DIR}/CMakeCache.txt")
# In build tree
include("${CALAMARES_CMAKE_DIR}/CalamaresBuildTreeSettings.cmake")
else()
set(CALAMARES_INCLUDE_DIRS "${CALAMARES_CMAKE_DIR}/@CONF_REL_INCLUDE_DIR@/libcalamares")
@PACKAGE_INIT@
### Versioning and IMPORTED targets
#
#
include(${CMAKE_CURRENT_LIST_DIR}/CalamaresConfigVersion.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CalamaresTargets.cmake)
### Dependencies
#
# The libraries can depend on a variety of Qt and KDE Frameworks
# components, so accumulate them and find (just once).
#
macro(accumulate_deps outvar target namespace)
string(LENGTH ${namespace} _nslen)
get_target_property(_libs ${target} INTERFACE_LINK_LIBRARIES)
foreach(_lib ${_libs})
if (_lib MATCHES ^${namespace})
string(SUBSTRING ${_lib} ${_nslen} -1 _component)
list(APPEND ${outvar} ${_component})
endif()
endforeach()
endmacro()
# Qt5 infrastructure for translations is required
set(qt5_required Core Widgets LinguistTools)
accumulate_deps(qt5_required Calamares::calamares Qt5::)
accumulate_deps(qt5_required Calamares::calamaresui Qt5::)
find_package(Qt5 CONFIG REQUIRED ${qt5_required})
set(kf5_required "")
accumulate_deps(kf5_required Calamares::calamares KF5::)
accumulate_deps(kf5_required Calamares::calamaresui KF5::)
if(kf5_required)
find_package(ECM ${ECM_VERSION} NO_MODULE)
if( ECM_FOUND )
list(PREPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
find_package(KF5 REQUIRED COMPONENTS ${kf5_required})
endif()
endif()
# Our library dependencies (contains definitions for IMPORTED targets)
include("${CALAMARES_CMAKE_DIR}/CalamaresLibraryDepends.cmake")
### Legacy support
#
#
set(Calamares_LIB_DIRS "@PACKAGE_CMAKE_INSTALL_LIBDIR@")
set(Calamares_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
set(Calamares_LIBRARIES Calamares::calamares)
# These are IMPORTED targets created by CalamaresLibraryDepends.cmake
set(CALAMARES_LIBRARIES calamares)
### CMake support
#
#
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
# Convenience variables
set(CALAMARES_USE_FILE "${CALAMARES_CMAKE_DIR}/CalamaresUse.cmake")
set(CALAMARES_APPLICATION_NAME "Calamares")
include(CalamaresAddBrandingSubdirectory)
include(CalamaresAddLibrary)
include(CalamaresAddModuleSubdirectory)
include(CalamaresAddPlugin)
# These are feature-settings that affect consumers of Calamares
# libraries as well; without Python-support in the libs, for instance,
# there's no point in having a Python plugin.
#
# This list should match the one in libcalamares/CalamaresConfig.h,
# which is the C++-language side of the same configuration.
set(Calamares_WITH_PYTHON @WITH_PYTHON@)
set(Calamares_WITH_PYTHONQT @WITH_PYTHONQT@)
set(Calamares_WITH_QML @WITH_QML@)

View File

@ -1,12 +0,0 @@
set(PACKAGE_VERSION "@CALAMARES_VERSION@")
# Check whether the requested PACKAGE_FIND_VERSION is compatible
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()

View File

@ -1,29 +0,0 @@
# A setup-cmake-things-for-Calamares module.
#
# This module handles looking for dependencies and including
# all of the Calamares macro modules, so that you can focus
# on just using the macros to build Calamares modules.
# Typical use looks like this:
#
# ```
# find_package( Calamares REQUIRED )
# include( "${CALAMARES_CMAKE_DIR}/CalamaresUse.cmake" )
# ```
#
# The first CMake command finds Calamares (which will contain
# this file), then adds the found location to the search path,
# and then includes this file. After that, you can use
# Calamares module and plugin macros.
if( NOT CALAMARES_CMAKE_DIR )
message( FATAL_ERROR "Use find_package(Calamares) first." )
endif()
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CALAMARES_CMAKE_DIR} )
find_package( Qt5 @QT_VERSION@ CONFIG REQUIRED Core Widgets LinguistTools )
include( CalamaresAddLibrary )
include( CalamaresAddModuleSubdirectory )
include( CalamaresAddPlugin )
include( CalamaresAddBrandingSubdirectory )

View File

@ -159,7 +159,7 @@ dont-chroot: false
# If this is set to true, Calamares refers to itself as a "setup program"
# rather than an "installer". Defaults to the value of dont-chroot, but
# Calamares will complain if this is not explicitly set.
# oem-setup: true
oem-setup: false
# If this is set to true, the "Cancel" button will be disabled entirely.
# The button is also hidden from view.

View File

@ -163,21 +163,25 @@ set_target_properties( calamares
PROPERTIES
VERSION ${CALAMARES_VERSION_SHORT}
SOVERSION ${CALAMARES_VERSION_SHORT}
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_INSTALL_FULL_INCLUDEDIR}/libcalamares
)
calamares_automoc( calamares )
target_link_libraries( calamares
LINK_PRIVATE
${OPTIONAL_PRIVATE_LIBRARIES}
LINK_PUBLIC
yamlcpp
LINK_PUBLIC
Qt5::Core
KF5::CoreAddons
${OPTIONAL_PUBLIC_LIBRARIES}
)
### Installation
#
#
install( TARGETS calamares
EXPORT CalamaresLibraryDepends
EXPORT Calamares
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
@ -192,13 +196,18 @@ install( CODE "
# Install header files
file( GLOB rootHeaders "*.h" )
file( GLOB kdsingleapplicationguardHeaders "kdsingleapplicationguard/*.h" )
file( GLOB utilsHeaders "utils/*.h" )
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/CalamaresConfig.h
${rootHeaders}
DESTINATION include/libcalamares
)
# Install each subdir-worth of header files
foreach( subdir geoip locale modulesystem network partition utils )
file( GLOB subdir_headers "${subdir}/*.h" )
install( FILES ${subdir_headers} DESTINATION include/libcalamares/${subdir} )
endforeach()
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/CalamaresConfig.h DESTINATION include/libcalamares )
install( FILES ${rootHeaders} DESTINATION include/libcalamares )
install( FILES ${kdsingleapplicationguardHeaders} DESTINATION include/libcalamares/kdsingleapplicationguard )
install( FILES ${utilsHeaders} DESTINATION include/libcalamares/utils )
### TESTING
#

View File

@ -29,7 +29,14 @@
#define CMAKE_INSTALL_FULL_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}/calamares"
#define CMAKE_INSTALL_FULL_SYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}"
//cmakedefines for CMake variables (e.g. for optdepends) go here
/*
* These are feature-settings that affect consumers of Calamares
* libraries as well; without Python-support in the libs, for instance,
* there's no point in having a Python plugin.
*
* This list should match the one in CalamaresConfig.cmake
* which is the CMake-time side of the same configuration.
*/
#cmakedefine WITH_PYTHON
#cmakedefine WITH_PYTHONQT
#cmakedefine WITH_QML

View File

@ -96,13 +96,16 @@ RequirementsModel::roleNames() const
void
RequirementsModel::describe() const
{
cDebug() << "Requirements model has" << m_requirements.count() << "items";
bool acceptable = true;
int count = 0;
for ( const auto& r : m_requirements )
{
cDebug() << Logger::SubEntry << "requirement" << count << r.name
<< "satisfied?" << r.satisfied
<< "mandatory?" << r.mandatory;
if ( r.mandatory && !r.satisfied )
{
cDebug() << Logger::SubEntry << "requirement" << count << r.name << "is not satisfied.";
acceptable = false;
}
++count;

View File

@ -66,8 +66,9 @@ calamares_add_library( calamaresui
EXPORT_MACRO UIDLLEXPORT_PRO
LINK_LIBRARIES
Qt5::Svg
yamlcpp
RESOURCES libcalamaresui.qrc
EXPORT CalamaresLibraryDepends
EXPORT Calamares
VERSION ${CALAMARES_VERSION_SHORT}
)
@ -82,3 +83,25 @@ endif()
if( WITH_QML )
target_link_libraries( calamaresui PUBLIC Qt5::QuickWidgets )
endif()
### Installation
#
#
# The library is already installed through calamares_add_library(),
# so we only need to do headers. Unlike the Calamares source tree,
# where libcalamares and libcalamaresui live in different branches,
# we're going to glom it all together in the installed headers location.
install(
FILES
Branding.h
ViewManager.h
DESTINATION include/libcalamares
)
# Install each subdir-worth of header files
foreach( subdir modulesystem utils viewpages widgets )
file( GLOB subdir_headers "${subdir}/*.h" )
install( FILES ${subdir_headers} DESTINATION include/libcalamares/${subdir} )
endforeach()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 867 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -21,7 +21,6 @@
<file>images/timezone_10.0.png</file>
<file>images/timezone_10.5.png</file>
<file>images/timezone_11.0.png</file>
<file>images/timezone_11.5.png</file>
<file>images/timezone_12.0.png</file>
<file>images/timezone_12.75.png</file>
<file>images/timezone_13.0.png</file>

View File

@ -26,7 +26,7 @@
static const char* zoneNames[]
= { "0.0", "1.0", "2.0", "3.0", "3.5", "4.0", "4.5", "5.0", "5.5", "5.75", "6.0", "6.5", "7.0",
"8.0", "9.0", "9.5", "10.0", "10.5", "11.0", "11.5", "12.0", "12.75", "13.0", "-1.0", "-2.0", "-3.0",
"8.0", "9.0", "9.5", "10.0", "10.5", "11.0", "12.0", "12.75", "13.0", "-1.0", "-2.0", "-3.0",
"-3.5", "-4.0", "-4.5", "-5.0", "-5.5", "-6.0", "-7.0", "-8.0", "-9.0", "-9.5", "-10.0", "-11.0" };
static_assert( TimeZoneImageList::zoneCount == ( sizeof( zoneNames ) / sizeof( zoneNames[ 0 ] ) ),
"Incorrect number of zones" );
@ -36,7 +36,7 @@ static_assert( TimeZoneImageList::zoneCount == ( sizeof( zoneNames ) / sizeof( z
/* static constexpr */ const int TimeZoneImageList::zoneCount;
/* static constexpr */ const QSize TimeZoneImageList::imageSize;
static_assert( TimeZoneImageList::zoneCount == 38 );
static_assert( TimeZoneImageList::zoneCount == 37 );
TimeZoneImageList::TimeZoneImageList() {}

View File

@ -77,7 +77,7 @@ public:
QImage find( QPoint p ) const;
/// @brief The **expected** number of zones in the list.
static constexpr const int zoneCount = 38;
static constexpr const int zoneCount = 37;
/// @brief The expected size of each zone image.
static constexpr const QSize imageSize = QSize( 780, 340 );
};

View File

@ -52,8 +52,13 @@ def mount_partition(root_mount_point, partition, partitions):
# Ensure that the created directory has the correct SELinux context on
# SELinux-enabled systems.
os.makedirs(mount_point, exist_ok=True)
subprocess.call(['chcon', '--reference=' + raw_mount_point,
mount_point])
try:
subprocess.call(['chcon', '--reference=' + raw_mount_point, mount_point])
except FileNotFoundError as e:
libcalamares.utils.warning(str(e))
except OSError:
libcalamares.utils.error("Cannot run 'chcon' normally.")
raise
fstype = partition.get("fs", "").lower()

View File

@ -26,5 +26,6 @@ calamares_add_test(
PackageModel.cpp
LIBRARIES
Qt5::Gui
yamlcpp
)

View File

@ -274,6 +274,20 @@ class PMApt(PackageManager):
# Doesn't need to update the system explicitly
pass
class PMXbps(PackageManager):
backend = "xbps"
def install(self, pkgs, from_local=False):
check_target_env_call(["xbps-install", "-Sy"] + pkgs)
def remove(self, pkgs):
check_target_env_call(["xbps-remove", "-Ry", "--noconfirm"] + pkgs)
def update_db(self):
check_target_env_call(["xbps-install", "-S"])
def update_system(self):
check_target_env_call(["xbps", "-Suy"])
class PMPacman(PackageManager):
backend = "pacman"

View File

@ -32,6 +32,7 @@
Config::Config( QObject* parent )
: QObject( parent )
, m_languages( CalamaresUtils::Locale::availableTranslations() )
, m_filtermodel( std::make_unique< QSortFilterProxyModel >() )
{
initLanguages();
@ -97,6 +98,18 @@ Config::requirementsModel() const
return Calamares::ModuleManager::instance()->requirementsModel();
}
QAbstractItemModel*
Config::unsatisfiedRequirements() const
{
if ( !m_filtermodel->sourceModel() )
{
m_filtermodel->setFilterRole( Calamares::RequirementsModel::Roles::Satisfied );
m_filtermodel->setFilterFixedString( QStringLiteral( "false" ) );
m_filtermodel->setSourceModel( requirementsModel() );
}
return m_filtermodel.get();
}
QString
Config::languageIcon() const
@ -336,7 +349,7 @@ setCountry( Config* config, const QString& countryCode, CalamaresUtils::GeoIP::H
}
static inline void
setGeoIP( Config* c, const QVariantMap& configurationMap )
setGeoIP( Config* config, const QVariantMap& configurationMap )
{
bool ok = false;
QVariantMap geoip = CalamaresUtils::getSubMap( configurationMap, "geoip", ok );
@ -350,12 +363,12 @@ setGeoIP( Config* c, const QVariantMap& configurationMap )
if ( handler->type() != CalamaresUtils::GeoIP::Handler::Type::None )
{
auto* future = new FWString();
QObject::connect( future, &FWString::finished, [config = c, f = future, h = handler]() {
QString countryResult = f->future().result();
QObject::connect( future, &FWString::finished, [config, future, handler]() {
QString countryResult = future->future().result();
cDebug() << "GeoIP result for welcome=" << countryResult;
::setCountry( config, countryResult, h );
f->deleteLater();
delete h;
::setCountry( config, countryResult, handler );
future->deleteLater();
delete handler;
} );
future->setFuture( handler->queryRaw() );
}

View File

@ -23,13 +23,37 @@
#include "modulesystem/RequirementsModel.h"
#include <QObject>
#include <QSortFilterProxyModel>
#include <QUrl>
#include <memory>
class Config : public QObject
{
Q_OBJECT
/** @brief The languages available in Calamares.
*
* This is a list-model, with names and descriptions for the translations
* available to Calamares.
*/
Q_PROPERTY( CalamaresUtils::Locale::LabelModel* languagesModel READ languagesModel CONSTANT FINAL )
/** @brief The requirements (from modules) and their checked-status
*
* The model grows rows over time as each module is checked and its
* requirements are taken into account. The model **as a whole**
* has properties *satisfiedRequirements* and *satisfiedMandatory*
* to say if all of the requirements held in the model have been
* satisfied. See the model documentation for details.
*/
Q_PROPERTY( Calamares::RequirementsModel* requirementsModel READ requirementsModel CONSTANT FINAL )
/** @brief The requirements (from modules) that are **unsatisfied**
*
* This is the same as requirementsModel(), except filtered so
* that only those requirements that are not satisfied are exposed.
* Note that the type is different, so you should still use the
* requirementsModel() for overall status like *satisfiedMandatory*.
*/
Q_PROPERTY( QAbstractItemModel* unsatisfiedRequirements READ unsatisfiedRequirements CONSTANT FINAL )
Q_PROPERTY( QString languageIcon READ languageIcon CONSTANT FINAL )
@ -83,6 +107,8 @@ public slots:
///@brief The **global** requirements model, from ModuleManager
Calamares::RequirementsModel* requirementsModel() const;
QAbstractItemModel* unsatisfiedRequirements() const;
signals:
void countryCodeChanged( QString countryCode );
void localeIndexChanged( int localeIndex );
@ -99,7 +125,8 @@ signals:
private:
void initLanguages();
CalamaresUtils::Locale::LabelModel* m_languages;
CalamaresUtils::Locale::LabelModel* m_languages = nullptr;
std::unique_ptr< QSortFilterProxyModel > m_filtermodel;
QString m_languageIcon;
QString m_countryCode;

View File

@ -67,6 +67,14 @@ requirements:
# Also, note the analogous feature in `src/modules/locale/locale.conf`,
# which is where you will find complete documentation.
#
# For testing, the *style* may be set to `fixed`, any URL that
# returns data (e.g. `http://example.com`) and then *selector*
# sets the data that is actually returned (e.g. "DE" to simulate
# the machine being in Germany).
#
# NOTE: the *selector* must pick the country code from the GeoIP
# data. Timezone, city, or other data will not be recognized.
#
geoip:
style: "none"
url: "https://geoip.kde.org/v1/ubiquity" # extended XML format

View File

@ -17,6 +17,8 @@
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
/* THIS COMPONENT IS UNUSED -- from the default welcomeq.qml at least */
import io.calamares.core 1.0
import io.calamares.ui 1.0

View File

@ -44,8 +44,12 @@ Rectangle {
activeFocusOnPress: false
wrapMode: Text.WordWrap
text: qsTr("<p>This computer does not satisfy the minimum requirements for installing %1.<br/>
property var requirementsText: qsTr("<p>This computer does not satisfy the minimum requirements for installing %1.<br/>
Installation cannot continue.</p>").arg(Branding.string(Branding.VersionedName))
property var recommendationsText: qsTr("<p>This computer does not satisfy some of the recommended requirements for setting up %1.<br/>
Setup can continue, but some features might be disabled.</p>").arg(Branding.string(Branding.VersionedName))
text: config.requirementsModel.satisfiedMandatory ? recommendationsText : requirementsText
}
Rectangle {
@ -61,6 +65,7 @@ Rectangle {
Item {
width: 640
height: 35
visible: true
Column {
anchors.centerIn: parent
@ -68,18 +73,22 @@ Rectangle {
Rectangle {
implicitWidth: 640
implicitHeight: 35
border.color: mandatory ? "#228b22" : "#ff0000"
color: mandatory ? "#f0fff0" : "#ffc0cb"
// Colors and images based on the two satisfied-bools:
// - if satisfied, then green / ok
// - otherwise if mandatory, then red / stop
// - otherwise, then yellow / warning
border.color: satisfied ? "#228b22" : (mandatory ? "#ff0000" : "#ffa411")
color: satisfied ? "#f0fff0" : (mandatory ? "#ffc0cb" : "#ffefd5")
Image {
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.margins: 20
source: mandatory ? "qrc:/data/images/yes.svgz" : "qrc:/data/images/no.svgz"
source: satisfied ? "qrc:/data/images/yes.svgz" : (mandatory ? "qrc:/data/images/no.svgz" : "qrc:/data/images/information.svgz")
}
Text {
text: mandatory ? details : negatedText
text: satisfied ? details : negatedText
anchors.centerIn: parent
font.pointSize: 11
}
@ -89,9 +98,13 @@ Rectangle {
}
ListView {
id: requirementsList
anchors.fill: parent
spacing: 5
model: config.requirementsModel
// This uses the filtered model, so that only unsatisfied
// requirements are ever shown. You could use *requirementsModel*
// to get all of them.
model: config.unsatisfiedRequirements
delegate: requirementsDelegate
}
}

View File

@ -1,52 +1,24 @@
# Configuration for the welcome module. The welcome page
# displays some information from the branding file.
# Which parts it displays can be configured through
# the show* variables.
# Configuration for the welcomeq module.
#
# In addition to displaying the welcome page, this module
# can check requirements for installation.
# The configuration for welcomeq is exactly the same
# as the welcome module, with the one exception of
# *qmlSearch* which governs QML loading.
#
# No documentation is given here: look in the welcome module.
---
# Setting for QML loading
# Setting for QML loading: use QRC, branding, or both sources of files
qmlSearch: both
# Display settings for various buttons on the welcome page.
# The URLs themselves come from branding.desc is the setting
# here is "true". If the setting is false, the button is hidden.
# The setting can also be a full URL which will then be used
# instead of the one from the branding file, or empty or not-set
# which will hide the button.
# Everythin below here is documented in `welcome.conf`
showSupportUrl: true
showKnownIssuesUrl: true
showReleaseNotesUrl: true
# If this Url is set to something non-empty, a "donate"
# button is added to the welcome page alongside the
# others (see settings, above). Clicking the button opens
# the corresponding link. (This button has no corresponding
# branding.desc string)
#
# showDonateUrl: https://kde.org/community/donations/
# Requirements checking. These are general, generic, things
# that are checked. They may not match with the actual requirements
# imposed by other modules in the system.
requirements:
# Amount of available disk, in GiB. Floating-point is allowed here.
# Note that this does not account for *usable* disk, so it is possible
# to pass this requirement, yet have no space to install to.
requiredStorage: 5.5
# Amount of available RAM, in GiB. Floating-point is allowed here.
requiredRam: 1.0
# To check for internet connectivity, Calamares does a HTTP GET
# on this URL; on success (e.g. HTTP code 200) internet is OK.
internetCheckUrl: http://google.com
# List conditions to check. Each listed condition will be
# probed in some way, and yields true or false according to
# the host system satisfying the condition.
#
# This sample file lists all the conditions that are known.
check:
- storage
- ram
@ -54,11 +26,10 @@ requirements:
- internet
- root
- screen
# List conditions that **must** be satisfied (from the list
# of conditions, above) for installation to proceed.
# If any of these conditions are not met, the user cannot
# continue past the welcome page.
required:
# - storage
- ram
# - root
geoip:
style: "none"
url: "https://geoip.kde.org/v1/ubiquity" # extended XML format
selector: "CountryCode" # blank uses default, which is wrong

View File

@ -56,12 +56,8 @@ Page
fillMode: Image.PreserveAspectFit
}
Recommended {
visible: !config.requirementsModel.satisfiedRequirements
}
Requirements {
visible: !config.requirementsModel.satisfiedMandatory
visible: !config.requirementsModel.satisfiedRequirements
}
RowLayout {