2020-08-25 16:05:56 +02:00
|
|
|
/* === This file is part of Calamares - <https://calamares.io> ===
|
2017-12-12 11:42:35 +01:00
|
|
|
*
|
2020-08-22 01:19:58 +02:00
|
|
|
* SPDX-FileCopyrightText: 2017 Adriaan de Groot <groot@kde.org>
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2017-12-12 11:42:35 +01:00
|
|
|
*
|
2020-08-25 16:05:56 +02:00
|
|
|
* Calamares is Free Software: see the License-Identifier above.
|
2017-12-12 11:42:35 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PLASMALNF_THEMEINFO_H
|
|
|
|
#define PLASMALNF_THEMEINFO_H
|
|
|
|
|
2020-11-16 16:37:30 +01:00
|
|
|
#include <QAbstractListModel>
|
2017-12-12 11:42:35 +01:00
|
|
|
#include <QList>
|
|
|
|
#include <QString>
|
|
|
|
|
2020-11-17 11:56:09 +01:00
|
|
|
class ThemeInfoList;
|
2017-12-12 11:42:35 +01:00
|
|
|
|
2020-11-16 16:37:30 +01:00
|
|
|
class ThemesModel : public QAbstractListModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
LabelRole = Qt::DisplayRole,
|
2020-11-16 23:36:32 +01:00
|
|
|
KeyRole = Qt::UserRole,
|
2020-11-17 00:12:47 +01:00
|
|
|
ShownRole,
|
|
|
|
ImageRole
|
2020-11-16 16:37:30 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
explicit ThemesModel( QObject* parent );
|
|
|
|
|
|
|
|
int rowCount( const QModelIndex& = QModelIndex() ) const override;
|
|
|
|
QVariant data( const QModelIndex& index, int role ) const override;
|
|
|
|
|
|
|
|
QHash< int, QByteArray > roleNames() const override;
|
|
|
|
|
2020-11-16 21:28:37 +01:00
|
|
|
/// @brief Set the screenshot to go with the given @p id
|
|
|
|
void setThemeImage( const QString& id, const QString& imagePath );
|
|
|
|
|
|
|
|
/// @brief Call setThemeImage( key, value ) for all keys in @p images
|
|
|
|
void setThemeImage( const QMap< QString, QString >& images );
|
|
|
|
|
|
|
|
/// @brief Set whether to show the given theme @p id (or not)
|
|
|
|
void showTheme( const QString& id, bool show = true );
|
|
|
|
|
|
|
|
/// @brief Shows the keys in the @p onlyThese map, and hides the rest
|
2020-11-16 21:57:06 +01:00
|
|
|
void showOnlyThemes( const QMap< QString, QString >& onlyThese );
|
2020-11-16 21:28:37 +01:00
|
|
|
|
2020-11-16 16:37:30 +01:00
|
|
|
private:
|
2020-11-17 11:56:09 +01:00
|
|
|
ThemeInfoList* m_themes;
|
2020-11-16 16:37:30 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-12-12 11:42:35 +01:00
|
|
|
#endif
|