diff --git a/src/modules/plasmalnf/PlasmaLnfJob.cpp b/src/modules/plasmalnf/PlasmaLnfJob.cpp index a06716a89..82d55f609 100644 --- a/src/modules/plasmalnf/PlasmaLnfJob.cpp +++ b/src/modules/plasmalnf/PlasmaLnfJob.cpp @@ -18,28 +18,14 @@ #include "PlasmaLnfJob.h" -#include -#include -#include -#include -#include - -#include -#include -#include // Future - -#include // TODO: port to KPluginLoader - -#include "CalamaresVersion.h" -#include "JobQueue.h" #include "GlobalStorage.h" - +#include "JobQueue.h" #include "utils/CalamaresUtilsSystem.h" #include "utils/Logger.h" PlasmaLnfJob::PlasmaLnfJob( const QString& lnfPath, const QString& id ) : m_lnfPath( lnfPath ) - , m_id(id) + , m_id( id ) { } @@ -75,15 +61,17 @@ PlasmaLnfJob::exec() auto system = CalamaresUtils::System::instance(); Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); - QStringList command( { - "sudo", "-E", "-H", "-u", gs->value("username").toString(), - m_lnfPath, "-platform", "minimal", "--resetLayout", "--apply", m_id } ); + QStringList command( + { + "sudo", "-E", "-H", "-u", gs->value( "username" ).toString(), + m_lnfPath, "-platform", "minimal", "--resetLayout", "--apply", m_id + } ); int r = system->targetEnvCall( command ); - if (r) + if ( r ) return Calamares::JobResult::error( - tr( "Could not select KDE Plasma Look-and-Feel package" ), - tr( "Could not select KDE Plasma Look-and-Feel package" ) ); + tr( "Could not select KDE Plasma Look-and-Feel package" ), + tr( "Could not select KDE Plasma Look-and-Feel package" ) ); return Calamares::JobResult::ok(); } diff --git a/src/modules/plasmalnf/PlasmaLnfPage.cpp b/src/modules/plasmalnf/PlasmaLnfPage.cpp index 1ea20a75e..01759ba32 100644 --- a/src/modules/plasmalnf/PlasmaLnfPage.cpp +++ b/src/modules/plasmalnf/PlasmaLnfPage.cpp @@ -20,28 +20,20 @@ #include "ui_page_plasmalnf.h" -#include "Branding.h" -#include "JobQueue.h" -#include "GlobalStorage.h" #include "utils/Logger.h" -#include "utils/CalamaresUtilsGui.h" #include "utils/Retranslator.h" -#include "ViewManager.h" #include #include -#include -#include -#include - static PlasmaLnfList plasma_themes() { PlasmaLnfList packages; - QList pkgs = KPackage::PackageLoader::self()->listPackages("Plasma/LookAndFeel"); + QList pkgs = KPackage::PackageLoader::self()->listPackages( "Plasma/LookAndFeel" ); - for (const KPluginMetaData &data : pkgs) { + for ( const KPluginMetaData& data : pkgs ) + { packages << PlasmaLnfDescriptor{ data.pluginId(), data.name() }; cDebug() << "LNF Package" << data.pluginId(); cDebug() << " .." << data.name(); @@ -53,30 +45,29 @@ static PlasmaLnfList plasma_themes() } -PlasmaLnfPage::PlasmaLnfPage(QWidget *parent) +PlasmaLnfPage::PlasmaLnfPage( QWidget* parent ) : QWidget( parent ) , ui( new Ui::PlasmaLnfPage ) { - using StringEntry = Calamares::Branding::StringEntry; - ui->setupUi( this ); CALAMARES_RETRANSLATE( + { ui->retranslateUi( this ); ui->generalExplanation->setText( tr( "Please choose a look-and-feel for the KDE Plasma Desktop, below." ) ); m_availableLnf = plasma_themes(); ui->lnfCombo->clear(); for ( const auto& p : m_availableLnf ) ui->lnfCombo->addItem( p.name ); + } ) - - QObject::connect(ui->lnfCombo, &QComboBox::activated, this, &PlasmaLnfPage::activated); + QObject::connect( ui->lnfCombo, &QComboBox::activated, this, &PlasmaLnfPage::activated ); } void PlasmaLnfPage::activated( int index ) { - if ( (index < 0) || (index > m_availableLnf.length()) ) + if ( ( index < 0 ) || ( index > m_availableLnf.length() ) ) { cDebug() << "Plasma LNF index" << index << "out of range."; return; @@ -88,7 +79,7 @@ PlasmaLnfPage::activated( int index ) } void -PlasmaLnfPage::setLnfPath(const QString& path) +PlasmaLnfPage::setLnfPath( const QString& path ) { m_lnfPath = path; } diff --git a/src/modules/plasmalnf/PlasmaLnfPage.h b/src/modules/plasmalnf/PlasmaLnfPage.h index e115fb649..31731eb0d 100644 --- a/src/modules/plasmalnf/PlasmaLnfPage.h +++ b/src/modules/plasmalnf/PlasmaLnfPage.h @@ -19,8 +19,9 @@ #ifndef PLASMALNFPAGE_H #define PLASMALNFPAGE_H +#include +#include #include -#include namespace Ui { diff --git a/src/modules/plasmalnf/PlasmaLnfViewStep.cpp b/src/modules/plasmalnf/PlasmaLnfViewStep.cpp index b9337e263..1ac3226b1 100644 --- a/src/modules/plasmalnf/PlasmaLnfViewStep.cpp +++ b/src/modules/plasmalnf/PlasmaLnfViewStep.cpp @@ -15,18 +15,13 @@ * You should have received a copy of the GNU General Public License * along with Calamares. If not, see . */ - -#include "JobQueue.h" -#include "GlobalStorage.h" -#include "utils/Logger.h" -#include "utils/CalamaresUtils.h" -#include "utils/CalamaresUtilsSystem.h" +#include "PlasmaLnfViewStep.h" #include "PlasmaLnfJob.h" #include "PlasmaLnfPage.h" -#include "PlasmaLnfViewStep.h" -#include +#include "utils/Logger.h" + #include #include @@ -114,9 +109,7 @@ PlasmaLnfViewStep::jobs() const cDebug() << "Creating Plasma LNF jobs .."; if ( !m_themeId.isEmpty() && !m_lnfPath.isEmpty() ) - { l.append( Calamares::job_ptr( new PlasmaLnfJob( m_lnfPath, m_themeId ) ) ); - } return l; } @@ -130,7 +123,7 @@ PlasmaLnfViewStep::setConfigurationMap( const QVariantMap& configurationMap ) m_lnfPath = lnfPath; m_widget->setLnfPath( m_lnfPath ); - if (m_lnfPath.isEmpty()) + if ( m_lnfPath.isEmpty() ) cDebug() << "WARNING: no lnftool given for plasmalnf module."; } @@ -153,7 +146,7 @@ PlasmaLnfViewStep::themeSelected( const QString& id ) return; } - if ( (lnftool.exitCode() == 0) && (lnftool.exitStatus() == QProcess::NormalExit ) ) + if ( ( lnftool.exitCode() == 0 ) && ( lnftool.exitStatus() == QProcess::NormalExit ) ) cDebug() << "Plasma look-and-feel applied" << id; else cDebug() << "WARNING: could not apply look-and-feel" << id; diff --git a/src/modules/plasmalnf/PlasmaLnfViewStep.h b/src/modules/plasmalnf/PlasmaLnfViewStep.h index 4d2598ccc..e65b59b93 100644 --- a/src/modules/plasmalnf/PlasmaLnfViewStep.h +++ b/src/modules/plasmalnf/PlasmaLnfViewStep.h @@ -57,7 +57,7 @@ public: void setConfigurationMap( const QVariantMap& configurationMap ) override; public slots: - void themeSelected( const QString &id ); + void themeSelected( const QString& id ); private: PlasmaLnfPage* m_widget;