2020-11-11 13:08:42 +01:00
|
|
|
/* === This file is part of Calamares - <https://calamares.io> ===
|
|
|
|
*
|
|
|
|
* SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*
|
|
|
|
* Calamares is Free Software: see the License-Identifier above.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PLASMALNF_CONFIG_H
|
|
|
|
#define PLASMALNF_CONFIG_H
|
|
|
|
|
2020-11-11 14:45:31 +01:00
|
|
|
#include "Job.h"
|
|
|
|
|
2020-11-16 16:37:30 +01:00
|
|
|
#include "ThemeInfo.h"
|
2020-11-11 13:08:42 +01:00
|
|
|
|
2020-11-16 16:37:30 +01:00
|
|
|
#include <QObject>
|
2020-11-12 15:36:29 +01:00
|
|
|
|
2020-11-11 13:08:42 +01:00
|
|
|
class Config : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2020-11-12 15:36:29 +01:00
|
|
|
Q_PROPERTY( QString preselectedTheme READ preselectedTheme CONSTANT )
|
2020-11-11 14:41:45 +01:00
|
|
|
Q_PROPERTY( QString theme READ theme WRITE setTheme NOTIFY themeChanged )
|
2020-11-12 15:36:29 +01:00
|
|
|
Q_PROPERTY( QAbstractItemModel* themeModel READ themeModel CONSTANT )
|
2020-11-11 14:41:45 +01:00
|
|
|
|
2020-11-11 13:08:42 +01:00
|
|
|
public:
|
|
|
|
Config( QObject* parent = nullptr );
|
2020-11-12 15:36:29 +01:00
|
|
|
virtual ~Config() override = default; // QObject cleans up the model pointer
|
2020-11-11 13:08:42 +01:00
|
|
|
|
|
|
|
void setConfigurationMap( const QVariantMap& );
|
2020-11-11 14:45:31 +01:00
|
|
|
Calamares::JobList createJobs() const;
|
2020-11-11 13:21:16 +01:00
|
|
|
|
2020-11-11 14:41:45 +01:00
|
|
|
/** @brief Full path to the lookandfeeltool (if it exists)
|
|
|
|
*
|
|
|
|
* This can be configured, or defaults to `lookandfeeltool` to find
|
|
|
|
* it in $PATH.
|
|
|
|
*/
|
2020-11-11 13:21:16 +01:00
|
|
|
QString lnfToolPath() const { return m_lnfPath; }
|
2020-11-11 14:41:45 +01:00
|
|
|
/** @brief For OEM mode, the name of the (current) live user
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
QString liveUser() const { return m_liveUser; }
|
|
|
|
|
|
|
|
/** @brief The id (in reverse-DNS notation) of the current theme.
|
|
|
|
*/
|
|
|
|
QString theme() const { return m_themeId; }
|
|
|
|
|
2020-11-12 15:36:29 +01:00
|
|
|
/** @brief The theme we start with
|
|
|
|
*
|
|
|
|
* This can be configured, or is taken from the live environment
|
|
|
|
* if the environment is (also) KDE Plasma.
|
|
|
|
*/
|
|
|
|
QString preselectedTheme() const { return m_preselectThemeId; }
|
|
|
|
|
|
|
|
/** @brief The (list) model of available themes.
|
|
|
|
*/
|
|
|
|
QAbstractItemModel* themeModel() const { return m_themeModel; }
|
|
|
|
|
2020-11-11 14:41:45 +01:00
|
|
|
public slots:
|
|
|
|
void setTheme( const QString& id );
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void themeChanged( const QString& id );
|
2020-11-11 13:21:16 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
QString m_lnfPath; // Path to the lnf tool
|
2020-11-11 14:41:45 +01:00
|
|
|
QString m_liveUser; // Name of the live user (for OEM mode)
|
|
|
|
|
2020-11-12 15:36:29 +01:00
|
|
|
QString m_preselectThemeId;
|
2020-11-11 14:41:45 +01:00
|
|
|
QString m_themeId; // Id of selected theme
|
2020-11-12 15:36:29 +01:00
|
|
|
|
2020-11-16 16:37:30 +01:00
|
|
|
ThemesModel* m_themeModel = nullptr;
|
2020-11-11 13:08:42 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|