calamares/src/modules/plasmalnf/ThemeInfo.h
Adriaan de Groot 258a14bea2 [plasmalnf] Expose only the themes model
- make ThemeInfo and ThemeInfoList internal, expose only
  ThemesModel to the rest of the PlasmaLnF module
- don't build the widget anymore (needs to be replaced by
  a delegate)
2020-11-17 11:56:09 +01:00

57 lines
1.4 KiB
C++

/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2017 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_THEMEINFO_H
#define PLASMALNF_THEMEINFO_H
#include <QAbstractListModel>
#include <QList>
#include <QString>
class ThemeInfoList;
class ThemesModel : public QAbstractListModel
{
Q_OBJECT
public:
enum
{
LabelRole = Qt::DisplayRole,
KeyRole = Qt::UserRole,
ShownRole,
ImageRole
};
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;
/// @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
void showOnlyThemes( const QMap< QString, QString >& onlyThese );
private:
ThemeInfoList* m_themes;
};
#endif