Merge branch 'work/qt6-i18n' into calamares
This commit is contained in:
commit
bf7983dac8
@ -20,19 +20,21 @@
|
||||
# SKIP_MODULES : a space or semicolon-separated list of directory names
|
||||
# under src/modules that should not be built.
|
||||
# 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
|
||||
# a list of WITH_<foo> grep CMakeCache.txt after running
|
||||
# CMake once. These affect the ABI offered by Calamares.
|
||||
# - PYTHON (enable Python Job modules)
|
||||
# - QML (enable QML UI View modules)
|
||||
# - QT6 (use Qt6 rather than Qt5, default to OFF)
|
||||
# The WITH_* options affect the ABI of Calamares: you must
|
||||
# build (C++) modules for Calamares with the same WITH_*
|
||||
# settings, or they may not load at all.
|
||||
# BUILD_<foo> : choose additional things to build
|
||||
# - TESTING (standard CMake option)
|
||||
# - SCHEMA_TESTING (requires Python, see ci/configvalidator.py)
|
||||
# - APPDATA (use AppData in packagechooser, requires QtXml)
|
||||
# - APPSTREAM (use AppStream in packagechooser, requires libappstream-qt)
|
||||
# - BUILD_CRASH_REPORTING (uses KCrash, rather than Calamares internal, for crash reporting)
|
||||
# - SCHEMA_TESTING (requires Python, see ci/configvalidator.py)
|
||||
# - TESTING (standard CMake option)
|
||||
# DEBUG_<foo> : special developer flags for debugging.
|
||||
#
|
||||
# Example usage:
|
||||
@ -177,8 +179,8 @@ else()
|
||||
set(qtname "Qt5")
|
||||
set(kfname "KF5")
|
||||
set(QT_VERSION 5.15.0)
|
||||
set(ECM_VERSION 5.100)
|
||||
set(KF_VERSION 5.100)
|
||||
set(ECM_VERSION 5.78)
|
||||
set(KF_VERSION 5.78)
|
||||
# API that was deprecated before Qt 5.15 causes a compile error
|
||||
add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x050f00)
|
||||
endif()
|
||||
|
@ -100,3 +100,58 @@ function( install_calamares_gettext_translations )
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
set(_calamares_qrc_translations_qrc_source ${CMAKE_CURRENT_LIST_DIR}/i18n.qrc.in) # Needs to be set outside of function
|
||||
function(calamares_qrc_translations basename)
|
||||
set(options "")
|
||||
set(oneValueArgs SUBDIRECTORY OUTPUT_VARIABLE)
|
||||
set(multiValueArgs PREFIXES LANGUAGES)
|
||||
cmake_parse_arguments(_qrt "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(NOT _qrt_OUTPUT_VARIABLE)
|
||||
message(FATAL_ERROR "No output variable")
|
||||
endif()
|
||||
if(NOT _qrt_PREFIXES)
|
||||
set(_qrt_PREFIXES "${basename}")
|
||||
endif()
|
||||
if(NOT _qrt_LANGUAGES)
|
||||
set(_qrt_LANGUAGES ${CALAMARES_TRANSLATION_LANGUAGES})
|
||||
endif()
|
||||
if(NOT _qrt_SUBDIRECTORY)
|
||||
set(_qrt_SUBDIRECTORY "")
|
||||
endif()
|
||||
|
||||
set(translations_qrc_infile ${CMAKE_CURRENT_BINARY_DIR}/${basename}.qrc)
|
||||
set(translations_qrc_outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${basename}.cxx)
|
||||
|
||||
# Must use this variable name because of the @ substitution
|
||||
set(calamares_i18n_qrc_content "")
|
||||
set(calamares_i18n_ts_filelist "")
|
||||
foreach(lang ${_qrt_LANGUAGES})
|
||||
foreach(tlsource ${_qrt_PREFIXES})
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/{$_qrt_SUBDIRECTORY}/${tlsource}_${lang}.ts")
|
||||
string(APPEND calamares_i18n_qrc_content "<file>${tlsource}_${lang}.qm</file>\n")
|
||||
list(APPEND calamares_i18n_ts_filelist "${CMAKE_SOURCE_DIR}/${_qrt_SUBDIRECTORY}/${tlsource}_${lang}.ts")
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
configure_file(${_calamares_qrc_translations_qrc_source} ${translations_qrc_infile} @ONLY)
|
||||
qt_add_translation(QM_FILES ${calamares_i18n_ts_filelist})
|
||||
|
||||
# Run the resource compiler (rcc_options should already be set)
|
||||
add_custom_command(
|
||||
OUTPUT ${translations_qrc_outfile}
|
||||
COMMAND ${qtname}::rcc
|
||||
ARGS
|
||||
${rcc_options}
|
||||
--format-version 1
|
||||
-name ${basename}
|
||||
-o ${translations_qrc_outfile}
|
||||
${translations_qrc_infile}
|
||||
MAIN_DEPENDENCY ${translations_qrc_infile}
|
||||
DEPENDS ${QM_FILES}
|
||||
)
|
||||
|
||||
set(${_qrt_OUTPUT_VARIABLE} ${translations_qrc_outfile} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
@ -30,35 +30,9 @@ install_calamares_gettext_translations(python
|
||||
### TRANSLATIONS
|
||||
#
|
||||
#
|
||||
set(TS_FILES "")
|
||||
set(calamares_i18n_qrc_content "")
|
||||
|
||||
# calamares and qt language files
|
||||
foreach(lang ${CALAMARES_TRANSLATION_LANGUAGES})
|
||||
foreach(tlsource "calamares_${lang}" "tz_${lang}" "kb_${lang}")
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/lang/${tlsource}.ts")
|
||||
string(APPEND calamares_i18n_qrc_content "<file>${tlsource}.qm</file>\n")
|
||||
list(APPEND TS_FILES "${CMAKE_SOURCE_DIR}/lang/${tlsource}.ts")
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
set(trans_file calamares_i18n)
|
||||
set(trans_infile ${CMAKE_CURRENT_BINARY_DIR}/${trans_file}.qrc)
|
||||
set(trans_outfile ${CMAKE_CURRENT_BINARY_DIR}/calamares-i18n.cxx)
|
||||
set(CALAMARES_TRANSLATIONS_SOURCE ${trans_outfile})
|
||||
|
||||
configure_file(${CMAKE_SOURCE_DIR}/lang/calamares_i18n.qrc.in ${trans_infile} @ONLY)
|
||||
|
||||
qt_add_translation(QM_FILES ${TS_FILES})
|
||||
|
||||
# Run the resource compiler (rcc_options should already be set)
|
||||
add_custom_command(
|
||||
OUTPUT ${trans_outfile}
|
||||
COMMAND "${Qt5Core_RCC_EXECUTABLE}"
|
||||
ARGS ${rcc_options} --format-version 1 -name ${trans_file} -o ${trans_outfile} ${trans_infile}
|
||||
MAIN_DEPENDENCY ${trans_infile}
|
||||
DEPENDS ${QM_FILES}
|
||||
calamares_qrc_translations(calamares-i18n
|
||||
OUTPUT_VARIABLE translation_outfile
|
||||
PREFIXES calamares tz kb
|
||||
)
|
||||
|
||||
add_library(calamares-i18n OBJECT ${trans_outfile})
|
||||
add_library(calamares-i18n OBJECT ${translation_outfile})
|
||||
|
@ -192,55 +192,6 @@ endforeach()
|
||||
|
||||
### TRANSLATION TESTING
|
||||
#
|
||||
# This is a support function, used just once, to help out the localetest
|
||||
function(calamares_qrc_translations basename)
|
||||
set(NAME ${ARGV0})
|
||||
set(options "")
|
||||
set(oneValueArgs SUBDIRECTORY OUTPUT_VARIABLE)
|
||||
set(multiValueArgs LANGUAGES)
|
||||
cmake_parse_arguments(_qrt "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(NOT _qrt_OUTPUT_VARIABLE)
|
||||
set(_qrt_OUTPUT_VARIABLE "qrc_translations_${basename}")
|
||||
endif()
|
||||
|
||||
set(translations_qrc_infile ${CMAKE_CURRENT_BINARY_DIR}/${basename}.qrc)
|
||||
set(translations_qrc_outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${basename}.cxx)
|
||||
|
||||
# Must use this variable name because of the @ substitution
|
||||
set(calamares_i18n_qrc_content "")
|
||||
set(calamares_i18n_ts_filelist "")
|
||||
foreach(lang ${_qrt_LANGUAGES})
|
||||
string(APPEND calamares_i18n_qrc_content "<file>${basename}_${lang}.qm</file>")
|
||||
list(
|
||||
APPEND
|
||||
calamares_i18n_ts_filelist
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/${_qrt_SUBDIRECTORY}/${basename}_${lang}.ts"
|
||||
)
|
||||
endforeach()
|
||||
|
||||
configure_file(${CMAKE_SOURCE_DIR}/lang/calamares_i18n.qrc.in ${translations_qrc_infile} @ONLY)
|
||||
qt_add_translation(QM_FILES ${calamares_i18n_ts_filelist})
|
||||
|
||||
# Run the resource compiler (rcc_options should already be set)
|
||||
add_custom_command(
|
||||
OUTPUT ${translations_qrc_outfile}
|
||||
COMMAND "${Qt5Core_RCC_EXECUTABLE}"
|
||||
ARGS
|
||||
${rcc_options}
|
||||
--format-version
|
||||
1
|
||||
-name
|
||||
${basename}
|
||||
-o
|
||||
${translations_qrc_outfile}
|
||||
${translations_qrc_infile}
|
||||
MAIN_DEPENDENCY ${translations_qrc_infile}
|
||||
DEPENDS ${QM_FILES}
|
||||
)
|
||||
|
||||
set(${_qrt_OUTPUT_VARIABLE} ${translations_qrc_outfile} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
calamares_qrc_translations( localetest OUTPUT_VARIABLE localetest_qrc SUBDIRECTORY testdata LANGUAGES nl )
|
||||
|
||||
|
@ -33,11 +33,9 @@ variantToPyObject( const QVariant& variant )
|
||||
#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
|
||||
@ -47,7 +45,7 @@ variantToPyObject( const QVariant& variant )
|
||||
case Calamares::MapVariantType:
|
||||
return variantMapToPyDict( variant.toMap() );
|
||||
|
||||
case HashVariantType:
|
||||
case Calamares::HashVariantType:
|
||||
return variantHashToPyDict( variant.toHash() );
|
||||
|
||||
case Calamares::ListVariantType:
|
||||
|
@ -19,6 +19,7 @@ namespace Calamares
|
||||
const auto typeOf = []( const QVariant& v ) { return v.type(); };
|
||||
const auto ListVariantType = QVariant::List;
|
||||
const auto MapVariantType = QVariant::Map;
|
||||
const auto HashVariantType = QVariant::Hash;
|
||||
const auto StringVariantType = QVariant::String;
|
||||
const auto CharVariantType = QVariant::Char;
|
||||
const auto StringListVariantType = QVariant::StringList;
|
||||
@ -31,6 +32,7 @@ const auto DoubleVariantType = QVariant::Double;
|
||||
const auto typeOf = []( const QVariant& v ) { return v.typeId(); };
|
||||
const auto ListVariantType = QMetaType::Type::QVariantList;
|
||||
const auto MapVariantType = QMetaType::Type::QVariantMap;
|
||||
const auto HashVariantType = QMetaType::Type::QVariantHash;
|
||||
const auto StringVariantType = QMetaType::Type::QString;
|
||||
const auto CharVariantType = QMetaType::Type::Char;
|
||||
const auto StringListVariantType = QMetaType::Type::QStringList;
|
||||
|
@ -21,10 +21,6 @@ string(REPLACE " " ";" SKIP_LIST "${SKIP_MODULES}")
|
||||
file(GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*")
|
||||
list(SORT SUBDIRECTORIES)
|
||||
|
||||
if(WITH_QT6) # TODO: Qt6
|
||||
set(SUBDIRECTORIES finished finishedq welcome welcomeq)
|
||||
endif()
|
||||
|
||||
foreach(SUBDIRECTORY ${SUBDIRECTORIES})
|
||||
calamares_add_module_subdirectory( ${SUBDIRECTORY} LIST_SKIPPED_MODULES )
|
||||
endforeach()
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
|
||||
#include "compat/Variant.h"
|
||||
#include "utils/CommandList.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Variant.h"
|
||||
@ -62,7 +63,7 @@ ContextualProcessBinding::run( const QString& value ) const
|
||||
static bool
|
||||
fetch( QString& value, QStringList& selector, int index, const QVariant& v )
|
||||
{
|
||||
if ( !v.canConvert( QMetaType::QVariantMap ) )
|
||||
if ( !v.canConvert< QVariantMap >() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -163,7 +164,7 @@ ContextualProcessJob::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( iter.value().type() != QVariant::Map )
|
||||
if ( Calamares::typeOf( iter.value() ) != Calamares::MapVariantType )
|
||||
{
|
||||
cWarning() << moduleInstanceKey() << "bad configuration values for" << variableName;
|
||||
continue;
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
|
||||
#include "compat/Variant.h"
|
||||
#include "utils/CalamaresUtilsSystem.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
@ -45,15 +46,16 @@ static QString variantHashToString( const QVariantHash& variantHash );
|
||||
static QString
|
||||
variantToString( const QVariant& variant )
|
||||
{
|
||||
if ( variant.type() == QVariant::Map )
|
||||
if ( Calamares::typeOf( variant ) == Calamares::MapVariantType )
|
||||
{
|
||||
return variantMapToString( variant.toMap() );
|
||||
}
|
||||
else if ( variant.type() == QVariant::Hash )
|
||||
else if ( Calamares::typeOf( variant ) == Calamares::HashVariantType )
|
||||
{
|
||||
return variantHashToString( variant.toHash() );
|
||||
}
|
||||
else if ( ( variant.type() == QVariant::List ) || ( variant.type() == QVariant::StringList ) )
|
||||
else if ( ( Calamares::typeOf( variant ) == Calamares::ListVariantType )
|
||||
|| ( Calamares::typeOf( variant ) == Calamares::StringListVariantType ) )
|
||||
{
|
||||
return variantListToString( variant.toList() );
|
||||
}
|
||||
|
@ -32,9 +32,7 @@ calamares_add_plugin(hostinfo
|
||||
NO_CONFIG
|
||||
)
|
||||
|
||||
if(KF5CoreAddons_FOUND AND KF5CoreAddons_VERSION VERSION_GREATER_EQUAL 5.58)
|
||||
target_compile_definitions(calamares_job_hostinfo PRIVATE WITH_KOSRelease)
|
||||
target_link_libraries(calamares_job_hostinfo PRIVATE KF5::CoreAddons)
|
||||
endif()
|
||||
target_compile_definitions(calamares_job_hostinfo PRIVATE WITH_KOSRelease)
|
||||
target_link_libraries(calamares_job_hostinfo PRIVATE ${kfname}::CoreAddons)
|
||||
|
||||
calamares_add_test(hostinfotest SOURCES Tests.cpp HostInfoJob.cpp LIBRARIES yamlcpp::yamlcpp)
|
||||
|
@ -3,6 +3,11 @@
|
||||
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
if(WITH_QT6)
|
||||
calamares_skip_module( "interactiveterminal (KDE Frameworks 5 only)" )
|
||||
return()
|
||||
endif()
|
||||
|
||||
find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE)
|
||||
|
||||
set(kf5_ver 5.41)
|
||||
|
@ -21,7 +21,7 @@ calamares_add_plugin(keyboard
|
||||
keyboard.qrc
|
||||
SHARED_LIB
|
||||
LINK_LIBRARIES
|
||||
Qt5::DBus
|
||||
${qtname}::DBus
|
||||
)
|
||||
|
||||
calamares_add_test(keyboardtest SOURCES Tests.cpp SetKeyboardLayoutJob.cpp RESOURCES keyboard.qrc)
|
||||
|
@ -23,8 +23,10 @@
|
||||
#include "utils/Variant.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QFile>
|
||||
#include <QGuiApplication>
|
||||
#include <QProcess>
|
||||
#include <QRegularExpression>
|
||||
#include <QTimer>
|
||||
|
||||
#include <QDBusConnection>
|
||||
@ -113,7 +115,7 @@ xkbmap_query_grp_option()
|
||||
}
|
||||
|
||||
//it's either in the end of line or before the other option so \s or ,
|
||||
int lastIndex = outputLine.indexOf( QRegExp( "[\\s,]" ), index );
|
||||
int lastIndex = outputLine.indexOf( QRegularExpression( "[\\s,]" ), index );
|
||||
|
||||
return outputLine.mid( index, lastIndex - index );
|
||||
}
|
||||
@ -349,7 +351,9 @@ Config::getCurrentKeyboardLayoutXkb( QString& currentLayout, QString& currentVar
|
||||
symbols = true;
|
||||
}
|
||||
else if ( !line.trimmed().startsWith( "xkb_geometry" ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int firstQuote = line.indexOf( '"' );
|
||||
int lastQuote = line.lastIndexOf( '"' );
|
||||
|
@ -19,6 +19,10 @@
|
||||
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QFile>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#ifdef Q_OS_FREEBSD
|
||||
static const char XKB_FILE[] = "/usr/local/share/X11/xkb/rules/base.lst";
|
||||
#else
|
||||
@ -75,16 +79,22 @@ parseKeyboardModels( const char* filepath )
|
||||
break;
|
||||
}
|
||||
|
||||
// here we are in the model section, otherwise we would continue or break
|
||||
QRegExp rx;
|
||||
rx.setPattern( "^\\s+(\\S+)\\s+(\\w.*)\n$" );
|
||||
// Here we are in the model section, otherwise we would continue or break.
|
||||
// Sample model lines:
|
||||
//
|
||||
// ! model
|
||||
// pc86 Generic 86-key PC
|
||||
// pc101 Generic 101-key PC
|
||||
//
|
||||
QRegularExpression rx( "^\\s+(\\S+)\\s+(\\w.*)\n$" );
|
||||
QRegularExpressionMatch m;
|
||||
|
||||
// insert into the model map
|
||||
if ( rx.indexIn( line ) != -1 )
|
||||
if ( QString( line ).indexOf( rx, 0, &m ) != -1 )
|
||||
{
|
||||
QString modelDesc = rx.cap( 2 );
|
||||
QString model = rx.cap( 1 );
|
||||
models.insert( modelDesc, model );
|
||||
const QString modelDescription = m.captured( 2 );
|
||||
const QString model = m.captured( 1 );
|
||||
models.insert( modelDescription, model );
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,16 +129,21 @@ parseKeyboardLayouts( const char* filepath )
|
||||
break;
|
||||
}
|
||||
|
||||
QRegExp rx;
|
||||
rx.setPattern( "^\\s+(\\S+)\\s+(\\w.*)\n$" );
|
||||
// Sample layout lines:
|
||||
//
|
||||
// ! layout
|
||||
// us English (US)
|
||||
// af Afghani
|
||||
QRegularExpression rx( "^\\s+(\\S+)\\s+(\\w.*)\n$" );
|
||||
QRegularExpressionMatch m;
|
||||
|
||||
// insert into the layout map
|
||||
if ( rx.indexIn( line ) != -1 )
|
||||
if ( QString( line ).indexOf( rx, 0, &m ) != -1 )
|
||||
{
|
||||
KeyboardGlobal::KeyboardInfo info;
|
||||
info.description = rx.cap( 2 );
|
||||
info.description = m.captured( 2 );
|
||||
info.variants.insert( QObject::tr( "Default" ), "" );
|
||||
layouts.insert( rx.cap( 1 ), info );
|
||||
layouts.insert( m.captured( 1 ), info );
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,25 +163,35 @@ parseKeyboardLayouts( const char* filepath )
|
||||
break;
|
||||
}
|
||||
|
||||
QRegExp rx;
|
||||
rx.setPattern( "^\\s+(\\S+)\\s+(\\S+): (\\w.*)\n$" );
|
||||
// Sample variant lines:
|
||||
//
|
||||
// ! variant
|
||||
// chr us: Cherokee
|
||||
// haw us: Hawaiian
|
||||
// ps af: Pashto
|
||||
// uz af: Uzbek (Afghanistan)
|
||||
QRegularExpression rx( "^\\s+(\\S+)\\s+(\\S+): (\\w.*)\n$" );
|
||||
QRegularExpressionMatch m;
|
||||
|
||||
// insert into the variants multimap, if the pattern matches
|
||||
if ( rx.indexIn( line ) != -1 )
|
||||
if ( QString( line ).indexOf( rx, 0, &m ) != -1 )
|
||||
{
|
||||
if ( layouts.find( rx.cap( 2 ) ) != layouts.end() )
|
||||
const QString variantKey = m.captured( 1 );
|
||||
const QString baseLayout = m.captured( 2 );
|
||||
const QString description = m.captured( 3 );
|
||||
if ( layouts.find( baseLayout ) != layouts.end() )
|
||||
{
|
||||
// in this case we found an entry in the multimap, and add the values to the multimap
|
||||
layouts.find( rx.cap( 2 ) ).value().variants.insert( rx.cap( 3 ), rx.cap( 1 ) );
|
||||
layouts.find( baseLayout ).value().variants.insert( description, variantKey );
|
||||
}
|
||||
else
|
||||
{
|
||||
// create a new map in the multimap - the value was not found.
|
||||
KeyboardGlobal::KeyboardInfo info;
|
||||
info.description = rx.cap( 2 );
|
||||
info.description = baseLayout;
|
||||
info.variants.insert( QObject::tr( "Default" ), "" );
|
||||
info.variants.insert( rx.cap( 3 ), rx.cap( 1 ) );
|
||||
layouts.insert( rx.cap( 2 ), info );
|
||||
info.variants.insert( description, variantKey );
|
||||
layouts.insert( baseLayout, info );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,16 +16,8 @@
|
||||
#ifndef KEYBOARDGLOBAL_H
|
||||
#define KEYBOARDGLOBAL_H
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QRegExp>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QTextStream>
|
||||
|
||||
class KeyboardGlobal
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ if(NOT WITH_QML)
|
||||
return()
|
||||
endif()
|
||||
|
||||
find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED Core DBus)
|
||||
find_package(${qtname} ${QT_VERSION} CONFIG REQUIRED Core DBus)
|
||||
|
||||
set(_keyboard ${CMAKE_CURRENT_SOURCE_DIR}/../keyboard)
|
||||
|
||||
@ -27,5 +27,5 @@ calamares_add_plugin(keyboardq
|
||||
keyboardq.qrc
|
||||
SHARED_LIB
|
||||
LINK_LIBRARIES
|
||||
Qt5::DBus
|
||||
${qtname}::DBus
|
||||
)
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
#include "LicensePage.h"
|
||||
|
||||
#include "compat/Variant.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include <QVariantMap>
|
||||
@ -89,12 +91,13 @@ void
|
||||
LicenseViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
QList< LicenseEntry > entriesList;
|
||||
if ( configurationMap.contains( "entries" ) && configurationMap.value( "entries" ).type() == QVariant::List )
|
||||
if ( configurationMap.contains( "entries" )
|
||||
&& Calamares::typeOf( configurationMap.value( "entries" ) ) == Calamares::ListVariantType )
|
||||
{
|
||||
const auto entries = configurationMap.value( "entries" ).toList();
|
||||
for ( const QVariant& entryV : entries )
|
||||
{
|
||||
if ( entryV.type() != QVariant::Map )
|
||||
if ( Calamares::typeOf( entryV ) != Calamares::MapVariantType )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ calamares_add_plugin(locale
|
||||
TYPE viewmodule
|
||||
EXPORT_MACRO PLUGINDLLEXPORT_PRO
|
||||
SOURCES
|
||||
${geoip_src}
|
||||
Config.cpp
|
||||
LCLocaleDialog.cpp
|
||||
LocaleConfiguration.cpp
|
||||
@ -32,8 +31,7 @@ calamares_add_plugin(locale
|
||||
RESOURCES
|
||||
locale.qrc
|
||||
LINK_PRIVATE_LIBRARIES
|
||||
Qt5::Network
|
||||
${geoip_libs}
|
||||
${qtname}::Network
|
||||
yamlcpp::yamlcpp
|
||||
SHARED_LIB
|
||||
)
|
||||
@ -48,5 +46,5 @@ calamares_add_test(
|
||||
SetTimezoneJob.cpp
|
||||
timezonewidget/TimeZoneImage.cpp
|
||||
DEFINITIONS SOURCE_DIR="${CMAKE_CURRENT_LIST_DIR}/images" DEBUG_TIMEZONES=1
|
||||
LIBRARIES Qt5::Gui
|
||||
LIBRARIES ${qtname}::Gui
|
||||
)
|
||||
|
@ -16,10 +16,10 @@ if(DEBUG_TIMEZONES)
|
||||
add_definitions(-DDEBUG_TIMEZONES)
|
||||
endif()
|
||||
|
||||
find_package(Qt5Location CONFIG)
|
||||
set_package_properties(Qt5Location PROPERTIES DESCRIPTION "Used for rendering the map" TYPE RUNTIME)
|
||||
find_package(Qt5Positioning CONFIG)
|
||||
set_package_properties(Qt5Positioning PROPERTIES DESCRIPTION "Used for GeoLocation and GeoCoding" TYPE RUNTIME)
|
||||
find_package(${qtname}Location CONFIG)
|
||||
set_package_properties(${qtname}Location PROPERTIES DESCRIPTION "Used for rendering the map" TYPE RUNTIME)
|
||||
find_package(${qtname}Positioning CONFIG)
|
||||
set_package_properties(${qtname}Positioning PROPERTIES DESCRIPTION "Used for GeoLocation and GeoCoding" TYPE RUNTIME)
|
||||
|
||||
# Because we're sharing sources with the regular locale module
|
||||
set(_locale ${CMAKE_CURRENT_SOURCE_DIR}/../locale)
|
||||
@ -38,6 +38,6 @@ calamares_add_plugin(localeq
|
||||
RESOURCES
|
||||
localeq.qrc
|
||||
LINK_PRIVATE_LIBRARIES
|
||||
Qt5::Network
|
||||
${qtname}::Network
|
||||
SHARED_LIB
|
||||
)
|
||||
|
@ -17,7 +17,7 @@ calamares_add_plugin(netinstall
|
||||
UI
|
||||
page_netinst.ui
|
||||
LINK_PRIVATE_LIBRARIES
|
||||
Qt5::Network
|
||||
${qtname}::Network
|
||||
SHARED_LIB
|
||||
)
|
||||
|
||||
@ -25,6 +25,6 @@ if(KF5CoreAddons_FOUND)
|
||||
calamares_add_test(
|
||||
netinstalltest
|
||||
SOURCES Tests.cpp Config.cpp LoaderQueue.cpp PackageTreeItem.cpp PackageModel.cpp
|
||||
LIBRARIES Qt5::Gui Qt5::Network KF5::CoreAddons
|
||||
LIBRARIES ${qtname}::Gui ${qtname}::Network KF5::CoreAddons
|
||||
)
|
||||
endif()
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
#include "compat/Variant.h"
|
||||
#include "network/Manager.h"
|
||||
#include "packages/Globals.h"
|
||||
#include "utils/Logger.h"
|
||||
@ -137,11 +138,11 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
const QString key = QStringLiteral( "groupsUrl" );
|
||||
const auto& groupsUrlVariant = configurationMap.value( key );
|
||||
m_queue = new LoaderQueue( this );
|
||||
if ( groupsUrlVariant.type() == QVariant::String )
|
||||
if ( Calamares::typeOf( groupsUrlVariant ) == Calamares::StringVariantType )
|
||||
{
|
||||
m_queue->append( SourceItem::makeSourceItem( groupsUrlVariant.toString(), configurationMap ) );
|
||||
}
|
||||
else if ( groupsUrlVariant.type() == QVariant::List )
|
||||
else if ( Calamares::typeOf( groupsUrlVariant ) == Calamares::ListVariantType )
|
||||
{
|
||||
for ( const auto& s : groupsUrlVariant.toStringList() )
|
||||
{
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "PackageModel.h"
|
||||
|
||||
#include "compat/Variant.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Variant.h"
|
||||
#include "utils/Yaml.h"
|
||||
@ -279,7 +280,7 @@ PackageModel::setupModelData( const QVariantList& groupList, PackageTreeItem* pa
|
||||
{
|
||||
for ( const auto& packageName : groupMap.value( "packages" ).toList() )
|
||||
{
|
||||
if ( packageName.type() == QVariant::String )
|
||||
if ( Calamares::typeOf( packageName ) == Calamares::StringVariantType )
|
||||
{
|
||||
item->appendChild( new PackageTreeItem( packageName.toString(), item ) );
|
||||
}
|
||||
@ -301,7 +302,7 @@ PackageModel::setupModelData( const QVariantList& groupList, PackageTreeItem* pa
|
||||
{
|
||||
bool haveWarned = false;
|
||||
const auto& subgroupValue = groupMap.value( "subgroups" );
|
||||
if ( !subgroupValue.canConvert( QVariant::List ) )
|
||||
if ( !subgroupValue.canConvert< QVariantList >() )
|
||||
{
|
||||
cWarning() << "*subgroups* under" << item->name() << "is not a list.";
|
||||
haveWarned = true;
|
||||
|
@ -22,7 +22,12 @@ GroupsTreeView::drawBranches( QPainter* painter, const QRect& rect, const QModel
|
||||
const QString s = index.data().toString();
|
||||
if ( s.isEmpty() )
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||
QStyleOptionViewItem opt = viewOptions();
|
||||
#else
|
||||
QStyleOptionViewItem opt;
|
||||
initViewItemOption( &opt );
|
||||
#endif
|
||||
opt.state = QStyle::State_Sibling;
|
||||
opt.rect = QRect( !isRightToLeft() ? rect.left() : rect.right() + 1, rect.top(), indentation(), rect.height() );
|
||||
painter->eraseRect( opt.rect );
|
||||
|
@ -12,6 +12,6 @@ calamares_add_plugin(oemid
|
||||
UI
|
||||
OEMPage.ui
|
||||
LINK_PRIVATE_LIBRARIES
|
||||
Qt5::Widgets
|
||||
${qtname}::Widgets
|
||||
SHARED_LIB
|
||||
)
|
||||
|
@ -3,20 +3,19 @@
|
||||
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED)
|
||||
find_package(${qtname} COMPONENTS Core Gui Widgets REQUIRED)
|
||||
set(_extra_libraries "")
|
||||
set(_extra_src "")
|
||||
|
||||
### OPTIONAL AppData XML support in PackageModel
|
||||
#
|
||||
#
|
||||
# TODO:3.3:WITH->BUILD (this doesn't affect the ABI offered by Calamares)
|
||||
option(WITH_APPDATA "Support appdata: items in PackageChooser (requires QtXml)" ON)
|
||||
if(WITH_APPDATA)
|
||||
find_package(Qt5 COMPONENTS Xml)
|
||||
if(Qt5Xml_FOUND)
|
||||
option(BUILD_APPDATA "Support appdata: items in PackageChooser (requires QtXml)" ON)
|
||||
if(BUILD_APPDATA)
|
||||
find_package(${qtname} COMPONENTS Xml)
|
||||
if(TARGET ${qtname}::Xml)
|
||||
add_definitions(-DHAVE_APPDATA)
|
||||
list(APPEND _extra_libraries Qt5::Xml)
|
||||
list(APPEND _extra_libraries ${qtname}::Xml)
|
||||
list(APPEND _extra_src ItemAppData.cpp)
|
||||
endif()
|
||||
endif()
|
||||
@ -24,8 +23,8 @@ endif()
|
||||
### OPTIONAL AppStream support in PackageModel
|
||||
#
|
||||
#
|
||||
option(WITH_APPSTREAM "Support appstream: items in PackageChooser (requires libappstream-qt)" ON)
|
||||
if(WITH_APPSTREAM)
|
||||
option(BUILD_APPSTREAM "Support appstream: items in PackageChooser (requires libappstream-qt)" ON)
|
||||
if(BUILD_APPSTREAM)
|
||||
find_package(AppStreamQt)
|
||||
set_package_properties(
|
||||
AppStreamQt
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
#include "compat/Variant.h"
|
||||
#include "packages/Globals.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Variant.h"
|
||||
@ -175,7 +176,7 @@ Config::updateGlobalStorage( const QStringList& selected ) const
|
||||
if ( gs->contains( "netinstallSelect" ) )
|
||||
{
|
||||
auto selectedOrig = gs->value( "netinstallSelect" );
|
||||
if ( selectedOrig.canConvert( QVariant::StringList ) )
|
||||
if ( selectedOrig.canConvert< QStringList >() )
|
||||
{
|
||||
newSelected += selectedOrig.toStringList();
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ if(NOT WITH_QML)
|
||||
return()
|
||||
endif()
|
||||
|
||||
find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED Core)
|
||||
find_package(${qtname} ${QT_VERSION} CONFIG REQUIRED Core)
|
||||
|
||||
# Add optional libraries here
|
||||
set(USER_EXTRA_LIB)
|
||||
@ -21,13 +21,12 @@ include_directories(${_packagechooser})
|
||||
### OPTIONAL AppData XML support in PackageModel
|
||||
#
|
||||
#
|
||||
# TODO:3.3:WITH->BUILD (this doesn't affect the ABI offered by Calamares)
|
||||
option(WITH_APPDATA "Support appdata: items in PackageChooser (requires QtXml)" ON)
|
||||
if(WITH_APPDATA)
|
||||
find_package(Qt5 COMPONENTS Xml)
|
||||
if(Qt5Xml_FOUND)
|
||||
option(BUILD_APPDATA "Support appdata: items in PackageChooser (requires QtXml)" ON)
|
||||
if(BUILD_APPDATA)
|
||||
find_package(${qtname} COMPONENTS Xml)
|
||||
if(TARGET ${qtname}::Xml)
|
||||
add_definitions(-DHAVE_APPDATA)
|
||||
list(APPEND _extra_libraries Qt5::Xml)
|
||||
list(APPEND _extra_libraries ${qtname}::Xml)
|
||||
list(APPEND _extra_src ${_packagechooser}/ItemAppData.cpp)
|
||||
endif()
|
||||
endif()
|
||||
@ -35,8 +34,8 @@ endif()
|
||||
### OPTIONAL AppStream support in PackageModel
|
||||
#
|
||||
#
|
||||
option(WITH_APPSTREAM "Support appstream: items in PackageChooser (requires libappstream-qt)" ON)
|
||||
if(WITH_APPSTREAM)
|
||||
option(BUILD_APPSTREAM "Support appstream: items in PackageChooser (requires libappstream-qt)" ON)
|
||||
if(BUILD_APPSTREAM)
|
||||
find_package(AppStreamQt)
|
||||
set_package_properties(
|
||||
AppStreamQt
|
||||
|
@ -3,19 +3,20 @@
|
||||
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
if(WITH_QT6)
|
||||
calamares_skip_module( "plasmalnf (KDE Frameworks 5 only)" )
|
||||
return()
|
||||
endif()
|
||||
|
||||
find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE)
|
||||
|
||||
# Requires a sufficiently recent Plasma framework, but also
|
||||
# needs a runtime support component (which we don't test for).
|
||||
set(lnf_ver 5.41)
|
||||
|
||||
find_package(KF5Config ${lnf_ver})
|
||||
find_package(${kfname} ${KF_VERSION} QUIET COMPONENTS Config Plasma Package)
|
||||
|
||||
set_package_properties(KF5Config PROPERTIES PURPOSE "For finding default Plasma Look-and-Feel")
|
||||
|
||||
find_package(KF5Plasma ${lnf_ver})
|
||||
set_package_properties(KF5Plasma PROPERTIES PURPOSE "For Plasma Look-and-Feel selection")
|
||||
|
||||
find_package(KF5Package ${lnf_ver})
|
||||
set_package_properties(KF5Package PROPERTIES PURPOSE "For Plasma Look-and-Feel selection")
|
||||
|
||||
if(KF5Plasma_FOUND AND KF5Package_FOUND)
|
||||
@ -35,8 +36,8 @@ if(KF5Plasma_FOUND AND KF5Package_FOUND)
|
||||
UI
|
||||
page_plasmalnf.ui
|
||||
LINK_PRIVATE_LIBRARIES
|
||||
KF5::Package
|
||||
KF5::Plasma
|
||||
${kfname}::Package
|
||||
${kfname}::Plasma
|
||||
SHARED_LIB
|
||||
)
|
||||
if(KF5Config_FOUND)
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
#include "compat/Variant.h"
|
||||
#include "utils/CalamaresUtilsSystem.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Units.h"
|
||||
@ -41,7 +42,7 @@ copy_file( const QString& source, const QString& dest )
|
||||
{
|
||||
b = sourcef.read( 1_MiB );
|
||||
destf.write( b );
|
||||
} while ( b.count() > 0 );
|
||||
} while ( b.size() > 0 );
|
||||
|
||||
sourcef.close();
|
||||
destf.close();
|
||||
@ -52,7 +53,7 @@ copy_file( const QString& source, const QString& dest )
|
||||
Item
|
||||
Item::fromVariant( const QVariant& v, const CalamaresUtils::Permissions& defaultPermissions )
|
||||
{
|
||||
if ( v.type() == QVariant::String )
|
||||
if ( Calamares::typeOf( v ) == Calamares::StringVariantType )
|
||||
{
|
||||
QString filename = v.toString();
|
||||
if ( !filename.isEmpty() )
|
||||
@ -65,7 +66,7 @@ Item::fromVariant( const QVariant& v, const CalamaresUtils::Permissions& default
|
||||
return {};
|
||||
}
|
||||
}
|
||||
else if ( v.type() == QVariant::Map )
|
||||
else if ( Calamares::typeOf( v ) == Calamares::MapVariantType )
|
||||
{
|
||||
const auto map = v.toMap();
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "CalamaresVersion.h"
|
||||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
#include "compat/Variant.h"
|
||||
#include "utils/CalamaresUtilsSystem.h"
|
||||
#include "utils/CommandList.h"
|
||||
#include "utils/Logger.h"
|
||||
@ -97,7 +98,7 @@ PreserveFiles::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
return;
|
||||
}
|
||||
|
||||
if ( files.type() != QVariant::List )
|
||||
if ( Calamares::typeOf( files ) != Calamares::ListVariantType )
|
||||
{
|
||||
cDebug() << "Configuration key 'files' is not a list for preservefiles.";
|
||||
return;
|
||||
|
@ -73,7 +73,7 @@ PreserveFilesTests::testItems()
|
||||
QFETCH( bool, ok );
|
||||
QFETCH( int, type_i );
|
||||
|
||||
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() );
|
||||
|
||||
bool config_file_ok = false;
|
||||
|
@ -3,7 +3,7 @@
|
||||
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED Core DBus Network)
|
||||
find_package(${qtname} ${QT_VERSION} CONFIG REQUIRED Core DBus Network)
|
||||
find_package(Crypt REQUIRED)
|
||||
|
||||
# Add optional libraries here
|
||||
@ -50,8 +50,8 @@ calamares_add_library(
|
||||
SOURCES
|
||||
${_users_src}
|
||||
LINK_LIBRARIES
|
||||
KF5::CoreAddons
|
||||
Qt5::DBus
|
||||
${kfname}::CoreAddons
|
||||
${qtname}::DBus
|
||||
${CRYPT_LIBRARIES}
|
||||
)
|
||||
|
||||
@ -80,8 +80,8 @@ calamares_add_test(
|
||||
TestGroupInformation.cpp
|
||||
${_users_src} # Build again with test-visibility
|
||||
LIBRARIES
|
||||
KF5::CoreAddons
|
||||
Qt5::DBus # HostName job can use DBus to systemd
|
||||
${kfname}::CoreAddons
|
||||
${qtname}::DBus # HostName job can use DBus to systemd
|
||||
${CRYPT_LIBRARIES} # SetPassword job uses crypt()
|
||||
${USER_EXTRA_LIB}
|
||||
)
|
||||
@ -90,7 +90,7 @@ calamares_add_test(
|
||||
usershostnametest
|
||||
SOURCES TestSetHostNameJob.cpp SetHostNameJob.cpp
|
||||
LIBRARIES
|
||||
Qt5::DBus # HostName job can use DBus to systemd
|
||||
${qtname}::DBus # HostName job can use DBus to systemd
|
||||
)
|
||||
|
||||
calamares_add_test(
|
||||
@ -99,8 +99,8 @@ calamares_add_test(
|
||||
Tests.cpp
|
||||
${_users_src} # Build again with test-visibility
|
||||
LIBRARIES
|
||||
KF5::CoreAddons
|
||||
Qt5::DBus # HostName job can use DBus to systemd
|
||||
${kfname}::CoreAddons
|
||||
${qtname}::DBus # HostName job can use DBus to systemd
|
||||
${CRYPT_LIBRARIES} # SetPassword job uses crypt()
|
||||
${USER_EXTRA_LIB}
|
||||
)
|
||||
|
@ -41,7 +41,7 @@ PasswordCheck::PasswordCheck( MessageFunc m, AcceptFunc a, Weight weight )
|
||||
DEFINE_CHECK_FUNC( minLength )
|
||||
{
|
||||
int minLength = -1;
|
||||
if ( value.canConvert( QVariant::Int ) )
|
||||
if ( value.canConvert< int >() )
|
||||
{
|
||||
minLength = value.toInt();
|
||||
}
|
||||
@ -57,7 +57,7 @@ DEFINE_CHECK_FUNC( minLength )
|
||||
DEFINE_CHECK_FUNC( maxLength )
|
||||
{
|
||||
int maxLength = -1;
|
||||
if ( value.canConvert( QVariant::Int ) )
|
||||
if ( value.canConvert< int >() )
|
||||
{
|
||||
maxLength = value.toInt();
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include "GlobalStorage.h"
|
||||
#include "JobQueue.h"
|
||||
#include "compat/Variant.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/String.h"
|
||||
#include "utils/StringExpander.h"
|
||||
@ -24,7 +25,7 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QFile>
|
||||
#include <QMetaProperty>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QTimer>
|
||||
|
||||
#ifdef HAVE_ICU
|
||||
@ -41,10 +42,10 @@ static const char TRANSLITERATOR_ID[] = "Russian-Latin/BGN;"
|
||||
|
||||
#include <memory>
|
||||
|
||||
static const QRegExp USERNAME_RX( "^[a-z_][a-z0-9_-]*[$]?$" );
|
||||
static const QRegularExpression USERNAME_RX( "^[a-z_][a-z0-9_-]*[$]?$" ); // Note anchors begin and end
|
||||
static constexpr const int USERNAME_MAX_LENGTH = 31;
|
||||
|
||||
static const QRegExp HOSTNAME_RX( "^[a-zA-Z0-9][-a-zA-Z0-9_]*$" );
|
||||
static const QRegularExpression HOSTNAME_RX( "^[a-zA-Z0-9][-a-zA-Z0-9_]*$" ); // Note anchors begin and end
|
||||
static constexpr const int HOSTNAME_MIN_LENGTH = 2;
|
||||
static constexpr const int HOSTNAME_MAX_LENGTH = 63;
|
||||
|
||||
@ -235,12 +236,12 @@ Config::loginNameStatus() const
|
||||
return tr( "Your username is too long." );
|
||||
}
|
||||
|
||||
QRegExp validateFirstLetter( "^[a-z_]" );
|
||||
if ( validateFirstLetter.indexIn( m_loginName ) != 0 )
|
||||
QRegularExpression validateFirstLetter( "^[a-z_]" );
|
||||
if ( m_loginName.indexOf( validateFirstLetter ) != 0 )
|
||||
{
|
||||
return tr( "Your username must start with a lowercase letter or underscore." );
|
||||
}
|
||||
if ( !USERNAME_RX.exactMatch( m_loginName ) )
|
||||
if ( m_loginName.indexOf( USERNAME_RX ) != 0 )
|
||||
{
|
||||
return tr( "Only lowercase letters, numbers, underscore and hyphen are allowed." );
|
||||
}
|
||||
@ -310,7 +311,7 @@ Config::hostnameStatus() const
|
||||
return tr( "'%1' is not allowed as hostname." ).arg( m_hostname );
|
||||
}
|
||||
|
||||
if ( !HOSTNAME_RX.exactMatch( m_hostname ) )
|
||||
if ( m_hostname.indexOf( HOSTNAME_RX ) != 0 )
|
||||
{
|
||||
return tr( "Only letters, numbers, underscore and hyphen are allowed." );
|
||||
}
|
||||
@ -321,7 +322,7 @@ Config::hostnameStatus() const
|
||||
static QString
|
||||
cleanupForHostname( const QString& s )
|
||||
{
|
||||
QRegExp dmirx( "(^Apple|\\(.*\\)|[^a-zA-Z0-9])", Qt::CaseInsensitive );
|
||||
QRegularExpression dmirx( "(^Apple|\\(.*\\)|[^a-zA-Z0-9])", QRegularExpression::CaseInsensitiveOption );
|
||||
return s.toLower().replace( dmirx, " " ).remove( ' ' );
|
||||
}
|
||||
|
||||
@ -412,7 +413,7 @@ makeLoginNameSuggestion( const QStringList& parts )
|
||||
}
|
||||
}
|
||||
|
||||
return USERNAME_RX.indexIn( usernameSuggestion ) != -1 ? usernameSuggestion : QString();
|
||||
return usernameSuggestion.indexOf( USERNAME_RX ) != -1 ? usernameSuggestion : QString();
|
||||
}
|
||||
|
||||
/** @brief Return an invalid string for use in a hostname, if @p s is empty
|
||||
@ -445,8 +446,8 @@ makeHostnameSuggestion( const QString& templateString, const QStringList& fullNa
|
||||
QString hostnameSuggestion = d.expand( templateString );
|
||||
|
||||
// RegExp for valid hostnames; if the suggestion produces a valid name, return it
|
||||
static const QRegExp HOSTNAME_RX( "^[a-zA-Z0-9][-a-zA-Z0-9_]*$" );
|
||||
return HOSTNAME_RX.indexIn( hostnameSuggestion ) != -1 ? hostnameSuggestion : QString();
|
||||
static const QRegularExpression HOSTNAME_RX( "^[a-zA-Z0-9][-a-zA-Z0-9_]*$" );
|
||||
return hostnameSuggestion.indexOf( HOSTNAME_RX ) != -1 ? hostnameSuggestion : QString();
|
||||
}
|
||||
|
||||
void
|
||||
@ -483,10 +484,10 @@ Config::setFullName( const QString& name )
|
||||
emit fullNameChanged( name );
|
||||
|
||||
// Build login and hostname, if needed
|
||||
static QRegExp rx( "[^a-zA-Z0-9 ]", Qt::CaseInsensitive );
|
||||
static QRegularExpression rx( "[^a-zA-Z0-9 ]" );
|
||||
|
||||
const QString cleanName = Calamares::String::removeDiacritics( transliterate( name ) )
|
||||
.replace( QRegExp( "[-']" ), "" )
|
||||
.replace( QRegularExpression( "[-']" ), "" )
|
||||
.replace( rx, " " )
|
||||
.toLower()
|
||||
.simplified();
|
||||
@ -751,7 +752,7 @@ setConfigurationDefaultGroups( const QVariantMap& map, QList< GroupDescription >
|
||||
auto groupsFromConfig = map.value( key ).toList();
|
||||
if ( groupsFromConfig.isEmpty() )
|
||||
{
|
||||
if ( map.contains( key ) && map.value( key ).isValid() && map.value( key ).canConvert( QVariant::List ) )
|
||||
if ( map.contains( key ) && map.value( key ).isValid() && map.value( key ).canConvert< QVariantList >() )
|
||||
{
|
||||
// Explicitly set, but empty: this is valid, but unusual.
|
||||
cDebug() << key << "has explicit empty value.";
|
||||
@ -772,11 +773,11 @@ setConfigurationDefaultGroups( const QVariantMap& map, QList< GroupDescription >
|
||||
{
|
||||
for ( const auto& v : groupsFromConfig )
|
||||
{
|
||||
if ( v.type() == QVariant::String )
|
||||
if ( Calamares::typeOf( v ) == Calamares::StringVariantType )
|
||||
{
|
||||
defaultGroups.append( GroupDescription( v.toString() ) );
|
||||
}
|
||||
else if ( v.type() == QVariant::Map )
|
||||
else if ( Calamares::typeOf( v ) == Calamares::MapVariantType )
|
||||
{
|
||||
const auto innermap = v.toMap();
|
||||
QString name = CalamaresUtils::getString( innermap, "name" );
|
||||
|
@ -79,7 +79,7 @@ void
|
||||
GroupTests::testCreateGroup()
|
||||
{
|
||||
// BUILD_AS_TEST is the source-directory path
|
||||
QFile fi( QString( "%1/tests/5-issue-1523.conf" ).arg( BUILD_AS_TEST ) );
|
||||
QFileInfo fi( QString( "%1/tests/5-issue-1523.conf" ).arg( BUILD_AS_TEST ) );
|
||||
QVERIFY( fi.exists() );
|
||||
|
||||
bool ok = false;
|
||||
|
@ -214,7 +214,7 @@ UserTests::testDefaultGroupsYAML()
|
||||
QFETCH( QString, group );
|
||||
|
||||
// BUILD_AS_TEST is the source-directory path
|
||||
QFile fi( QString( "%1/%2" ).arg( BUILD_AS_TEST, filename ) );
|
||||
QFileInfo fi( QString( "%1/%2" ).arg( BUILD_AS_TEST, filename ) );
|
||||
QVERIFY( fi.exists() );
|
||||
|
||||
bool ok = false;
|
||||
@ -450,7 +450,7 @@ UserTests::testAutoLogin()
|
||||
QFETCH( QString, autoLoginGroupName );
|
||||
|
||||
// BUILD_AS_TEST is the source-directory path
|
||||
QFile fi( QString( "%1/%2" ).arg( BUILD_AS_TEST, filename ) );
|
||||
QFileInfo fi( QString( "%1/%2" ).arg( BUILD_AS_TEST, filename ) );
|
||||
QVERIFY( fi.exists() );
|
||||
|
||||
bool ok = false;
|
||||
@ -502,7 +502,7 @@ UserTests::testUserYAML()
|
||||
QFETCH( QString, shell );
|
||||
|
||||
// BUILD_AS_TEST is the source-directory path
|
||||
QFile fi( QString( "%1/%2" ).arg( BUILD_AS_TEST, filename ) );
|
||||
QFileInfo fi( QString( "%1/%2" ).arg( BUILD_AS_TEST, filename ) );
|
||||
QVERIFY( fi.exists() );
|
||||
|
||||
bool ok = false;
|
||||
|
@ -8,7 +8,7 @@ if(NOT WITH_QML)
|
||||
return()
|
||||
endif()
|
||||
|
||||
find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED Core DBus Network)
|
||||
find_package(${qtname} ${QT_VERSION} CONFIG REQUIRED Core DBus Network)
|
||||
find_package(Crypt REQUIRED)
|
||||
|
||||
# Add optional libraries here
|
||||
@ -46,6 +46,6 @@ calamares_add_plugin(usersq
|
||||
users_internal
|
||||
${CRYPT_LIBRARIES}
|
||||
${USER_EXTRA_LIB}
|
||||
Qt5::DBus
|
||||
${qtname}::DBus
|
||||
SHARED_LIB
|
||||
)
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "Settings.h"
|
||||
|
||||
#include <QProcess>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
@ -29,7 +30,7 @@
|
||||
static QString
|
||||
alphaNumeric( QString input )
|
||||
{
|
||||
return input.remove( QRegExp( "[^a-zA-Z\\d\\s]" ) );
|
||||
return input.remove( QRegularExpression( "[^a-zA-Z\\d\\s]" ) );
|
||||
}
|
||||
|
||||
/** @brief Returns the best available device for zpool creation
|
||||
@ -107,7 +108,7 @@ ZfsJob::collectMountpoints( const QVariantList& partitions )
|
||||
m_mountpoints.empty();
|
||||
for ( const QVariant& partition : partitions )
|
||||
{
|
||||
if ( partition.canConvert( QVariant::Map ) )
|
||||
if ( partition.canConvert< QVariantMap >() )
|
||||
{
|
||||
QString mountpoint = partition.toMap().value( "mountPoint" ).toString();
|
||||
if ( !mountpoint.isEmpty() )
|
||||
@ -170,7 +171,7 @@ ZfsJob::exec()
|
||||
{
|
||||
QVariantList partitions;
|
||||
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
|
||||
if ( gs && gs->contains( "partitions" ) && gs->value( "partitions" ).canConvert( QVariant::List ) )
|
||||
if ( gs && gs->contains( "partitions" ) && gs->value( "partitions" ).canConvert< QVariantList >() )
|
||||
{
|
||||
partitions = gs->value( "partitions" ).toList();
|
||||
}
|
||||
@ -187,7 +188,7 @@ ZfsJob::exec()
|
||||
QVariantList poolNames;
|
||||
|
||||
// Check to ensure the list of zfs info from the partition module is available and convert it to a list
|
||||
if ( !gs->contains( "zfsInfo" ) && gs->value( "zfsInfo" ).canConvert( QVariant::List ) )
|
||||
if ( !gs->contains( "zfsInfo" ) && gs->value( "zfsInfo" ).canConvert< QVariantList >() )
|
||||
{
|
||||
return Calamares::JobResult::error( tr( "Internal data missing" ), tr( "Failed to create zpool" ) );
|
||||
}
|
||||
@ -196,7 +197,7 @@ ZfsJob::exec()
|
||||
for ( auto& partition : qAsConst( partitions ) )
|
||||
{
|
||||
QVariantMap pMap;
|
||||
if ( partition.canConvert( QVariant::Map ) )
|
||||
if ( partition.canConvert< QVariantMap >() )
|
||||
{
|
||||
pMap = partition.toMap();
|
||||
}
|
||||
@ -233,7 +234,7 @@ ZfsJob::exec()
|
||||
QString passphrase;
|
||||
for ( const QVariant& zfsInfo : qAsConst( zfsInfoList ) )
|
||||
{
|
||||
if ( zfsInfo.canConvert( QVariant::Map ) && zfsInfo.toMap().value( "encrypted" ).toBool()
|
||||
if ( zfsInfo.canConvert< QVariantMap >() && zfsInfo.toMap().value( "encrypted" ).toBool()
|
||||
&& mountpoint == zfsInfo.toMap().value( "mountpoint" ) )
|
||||
{
|
||||
encrypt = true;
|
||||
|
Loading…
Reference in New Issue
Block a user