2020-08-25 16:05:56 +02:00
|
|
|
/* === This file is part of Calamares - <https://calamares.io> ===
|
2020-03-10 22:44:48 +01:00
|
|
|
*
|
2020-08-22 01:19:58 +02:00
|
|
|
* SPDX-FileCopyrightText: 2019-2020 Adriaan de Groot <groot@kde.org>
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2020-03-10 22:44:48 +01:00
|
|
|
*
|
2020-08-25 16:05:56 +02:00
|
|
|
* Calamares is Free Software: see the License-Identifier above.
|
2020-03-10 22:44:48 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef WELCOME_CONFIG_H
|
|
|
|
#define WELCOME_CONFIG_H
|
|
|
|
|
2021-08-26 16:39:55 +02:00
|
|
|
#include "checker/GeneralRequirements.h"
|
2021-07-26 11:38:15 +02:00
|
|
|
#include "locale/TranslationsModel.h"
|
2020-04-02 21:52:05 +02:00
|
|
|
#include "modulesystem/RequirementsModel.h"
|
2020-03-25 12:00:41 +01:00
|
|
|
|
2020-03-10 22:44:48 +01:00
|
|
|
#include <QObject>
|
2020-06-09 12:05:40 +02:00
|
|
|
#include <QSortFilterProxyModel>
|
2020-03-10 22:44:48 +01:00
|
|
|
#include <QUrl>
|
|
|
|
|
2020-06-09 12:05:40 +02:00
|
|
|
#include <memory>
|
|
|
|
|
2020-03-10 22:44:48 +01:00
|
|
|
class Config : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2020-06-08 15:45:19 +02:00
|
|
|
/** @brief The languages available in Calamares.
|
|
|
|
*
|
|
|
|
* This is a list-model, with names and descriptions for the translations
|
|
|
|
* available to Calamares.
|
|
|
|
*/
|
2021-07-26 11:28:11 +02:00
|
|
|
Q_PROPERTY( CalamaresUtils::Locale::TranslationsModel* languagesModel READ languagesModel CONSTANT FINAL )
|
2020-06-08 15:45:19 +02:00
|
|
|
/** @brief The requirements (from modules) and their checked-status
|
|
|
|
*
|
|
|
|
* The model grows rows over time as each module is checked and its
|
|
|
|
* requirements are taken into account. The model **as a whole**
|
|
|
|
* has properties *satisfiedRequirements* and *satisfiedMandatory*
|
|
|
|
* to say if all of the requirements held in the model have been
|
|
|
|
* satisfied. See the model documentation for details.
|
|
|
|
*/
|
2020-05-11 16:18:55 +02:00
|
|
|
Q_PROPERTY( Calamares::RequirementsModel* requirementsModel READ requirementsModel CONSTANT FINAL )
|
2020-06-09 12:05:40 +02:00
|
|
|
/** @brief The requirements (from modules) that are **unsatisfied**
|
|
|
|
*
|
|
|
|
* This is the same as requirementsModel(), except filtered so
|
|
|
|
* that only those requirements that are not satisfied are exposed.
|
|
|
|
* Note that the type is different, so you should still use the
|
|
|
|
* requirementsModel() for overall status like *satisfiedMandatory*.
|
|
|
|
*/
|
|
|
|
Q_PROPERTY( QAbstractItemModel* unsatisfiedRequirements READ unsatisfiedRequirements CONSTANT FINAL )
|
2020-03-10 22:44:48 +01:00
|
|
|
|
|
|
|
Q_PROPERTY( QString languageIcon READ languageIcon CONSTANT FINAL )
|
|
|
|
|
|
|
|
Q_PROPERTY( QString countryCode MEMBER m_countryCode NOTIFY countryCodeChanged FINAL )
|
2020-03-25 11:41:39 +01:00
|
|
|
Q_PROPERTY( int localeIndex READ localeIndex WRITE setLocaleIndex NOTIFY localeIndexChanged )
|
2020-03-10 22:44:48 +01:00
|
|
|
|
2022-05-23 17:11:45 +02:00
|
|
|
Q_PROPERTY( QString aboutMessage READ aboutMessage CONSTANT FINAL )
|
2020-03-10 22:44:48 +01:00
|
|
|
Q_PROPERTY( QString genericWelcomeMessage MEMBER m_genericWelcomeMessage NOTIFY genericWelcomeMessageChanged FINAL )
|
2020-04-02 21:52:05 +02:00
|
|
|
Q_PROPERTY( QString warningMessage READ warningMessage NOTIFY warningMessageChanged FINAL )
|
2020-03-10 22:44:48 +01:00
|
|
|
|
2020-03-24 15:26:24 +01:00
|
|
|
Q_PROPERTY( QString supportUrl MEMBER m_supportUrl NOTIFY supportUrlChanged FINAL )
|
|
|
|
Q_PROPERTY( QString knownIssuesUrl MEMBER m_knownIssuesUrl NOTIFY knownIssuesUrlChanged FINAL )
|
|
|
|
Q_PROPERTY( QString releaseNotesUrl MEMBER m_releaseNotesUrl NOTIFY releaseNotesUrlChanged FINAL )
|
2020-03-25 11:41:39 +01:00
|
|
|
Q_PROPERTY( QString donateUrl MEMBER m_donateUrl NOTIFY donateUrlChanged FINAL )
|
2020-03-24 15:26:24 +01:00
|
|
|
|
|
|
|
Q_PROPERTY( bool isNextEnabled MEMBER m_isNextEnabled NOTIFY isNextEnabledChanged FINAL )
|
2020-03-10 22:44:48 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
Config( QObject* parent = nullptr );
|
2020-04-02 22:42:41 +02:00
|
|
|
|
2020-05-06 15:08:31 +02:00
|
|
|
void setConfigurationMap( const QVariantMap& );
|
|
|
|
|
2020-03-25 11:41:39 +01:00
|
|
|
void setCountryCode( const QString& countryCode );
|
2020-04-02 22:42:41 +02:00
|
|
|
|
|
|
|
QString languageIcon() const;
|
2020-03-25 11:41:39 +01:00
|
|
|
void setLanguageIcon( const QString& languageIcon );
|
2020-03-10 22:44:48 +01:00
|
|
|
|
2020-04-02 22:42:41 +02:00
|
|
|
void setIsNextEnabled( bool isNextEnabled );
|
2020-03-10 22:44:48 +01:00
|
|
|
|
|
|
|
int localeIndex() const { return m_localeIndex; }
|
2020-04-30 16:51:45 +02:00
|
|
|
void setLocaleIndex( int index );
|
2020-03-10 22:44:48 +01:00
|
|
|
|
2020-04-30 16:51:45 +02:00
|
|
|
QString supportUrl() const { return m_supportUrl; }
|
2020-03-25 11:41:39 +01:00
|
|
|
void setSupportUrl( const QString& url );
|
2020-03-10 22:44:48 +01:00
|
|
|
|
2020-04-30 16:51:45 +02:00
|
|
|
QString knownIssuesUrl() const { return m_knownIssuesUrl; }
|
2020-03-25 11:41:39 +01:00
|
|
|
void setKnownIssuesUrl( const QString& url );
|
2020-03-10 22:44:48 +01:00
|
|
|
|
2020-04-30 16:51:45 +02:00
|
|
|
QString releaseNotesUrl() const { return m_releaseNotesUrl; }
|
2020-03-25 11:41:39 +01:00
|
|
|
void setReleaseNotesUrl( const QString& url );
|
2020-03-10 22:44:48 +01:00
|
|
|
|
2020-04-30 16:51:45 +02:00
|
|
|
QString donateUrl() const { return m_donateUrl; }
|
2020-03-25 11:41:39 +01:00
|
|
|
void setDonateUrl( const QString& url );
|
2020-03-10 22:44:48 +01:00
|
|
|
|
2022-05-23 17:11:45 +02:00
|
|
|
QString aboutMessage() const;
|
2020-04-02 21:52:05 +02:00
|
|
|
QString genericWelcomeMessage() const;
|
|
|
|
QString warningMessage() const;
|
2020-03-24 16:39:29 +01:00
|
|
|
|
2020-03-10 22:44:48 +01:00
|
|
|
public slots:
|
2021-07-26 11:28:11 +02:00
|
|
|
CalamaresUtils::Locale::TranslationsModel* languagesModel() const;
|
2020-03-10 22:44:48 +01:00
|
|
|
void retranslate();
|
|
|
|
|
2020-05-11 16:18:55 +02:00
|
|
|
///@brief The **global** requirements model, from ModuleManager
|
|
|
|
Calamares::RequirementsModel* requirementsModel() const;
|
|
|
|
|
2020-06-09 12:05:40 +02:00
|
|
|
QAbstractItemModel* unsatisfiedRequirements() const;
|
|
|
|
|
2021-08-26 16:39:55 +02:00
|
|
|
/// @brief Check the general requirements
|
|
|
|
Calamares::RequirementsList checkRequirements() const { return m_requirementsChecker->checkRequirements(); }
|
|
|
|
|
2020-04-02 21:55:36 +02:00
|
|
|
signals:
|
|
|
|
void countryCodeChanged( QString countryCode );
|
|
|
|
void localeIndexChanged( int localeIndex );
|
|
|
|
void isNextEnabledChanged( bool isNextEnabled );
|
|
|
|
|
|
|
|
void genericWelcomeMessageChanged( QString message );
|
|
|
|
void warningMessageChanged( QString message );
|
|
|
|
|
|
|
|
void supportUrlChanged();
|
|
|
|
void knownIssuesUrlChanged();
|
|
|
|
void releaseNotesUrlChanged();
|
|
|
|
void donateUrlChanged();
|
|
|
|
|
2020-03-10 22:44:48 +01:00
|
|
|
private:
|
|
|
|
void initLanguages();
|
2020-04-02 22:00:43 +02:00
|
|
|
|
2021-07-26 11:28:11 +02:00
|
|
|
CalamaresUtils::Locale::TranslationsModel* m_languages = nullptr;
|
2020-06-09 12:05:40 +02:00
|
|
|
std::unique_ptr< QSortFilterProxyModel > m_filtermodel;
|
2021-08-26 16:39:55 +02:00
|
|
|
std::unique_ptr< GeneralRequirements > m_requirementsChecker;
|
2020-04-02 22:00:43 +02:00
|
|
|
|
2020-03-10 22:44:48 +01:00
|
|
|
QString m_languageIcon;
|
|
|
|
QString m_countryCode;
|
|
|
|
int m_localeIndex = 0;
|
|
|
|
bool m_isNextEnabled = false;
|
|
|
|
|
2020-03-24 15:26:24 +01:00
|
|
|
QString m_genericWelcomeMessage;
|
2020-04-02 21:52:05 +02:00
|
|
|
QString m_warningMessage;
|
2020-03-10 22:44:48 +01:00
|
|
|
|
|
|
|
QString m_supportUrl;
|
|
|
|
QString m_knownIssuesUrl;
|
|
|
|
QString m_releaseNotesUrl;
|
|
|
|
QString m_donateUrl;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|