Merge remote-tracking branch 'origin/plasma-lnf'
This commit is contained in:
commit
839c039168
@ -130,6 +130,16 @@ if( ECM_FOUND )
|
||||
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH})
|
||||
endif()
|
||||
|
||||
# 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 )
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
15
src/modules/plasmalnf/CMakeLists.txt
Normal file
15
src/modules/plasmalnf/CMakeLists.txt
Normal file
@ -0,0 +1,15 @@
|
||||
find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE)
|
||||
|
||||
find_package( KF5 5.29 REQUIRED CoreAddons Plasma Service )
|
||||
|
||||
calamares_add_plugin( plasmalnf
|
||||
TYPE job
|
||||
EXPORT_MACRO PLUGINDLLEXPORT_PRO
|
||||
SOURCES
|
||||
PlasmaLnfJob.cpp
|
||||
LINK_PRIVATE_LIBRARIES
|
||||
calamares
|
||||
KF5::Plasma
|
||||
KF5::Service
|
||||
SHARED_LIB
|
||||
)
|
114
src/modules/plasmalnf/PlasmaLnfJob.cpp
Normal file
114
src/modules/plasmalnf/PlasmaLnfJob.cpp
Normal file
@ -0,0 +1,114 @@
|
||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include "PlasmaLnfJob.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QDir>
|
||||
#include <QProcess>
|
||||
#include <QStandardPaths>
|
||||
#include <QThread>
|
||||
|
||||
#include <KService>
|
||||
#include <KServiceTypeTrader>
|
||||
#include <KPluginLoader> // Future
|
||||
|
||||
#include <Plasma/PluginLoader> // TODO: port to KPluginLoader
|
||||
|
||||
#include "CalamaresVersion.h"
|
||||
#include "JobQueue.h"
|
||||
#include "GlobalStorage.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
|
||||
PlasmaLnfJob::PlasmaLnfJob( QObject* parent )
|
||||
: Calamares::CppJob( parent )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
PlasmaLnfJob::~PlasmaLnfJob()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
PlasmaLnfJob::prettyName() const
|
||||
{
|
||||
return tr( "Plasma Look-and-Feel Job" );
|
||||
}
|
||||
|
||||
static void _themes_by_service()
|
||||
{
|
||||
KService::List services;
|
||||
KServiceTypeTrader* trader = KServiceTypeTrader::self();
|
||||
|
||||
services = trader->query("Plasma/Theme");
|
||||
int c = 0;
|
||||
for ( const auto s : services )
|
||||
{
|
||||
cDebug() << "Plasma theme '" << s->name() << '\'';
|
||||
c++;
|
||||
}
|
||||
cDebug() << "Plasma themes by service found" << c;
|
||||
}
|
||||
|
||||
static void _themes_by_kcm()
|
||||
{
|
||||
QString component;
|
||||
QList<Plasma::Package> packages;
|
||||
QStringList paths;
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
cDebug() << "Plasma theme '" << pkg.metadata().pluginName() << '\'';
|
||||
}
|
||||
}
|
||||
cDebug() << "Plasma themes by kcm found" << packages.length();
|
||||
}
|
||||
|
||||
|
||||
Calamares::JobResult
|
||||
PlasmaLnfJob::exec()
|
||||
{
|
||||
cDebug() << "Plasma Look-and-Feel Job";
|
||||
|
||||
_themes_by_service();
|
||||
_themes_by_kcm();
|
||||
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PlasmaLnfJob::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
m_configurationMap = configurationMap;
|
||||
}
|
||||
|
||||
CALAMARES_PLUGIN_FACTORY_DEFINITION( PlasmaLnfJobFactory, registerPlugin<PlasmaLnfJob>(); )
|
51
src/modules/plasmalnf/PlasmaLnfJob.h
Normal file
51
src/modules/plasmalnf/PlasmaLnfJob.h
Normal file
@ -0,0 +1,51 @@
|
||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* 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 PLASMALNFJOB_H
|
||||
#define PLASMALNFJOB_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QVariantMap>
|
||||
|
||||
#include <CppJob.h>
|
||||
|
||||
#include <utils/PluginFactory.h>
|
||||
|
||||
#include <PluginDllMacro.h>
|
||||
|
||||
class PLUGINDLLEXPORT PlasmaLnfJob : public Calamares::CppJob
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PlasmaLnfJob( QObject* parent = nullptr );
|
||||
virtual ~PlasmaLnfJob() override;
|
||||
|
||||
QString prettyName() const override;
|
||||
|
||||
Calamares::JobResult exec() override;
|
||||
|
||||
void setConfigurationMap( const QVariantMap& configurationMap ) override;
|
||||
|
||||
private:
|
||||
QVariantMap m_configurationMap;
|
||||
};
|
||||
|
||||
CALAMARES_PLUGIN_FACTORY_DECLARATION( PlasmaLnfJobFactory )
|
||||
|
||||
#endif // PLASMALNFJOB_H
|
@ -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()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user