From 1f49f764a6328d557d623bc80ea4311e3eb3bd52 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sun, 3 Dec 2017 10:09:00 -0500 Subject: [PATCH 1/4] [libcalamares] Allow retrieving chroot mode from system (as well as settings) --- src/libcalamares/utils/CalamaresUtilsSystem.cpp | 7 ++++++- src/libcalamares/utils/CalamaresUtilsSystem.h | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libcalamares/utils/CalamaresUtilsSystem.cpp b/src/libcalamares/utils/CalamaresUtilsSystem.cpp index 656a57c10..1f910230d 100644 --- a/src/libcalamares/utils/CalamaresUtilsSystem.cpp +++ b/src/libcalamares/utils/CalamaresUtilsSystem.cpp @@ -256,5 +256,10 @@ System::getTotalMemoryB() #endif } - +bool +System::doChroot() const +{ + return m_doChroot; } + +} // namespace diff --git a/src/libcalamares/utils/CalamaresUtilsSystem.h b/src/libcalamares/utils/CalamaresUtilsSystem.h index 1ccdfb516..8eeff4ef9 100644 --- a/src/libcalamares/utils/CalamaresUtilsSystem.h +++ b/src/libcalamares/utils/CalamaresUtilsSystem.h @@ -114,6 +114,8 @@ public: */ DLLEXPORT QPair getTotalMemoryB(); + DLLEXPORT bool doChroot() const; + private: static System* s_instance; From cddc4699aa6b53e3a161d2aeb762a4d2ad660942 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sun, 3 Dec 2017 12:47:41 -0500 Subject: [PATCH 2/4] [plasmalnf] Import Plasma Look-and-Feel module independently --- src/modules/plasmalnf/CMakeLists.txt | 21 +++ src/modules/plasmalnf/PlasmaLnfInfo.cpp | 140 ++++++++++++++++++++ src/modules/plasmalnf/PlasmaLnfInfo.h | 39 ++++++ src/modules/plasmalnf/PlasmaLnfJob.cpp | 93 +++++++++++++ src/modules/plasmalnf/PlasmaLnfJob.h | 46 +++++++ src/modules/plasmalnf/PlasmaLnfPage.cpp | 70 ++++++++++ src/modules/plasmalnf/PlasmaLnfPage.h | 46 +++++++ src/modules/plasmalnf/PlasmaLnfViewStep.cpp | 138 +++++++++++++++++++ src/modules/plasmalnf/PlasmaLnfViewStep.h | 70 ++++++++++ src/modules/plasmalnf/page_plasmalnf.qrc | 1 + src/modules/plasmalnf/page_plasmalnf.ui | 53 ++++++++ src/modules/plasmalnf/plasmalnf.conf | 4 + 12 files changed, 721 insertions(+) create mode 100644 src/modules/plasmalnf/CMakeLists.txt create mode 100644 src/modules/plasmalnf/PlasmaLnfInfo.cpp create mode 100644 src/modules/plasmalnf/PlasmaLnfInfo.h create mode 100644 src/modules/plasmalnf/PlasmaLnfJob.cpp create mode 100644 src/modules/plasmalnf/PlasmaLnfJob.h create mode 100644 src/modules/plasmalnf/PlasmaLnfPage.cpp create mode 100644 src/modules/plasmalnf/PlasmaLnfPage.h create mode 100644 src/modules/plasmalnf/PlasmaLnfViewStep.cpp create mode 100644 src/modules/plasmalnf/PlasmaLnfViewStep.h create mode 100644 src/modules/plasmalnf/page_plasmalnf.qrc create mode 100644 src/modules/plasmalnf/page_plasmalnf.ui create mode 100644 src/modules/plasmalnf/plasmalnf.conf diff --git a/src/modules/plasmalnf/CMakeLists.txt b/src/modules/plasmalnf/CMakeLists.txt new file mode 100644 index 000000000..9b3ccf716 --- /dev/null +++ b/src/modules/plasmalnf/CMakeLists.txt @@ -0,0 +1,21 @@ +find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE) + +find_package( KF5 5.29 REQUIRED CoreAddons Plasma Service Package ) + +calamares_add_plugin( plasmalnf + TYPE viewmodule + EXPORT_MACRO PLUGINDLLEXPORT_PRO + SOURCES + PlasmaLnfViewStep.cpp + PlasmaLnfPage.cpp + PlasmaLnfJob.cpp + PlasmaLnfInfo.cpp + UI + page_plasmalnf.ui + LINK_PRIVATE_LIBRARIES + calamaresui + KF5::Package + KF5::Plasma + KF5::Service + SHARED_LIB +) diff --git a/src/modules/plasmalnf/PlasmaLnfInfo.cpp b/src/modules/plasmalnf/PlasmaLnfInfo.cpp new file mode 100644 index 000000000..6e9249825 --- /dev/null +++ b/src/modules/plasmalnf/PlasmaLnfInfo.cpp @@ -0,0 +1,140 @@ +/* === This file is part of Calamares - === + * + * Copyright 2017, Adriaan de Groot + * + * 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 . + */ + +#include "PlasmaLnfInfo.h" + +#include +#include +#include +#include +#include + +#include +#include +#include // Future + +#include // TODO: port to KPluginLoader +#include +#include + +#include "utils/Logger.h" + + +namespace Calamares +{ + +QStringList themes_by_package() +{ + QStringList packages; + + QList pkgs = KPackage::PackageLoader::self()->listPackages("Plasma/LookAndFeel"); + + for (const KPluginMetaData &data : pkgs) { + packages << data.pluginId(); + } + + return packages; +} + + +QStringList themes_by_service() +{ + KService::List services; + KServiceTypeTrader* trader = KServiceTypeTrader::self(); + + cDebug() << "Plasma themes by service:"; + QStringList packages; + services = trader->query("Plasma/Theme"); + int c = 0; + for ( const auto s : services ) + { + cDebug() << " .. Plasma theme" << s->name(); + packages << s->name(); + c++; + } + + return packages; +} + +QStringList themes_by_kcm() +{ + QString component; + QList packages; + QStringList paths; + QStringList packageNames; + const QStringList dataPaths = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation); + + for (const QString &path : dataPaths) { + QDir dir(path + "/plasma/look-and-feel"); + paths << dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot); + } + + cDebug() << "Plasma themes by kcm:"; + for (const QString &path : paths) { + Plasma::Package pkg = Plasma::PluginLoader::self()->loadPackage(QStringLiteral("Plasma/LookAndFeel")); + pkg.setPath(path); + pkg.setFallbackPackage(Plasma::Package()); + if (component.isEmpty() || !pkg.filePath(component.toUtf8()).isEmpty()) { + packages << pkg; + packageNames << pkg.metadata().pluginName(); + cDebug() << " .. Plasma theme" << pkg.metadata().pluginName(); + } + } + + return packageNames; +} + +QStringList themes_by_lnftool() +{ + QStringList packages; + + QProcess lnftool; + lnftool.start( Calamares::lnftool(), {"--list"} ); + if ( lnftool.waitForStarted(1000) && lnftool.waitForFinished( 1000 ) && (lnftool.exitCode() == 0) && (lnftool.exitStatus() == QProcess::NormalExit ) ) + { + packages = QString::fromLocal8Bit( lnftool.readAllStandardOutput() ).trimmed().split('\n'); + } + return packages; +} + +QStringList plasma_themes() +{ + QStringList l( themes_by_package() ); + if (l.isEmpty()) + return themes_by_lnftool(); + return l; +} + +static QString *p_lnfPath = nullptr; + +QString lnftool() +{ + if ( !p_lnfPath ) + p_lnfPath = new QString("/usr/bin/lookandfeeltool"); + + return *p_lnfPath; +} + +void set_lnftool( const QString& lnfPath ) +{ + if (p_lnfPath) + delete p_lnfPath; + p_lnfPath = new QString( lnfPath ); +} + +} // namespace Calamares diff --git a/src/modules/plasmalnf/PlasmaLnfInfo.h b/src/modules/plasmalnf/PlasmaLnfInfo.h new file mode 100644 index 000000000..27adc224c --- /dev/null +++ b/src/modules/plasmalnf/PlasmaLnfInfo.h @@ -0,0 +1,39 @@ +/* === This file is part of Calamares - === + * + * Copyright 2017, Adriaan de Groot + * + * 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 . + */ + +#ifndef PLASMALNFINFO_H +#define PLASMALNFINFO_H + +#include +#include + +namespace Calamares +{ +QString lnftool(); +void set_lnftool( const QString& ); + + /* Internal */ +QStringList themes_by_package(); +QStringList themes_by_service(); +QStringList themes_by_kcm(); +QStringList themes_by_lnftool(); + +QStringList plasma_themes(); +} + +#endif // PLASMALNFINFO_H diff --git a/src/modules/plasmalnf/PlasmaLnfJob.cpp b/src/modules/plasmalnf/PlasmaLnfJob.cpp new file mode 100644 index 000000000..e6a4fbe10 --- /dev/null +++ b/src/modules/plasmalnf/PlasmaLnfJob.cpp @@ -0,0 +1,93 @@ +/* === This file is part of Calamares - === + * + * Copyright 2017, Adriaan de Groot + * + * 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 . + */ + +#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 "utils/CalamaresUtilsSystem.h" +#include "utils/Logger.h" + +PlasmaLnfJob::PlasmaLnfJob( const QString& lnfPath, const QString& id ) + : m_lnfPath( lnfPath ) + , m_id(id) +{ +} + + +PlasmaLnfJob::~PlasmaLnfJob() +{ +} + + +QString +PlasmaLnfJob::prettyName() const +{ + return tr( "Plasma Look-and-Feel Job" ); +} + +QString +PlasmaLnfJob::prettyDescription() const +{ + return prettyName(); +} + +QString PlasmaLnfJob::prettyStatusMessage() const +{ + return prettyName(); +} + + +Calamares::JobResult +PlasmaLnfJob::exec() +{ + cDebug() << "Plasma Look-and-Feel Job"; + + auto system = CalamaresUtils::System::instance(); + Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); + + QStringList command; + + if ( !system->doChroot() ) + command << "sudo" << "-E" << "-H" << "-u" << gs->value("username").toString(); + + command << m_lnfPath << "-platform" << "minimal" << "--resetLayout" << "--apply" << m_id; + + int r = system->targetEnvCall( command ); + 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" ) ); + + return Calamares::JobResult::ok(); +} + diff --git a/src/modules/plasmalnf/PlasmaLnfJob.h b/src/modules/plasmalnf/PlasmaLnfJob.h new file mode 100644 index 000000000..c7a7726ed --- /dev/null +++ b/src/modules/plasmalnf/PlasmaLnfJob.h @@ -0,0 +1,46 @@ +/* === This file is part of Calamares - === + * + * Copyright 2017, Adriaan de Groot + * + * 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 . + */ + +#ifndef PLASMALNFJOB_H +#define PLASMALNFJOB_H + +#include +#include + +#include + +class PlasmaLnfJob : public Calamares::Job +{ + Q_OBJECT + +public: + explicit PlasmaLnfJob( const QString& lnfPath, const QString& id ); + virtual ~PlasmaLnfJob() override; + + QString prettyName() const override; + QString prettyDescription() const override; + QString prettyStatusMessage() const override; + + Calamares::JobResult exec() override; + +private: + QString m_lnfPath; + QString m_id; +}; + +#endif // PLASMALNFJOB_H diff --git a/src/modules/plasmalnf/PlasmaLnfPage.cpp b/src/modules/plasmalnf/PlasmaLnfPage.cpp new file mode 100644 index 000000000..632b9f13a --- /dev/null +++ b/src/modules/plasmalnf/PlasmaLnfPage.cpp @@ -0,0 +1,70 @@ +/* === This file is part of Calamares - === + * + * Copyright 2017, Adriaan de Groot + * + * 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 . + */ + +#include "PlasmaLnfPage.h" +#include "PlasmaLnfInfo.h" + +#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 + +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." ) ); + ) + + Calamares::themes_by_package(); + ui->lnfCombo->addItems( Calamares::plasma_themes() ); + + QObject::connect(ui->lnfCombo, &QComboBox::activated, this, &PlasmaLnfPage::activated); +} + +void +PlasmaLnfPage::activated(const QString& name) +{ + cDebug() << "Changed to" << name; + + QProcess lnftool; + lnftool.start( Calamares::lnftool(), {"--resetLayout", "--apply", name} ); + + if ( lnftool.waitForStarted(1000) && lnftool.waitForFinished( 1000 ) && (lnftool.exitCode() == 0) && (lnftool.exitStatus() == QProcess::NormalExit ) ) + ; // OK + else + cDebug() << "WARNING: could not apply look-and-feel" << name; + + + emit plasmaThemeSelected( name ); +} diff --git a/src/modules/plasmalnf/PlasmaLnfPage.h b/src/modules/plasmalnf/PlasmaLnfPage.h new file mode 100644 index 000000000..ceed37044 --- /dev/null +++ b/src/modules/plasmalnf/PlasmaLnfPage.h @@ -0,0 +1,46 @@ +/* === This file is part of Calamares - === + * + * Copyright 2017, Adriaan de Groot + * + * 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 . + */ + +#ifndef PLASMALNFPAGE_H +#define PLASMALNFPAGE_H + +#include +#include + +namespace Ui +{ +class PlasmaLnfPage; +} + +class PlasmaLnfPage : public QWidget +{ + Q_OBJECT +public: + explicit PlasmaLnfPage( QWidget* parent = nullptr ); + +public slots: + void activated(const QString& name); + +signals: + void plasmaThemeSelected( const QString &id ); + +private: + Ui::PlasmaLnfPage* ui; +}; + +#endif //PLASMALNFPAGE_H diff --git a/src/modules/plasmalnf/PlasmaLnfViewStep.cpp b/src/modules/plasmalnf/PlasmaLnfViewStep.cpp new file mode 100644 index 000000000..73f89091b --- /dev/null +++ b/src/modules/plasmalnf/PlasmaLnfViewStep.cpp @@ -0,0 +1,138 @@ +/* === This file is part of Calamares - === + * + * Copyright 2017, Adriaan de Groot + * + * 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 . + */ + +#include "JobQueue.h" +#include "GlobalStorage.h" +#include "utils/Logger.h" +#include "utils/CalamaresUtils.h" +#include "utils/CalamaresUtilsSystem.h" + +#include "PlasmaLnfInfo.h" +#include "PlasmaLnfJob.h" +#include "PlasmaLnfPage.h" +#include "PlasmaLnfViewStep.h" + +#include +#include + +CALAMARES_PLUGIN_FACTORY_DEFINITION( PlasmaLnfViewStepFactory, registerPlugin(); ) + +PlasmaLnfViewStep::PlasmaLnfViewStep( QObject* parent ) + : Calamares::ViewStep( parent ) + , m_widget( new PlasmaLnfPage ) +{ + connect( m_widget, &PlasmaLnfPage::plasmaThemeSelected, this, &PlasmaLnfViewStep::themeSelected ); + emit nextStatusChanged( false ); +} + + +PlasmaLnfViewStep::~PlasmaLnfViewStep() +{ + if ( m_widget && m_widget->parent() == nullptr ) + m_widget->deleteLater(); +} + + +QString +PlasmaLnfViewStep::prettyName() const +{ + return tr( "Look-and-Feel" ); +} + + +QWidget* +PlasmaLnfViewStep::widget() +{ + return m_widget; +} + + +void +PlasmaLnfViewStep::next() +{ + emit done(); +} + + +void +PlasmaLnfViewStep::back() +{} + + +bool +PlasmaLnfViewStep::isNextEnabled() const +{ + return true; +} + + +bool +PlasmaLnfViewStep::isBackEnabled() const +{ + return true; +} + + +bool +PlasmaLnfViewStep::isAtBeginning() const +{ + return true; +} + + +bool +PlasmaLnfViewStep::isAtEnd() const +{ + return true; +} + + +void PlasmaLnfViewStep::onLeave() +{ +} + + +Calamares::JobList +PlasmaLnfViewStep::jobs() const +{ + Calamares::JobList l; + + 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; +} + + +void +PlasmaLnfViewStep::setConfigurationMap( const QVariantMap& configurationMap ) +{ + m_lnfPath = CalamaresUtils::getString( configurationMap, "lnftool" ); + Calamares::set_lnftool( m_lnfPath ); + + if (m_lnfPath.isEmpty()) + cDebug() << "WARNING: no lnftool given for plasmalnf module."; +} + +void +PlasmaLnfViewStep::themeSelected( const QString& id ) +{ + m_themeId = id; +} diff --git a/src/modules/plasmalnf/PlasmaLnfViewStep.h b/src/modules/plasmalnf/PlasmaLnfViewStep.h new file mode 100644 index 000000000..c2bcce2c0 --- /dev/null +++ b/src/modules/plasmalnf/PlasmaLnfViewStep.h @@ -0,0 +1,70 @@ +/* === This file is part of Calamares - === + * + * Copyright 2017, Adriaan de Groot + * + * 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 . + */ + +#ifndef PLASMALNFVIEWSTEP_H +#define PLASMALNFVIEWSTEP_H + +#include +#include +#include + +#include +#include +#include + +class PlasmaLnfPage; + +class PLUGINDLLEXPORT PlasmaLnfViewStep : public Calamares::ViewStep +{ + Q_OBJECT + +public: + explicit PlasmaLnfViewStep( QObject* parent = nullptr ); + virtual ~PlasmaLnfViewStep() override; + + QString prettyName() const override; + + QWidget* widget() override; + + void next() override; + void back() override; + + bool isNextEnabled() const override; + bool isBackEnabled() const override; + + bool isAtBeginning() const override; + bool isAtEnd() const override; + + void onLeave() override; + + Calamares::JobList jobs() const override; + + void setConfigurationMap( const QVariantMap& configurationMap ) override; + +public slots: + void themeSelected( const QString &id ); + +private: + PlasmaLnfPage* m_widget; + QString m_lnfPath; + QString m_themeId; +}; + +CALAMARES_PLUGIN_FACTORY_DECLARATION( PlasmaLnfViewStepFactory ) + +#endif // PLASMALNFVIEWSTEP_H diff --git a/src/modules/plasmalnf/page_plasmalnf.qrc b/src/modules/plasmalnf/page_plasmalnf.qrc new file mode 100644 index 000000000..7646d2b36 --- /dev/null +++ b/src/modules/plasmalnf/page_plasmalnf.qrc @@ -0,0 +1 @@ + diff --git a/src/modules/plasmalnf/page_plasmalnf.ui b/src/modules/plasmalnf/page_plasmalnf.ui new file mode 100644 index 000000000..340527ad0 --- /dev/null +++ b/src/modules/plasmalnf/page_plasmalnf.ui @@ -0,0 +1,53 @@ + + + PlasmaLnfPage + + + + 0 + 0 + 799 + 400 + + + + Form + + + + + + margin-bottom: 1ex; +margin-left: 2em; + + + Placeholder + + + true + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + diff --git a/src/modules/plasmalnf/plasmalnf.conf b/src/modules/plasmalnf/plasmalnf.conf new file mode 100644 index 000000000..d9817ecbc --- /dev/null +++ b/src/modules/plasmalnf/plasmalnf.conf @@ -0,0 +1,4 @@ +--- +# Full path to the Plasma look-and-feel tool (CLI program +# for querying and applying Plasma themes). +lnftool: "/usr/bin/lookandfeeltool" From 3a94f02547b2b39884680ac7e185ddab489a03f7 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 31 Oct 2017 08:25:57 -0400 Subject: [PATCH 3/4] CMake: look for ECM at top-level, add to search path if found. --- CMakeLists.txt | 10 ++++++++++ src/modules/interactiveterminal/CMakeLists.txt | 3 +-- src/modules/partition/CMakeLists.txt | 3 +-- src/modules/users/CMakeLists.txt | 3 +-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dce53b416..ad579be2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,6 +114,16 @@ find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED Core Gui Widgets LinguistTools S find_package( YAMLCPP 0.5.1 REQUIRED ) find_package( PolkitQt5-1 REQUIRED ) +# Find ECM once, and add it to the module search path; Calamares +# modules that need ECM can do +# find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE), +# no need to mess with the module path after. +set( ECM_VERSION 5.10.0 ) +find_package(ECM ${ECM_VERSION} NO_MODULE) +if( ECM_FOUND ) + set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH}) +endif() + option( INSTALL_CONFIG "Install configuration files" ON ) option( WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON ) option( WITH_PYTHONQT "Enable next generation Python modules API (experimental, requires PythonQt)." OFF ) diff --git a/src/modules/interactiveterminal/CMakeLists.txt b/src/modules/interactiveterminal/CMakeLists.txt index 7b35fae0d..71f6bae14 100644 --- a/src/modules/interactiveterminal/CMakeLists.txt +++ b/src/modules/interactiveterminal/CMakeLists.txt @@ -1,5 +1,4 @@ -find_package(ECM 5.10.0 REQUIRED NO_MODULE) -set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH}) +find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE) include(KDEInstallDirs) include(GenerateExportHeader) diff --git a/src/modules/partition/CMakeLists.txt b/src/modules/partition/CMakeLists.txt index ee96c4275..c58eb1d69 100644 --- a/src/modules/partition/CMakeLists.txt +++ b/src/modules/partition/CMakeLists.txt @@ -1,5 +1,4 @@ -find_package(ECM 5.10.0 REQUIRED NO_MODULE) -set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH}) +find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE) include(KDEInstallDirs) include(GenerateExportHeader) diff --git a/src/modules/users/CMakeLists.txt b/src/modules/users/CMakeLists.txt index 074118d54..ebff9df8c 100644 --- a/src/modules/users/CMakeLists.txt +++ b/src/modules/users/CMakeLists.txt @@ -1,6 +1,5 @@ -find_package(ECM 5.10.0 NO_MODULE) +find_package(ECM ${ECM_VERSION} NO_MODULE) if( ECM_FOUND ) - set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH}) include( ECMAddTests ) endif() From ac92d4911d4f52add6ccd40710653ccecf5116f2 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sun, 3 Dec 2017 12:58:54 -0500 Subject: [PATCH 4/4] Compatibility: revert conveniences from master --- src/modules/plasmalnf/PlasmaLnfViewStep.cpp | 9 ++++++--- src/modules/plasmalnf/PlasmaLnfViewStep.h | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/modules/plasmalnf/PlasmaLnfViewStep.cpp b/src/modules/plasmalnf/PlasmaLnfViewStep.cpp index 73f89091b..1beb71d2e 100644 --- a/src/modules/plasmalnf/PlasmaLnfViewStep.cpp +++ b/src/modules/plasmalnf/PlasmaLnfViewStep.cpp @@ -107,10 +107,10 @@ void PlasmaLnfViewStep::onLeave() } -Calamares::JobList +QList PlasmaLnfViewStep::jobs() const { - Calamares::JobList l; + QList l; cDebug() << "Creating Plasma LNF jobs .."; if ( !m_themeId.isEmpty() && !m_lnfPath.isEmpty() ) @@ -124,7 +124,10 @@ PlasmaLnfViewStep::jobs() const void PlasmaLnfViewStep::setConfigurationMap( const QVariantMap& configurationMap ) { - m_lnfPath = CalamaresUtils::getString( configurationMap, "lnftool" ); + QString lnfPath; + if ( configurationMap.contains( "lnftool" ) && configurationMap.value( "lnftool" ).type() == QVariant::String ) + lnfPath = configurationMap.value( "lnftool" ).toString(); + m_lnfPath = lnfPath; Calamares::set_lnftool( m_lnfPath ); if (m_lnfPath.isEmpty()) diff --git a/src/modules/plasmalnf/PlasmaLnfViewStep.h b/src/modules/plasmalnf/PlasmaLnfViewStep.h index c2bcce2c0..4d2598ccc 100644 --- a/src/modules/plasmalnf/PlasmaLnfViewStep.h +++ b/src/modules/plasmalnf/PlasmaLnfViewStep.h @@ -52,7 +52,7 @@ public: void onLeave() override; - Calamares::JobList jobs() const override; + QList jobs() const override; void setConfigurationMap( const QVariantMap& configurationMap ) override;