2020-08-25 16:05:56 +02:00
|
|
|
/* === This file is part of Calamares - <https://calamares.io> ===
|
2017-12-03 18:47:41 +01:00
|
|
|
*
|
2020-08-22 01:19:58 +02:00
|
|
|
* SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot <groot@kde.org>
|
|
|
|
* SPDX-FileCopyrightText: 2019 Collabora Ltd <arnaud.ferraris@collabora.com>
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2017-12-03 18:47:41 +01:00
|
|
|
*
|
2020-08-25 16:05:56 +02:00
|
|
|
* Calamares is Free Software: see the License-Identifier above.
|
2017-12-03 18:47:41 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "PlasmaLnfPage.h"
|
|
|
|
|
2020-11-16 23:36:32 +01:00
|
|
|
#include "Config.h"
|
2017-12-03 18:47:41 +01:00
|
|
|
#include "ui_page_plasmalnf.h"
|
|
|
|
|
2020-08-22 01:19:58 +02:00
|
|
|
#include "Settings.h"
|
2017-12-03 18:47:41 +01:00
|
|
|
#include "utils/Logger.h"
|
|
|
|
#include "utils/Retranslator.h"
|
|
|
|
|
2020-11-17 12:41:50 +01:00
|
|
|
#include <QHeaderView>
|
|
|
|
#include <QStyledItemDelegate>
|
|
|
|
#include <QTableView>
|
2017-12-03 21:34:06 +01:00
|
|
|
|
2020-11-16 23:36:32 +01:00
|
|
|
PlasmaLnfPage::PlasmaLnfPage( Config* config, QWidget* parent )
|
2017-12-03 18:47:41 +01:00
|
|
|
: QWidget( parent )
|
|
|
|
, ui( new Ui::PlasmaLnfPage )
|
2020-11-16 23:36:32 +01:00
|
|
|
, m_config( config )
|
2017-12-03 18:47:41 +01:00
|
|
|
{
|
|
|
|
ui->setupUi( this );
|
2020-08-22 01:19:58 +02:00
|
|
|
CALAMARES_RETRANSLATE( {
|
2017-12-03 18:47:41 +01:00
|
|
|
ui->retranslateUi( this );
|
2019-04-08 13:44:41 +02:00
|
|
|
if ( Calamares::Settings::instance()->isSetupMode() )
|
2020-08-22 01:19:58 +02:00
|
|
|
ui->generalExplanation->setText( tr( "Please choose a look-and-feel for the KDE Plasma Desktop. "
|
|
|
|
"You can also skip this step and configure the look-and-feel "
|
|
|
|
"once the system is set up. Clicking on a look-and-feel "
|
|
|
|
"selection will give you a live preview of that look-and-feel." ) );
|
2019-04-08 13:44:41 +02:00
|
|
|
else
|
2020-08-22 01:19:58 +02:00
|
|
|
ui->generalExplanation->setText( tr( "Please choose a look-and-feel for the KDE Plasma Desktop. "
|
|
|
|
"You can also skip this step and configure the look-and-feel "
|
|
|
|
"once the system is installed. Clicking on a look-and-feel "
|
|
|
|
"selection will give you a live preview of that look-and-feel." ) );
|
|
|
|
} )
|
2020-11-16 23:36:32 +01:00
|
|
|
connect( this, &PlasmaLnfPage::plasmaThemeSelected, config, &Config::setTheme );
|
2020-11-17 00:02:59 +01:00
|
|
|
|
2020-11-17 12:41:50 +01:00
|
|
|
QTableView* view = new QTableView( this );
|
|
|
|
view->verticalHeader()->hide();
|
|
|
|
view->horizontalHeader()->hide();
|
2020-11-17 11:38:33 +01:00
|
|
|
view->setModel( m_config->themeModel() );
|
|
|
|
ui->verticalLayout->addWidget( view );
|
|
|
|
|
|
|
|
connect( view->selectionModel(),
|
|
|
|
&QItemSelectionModel::selectionChanged,
|
|
|
|
[this]( const QItemSelection& selected, const QItemSelection& ) {
|
|
|
|
auto i = selected.indexes();
|
|
|
|
if ( !i.isEmpty() )
|
|
|
|
{
|
|
|
|
auto* model = m_config->themeModel();
|
|
|
|
auto id = model->data( i.first(), ThemesModel::KeyRole ).toString();
|
|
|
|
cDebug() << "View selected" << selected << id;
|
|
|
|
if ( !id.isEmpty() )
|
|
|
|
{
|
|
|
|
emit plasmaThemeSelected( id );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} );
|
2017-12-12 17:40:10 +01:00
|
|
|
}
|