[welcomeq] Add more fields to Config

- getters as slots, for later access from QML
This commit is contained in:
Adriaan de Groot 2020-02-12 17:31:32 +01:00
parent 86bf9287ab
commit f0134aab71
3 changed files with 19 additions and 11 deletions

View File

@ -18,9 +18,6 @@
#include "Config.h"
Config::Config()
: m_helpUrl( "https://www.kde.org/" )
{
}
Config::Config() {}
Config::~Config() {}

View File

@ -25,16 +25,27 @@
class Config : public QObject
{
Q_OBJECT
Q_PROPERTY( QUrl helpUrl READ helpUrl WRITE setHelpUrl )
Q_PROPERTY( QUrl helpUrl READ helpUrl WRITE setHelpUrl FINAL )
Q_PROPERTY( QUrl issuesUrl READ issuesUrl WRITE setIssuesUrl FINAL )
Q_PROPERTY( QUrl notesUrl READ notesUrl WRITE setNotesUrl FINAL )
Q_PROPERTY( QUrl donateUrl READ donateUrl WRITE setDonateUrl FINAL )
public:
Config();
virtual ~Config();
QUrl helpUrl() const { return m_helpUrl; }
void setHelpUrl( const QUrl& url ) { m_helpUrl = url; }
void setIssuesUrl( const QUrl& url ) { m_issuesUrl = url; }
void setNotesUrl( const QUrl& url ) { m_notesUrl = url; }
void setDonateUrl( const QUrl& url ) { m_donateUrl = url; }
public slots:
QUrl helpUrl() const { return m_helpUrl; }
QUrl issuesUrl() const { return m_issuesUrl; }
QUrl notesUrl() const { return m_notesUrl; }
QUrl donateUrl() const { return m_donateUrl; }
private:
QUrl m_helpUrl;
QUrl m_helpUrl, m_issuesUrl, m_notesUrl, m_donateUrl;
};
#endif

View File

@ -47,9 +47,7 @@ WelcomeQmlViewStep::WelcomeQmlViewStep( QObject* parent )
}
WelcomeQmlViewStep::~WelcomeQmlViewStep()
{
}
WelcomeQmlViewStep::~WelcomeQmlViewStep() {}
QString
WelcomeQmlViewStep::prettyName() const
@ -96,7 +94,9 @@ WelcomeQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
using Calamares::Branding;
m_config.setHelpUrl( jobOrBrandingSetting( Branding::SupportUrl, configurationMap, "showSupportUrl" ) );
// TODO: expand Config class and set the remaining fields
m_config.setIssuesUrl( jobOrBrandingSetting( Branding::KnownIssuesUrl, configurationMap, "showKnownIssuesUrl" ) );
m_config.setNotesUrl( jobOrBrandingSetting( Branding::ReleaseNotesUrl, configurationMap, "showReleaseNotesUrl" ) );
m_config.setDonateUrl( CalamaresUtils::getString( configurationMap, "showDonateUrl" ) );
// TODO: figure out how the requirements (held by ModuleManager) should be accessible
// to QML as a odel.