update wlecome to latest
This commit is contained in:
parent
1eec1a9fe7
commit
2d09557297
@ -12,8 +12,6 @@ else()
|
|||||||
add_definitions( -DWITHOUT_LIBPARTED )
|
add_definitions( -DWITHOUT_LIBPARTED )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui )
|
|
||||||
|
|
||||||
set( CHECKER_SOURCES
|
set( CHECKER_SOURCES
|
||||||
checker/CheckerContainer.cpp
|
checker/CheckerContainer.cpp
|
||||||
checker/GeneralRequirements.cpp
|
checker/GeneralRequirements.cpp
|
||||||
|
@ -27,9 +27,10 @@
|
|||||||
void
|
void
|
||||||
RequirementsModel::setRequirementsList( const Calamares::RequirementsList& requirements )
|
RequirementsModel::setRequirementsList( const Calamares::RequirementsList& requirements )
|
||||||
{
|
{
|
||||||
|
CALAMARES_RETRANSLATE_SLOT( &RequirementsModel::retranslate )
|
||||||
|
|
||||||
emit beginResetModel();
|
emit beginResetModel();
|
||||||
m_requierements = requirements;
|
m_requierements = requirements;
|
||||||
m_satisfiedRequirements = true;
|
|
||||||
|
|
||||||
auto isUnSatisfied = []( const Calamares::RequirementEntry& e ) { return !e.satisfied; };
|
auto isUnSatisfied = []( const Calamares::RequirementEntry& e ) { return !e.satisfied; };
|
||||||
auto isMandatoryAndUnSatisfied = []( const Calamares::RequirementEntry& e ) { return e.mandatory && !e.satisfied; };
|
auto isMandatoryAndUnSatisfied = []( const Calamares::RequirementEntry& e ) { return e.mandatory && !e.satisfied; };
|
||||||
@ -115,7 +116,7 @@ Config::retranslate()
|
|||||||
m_genericWelcomeMessage = message.arg( *Calamares::Branding::VersionedName );
|
m_genericWelcomeMessage = message.arg( *Calamares::Branding::VersionedName );
|
||||||
emit genericWelcomeMessageChanged();
|
emit genericWelcomeMessageChanged();
|
||||||
|
|
||||||
// ui->supportButton->setText( tr( "%1 support" ).arg( *Calamares::Branding::ShortProductName ) );
|
m_requirementsModel->retranslate();
|
||||||
}
|
}
|
||||||
|
|
||||||
CalamaresUtils::Locale::LabelModel*
|
CalamaresUtils::Locale::LabelModel*
|
||||||
@ -231,6 +232,7 @@ QString Config::donateUrl() const
|
|||||||
void Config::setDonateUrl(const QString& url)
|
void Config::setDonateUrl(const QString& url)
|
||||||
{
|
{
|
||||||
m_donateUrl = url;
|
m_donateUrl = url;
|
||||||
|
emit donateUrlChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Config::knownIssuesUrl() const
|
QString Config::knownIssuesUrl() const
|
||||||
@ -241,11 +243,13 @@ QString Config::knownIssuesUrl() const
|
|||||||
void Config::setKnownIssuesUrl(const QString& url)
|
void Config::setKnownIssuesUrl(const QString& url)
|
||||||
{
|
{
|
||||||
m_knownIssuesUrl = url;
|
m_knownIssuesUrl = url;
|
||||||
|
emit knownIssuesUrlChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Config::setReleaseNotesUrl(const QString& url)
|
void Config::setReleaseNotesUrl(const QString& url)
|
||||||
{
|
{
|
||||||
m_releaseNotesUrl = url;
|
m_releaseNotesUrl = url;
|
||||||
|
emit releaseNotesUrlChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Config::releaseNotesUrl() const
|
QString Config::releaseNotesUrl() const
|
||||||
@ -261,13 +265,46 @@ QString Config::supportUrl() const
|
|||||||
void Config::setSupportUrl(const QString& url)
|
void Config::setSupportUrl(const QString& url)
|
||||||
{
|
{
|
||||||
m_supportUrl = url;
|
m_supportUrl = url;
|
||||||
|
emit supportUrlChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RequirementsModel::retranslate()
|
||||||
|
{
|
||||||
|
if ( !m_satisfiedRequirements )
|
||||||
|
{
|
||||||
|
QString message;
|
||||||
|
const bool setup = Calamares::Settings::instance()->isSetupMode();
|
||||||
|
|
||||||
|
if ( !m_satisfiedMandatory )
|
||||||
|
{
|
||||||
|
message = setup ? tr( "This computer does not satisfy the minimum "
|
||||||
|
"requirements for setting up %1.<br/>"
|
||||||
|
"Setup cannot continue. "
|
||||||
|
"<a href=\"#details\">Details...</a>" )
|
||||||
|
: tr( "This computer does not satisfy the minimum "
|
||||||
|
"requirements for installing %1.<br/>"
|
||||||
|
"Installation cannot continue. "
|
||||||
|
"<a href=\"#details\">Details...</a>" );
|
||||||
|
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
message = setup ? tr( "This computer does not satisfy some of the "
|
||||||
|
"recommended requirements for setting up %1.<br/>"
|
||||||
|
"Setup can continue, but some features "
|
||||||
|
"might be disabled." )
|
||||||
|
: tr( "This computer does not satisfy some of the "
|
||||||
|
"recommended requirements for installing %1.<br/>"
|
||||||
|
"Installation can continue, but some features "
|
||||||
|
"might be disabled." );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_warningMessage = message.arg( *Calamares::Branding::ShortVersionedName );
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
m_warningMessage = tr( "This program will ask you some questions and "
|
||||||
|
"set up %2 on your computer." )
|
||||||
|
.arg( *Calamares::Branding::ProductName );
|
||||||
|
}
|
||||||
|
|
||||||
|
emit warningMessageChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ class RequirementsModel : public QAbstractListModel
|
|||||||
Q_PROPERTY(bool satisfiedRequirements READ satisfiedRequirements NOTIFY satisfiedRequirementsChanged FINAL)
|
Q_PROPERTY(bool satisfiedRequirements READ satisfiedRequirements NOTIFY satisfiedRequirementsChanged FINAL)
|
||||||
|
|
||||||
Q_PROPERTY(bool satisfiedMandatory READ satisfiedMandatory NOTIFY satisfiedMandatoryChanged FINAL)
|
Q_PROPERTY(bool satisfiedMandatory READ satisfiedMandatory NOTIFY satisfiedMandatoryChanged FINAL)
|
||||||
|
Q_PROPERTY( QString warningMessage READ warningMessage NOTIFY warningMessageChanged FINAL )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Roles : short
|
enum Roles : short
|
||||||
@ -71,6 +72,13 @@ public:
|
|||||||
return m_requierements.count();
|
return m_requierements.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString warningMessage() const
|
||||||
|
{
|
||||||
|
return m_warningMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
void retranslate();
|
||||||
|
|
||||||
QVariant data(const QModelIndex& index, int role) const override;
|
QVariant data(const QModelIndex& index, int role) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -81,9 +89,12 @@ private:
|
|||||||
bool m_satisfiedRequirements = false;
|
bool m_satisfiedRequirements = false;
|
||||||
bool m_satisfiedMandatory = false;
|
bool m_satisfiedMandatory = false;
|
||||||
|
|
||||||
|
QString m_warningMessage;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void satisfiedRequirementsChanged(bool value);
|
void satisfiedRequirementsChanged(bool value);
|
||||||
void satisfiedMandatoryChanged();
|
void satisfiedMandatoryChanged();
|
||||||
|
void warningMessageChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -101,10 +112,12 @@ class Config : public QObject
|
|||||||
Q_PROPERTY( QString genericWelcomeMessage MEMBER m_genericWelcomeMessage NOTIFY genericWelcomeMessageChanged FINAL )
|
Q_PROPERTY( QString genericWelcomeMessage MEMBER m_genericWelcomeMessage NOTIFY genericWelcomeMessageChanged FINAL )
|
||||||
Q_PROPERTY( QString warningMessage MEMBER m_warningMessage CONSTANT FINAL )
|
Q_PROPERTY( QString warningMessage MEMBER m_warningMessage CONSTANT FINAL )
|
||||||
|
|
||||||
Q_PROPERTY(QString supportUrl MEMBER m_supportUrl CONSTANT FINAL)
|
Q_PROPERTY( QString supportUrl MEMBER m_supportUrl NOTIFY supportUrlChanged FINAL )
|
||||||
Q_PROPERTY(QString knownIssuesUrl MEMBER m_knownIssuesUrl CONSTANT FINAL)
|
Q_PROPERTY( QString knownIssuesUrl MEMBER m_knownIssuesUrl NOTIFY knownIssuesUrlChanged FINAL )
|
||||||
Q_PROPERTY(QString releaseNotesUrl MEMBER m_releaseNotesUrl CONSTANT FINAL)
|
Q_PROPERTY( QString releaseNotesUrl MEMBER m_releaseNotesUrl NOTIFY releaseNotesUrlChanged FINAL )
|
||||||
Q_PROPERTY(QString donateUrl MEMBER m_donateUrl CONSTANT FINAL)
|
Q_PROPERTY (QString donateUrl MEMBER m_donateUrl NOTIFY donateUrlChanged FINAL )
|
||||||
|
|
||||||
|
Q_PROPERTY( bool isNextEnabled MEMBER m_isNextEnabled NOTIFY isNextEnabledChanged FINAL )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Config( QObject* parent = nullptr );
|
Config( QObject* parent = nullptr );
|
||||||
@ -144,9 +157,7 @@ private:
|
|||||||
bool m_isNextEnabled = false;
|
bool m_isNextEnabled = false;
|
||||||
CalamaresUtils::Locale::LabelModel* m_languages;
|
CalamaresUtils::Locale::LabelModel* m_languages;
|
||||||
|
|
||||||
QString m_genericWelcomeMessage = tr("This program will ask you some questions and set up your installation");
|
QString m_genericWelcomeMessage;
|
||||||
|
|
||||||
QString m_warningMessage = tr("This program does not satisfy the minimum requirements for installing.\nInstallation can not continue");
|
|
||||||
|
|
||||||
QString m_supportUrl;
|
QString m_supportUrl;
|
||||||
QString m_knownIssuesUrl;
|
QString m_knownIssuesUrl;
|
||||||
@ -158,6 +169,11 @@ signals:
|
|||||||
void localeIndexChanged( int localeIndex );
|
void localeIndexChanged( int localeIndex );
|
||||||
void isNextEnabledChanged( bool isNextEnabled );
|
void isNextEnabledChanged( bool isNextEnabled );
|
||||||
void genericWelcomeMessageChanged();
|
void genericWelcomeMessageChanged();
|
||||||
|
void supportUrlChanged();
|
||||||
|
void knownIssuesUrlChanged();
|
||||||
|
void releaseNotesUrlChanged();
|
||||||
|
void donateUrlChanged();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -41,7 +41,7 @@ CALAMARES_PLUGIN_FACTORY_DEFINITION( WelcomeQmlViewStepFactory, registerPlugin<
|
|||||||
|
|
||||||
WelcomeQmlViewStep::WelcomeQmlViewStep( QObject* parent )
|
WelcomeQmlViewStep::WelcomeQmlViewStep( QObject* parent )
|
||||||
: Calamares::QmlViewStep(parent )
|
: Calamares::QmlViewStep(parent )
|
||||||
, m_config( new Config( ) ) // the qml singleton takes ownership and deletes it
|
, m_config( new Config( this ) ) // the qml singleton takes ownership and deletes it
|
||||||
// , m_nextEnabled( false )
|
// , m_nextEnabled( false )
|
||||||
, m_requirementsChecker( new GeneralRequirements( this ) )
|
, m_requirementsChecker( new GeneralRequirements( this ) )
|
||||||
|
|
||||||
@ -98,10 +98,46 @@ WelcomeQmlViewStep::jobs() const
|
|||||||
return Calamares::JobList();
|
return Calamares::JobList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @brief Look up a URL for a button
|
||||||
|
*
|
||||||
|
* Looks up @p key in @p map; if it is a *boolean* value, then
|
||||||
|
* assume an old-style configuration, and fetch the string from
|
||||||
|
* the branding settings @p e. If it is a string, not a boolean,
|
||||||
|
* use it as-is. If not found, or a weird type, returns empty.
|
||||||
|
*
|
||||||
|
* This allows switching the showKnownIssuesUrl and similar settings
|
||||||
|
* in welcome.conf from a boolean (deferring to branding) to an
|
||||||
|
* actual string for immediate use. Empty strings, as well as
|
||||||
|
* "false" as a setting, will hide the buttons as before.
|
||||||
|
*/
|
||||||
|
static QString
|
||||||
|
jobOrBrandingSetting( Calamares::Branding::StringEntry e, const QVariantMap& map, const QString& key )
|
||||||
|
{
|
||||||
|
if ( !map.contains( key ) )
|
||||||
|
{
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
auto v = map.value( key );
|
||||||
|
if ( v.type() == QVariant::Bool )
|
||||||
|
{
|
||||||
|
return v.toBool() ? ( *e ) : QString();
|
||||||
|
}
|
||||||
|
if ( v.type() == QVariant::String )
|
||||||
|
{
|
||||||
|
return v.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
WelcomeQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
WelcomeQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
{
|
{
|
||||||
using Calamares::Branding;
|
using Calamares::Branding;
|
||||||
|
m_config->setSupportUrl( jobOrBrandingSetting( Branding::SupportUrl, configurationMap, "showSupportUrl" ) );
|
||||||
|
m_config->setKnownIssuesUrl( jobOrBrandingSetting( Branding::KnownIssuesUrl, configurationMap, "showKnownIssuesUrl" ) );
|
||||||
|
m_config->setReleaseNotesUrl( jobOrBrandingSetting( Branding::ReleaseNotesUrl, configurationMap, "showReleaseNotesUrl" ) );
|
||||||
|
m_config->setDonateUrl( CalamaresUtils::getString( configurationMap, "showDonateUrl" ) );
|
||||||
|
|
||||||
// TODO: expand Config class and set the remaining fields // with the configurationMap all those properties can be accesed withouth having to declare a property, get and setter for each
|
// TODO: expand Config class and set the remaining fields // with the configurationMap all those properties can be accesed withouth having to declare a property, get and setter for each
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user