3.2.24
This commit is contained in:
commit
c56a6f0be7
17
CHANGES
17
CHANGES
@ -3,7 +3,19 @@ contributors are listed. Note that Calamares does not have a historical
|
||||
changelog -- this log starts with version 3.2.0. The release notes on the
|
||||
website will have to do for older versions.
|
||||
|
||||
# 3.2.24 (unreleased) #
|
||||
# 3.2.25 (unreleased) #
|
||||
|
||||
This release contains contributions from (alphabetically by first name):
|
||||
- No external contributors yet
|
||||
|
||||
## Core ##
|
||||
- No core changes yet
|
||||
|
||||
## Modules ##
|
||||
- No module changes yet
|
||||
|
||||
|
||||
# 3.2.24 (2020-05-11) #
|
||||
|
||||
This release contains contributions from (alphabetically by first name):
|
||||
- Bill Auger
|
||||
@ -18,6 +30,9 @@ This release contains contributions from (alphabetically by first name):
|
||||
- GlobalStorage is available to QML modules as `Global`.
|
||||
- The height of the navigation bar in QML can be set within the
|
||||
QML code for the navigation; if not set, try something sensible.
|
||||
- A regression in the requirements-checker which could block the
|
||||
installer from proceeding without telling the user **why** it
|
||||
was blocked, has been resolved.
|
||||
|
||||
## Modules ##
|
||||
- The *bootloader* module can force a UEFI-based machine to boot into
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
cmake_minimum_required( VERSION 3.3 FATAL_ERROR )
|
||||
project( CALAMARES
|
||||
VERSION 3.2.23
|
||||
VERSION 3.2.24
|
||||
LANGUAGES C CXX )
|
||||
|
||||
set( CALAMARES_VERSION_RC 0 ) # Set to 0 during release cycle, 1 during development
|
||||
@ -54,7 +54,7 @@ option( BUILD_TESTING "Build the testing tree." ON )
|
||||
option( WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON )
|
||||
option( WITH_PYTHONQT "Enable next generation Python modules API (experimental, requires PythonQt)." OFF )
|
||||
option( WITH_KF5Crash "Enable crash reporting with KCrash." ON )
|
||||
option( WITH_KF5DBus "Use DBus service for unique-application." ON )
|
||||
option( WITH_KF5DBus "Use DBus service for unique-application." OFF )
|
||||
|
||||
# Possible debugging flags are:
|
||||
# - DEBUG_TIMEZONES draws latitude and longitude lines on the timezone
|
||||
|
@ -49,10 +49,10 @@ windowPlacement: center
|
||||
strings:
|
||||
productName: Manjaro Linux
|
||||
shortProductName: Manjaro
|
||||
version: 19.0
|
||||
shortVersion: 19.0
|
||||
versionedName: Manjaro Linux 19.0 "Kyria"
|
||||
shortVersionedName: Manjaro 19.0
|
||||
version: 20.0
|
||||
shortVersion: 20.0
|
||||
versionedName: Manjaro Linux 20.0 "Lysia"
|
||||
shortVersionedName: Manjaro 20.0
|
||||
bootloaderEntryName: Manjaro
|
||||
|
||||
# These images are loaded from the branding module directory.
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "modulesystem/Module.h"
|
||||
#include "modulesystem/Requirement.h"
|
||||
#include "modulesystem/RequirementsModel.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include <QFuture>
|
||||
@ -32,47 +33,15 @@
|
||||
namespace Calamares
|
||||
{
|
||||
|
||||
static void
|
||||
registerMetatypes()
|
||||
{
|
||||
static bool done = false;
|
||||
|
||||
if ( !done )
|
||||
{
|
||||
qRegisterMetaType< RequirementEntry >( "RequirementEntry" );
|
||||
// It's sensitive to the names of types in parameters; in particular
|
||||
// althrough QList<RequirementEntry> is the same as RequirementsList,
|
||||
// because we *name* the type as RequirementsList in the parameters,
|
||||
// we need to register that (as well). Here, be safe and register
|
||||
// both names.
|
||||
qRegisterMetaType< QList< RequirementEntry > >( "QList<RequirementEntry>" );
|
||||
qRegisterMetaType< RequirementsList >( "RequirementsList" );
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
check( Module* const& m, RequirementsChecker* c )
|
||||
{
|
||||
RequirementsList l = m->checkRequirements();
|
||||
if ( l.count() > 0 )
|
||||
{
|
||||
c->addCheckedRequirements( l );
|
||||
}
|
||||
c->requirementsProgress(
|
||||
QObject::tr( "Requirements checking for module <i>%1</i> is complete." ).arg( m->name() ) );
|
||||
}
|
||||
|
||||
RequirementsChecker::RequirementsChecker( QVector< Module* > modules, QObject* parent )
|
||||
RequirementsChecker::RequirementsChecker( QVector< Module* > modules, RequirementsModel* model, QObject* parent )
|
||||
: QObject( parent )
|
||||
, m_modules( std::move( modules ) )
|
||||
, m_model( model )
|
||||
, m_progressTimer( nullptr )
|
||||
, m_progressTimeouts( 0 )
|
||||
{
|
||||
m_watchers.reserve( m_modules.count() );
|
||||
m_collectedRequirements.reserve( m_modules.count() );
|
||||
|
||||
registerMetatypes();
|
||||
connect( this, &RequirementsChecker::requirementsProgress, model, &RequirementsModel::setProgressMessage );
|
||||
}
|
||||
|
||||
RequirementsChecker::~RequirementsChecker() {}
|
||||
@ -87,7 +56,7 @@ RequirementsChecker::run()
|
||||
for ( const auto& module : m_modules )
|
||||
{
|
||||
Watcher* watcher = new Watcher( this );
|
||||
watcher->setFuture( QtConcurrent::run( check, module, this ) );
|
||||
watcher->setFuture( QtConcurrent::run( this, &RequirementsChecker::addCheckedRequirements, module ) );
|
||||
watcher->setObjectName( module->name() );
|
||||
m_watchers.append( watcher );
|
||||
connect( watcher, &Watcher::finished, this, &RequirementsChecker::finished );
|
||||
@ -114,33 +83,23 @@ RequirementsChecker::finished()
|
||||
m_progressTimer = nullptr;
|
||||
}
|
||||
|
||||
bool acceptable = true;
|
||||
int count = 0;
|
||||
for ( const auto& r : m_collectedRequirements )
|
||||
{
|
||||
if ( r.mandatory && !r.satisfied )
|
||||
{
|
||||
cDebug() << Logger::SubEntry << "requirement" << count << r.name << "is not satisfied.";
|
||||
acceptable = false;
|
||||
}
|
||||
++count;
|
||||
}
|
||||
|
||||
emit requirementsComplete( acceptable );
|
||||
m_model->describe();
|
||||
m_model->changeRequirementsList();
|
||||
QTimer::singleShot( 0, this, &RequirementsChecker::done );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RequirementsChecker::addCheckedRequirements( RequirementsList l )
|
||||
RequirementsChecker::addCheckedRequirements( Module* m )
|
||||
{
|
||||
static QMutex addMutex;
|
||||
RequirementsList l = m->checkRequirements();
|
||||
cDebug() << "Got" << l.count() << "requirement results from" << m->name();
|
||||
if ( l.count() > 0 )
|
||||
{
|
||||
QMutexLocker lock( &addMutex );
|
||||
m_collectedRequirements.append( l );
|
||||
m_model->addRequirementsList( l );
|
||||
}
|
||||
cDebug() << "Added" << l.count() << "requirement results";
|
||||
emit requirementsResult( l );
|
||||
|
||||
requirementsProgress( tr( "Requirements checking for module <i>%1</i> is complete." ).arg( m->name() ) );
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -29,6 +29,7 @@ namespace Calamares
|
||||
{
|
||||
|
||||
class Module;
|
||||
class RequirementsModel;
|
||||
|
||||
/** @brief A manager-class that checks all the module requirements
|
||||
*
|
||||
@ -40,7 +41,7 @@ class RequirementsChecker : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RequirementsChecker( QVector< Module* > modules, QObject* parent = nullptr );
|
||||
RequirementsChecker( QVector< Module* > modules, RequirementsModel* model, QObject* parent = nullptr );
|
||||
virtual ~RequirementsChecker() override;
|
||||
|
||||
public Q_SLOTS:
|
||||
@ -48,7 +49,7 @@ public Q_SLOTS:
|
||||
void run();
|
||||
|
||||
/// @brief Called when requirements are reported by a module
|
||||
void addCheckedRequirements( RequirementsList );
|
||||
void addCheckedRequirements( Module* );
|
||||
|
||||
/// @brief Called when all requirements have been checked
|
||||
void finished();
|
||||
@ -59,13 +60,6 @@ public Q_SLOTS:
|
||||
signals:
|
||||
/// @brief Human-readable progress message
|
||||
void requirementsProgress( const QString& );
|
||||
/// @brief Requirements from a single module
|
||||
void requirementsResult( RequirementsList );
|
||||
/** @brief When all requirements are collected
|
||||
*
|
||||
* The argument indicates if all mandatory requirements are satisfied.
|
||||
*/
|
||||
void requirementsComplete( bool );
|
||||
/// @brief Emitted after requirementsComplete
|
||||
void done();
|
||||
|
||||
@ -75,7 +69,7 @@ private:
|
||||
using Watcher = QFutureWatcher< void >;
|
||||
QVector< Watcher* > m_watchers;
|
||||
|
||||
RequirementsList m_collectedRequirements;
|
||||
RequirementsModel* m_model;
|
||||
|
||||
QTimer* m_progressTimer;
|
||||
unsigned m_progressTimeouts;
|
||||
|
@ -18,15 +18,24 @@
|
||||
|
||||
#include "RequirementsModel.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
|
||||
namespace Calamares
|
||||
{
|
||||
|
||||
void
|
||||
RequirementsModel::setRequirementsList( const Calamares::RequirementsList& requirements )
|
||||
RequirementsModel::addRequirementsList( const Calamares::RequirementsList& requirements )
|
||||
{
|
||||
QMutexLocker l( &m_addLock );
|
||||
emit beginResetModel();
|
||||
m_requirements = requirements;
|
||||
m_requirements.append( requirements );
|
||||
changeRequirementsList();
|
||||
emit endResetModel();
|
||||
}
|
||||
|
||||
void
|
||||
RequirementsModel::changeRequirementsList()
|
||||
{
|
||||
auto isUnSatisfied = []( const Calamares::RequirementEntry& e ) { return !e.satisfied; };
|
||||
auto isMandatoryAndUnSatisfied = []( const Calamares::RequirementEntry& e ) { return e.mandatory && !e.satisfied; };
|
||||
|
||||
@ -35,7 +44,6 @@ RequirementsModel::setRequirementsList( const Calamares::RequirementsList& requi
|
||||
|
||||
emit satisfiedRequirementsChanged( m_satisfiedRequirements );
|
||||
emit satisfiedMandatoryChanged( m_satisfiedMandatory );
|
||||
emit endResetModel();
|
||||
}
|
||||
|
||||
int
|
||||
@ -61,6 +69,8 @@ RequirementsModel::data( const QModelIndex& index, int role ) const
|
||||
return requirement.satisfied;
|
||||
case Roles::Mandatory:
|
||||
return requirement.mandatory;
|
||||
case Roles::HasDetails:
|
||||
return requirement.hasDetails();
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
@ -75,7 +85,31 @@ RequirementsModel::roleNames() const
|
||||
roles[ Roles::NegatedText ] = "negatedText";
|
||||
roles[ Roles::Satisfied ] = "satisfied";
|
||||
roles[ Roles::Mandatory ] = "mandatory";
|
||||
roles[ Roles::HasDetails ] = "hasDetails";
|
||||
return roles;
|
||||
}
|
||||
|
||||
void
|
||||
RequirementsModel::describe() const
|
||||
{
|
||||
bool acceptable = true;
|
||||
int count = 0;
|
||||
for ( const auto& r : m_requirements )
|
||||
{
|
||||
if ( r.mandatory && !r.satisfied )
|
||||
{
|
||||
cDebug() << Logger::SubEntry << "requirement" << count << r.name << "is not satisfied.";
|
||||
acceptable = false;
|
||||
}
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RequirementsModel::setProgressMessage( const QString& m )
|
||||
{
|
||||
m_progressMessage = m;
|
||||
emit progressMessageChanged( m_progressMessage );
|
||||
}
|
||||
|
||||
} // namespace Calamares
|
||||
|
@ -24,15 +24,29 @@
|
||||
#include "DllMacro.h"
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QMutex>
|
||||
|
||||
namespace Calamares
|
||||
{
|
||||
class RequirementsChecker;
|
||||
|
||||
/** @brief System requirements from each module and their checked-status
|
||||
*
|
||||
* A Calamares module can have system requirements (e.g. check for
|
||||
* internet, or amount of RAM, or an available disk) which can
|
||||
* be stated and checked.
|
||||
*
|
||||
* This model collects those requirements, can run the checks, and
|
||||
* reports on the overall status of those checks.
|
||||
*/
|
||||
class DLLEXPORT RequirementsModel : public QAbstractListModel
|
||||
{
|
||||
friend class RequirementsChecker;
|
||||
|
||||
Q_OBJECT
|
||||
Q_PROPERTY( bool satisfiedRequirements READ satisfiedRequirements NOTIFY satisfiedRequirementsChanged FINAL )
|
||||
Q_PROPERTY( bool satisfiedMandatory READ satisfiedMandatory NOTIFY satisfiedMandatoryChanged FINAL )
|
||||
Q_PROPERTY( QString progressMessage READ progressMessage NOTIFY progressMessageChanged FINAL )
|
||||
|
||||
public:
|
||||
using QAbstractListModel::QAbstractListModel;
|
||||
@ -48,32 +62,44 @@ public:
|
||||
};
|
||||
// No Q_ENUM because these are exposed through roleNames()
|
||||
|
||||
///@brief Are all the requirements satisfied?
|
||||
bool satisfiedRequirements() const { return m_satisfiedRequirements; }
|
||||
///@brief Are all the **mandatory** requirements satisfied?
|
||||
bool satisfiedMandatory() const { return m_satisfiedMandatory; }
|
||||
///@brief Message (from an ongoing check) about progress
|
||||
QString progressMessage() const { return m_progressMessage; }
|
||||
|
||||
const Calamares::RequirementEntry& getEntry( int index ) const
|
||||
{
|
||||
return m_requirements.at( index );
|
||||
}
|
||||
|
||||
void setRequirementsList( const Calamares::RequirementsList& requirements );
|
||||
|
||||
QVariant data( const QModelIndex& index, int role ) const override;
|
||||
int rowCount( const QModelIndex& ) const override;
|
||||
int count() const { return m_requirements.count(); }
|
||||
|
||||
///@brief Debugging tool, describe the checking-state
|
||||
void describe() const;
|
||||
|
||||
signals:
|
||||
void satisfiedRequirementsChanged( bool value );
|
||||
void satisfiedMandatoryChanged( bool value );
|
||||
void progressMessageChanged( QString message );
|
||||
|
||||
protected:
|
||||
QHash< int, QByteArray > roleNames() const override;
|
||||
|
||||
///@brief Append some requirements; resets the model
|
||||
void addRequirementsList( const Calamares::RequirementsList& requirements );
|
||||
|
||||
///@brief Update progress message (called by the checker)
|
||||
void setProgressMessage( const QString& m );
|
||||
|
||||
private:
|
||||
Calamares::RequirementsList m_requirements;
|
||||
///@brief Implementation for {set,add}RequirementsList
|
||||
void changeRequirementsList();
|
||||
|
||||
QString m_progressMessage;
|
||||
QMutex m_addLock;
|
||||
RequirementsList m_requirements;
|
||||
bool m_satisfiedRequirements = false;
|
||||
bool m_satisfiedMandatory = false;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Calamares
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "Settings.h"
|
||||
#include "modulesystem/Module.h"
|
||||
#include "modulesystem/RequirementsChecker.h"
|
||||
#include "modulesystem/RequirementsModel.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Yaml.h"
|
||||
#include "viewpages/ExecutionViewStep.h"
|
||||
@ -46,6 +47,7 @@ ModuleManager::instance()
|
||||
ModuleManager::ModuleManager( const QStringList& paths, QObject* parent )
|
||||
: QObject( parent )
|
||||
, m_paths( paths )
|
||||
, m_requirementsModel( new RequirementsModel( this ) )
|
||||
{
|
||||
Q_ASSERT( !s_instance );
|
||||
s_instance = this;
|
||||
@ -355,11 +357,9 @@ ModuleManager::checkRequirements()
|
||||
modules[ count++ ] = module;
|
||||
}
|
||||
|
||||
RequirementsChecker* rq = new RequirementsChecker( modules, this );
|
||||
connect( rq, &RequirementsChecker::requirementsResult, this, &ModuleManager::requirementsResult );
|
||||
connect( rq, &RequirementsChecker::requirementsComplete, this, &ModuleManager::requirementsComplete );
|
||||
connect( rq, &RequirementsChecker::requirementsProgress, this, &ModuleManager::requirementsProgress );
|
||||
RequirementsChecker* rq = new RequirementsChecker( modules, m_requirementsModel, this );
|
||||
connect( rq, &RequirementsChecker::done, rq, &RequirementsChecker::deleteLater );
|
||||
connect( rq, &RequirementsChecker::done, this, [=](){ this->requirementsComplete( m_requirementsModel->satisfiedMandatory() ); } );
|
||||
|
||||
QTimer::singleShot( 0, rq, &RequirementsChecker::run );
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ namespace Calamares
|
||||
{
|
||||
|
||||
class Module;
|
||||
struct RequirementEntry; // from Requirement.h
|
||||
class RequirementsModel;
|
||||
|
||||
/**
|
||||
* @brief The ModuleManager class is a singleton which manages Calamares modules.
|
||||
@ -87,18 +87,19 @@ public:
|
||||
|
||||
/**
|
||||
* @brief Starts asynchronous requirements checking for each module.
|
||||
* When this is done, the signal modulesChecked is emitted.
|
||||
* When this is done, the signal requirementsComplete is emitted.
|
||||
*/
|
||||
void checkRequirements();
|
||||
|
||||
///@brief Gets the model that requirements-checking works on.
|
||||
RequirementsModel* requirementsModel() { return m_requirementsModel; }
|
||||
|
||||
signals:
|
||||
void initDone();
|
||||
void modulesLoaded(); /// All of the modules were loaded successfully
|
||||
void modulesFailed( QStringList ); /// .. or not
|
||||
// Below, see RequirementsChecker documentation
|
||||
void requirementsComplete( bool );
|
||||
void requirementsResult( RequirementsList );
|
||||
void requirementsProgress( const QString& );
|
||||
|
||||
private slots:
|
||||
void doInit();
|
||||
@ -130,6 +131,7 @@ private:
|
||||
QMap< QString, QString > m_moduleDirectoriesByModuleName;
|
||||
QMap< ModuleSystem::InstanceKey, Module* > m_loadedModulesByInstanceKey;
|
||||
const QStringList m_paths;
|
||||
RequirementsModel* m_requirementsModel;
|
||||
|
||||
static ModuleManager* s_instance;
|
||||
};
|
||||
|
@ -6,6 +6,17 @@ 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
|
||||
)
|
||||
|
||||
# Because we're sharing sources with the regular locale module
|
||||
set( _locale ${CMAKE_CURRENT_SOURCE_DIR}/../locale )
|
||||
|
||||
|
243
src/modules/localeq/Map.qml
Normal file
243
src/modules/localeq/Map.qml
Normal file
@ -0,0 +1,243 @@
|
||||
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2020, Anke Boersma <demm@kaosx.us>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Calamares is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import QtQuick 2.10
|
||||
import QtQuick.Controls 2.10
|
||||
import QtQuick.Window 2.14
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
import org.kde.kirigami 2.7 as Kirigami
|
||||
|
||||
import QtLocation 5.14
|
||||
import QtPositioning 5.14
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
|
||||
//Needs to come from .conf/geoip
|
||||
property var configCity: "New York"
|
||||
property var configCountry: "USA"
|
||||
property var configTimezone: "America/New York"
|
||||
property var geoipCity: "" //"Amsterdam"
|
||||
property var geoipCountry: "" //"Netherlands"
|
||||
property var geoipTimezone: "" //"Europe/Amsterdam"
|
||||
// vars that will stay once connected
|
||||
property var cityName: (geoipCity != "") ? geoipCity : configCity
|
||||
property var countryName: (geoipCountry != "") ? geoipCountry : configCountry
|
||||
property var timeZone: (geoipTimezone != "") ? geoipTimezone : configTimezone
|
||||
|
||||
function getIp() {
|
||||
var xhr = new XMLHttpRequest
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === XMLHttpRequest.DONE) {
|
||||
var responseJSON = JSON.parse(xhr.responseText)
|
||||
var tz = responseJSON.timezone
|
||||
var ct = responseJSON.city
|
||||
var cy = responseJSON.country
|
||||
|
||||
tzText.text = "Timezone: " + tz
|
||||
cityName = ct
|
||||
countryName = cy
|
||||
}
|
||||
}
|
||||
|
||||
// Define the target of the request
|
||||
xhr.open("GET", "https://get.geojs.io/v1/ip/geo.json")
|
||||
// Execute the request
|
||||
xhr.send()
|
||||
}
|
||||
|
||||
function getTz() {
|
||||
var xhr = new XMLHttpRequest
|
||||
var latC = map.center.latitude
|
||||
var lonC = map.center.longitude
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === XMLHttpRequest.DONE) {
|
||||
var responseJSON = JSON.parse(xhr.responseText)
|
||||
var tz2 = responseJSON.timezoneId
|
||||
|
||||
tzText.text = "Timezone: " + tz2
|
||||
}
|
||||
}
|
||||
|
||||
// Needs to move to localeq.conf, each distribution will need their own account
|
||||
xhr.open("GET", "http://api.geonames.org/timezoneJSON?lat=" + latC + "&lng=" + lonC + "&username=SOME_USERNAME")
|
||||
xhr.send()
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: parent.height / 1.28
|
||||
|
||||
Plugin {
|
||||
id: mapPlugin
|
||||
name: "esri" // "esri", "here", "itemsoverlay", "mapbox", "mapboxgl", "osm"
|
||||
}
|
||||
|
||||
Map {
|
||||
id: map
|
||||
anchors.fill: parent
|
||||
plugin: mapPlugin
|
||||
activeMapType: supportedMapTypes[0]
|
||||
//might be desirable to set zoom level configurable?
|
||||
zoomLevel: 5
|
||||
bearing: 0
|
||||
tilt: 0
|
||||
copyrightsVisible : true
|
||||
fieldOfView : 0
|
||||
|
||||
GeocodeModel {
|
||||
id: geocodeModel
|
||||
plugin: mapPlugin
|
||||
autoUpdate: true
|
||||
query: Address {
|
||||
id: address
|
||||
city: cityName
|
||||
country: countryName
|
||||
}
|
||||
|
||||
onLocationsChanged: {
|
||||
if (count == 1) {
|
||||
map.center.latitude = get(0).coordinate.latitude
|
||||
map.center.longitude = get(0).coordinate.longitude
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MapQuickItem {
|
||||
id: marker
|
||||
anchorPoint.x: image.width/4
|
||||
anchorPoint.y: image.height
|
||||
coordinate: QtPositioning.coordinate(
|
||||
map.center.latitude,
|
||||
map.center.longitude)
|
||||
//coordinate: QtPositioning.coordinate(40.730610, -73.935242) // New York
|
||||
|
||||
sourceItem: Image {
|
||||
id: image
|
||||
width: 32
|
||||
height: 32
|
||||
source: "img/pin.svg"
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
acceptedButtons: Qt.LeftButton
|
||||
anchors.fill: map
|
||||
hoverEnabled: true
|
||||
property var coordinate: map.toCoordinate(Qt.point(mouseX, mouseY))
|
||||
Label {
|
||||
x: parent.mouseX - width
|
||||
y: parent.mouseY - height - 5
|
||||
text: "%1, %2".arg(
|
||||
parent.coordinate.latitude).arg(parent.coordinate.longitude)
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
marker.coordinate = coordinate
|
||||
map.center.latitude = coordinate.latitude
|
||||
map.center.longitude = coordinate.longitude
|
||||
|
||||
getTz();
|
||||
|
||||
console.log(coordinate.latitude, coordinate.longitude)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
anchors.bottomMargin: 5
|
||||
anchors.rightMargin: 10
|
||||
|
||||
MouseArea {
|
||||
width: 32
|
||||
height:32
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
Image {
|
||||
source: "img/plus.png"
|
||||
anchors.centerIn: parent
|
||||
width: 36
|
||||
height: 36
|
||||
}
|
||||
|
||||
onClicked: map.zoomLevel++
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
width: 32
|
||||
height:32
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
Image {
|
||||
source: "img/minus.png"
|
||||
anchors.centerIn: parent
|
||||
width: 32
|
||||
height: 32
|
||||
}
|
||||
|
||||
onClicked: map.zoomLevel--
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 100
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
Item {
|
||||
id: location
|
||||
Kirigami.Theme.inherit: false
|
||||
Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
Rectangle {
|
||||
anchors.centerIn: parent
|
||||
width: 300
|
||||
height: 30
|
||||
color: Kirigami.Theme.backgroundColor
|
||||
|
||||
Text {
|
||||
id: tzText
|
||||
text: tzText.text
|
||||
//text: qsTr("Timezone: %1").arg(timeZone)
|
||||
color: Kirigami.Theme.textColor
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
Component.onCompleted: getIp();
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.top: location.bottom
|
||||
anchors.topMargin: 20
|
||||
padding: 10
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
Kirigami.Theme.backgroundColor: Kirigami.Theme.backgroundColor
|
||||
text: qsTr("Please select your preferred location on the map so the installer can suggest the locale
|
||||
and timezone settings for you. You can fine-tune the suggested settings below. Search the map by dragging
|
||||
to move and using the +/- buttons to zoom in/out or use mouse scrolling for zooming.")
|
||||
}
|
||||
}
|
||||
}
|
80
src/modules/localeq/Offline.qml
Normal file
80
src/modules/localeq/Offline.qml
Normal file
@ -0,0 +1,80 @@
|
||||
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2020, Anke Boersma <demm@kaosx.us>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Calamares is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import QtQuick 2.10
|
||||
import QtQuick.Controls 2.10
|
||||
import QtQuick.Window 2.14
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
import org.kde.kirigami 2.7 as Kirigami
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
|
||||
//Needs to come from localeq.conf
|
||||
property var configTimezone: "America/New York"
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: parent.height / 1.28
|
||||
|
||||
Image {
|
||||
id: image
|
||||
anchors.fill: parent
|
||||
source: "img/worldmap.png"
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 100
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
Item {
|
||||
id: location
|
||||
Kirigami.Theme.inherit: false
|
||||
Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
Rectangle {
|
||||
anchors.centerIn: parent
|
||||
width: 300
|
||||
height: 30
|
||||
color: Kirigami.Theme.backgroundColor
|
||||
|
||||
Text {
|
||||
text: qsTr("Timezone: %1").arg(configTimezone)
|
||||
color: Kirigami.Theme.textColor
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.top: location.bottom
|
||||
anchors.topMargin: 20
|
||||
padding: 10
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
Kirigami.Theme.backgroundColor: Kirigami.Theme.backgroundColor
|
||||
text: qsTr("To be able to select a timezone, make sure you are connected to the internet. Restart the installer after connecting. You can fine-tune Language and Locale settings below.")
|
||||
}
|
||||
}
|
||||
}
|
189
src/modules/localeq/i18n.qml
Normal file
189
src/modules/localeq/i18n.qml
Normal file
@ -0,0 +1,189 @@
|
||||
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2020, Anke Boersma <demm@kaosx.us>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Calamares is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import io.calamares.ui 1.0
|
||||
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
import org.kde.kirigami 2.7 as Kirigami
|
||||
|
||||
Item {
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
focus: true
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
//Needs to come from Locale config
|
||||
property var confLang: "en_US.UTF8"
|
||||
property var confLocale: "nl_NL.UTF8"
|
||||
|
||||
Rectangle {
|
||||
id: textArea
|
||||
x: 28
|
||||
y: 14
|
||||
anchors.fill: parent
|
||||
Kirigami.Theme.backgroundColor: Kirigami.Theme.backgroundColor
|
||||
|
||||
Column {
|
||||
id: languages
|
||||
x: 130
|
||||
y: 40
|
||||
|
||||
Rectangle {
|
||||
width: 250
|
||||
height: 140
|
||||
color: "#d3d3d3"
|
||||
Text {
|
||||
anchors.top: parent.top
|
||||
width: 240
|
||||
wrapMode: Text.WordWrap
|
||||
text: qsTr("<h1>Languages</h1> </br>
|
||||
The system locale setting affects the language and character set for some command line user interface elements. The current setting is <strong>%1</strong>.").arg(confLang)
|
||||
font.pointSize: 10
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: 250
|
||||
height: 300
|
||||
|
||||
ScrollView {
|
||||
id: scroll1
|
||||
anchors.fill: parent
|
||||
contentHeight: 800
|
||||
clip: true
|
||||
|
||||
ListView {
|
||||
id: list1
|
||||
focus: true
|
||||
|
||||
// bogus entries, need to come from Locale config
|
||||
model: ["en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8"]
|
||||
|
||||
currentIndex: 1
|
||||
highlight: Rectangle {
|
||||
color: Kirigami.Theme.highlightColor
|
||||
}
|
||||
delegate: Text {
|
||||
text: modelData
|
||||
|
||||
MouseArea {
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onEntered: {
|
||||
color: "#0000ff"
|
||||
}
|
||||
onClicked: {
|
||||
list1.currentIndex = index
|
||||
confLang = list1.currentIndex
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: i18n
|
||||
x: 430
|
||||
y: 40
|
||||
|
||||
Rectangle {
|
||||
width: 250
|
||||
height: 140
|
||||
color: "#d3d3d3"
|
||||
Text {
|
||||
anchors.top: parent.top
|
||||
width: 240
|
||||
wrapMode: Text.WordWrap
|
||||
text: qsTr("<h1>Locales</h1> </br>
|
||||
The system locale setting affects the language and character set for some command line user interface elements. The current setting is <strong>%1</strong>.").arg(confLocale)
|
||||
font.pointSize: 10
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: 250
|
||||
height: 300
|
||||
|
||||
ScrollView {
|
||||
id: scroll2
|
||||
anchors.fill: parent
|
||||
contentHeight: 800
|
||||
clip: true
|
||||
|
||||
ListView {
|
||||
id: list2
|
||||
width: 180; height: 200
|
||||
focus: true
|
||||
|
||||
// bogus entries, need to come from Locale config
|
||||
model: ["en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8"]
|
||||
|
||||
currentIndex: 2
|
||||
highlight: Rectangle {
|
||||
color: Kirigami.Theme.highlightColor
|
||||
}
|
||||
delegate: Text {
|
||||
text: modelData
|
||||
|
||||
MouseArea {
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
list2.currentIndex = index
|
||||
confLocale = list1.currentIndex
|
||||
}
|
||||
}
|
||||
}
|
||||
onCurrentItemChanged: console.debug(currentIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
id: toolButton
|
||||
x: 19
|
||||
y: 29
|
||||
width: 105
|
||||
height: 48
|
||||
text: qsTr("Back")
|
||||
hoverEnabled: true
|
||||
onClicked: load.source = ""
|
||||
|
||||
Image {
|
||||
id: image1
|
||||
x: 0
|
||||
y: 13
|
||||
width: 22
|
||||
height: 22
|
||||
source: "img/chevron-left-solid.svg"
|
||||
fillMode: Image.PreserveAspectFit
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
1
src/modules/localeq/img/chevron-left-solid.svg
Normal file
1
src/modules/localeq/img/chevron-left-solid.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="chevron-left" class="svg-inline--fa fa-chevron-left fa-w-10" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path fill="currentColor" d="M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"></path></svg>
|
After Width: | Height: | Size: 482 B |
BIN
src/modules/localeq/img/minus.png
Normal file
BIN
src/modules/localeq/img/minus.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 177 B |
60
src/modules/localeq/img/pin.svg
Normal file
60
src/modules/localeq/img/pin.svg
Normal file
@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 1000 1000"
|
||||
enable-background="new 0 0 1000 1000"
|
||||
xml:space="preserve"
|
||||
id="svg14"
|
||||
sodipodi:docname="pin.svg"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"><metadata
|
||||
id="metadata20"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs18" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1351"
|
||||
inkscape:window-height="721"
|
||||
id="namedview16"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.236"
|
||||
inkscape:cx="46.610169"
|
||||
inkscape:cy="500"
|
||||
inkscape:window-x="909"
|
||||
inkscape:window-y="241"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg14" />
|
||||
<g
|
||||
id="g12"
|
||||
style="fill:#ff0000"><g
|
||||
transform="translate(0.000000,511.000000) scale(0.100000,-0.100000)"
|
||||
id="g10"
|
||||
style="fill:#ff0000"><path
|
||||
d="M6663.2,4984.8c-127.4-55.5-334.8-320.4-451.9-575.2c-127.4-273.2-164.3-456-164.3-803.2c0-260.9,8.2-332.8,47.2-472.5c217.8-755.9,891.5-1505.7,1647.5-1828.2c451.9-193.1,875.1-215.7,1335.2-67.8c382.1,121.2,778.6,414.9,813.5,601.9c84.2,456-386.2,1290-1164.7,2058.3c-318.4,312.2-517.7,478.6-819.6,682C7382.1,4931.4,6899.4,5089.6,6663.2,4984.8z M7686.1,4235c213.6-108.9,482.7-324.6,797-636.8c435.5-435.5,690.2-803.2,712.8-1025c10.3-125.3-22.6-158.2-150-143.8c-221.8,26.7-585.4,281.4-1018.9,712.8c-312.2,314.3-525.9,581.3-636.8,797c-74,145.8-98.6,297.9-57.5,347.1C7373.9,4335.7,7532.1,4313.1,7686.1,4235z"
|
||||
id="path2"
|
||||
style="fill:#ff0000" /><path
|
||||
d="M5143,2616.3c-338.9-240.3-638.9-466.3-667.6-501.2c-74-94.5-84.2-328.7-20.5-536.1C4660.3,901,5397.8,77.3,6129.1-286.3c275.3-137.6,431.4-184.9,616.3-184.9c228,2.1,252.7,22.6,595.7,505.3c168.4,236.2,367.7,517.7,445.8,624.5c76,106.8,139.7,199.3,139.7,207.5c0,6.2-67.8,32.9-147.9,57.5c-439.6,141.7-998.3,525.9-1347.5,930.6c-262.9,304-501.2,704.6-618.3,1045.6l-53.4,154.1L5143,2616.3z"
|
||||
id="path4"
|
||||
style="fill:#ff0000" /><path
|
||||
d="M3212.1,2384.2c-353.3-55.5-688.2-197.2-971.6-410.8c-386.2-289.6-517.7-554.6-517.7-1043.5c0-408.8,100.7-782.6,341-1273.6c655.3-1331.1,2085-2526.7,3336-2789.6c213.7-43.2,601.9-49.3,760.1-10.3c211.6,51.4,390.3,152,540.3,304c297.9,302,484.8,667.6,558.7,1092.8c49.3,273.2,39,710.7-22.6,1010.7l-10.3,55.4l-123.3-63.7c-456-234.2-1271.6,84.2-2027.5,797c-332.8,314.3-675.8,778.5-838.1,1131.9c-199.2,435.5-223.9,836.1-67.8,1088.7l39,65.7l-127.4,24.7C3910.5,2394.4,3368.2,2406.8,3212.1,2384.2z"
|
||||
id="path6"
|
||||
style="fill:#ff0000" /><path
|
||||
d="M1948.8-2445.2C1603.7-2841.7,1047-3482.6,712.1-3868.8C151.4-4509.7,100-4575.4,100-4643.2c0-106.8,96.6-180.8,191-143.8c24.7,10.3,423.2,349.2,887.4,751.8c464.3,404.7,1082.6,942.9,1376.3,1197.6c293.7,254.7,550.5,476.6,571.1,495.1c32.9,32.9,18.5,51.4-256.8,326.6c-160.2,160.2-291.7,291.7-293.7,291.7C2575.3-1724.2,2293.9-2048.8,1948.8-2445.2z"
|
||||
id="path8"
|
||||
style="fill:#ff0000" /></g></g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.6 KiB |
BIN
src/modules/localeq/img/plus.png
Normal file
BIN
src/modules/localeq/img/plus.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 483 B |
BIN
src/modules/localeq/img/worldmap.png
Normal file
BIN
src/modules/localeq/img/worldmap.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 100 KiB |
@ -1,3 +1,22 @@
|
||||
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2020, Adriaan de Groot <groot@kde.org>
|
||||
* Copyright 2020, Anke Boersma <demm@kaosx.us>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Calamares is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import io.calamares.core 1.0
|
||||
import io.calamares.ui 1.0
|
||||
|
||||
@ -5,35 +24,77 @@ import QtQuick 2.10
|
||||
import QtQuick.Controls 2.10
|
||||
import QtQuick.Layouts 1.3
|
||||
import org.kde.kirigami 2.7 as Kirigami
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
RowLayout
|
||||
{
|
||||
Rectangle {
|
||||
width: parent.width / 3
|
||||
Layout.fillWidth: true
|
||||
Page {
|
||||
width: 800
|
||||
height: 550
|
||||
|
||||
property var confLang: "American English"
|
||||
property var confLocale: "Nederland"
|
||||
//Needs to come from .conf/geoip
|
||||
property var hasInternet: true
|
||||
|
||||
Loader {
|
||||
id: image
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: parent.width
|
||||
height: parent.height / 1.28
|
||||
source: (hasInternet) ? "Map.qml" : "Offline.qml"
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin : 20
|
||||
width: parent.width
|
||||
|
||||
Kirigami.FormLayout {
|
||||
id: lang
|
||||
|
||||
GridLayout {
|
||||
anchors {
|
||||
left: parent.left
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
}
|
||||
rowSpacing: Kirigami.Units.largeSpacing
|
||||
columnSpacing: Kirigami.Units.largeSpacing
|
||||
|
||||
Kirigami.Icon {
|
||||
source: "application-x-gettext-translation"
|
||||
Layout.fillHeight: true
|
||||
Layout.maximumHeight: Kirigami.Units.iconSizes.medium
|
||||
Layout.preferredWidth: height
|
||||
}
|
||||
ColumnLayout {
|
||||
id: regions
|
||||
Repeater {
|
||||
model: config.regionModel
|
||||
Text {
|
||||
text: label
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
width: parent.width / 3
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
ColumnLayout {
|
||||
id: zones
|
||||
ListView {
|
||||
model: config.zonesModel
|
||||
delegate: Text {
|
||||
text: label
|
||||
wrapMode: Text.WordWrap
|
||||
text: qsTr("System language set to %1").arg(confLang)
|
||||
}
|
||||
Kirigami.Separator {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
text: qsTr("Numbers and dates locale set to %1").arg(confLocale)
|
||||
}
|
||||
}
|
||||
Button {
|
||||
Layout.alignment: Qt.AlignRight|Qt.AlignVCenter
|
||||
Layout.columnSpan: 2
|
||||
text: qsTr("Change")
|
||||
//onClicked: console.log("Adjust Language clicked");
|
||||
onClicked: {
|
||||
onClicked: load.source = "i18n.qml"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loader {
|
||||
id:load
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,47 +1,13 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file alias="images/bg.png">../locale/images/bg.png</file>
|
||||
<file alias="images/pin.png">../locale/images/pin.png</file>
|
||||
<file alias="images/timezone_0.0.png">../locale/images/timezone_0.0.png</file>
|
||||
<file alias="images/timezone_1.0.png">../locale/images/timezone_1.0.png</file>
|
||||
<file alias="images/timezone_2.0.png">../locale/images/timezone_2.0.png</file>
|
||||
<file alias="images/timezone_3.0.png">../locale/images/timezone_3.0.png</file>
|
||||
<file alias="images/timezone_3.5.png">../locale/images/timezone_3.5.png</file>
|
||||
<file alias="images/timezone_4.0.png">../locale/images/timezone_4.0.png</file>
|
||||
<file alias="images/timezone_4.5.png">../locale/images/timezone_4.5.png</file>
|
||||
<file alias="images/timezone_5.0.png">../locale/images/timezone_5.0.png</file>
|
||||
<file alias="images/timezone_5.5.png">../locale/images/timezone_5.5.png</file>
|
||||
<file alias="images/timezone_5.75.png">../locale/images/timezone_5.75.png</file>
|
||||
<file alias="images/timezone_6.0.png">../locale/images/timezone_6.0.png</file>
|
||||
<file alias="images/timezone_6.5.png">../locale/images/timezone_6.5.png</file>
|
||||
<file alias="images/timezone_7.0.png">../locale/images/timezone_7.0.png</file>
|
||||
<file alias="images/timezone_8.0.png">../locale/images/timezone_8.0.png</file>
|
||||
<file alias="images/timezone_9.0.png">../locale/images/timezone_9.0.png</file>
|
||||
<file alias="images/timezone_9.5.png">../locale/images/timezone_9.5.png</file>
|
||||
<file alias="images/timezone_10.0.png">../locale/images/timezone_10.0.png</file>
|
||||
<file alias="images/timezone_10.5.png">../locale/images/timezone_10.5.png</file>
|
||||
<file alias="images/timezone_11.0.png">../locale/images/timezone_11.0.png</file>
|
||||
<file alias="images/timezone_11.5.png">../locale/images/timezone_11.5.png</file>
|
||||
<file alias="images/timezone_12.0.png">../locale/images/timezone_12.0.png</file>
|
||||
<file alias="images/timezone_12.75.png">../locale/images/timezone_12.75.png</file>
|
||||
<file alias="images/timezone_13.0.png">../locale/images/timezone_13.0.png</file>
|
||||
<file alias="images/timezone_-1.0.png">../locale/images/timezone_-1.0.png</file>
|
||||
<file alias="images/timezone_-2.0.png">../locale/images/timezone_-2.0.png</file>
|
||||
<file alias="images/timezone_-3.0.png">../locale/images/timezone_-3.0.png</file>
|
||||
<file alias="images/timezone_-3.5.png">../locale/images/timezone_-3.5.png</file>
|
||||
<file alias="images/timezone_-4.0.png">../locale/images/timezone_-4.0.png</file>
|
||||
<file alias="images/timezone_-4.5.png">../locale/images/timezone_-4.5.png</file>
|
||||
<file alias="images/timezone_-5.0.png">../locale/images/timezone_-5.0.png</file>
|
||||
<file alias="images/timezone_-5.5.png">../locale/images/timezone_-5.5.png</file>
|
||||
<file alias="images/timezone_-6.0.png">../locale/images/timezone_-6.0.png</file>
|
||||
<file alias="images/timezone_-7.0.png">../locale/images/timezone_-7.0.png</file>
|
||||
<file alias="images/timezone_-8.0.png">../locale/images/timezone_-8.0.png</file>
|
||||
<file alias="images/timezone_-9.0.png">../locale/images/timezone_-9.0.png</file>
|
||||
<file alias="images/timezone_-9.5.png">../locale/images/timezone_-9.5.png</file>
|
||||
<file alias="images/timezone_-10.0.png">../locale/images/timezone_-10.0.png</file>
|
||||
<file alias="images/timezone_-11.0.png">../locale/images/timezone_-11.0.png</file>
|
||||
</qresource>
|
||||
<qresource>
|
||||
<file>i18n.qml</file>
|
||||
<file>localeq.qml</file>
|
||||
<file>Map.qml</file>
|
||||
<file>Offline.qml</file>
|
||||
<file>img/minus.png</file>
|
||||
<file>img/pin.svg</file>
|
||||
<file>img/plus.png</file>
|
||||
<file>img/chevron-left-solid.svg</file>
|
||||
<file>img/worldmap.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "Settings.h"
|
||||
#include "geoip/Handler.h"
|
||||
#include "locale/Lookup.h"
|
||||
#include "modulesystem/ModuleManager.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Retranslator.h"
|
||||
#include "utils/Variant.h"
|
||||
@ -30,14 +31,8 @@
|
||||
|
||||
Config::Config( QObject* parent )
|
||||
: QObject( parent )
|
||||
, m_requirementsModel( new Calamares::RequirementsModel( this ) )
|
||||
, m_languages( CalamaresUtils::Locale::availableTranslations() )
|
||||
{
|
||||
connect( m_requirementsModel,
|
||||
&Calamares::RequirementsModel::satisfiedRequirementsChanged,
|
||||
this,
|
||||
&Config::setIsNextEnabled );
|
||||
|
||||
initLanguages();
|
||||
|
||||
CALAMARES_RETRANSLATE_SLOT( &Config::retranslate )
|
||||
@ -49,12 +44,13 @@ Config::retranslate()
|
||||
m_genericWelcomeMessage = genericWelcomeMessage().arg( Calamares::Branding::instance()->versionedName() );
|
||||
emit genericWelcomeMessageChanged( m_genericWelcomeMessage );
|
||||
|
||||
if ( !m_requirementsModel->satisfiedRequirements() )
|
||||
const auto* r = requirementsModel();
|
||||
if ( !r->satisfiedRequirements() )
|
||||
{
|
||||
QString message;
|
||||
const bool setup = Calamares::Settings::instance()->isSetupMode();
|
||||
|
||||
if ( !m_requirementsModel->satisfiedMandatory() )
|
||||
if ( !r->satisfiedMandatory() )
|
||||
{
|
||||
message = setup ? tr( "This computer does not satisfy the minimum "
|
||||
"requirements for setting up %1.<br/>"
|
||||
@ -95,6 +91,13 @@ Config::languagesModel() const
|
||||
return m_languages;
|
||||
}
|
||||
|
||||
Calamares::RequirementsModel*
|
||||
Config::requirementsModel() const
|
||||
{
|
||||
return Calamares::ModuleManager::instance()->requirementsModel();
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Config::languageIcon() const
|
||||
{
|
||||
@ -183,12 +186,6 @@ Config::setLocaleIndex( int index )
|
||||
emit localeIndexChanged( m_localeIndex );
|
||||
}
|
||||
|
||||
Calamares::RequirementsModel&
|
||||
Config::requirementsModel() const
|
||||
{
|
||||
return *m_requirementsModel;
|
||||
}
|
||||
|
||||
void
|
||||
Config::setIsNextEnabled( bool isNextEnabled )
|
||||
{
|
||||
|
@ -20,7 +20,6 @@
|
||||
#define WELCOME_CONFIG_H
|
||||
|
||||
#include "locale/LabelModel.h"
|
||||
#include "modulesystem/Requirement.h"
|
||||
#include "modulesystem/RequirementsModel.h"
|
||||
|
||||
#include <QObject>
|
||||
@ -30,7 +29,7 @@ class Config : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY( CalamaresUtils::Locale::LabelModel* languagesModel READ languagesModel CONSTANT FINAL )
|
||||
Q_PROPERTY( Calamares::RequirementsModel* requirementsModel MEMBER m_requirementsModel CONSTANT FINAL )
|
||||
Q_PROPERTY( Calamares::RequirementsModel* requirementsModel READ requirementsModel CONSTANT FINAL )
|
||||
|
||||
Q_PROPERTY( QString languageIcon READ languageIcon CONSTANT FINAL )
|
||||
|
||||
@ -52,8 +51,6 @@ public:
|
||||
|
||||
void setConfigurationMap( const QVariantMap& );
|
||||
|
||||
Calamares::RequirementsModel& requirementsModel() const;
|
||||
|
||||
void setCountryCode( const QString& countryCode );
|
||||
|
||||
QString languageIcon() const;
|
||||
@ -83,6 +80,9 @@ public slots:
|
||||
CalamaresUtils::Locale::LabelModel* languagesModel() const;
|
||||
void retranslate();
|
||||
|
||||
///@brief The **global** requirements model, from ModuleManager
|
||||
Calamares::RequirementsModel* requirementsModel() const;
|
||||
|
||||
signals:
|
||||
void countryCodeChanged( QString countryCode );
|
||||
void localeIndexChanged( int localeIndex );
|
||||
@ -99,7 +99,6 @@ signals:
|
||||
private:
|
||||
void initLanguages();
|
||||
|
||||
Calamares::RequirementsModel* m_requirementsModel;
|
||||
CalamaresUtils::Locale::LabelModel* m_languages;
|
||||
|
||||
QString m_languageIcon;
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
#include "locale/LabelModel.h"
|
||||
#include "modulesystem/ModuleManager.h"
|
||||
#include "modulesystem/RequirementsModel.h"
|
||||
#include "utils/CalamaresUtilsGui.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/NamedEnum.h"
|
||||
@ -47,7 +48,7 @@
|
||||
WelcomePage::WelcomePage( Config* conf, QWidget* parent )
|
||||
: QWidget( parent )
|
||||
, ui( new Ui::WelcomePage )
|
||||
, m_checkingWidget( new CheckerContainer( conf->requirementsModel(), this ) )
|
||||
, m_checkingWidget( new CheckerContainer( *(conf->requirementsModel()), this ) )
|
||||
, m_languages( nullptr )
|
||||
, m_conf( conf )
|
||||
{
|
||||
@ -90,8 +91,8 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent )
|
||||
&Calamares::ModuleManager::requirementsComplete,
|
||||
m_checkingWidget,
|
||||
&CheckerContainer::requirementsComplete );
|
||||
connect( Calamares::ModuleManager::instance(),
|
||||
&Calamares::ModuleManager::requirementsProgress,
|
||||
connect( Calamares::ModuleManager::instance()->requirementsModel(),
|
||||
&Calamares::RequirementsModel::progressMessageChanged,
|
||||
m_checkingWidget,
|
||||
&CheckerContainer::requirementsProgress );
|
||||
}
|
||||
|
@ -32,16 +32,14 @@ CALAMARES_PLUGIN_FACTORY_DEFINITION( WelcomeViewStepFactory, registerPlugin< Wel
|
||||
|
||||
WelcomeViewStep::WelcomeViewStep( QObject* parent )
|
||||
: Calamares::ViewStep( parent )
|
||||
, m_requirementsChecker( new GeneralRequirements( this ) )
|
||||
, m_conf( new Config( this ) )
|
||||
, m_widget( new WelcomePage( m_conf ) )
|
||||
, m_requirementsChecker( new GeneralRequirements( this ) )
|
||||
{
|
||||
connect( Calamares::ModuleManager::instance(),
|
||||
&Calamares::ModuleManager::requirementsComplete,
|
||||
this,
|
||||
&WelcomeViewStep::nextStatusChanged );
|
||||
|
||||
// the instance of the qqc2 or qwidgets page
|
||||
m_widget = new WelcomePage( m_conf );
|
||||
connect( m_conf, &Config::localeIndexChanged, m_widget, &WelcomePage::externallySelectedLanguage );
|
||||
}
|
||||
|
||||
@ -111,12 +109,12 @@ WelcomeViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
&& configurationMap.value( "requirements" ).type() == QVariant::Map )
|
||||
{
|
||||
m_requirementsChecker->setConfigurationMap( configurationMap.value( "requirements" ).toMap() );
|
||||
|
||||
m_conf->requirementsModel().setRequirementsList( checkRequirements() );
|
||||
}
|
||||
else
|
||||
{
|
||||
cWarning() << "no valid requirements map found in welcome "
|
||||
"module configuration.";
|
||||
}
|
||||
|
||||
//here init the qml or qwidgets needed bits
|
||||
m_widget->init();
|
||||
|
@ -73,9 +73,9 @@ public:
|
||||
Calamares::RequirementsList checkRequirements() override;
|
||||
|
||||
private:
|
||||
Config* m_conf;
|
||||
WelcomePage* m_widget;
|
||||
GeneralRequirements* m_requirementsChecker;
|
||||
Config* m_conf;
|
||||
};
|
||||
|
||||
CALAMARES_PLUGIN_FACTORY_DECLARATION( WelcomeViewStepFactory )
|
||||
|
@ -55,6 +55,17 @@ CheckerContainer::~CheckerContainer()
|
||||
void
|
||||
CheckerContainer::requirementsComplete( bool ok )
|
||||
{
|
||||
if ( !ok )
|
||||
{
|
||||
cDebug() << "Requirements not satisfied" << m_model.count() << "entries:";
|
||||
for ( int i = 0; i < m_model.count(); ++i )
|
||||
{
|
||||
auto index = m_model.index( i );
|
||||
cDebug() << Logger::SubEntry << i << m_model.data( index, Calamares::RequirementsModel::Name ).toString()
|
||||
<< "set?" << m_model.data( index, Calamares::RequirementsModel::Satisfied ).toBool() << "req?"
|
||||
<< m_model.data( index, Calamares::RequirementsModel::Mandatory ).toBool();
|
||||
}
|
||||
}
|
||||
|
||||
layout()->removeWidget( m_waitingWidget );
|
||||
m_waitingWidget->deleteLater();
|
||||
|
@ -70,16 +70,49 @@ biggestSingleScreen()
|
||||
return s;
|
||||
}
|
||||
|
||||
/** @brief Distinguish has-not-been-checked-at-all from false.
|
||||
*
|
||||
*/
|
||||
struct MaybeChecked
|
||||
{
|
||||
bool hasBeenChecked = false;
|
||||
bool value = false;
|
||||
|
||||
MaybeChecked& operator=( bool b )
|
||||
{
|
||||
cDebug() << "Assigning" << b;
|
||||
hasBeenChecked = true;
|
||||
value = b;
|
||||
return *this;
|
||||
}
|
||||
|
||||
operator bool() const { return value; }
|
||||
};
|
||||
|
||||
QDebug&
|
||||
operator<<( QDebug& s, const MaybeChecked& c )
|
||||
{
|
||||
if ( c.hasBeenChecked )
|
||||
{
|
||||
s << c.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
s << "unchecked";
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
Calamares::RequirementsList
|
||||
GeneralRequirements::checkRequirements()
|
||||
{
|
||||
QSize availableSize = biggestSingleScreen();
|
||||
|
||||
bool enoughStorage = false;
|
||||
bool enoughRam = false;
|
||||
bool hasPower = false;
|
||||
bool hasInternet = false;
|
||||
bool isRoot = false;
|
||||
MaybeChecked enoughStorage;
|
||||
MaybeChecked enoughRam;
|
||||
MaybeChecked hasPower;
|
||||
MaybeChecked hasInternet;
|
||||
MaybeChecked isRoot;
|
||||
bool enoughScreen = availableSize.isValid() && ( availableSize.width() >= CalamaresUtils::windowMinimumWidth )
|
||||
&& ( availableSize.height() >= CalamaresUtils::windowMinimumHeight );
|
||||
|
||||
@ -112,7 +145,7 @@ GeneralRequirements::checkRequirements()
|
||||
isRoot = checkIsRoot();
|
||||
}
|
||||
|
||||
using TR = Logger::DebugRow< const char*, bool >;
|
||||
using TR = Logger::DebugRow< const char*, MaybeChecked >;
|
||||
cDebug() << "GeneralRequirements output:" << TR( "enoughStorage", enoughStorage ) << TR( "enoughRam", enoughRam )
|
||||
<< TR( "hasPower", hasPower ) << TR( "hasInternet", hasInternet ) << TR( "isRoot", isRoot );
|
||||
|
||||
|
@ -48,27 +48,29 @@ static void
|
||||
createResultWidgets( QLayout* layout,
|
||||
QList< ResultWidget* >& resultWidgets,
|
||||
const Calamares::RequirementsModel& model,
|
||||
std::function< bool( const Calamares::RequirementEntry& ) > predicate )
|
||||
std::function< bool( const Calamares::RequirementsModel&, QModelIndex ) > predicate )
|
||||
{
|
||||
resultWidgets.clear();
|
||||
resultWidgets.reserve( model.count() );
|
||||
for ( auto i = 0; i < model.count(); i++ )
|
||||
{
|
||||
const auto& entry = model.getEntry( i );
|
||||
if ( !predicate( entry ) )
|
||||
const auto& index = model.index( i );
|
||||
if ( !predicate( model, index ) )
|
||||
{
|
||||
resultWidgets.append( nullptr );
|
||||
continue;
|
||||
}
|
||||
|
||||
ResultWidget* ciw = new ResultWidget( entry.satisfied, entry.mandatory );
|
||||
const bool is_satisfied = model.data( index, Calamares::RequirementsModel::Satisfied ).toBool();
|
||||
const bool is_mandatory = model.data( index, Calamares::RequirementsModel::Mandatory ).toBool();
|
||||
ResultWidget* ciw = new ResultWidget( is_satisfied, is_mandatory );
|
||||
layout->addWidget( ciw );
|
||||
ciw->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
||||
|
||||
ciw->setAutoFillBackground( true );
|
||||
QPalette pal( ciw->palette() );
|
||||
QColor bgColor = pal.window().color();
|
||||
int bgHue = ( entry.satisfied ) ? bgColor.hue() : ( entry.mandatory ) ? 0 : 60;
|
||||
int bgHue = ( is_satisfied ) ? bgColor.hue() : ( is_mandatory ) ? 0 : 60;
|
||||
bgColor.setHsv( bgHue, 64, bgColor.value() );
|
||||
pal.setColor( QPalette::Window, bgColor );
|
||||
ciw->setPalette( pal );
|
||||
@ -114,7 +116,9 @@ ResultsListDialog::ResultsListDialog( const Calamares::RequirementsModel& model,
|
||||
m_title = new QLabel( this );
|
||||
|
||||
createResultWidgets(
|
||||
entriesLayout, m_resultWidgets, model, []( const Calamares::RequirementEntry& e ) { return e.hasDetails(); } );
|
||||
entriesLayout, m_resultWidgets, model, []( const Calamares::RequirementsModel& m, QModelIndex i ) {
|
||||
return m.data( i, Calamares::RequirementsModel::HasDetails ).toBool();
|
||||
} );
|
||||
|
||||
QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Close, Qt::Horizontal, this );
|
||||
|
||||
@ -130,7 +134,7 @@ ResultsListDialog::ResultsListDialog( const Calamares::RequirementsModel& model,
|
||||
retranslate(); // Do it now to fill in the texts
|
||||
}
|
||||
|
||||
ResultsListDialog::~ResultsListDialog() { }
|
||||
ResultsListDialog::~ResultsListDialog() {}
|
||||
|
||||
void
|
||||
ResultsListDialog::retranslate()
|
||||
@ -140,10 +144,10 @@ ResultsListDialog::retranslate()
|
||||
|
||||
for ( auto i = 0; i < m_model.count(); i++ )
|
||||
{
|
||||
const auto& entry = m_model.getEntry( i );
|
||||
if ( m_resultWidgets[ i ] )
|
||||
{
|
||||
m_resultWidgets[ i ]->setText( entry.enumerationText() );
|
||||
m_resultWidgets[ i ]->setText(
|
||||
m_model.data( m_model.index( i ), Calamares::RequirementsModel::Details ).toString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -180,7 +184,9 @@ ResultsListWidget::ResultsListWidget( const Calamares::RequirementsModel& model,
|
||||
// all *mandatory* entries are satisfied (gives errors if not).
|
||||
|
||||
const bool requirementsSatisfied = m_model.satisfiedRequirements();
|
||||
auto isUnSatisfied = []( const Calamares::RequirementEntry& e ) { return !e.satisfied; };
|
||||
auto isUnSatisfied = []( const Calamares::RequirementsModel& m, QModelIndex i ) {
|
||||
return !m.data( i, Calamares::RequirementsModel::Satisfied ).toBool();
|
||||
};
|
||||
|
||||
createResultWidgets( entriesLayout, m_resultWidgets, model, isUnSatisfied );
|
||||
|
||||
@ -240,10 +246,10 @@ ResultsListWidget::retranslate()
|
||||
{
|
||||
for ( auto i = 0; i < m_model.count(); i++ )
|
||||
{
|
||||
const auto& entry = m_model.getEntry( i );
|
||||
if ( m_resultWidgets[ i ] )
|
||||
{
|
||||
m_resultWidgets[ i ]->setText( entry.negatedText() );
|
||||
m_resultWidgets[ i ]->setText(
|
||||
m_model.data( m_model.index( i ), Calamares::RequirementsModel::NegatedText ).toString() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,9 +22,9 @@
|
||||
#include "checker/GeneralRequirements.h"
|
||||
|
||||
#include "locale/LabelModel.h"
|
||||
#include "utils/Dirs.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Variant.h"
|
||||
#include "utils/Dirs.h"
|
||||
|
||||
#include "Branding.h"
|
||||
#include "modulesystem/ModuleManager.h"
|
||||
@ -33,17 +33,14 @@
|
||||
CALAMARES_PLUGIN_FACTORY_DEFINITION( WelcomeQmlViewStepFactory, registerPlugin< WelcomeQmlViewStep >(); )
|
||||
|
||||
WelcomeQmlViewStep::WelcomeQmlViewStep( QObject* parent )
|
||||
: Calamares::QmlViewStep(parent )
|
||||
, m_config( new Config( this ) ) // the qml singleton takes ownership and deletes it
|
||||
// , m_nextEnabled( false )
|
||||
: Calamares::QmlViewStep( parent )
|
||||
, m_config( new Config( this ) )
|
||||
, m_requirementsChecker( new GeneralRequirements( this ) )
|
||||
|
||||
{
|
||||
// connect( m_config,
|
||||
// &Config::isNextEnabledChanged,
|
||||
// this,
|
||||
// &WelcomeQmlViewStep::nextStatusChanged );
|
||||
// emit nextStatusChanged(true);
|
||||
connect( Calamares::ModuleManager::instance(),
|
||||
&Calamares::ModuleManager::requirementsComplete,
|
||||
this,
|
||||
&WelcomeQmlViewStep::nextStatusChanged );
|
||||
}
|
||||
|
||||
|
||||
@ -56,9 +53,7 @@ WelcomeQmlViewStep::prettyName() const
|
||||
bool
|
||||
WelcomeQmlViewStep::isNextEnabled() const
|
||||
{
|
||||
// TODO: should return true
|
||||
// return m_config->property("isNextEnabled").toBool();
|
||||
return true;
|
||||
return m_config->requirementsModel()->satisfiedMandatory();
|
||||
}
|
||||
|
||||
bool
|
||||
@ -96,18 +91,16 @@ WelcomeQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
m_config->setConfigurationMap( configurationMap );
|
||||
|
||||
// TODO: figure out how the requirements (held by ModuleManager) should be accessible
|
||||
// to QML as a model. //will be model as a qvariantmap containing a alert level and the message string
|
||||
if ( configurationMap.contains( "requirements" )
|
||||
&& configurationMap.value( "requirements" ).type() == QVariant::Map )
|
||||
{
|
||||
m_requirementsChecker->setConfigurationMap( configurationMap.value( "requirements" ).toMap() );
|
||||
|
||||
m_config->requirementsModel().setRequirementsList( checkRequirements() );
|
||||
}
|
||||
else
|
||||
cWarning() << "no valid requirements map found in welcome "
|
||||
{
|
||||
cWarning() << "no valid requirements map found in welcomeq "
|
||||
"module configuration.";
|
||||
}
|
||||
|
||||
Calamares::QmlViewStep::setConfigurationMap( configurationMap ); // call parent implementation last
|
||||
setContextProperty( "Welcome", m_config );
|
||||
@ -124,4 +117,3 @@ WelcomeQmlViewStep::getConfig()
|
||||
{
|
||||
return m_config;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,6 @@ class PLUGINDLLEXPORT WelcomeQmlViewStep : public Calamares::QmlViewStep
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
explicit WelcomeQmlViewStep( QObject* parent = nullptr );
|
||||
|
||||
QString prettyName() const override;
|
||||
@ -74,8 +73,7 @@ public:
|
||||
QObject* getConfig() override;
|
||||
|
||||
private:
|
||||
// TODO: a generic QML viewstep should return a config object from a method
|
||||
Config *m_config;
|
||||
Config* m_config;
|
||||
GeneralRequirements* m_requirementsChecker;
|
||||
};
|
||||
|
||||
|
@ -60,14 +60,14 @@ Page
|
||||
property var required: "yes" //requirementsModel
|
||||
property var satisfied: "yes" //satisfiedRequirements
|
||||
property var requiredMet: (required != satisfied) ? true : false
|
||||
visible: requiredMet
|
||||
visible: !config.requirementsModel.satisfiedRequirements
|
||||
}
|
||||
|
||||
Requirements {
|
||||
property var required: "yes" //requirementsModel
|
||||
property var mandatory: "yes" //satisfiedMandatory
|
||||
property var mandatoryMet: (required != mandatory) ? true : false
|
||||
visible: mandatoryMet
|
||||
visible: !config.requirementsModel.satisfiedMandatory
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
|
Loading…
Reference in New Issue
Block a user