2017-12-20 14:39:09 +01:00
|
|
|
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
2017-12-03 18:47:41 +01:00
|
|
|
*
|
|
|
|
* Copyright 2017, Adriaan de Groot <groot@kde.org>
|
|
|
|
*
|
|
|
|
* Calamares is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Calamares is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PLASMALNFPAGE_H
|
|
|
|
#define PLASMALNFPAGE_H
|
|
|
|
|
2017-12-13 16:28:31 +01:00
|
|
|
#include <QButtonGroup>
|
2017-12-04 12:44:37 +01:00
|
|
|
#include <QList>
|
|
|
|
#include <QString>
|
2017-12-04 18:27:30 +01:00
|
|
|
#include <QStringList>
|
2017-12-03 18:47:41 +01:00
|
|
|
#include <QWidget>
|
|
|
|
|
2017-12-12 11:42:35 +01:00
|
|
|
#include "ThemeInfo.h"
|
2017-12-13 16:28:31 +01:00
|
|
|
#include "ThemeWidget.h"
|
2017-12-12 11:42:35 +01:00
|
|
|
|
2017-12-03 18:47:41 +01:00
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
class PlasmaLnfPage;
|
|
|
|
}
|
|
|
|
|
2017-12-19 12:51:56 +01:00
|
|
|
/** @brief Page for selecting a Plasma Look-and-Feel theme.
|
|
|
|
*
|
|
|
|
* You must call setEnabledThemes -- either overload -- once
|
|
|
|
* to get the selection widgets. Note that calling that with
|
|
|
|
* an empty list will result in zero (0) selectable themes.
|
|
|
|
*/
|
2017-12-03 18:47:41 +01:00
|
|
|
class PlasmaLnfPage : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit PlasmaLnfPage( QWidget* parent = nullptr );
|
|
|
|
|
2017-12-03 21:41:52 +01:00
|
|
|
void setLnfPath( const QString& path );
|
2018-03-29 16:09:45 +02:00
|
|
|
/** @brief enable only the listed themes.
|
|
|
|
*
|
|
|
|
* Shows the listed @p themes with full information (e.g. screenshot).
|
|
|
|
* If @p showAll is true, then also show all installed themes
|
|
|
|
* not explicitly listed (without a screenshot).
|
|
|
|
*/
|
|
|
|
void setEnabledThemes( const ThemeInfoList& themes, bool showAll );
|
2017-12-19 12:51:56 +01:00
|
|
|
/** @brief enable all installed plasma themes. */
|
|
|
|
void setEnabledThemesAll();
|
2018-03-29 10:45:34 +02:00
|
|
|
/** @brief set which theme is to be preselected. */
|
|
|
|
void setPreselect( const QString& id );
|
2017-12-03 21:41:52 +01:00
|
|
|
|
2017-12-03 18:47:41 +01:00
|
|
|
signals:
|
2017-12-04 12:40:13 +01:00
|
|
|
void plasmaThemeSelected( const QString& id );
|
2017-12-03 18:47:41 +01:00
|
|
|
|
|
|
|
private:
|
2017-12-12 17:40:10 +01:00
|
|
|
/** @brief Intersect the list of enabled themes with the installed ones. */
|
2017-12-04 18:27:30 +01:00
|
|
|
void winnowThemes();
|
2017-12-12 17:40:10 +01:00
|
|
|
/** @brief Get the translated names for all enabled themes. */
|
|
|
|
void updateThemeNames();
|
|
|
|
/** @brief show enabled themes in the UI. */
|
|
|
|
void fillUi();
|
2017-12-04 18:27:30 +01:00
|
|
|
|
2017-12-03 18:47:41 +01:00
|
|
|
Ui::PlasmaLnfPage* ui;
|
2017-12-03 21:41:52 +01:00
|
|
|
QString m_lnfPath;
|
2018-03-29 10:45:34 +02:00
|
|
|
QString m_preselect;
|
2018-03-29 15:57:19 +02:00
|
|
|
bool m_showAll; // If true, don't winnow according to enabledThemes
|
2017-12-12 11:42:35 +01:00
|
|
|
ThemeInfoList m_enabledThemes;
|
2017-12-13 16:28:31 +01:00
|
|
|
|
|
|
|
QButtonGroup *m_buttonGroup;
|
|
|
|
QList< ThemeWidget* > m_widgets;
|
2017-12-03 18:47:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //PLASMALNFPAGE_H
|