[plasmalnf] Make an actual job of setting the theme
- Job doesn't actually run lookandfeeltool in the target system yet.
This commit is contained in:
parent
2d3defcca3
commit
62623a2376
@ -8,6 +8,7 @@ calamares_add_plugin( plasmalnf
|
|||||||
SOURCES
|
SOURCES
|
||||||
PlasmaLnfViewStep.cpp
|
PlasmaLnfViewStep.cpp
|
||||||
PlasmaLnfPage.cpp
|
PlasmaLnfPage.cpp
|
||||||
|
PlasmaLnfJob.cpp
|
||||||
PlasmaLnfInfo.cpp
|
PlasmaLnfInfo.cpp
|
||||||
UI
|
UI
|
||||||
page_plasmalnf.ui
|
page_plasmalnf.ui
|
||||||
|
@ -36,8 +36,8 @@
|
|||||||
|
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
PlasmaLnfJob::PlasmaLnfJob( QObject* parent )
|
PlasmaLnfJob::PlasmaLnfJob( const QString& id )
|
||||||
: Calamares::CppJob( parent )
|
: m_id(id)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,43 +53,15 @@ PlasmaLnfJob::prettyName() const
|
|||||||
return tr( "Plasma Look-and-Feel Job" );
|
return tr( "Plasma Look-and-Feel Job" );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _themes_by_service()
|
QString
|
||||||
|
PlasmaLnfJob::prettyDescription() const
|
||||||
{
|
{
|
||||||
KService::List services;
|
return prettyName();
|
||||||
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 PlasmaLnfJob::prettyStatusMessage() const
|
||||||
{
|
{
|
||||||
QString component;
|
return prettyName();
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -98,17 +70,6 @@ PlasmaLnfJob::exec()
|
|||||||
{
|
{
|
||||||
cDebug() << "Plasma Look-and-Feel Job";
|
cDebug() << "Plasma Look-and-Feel Job";
|
||||||
|
|
||||||
_themes_by_service();
|
|
||||||
_themes_by_kcm();
|
|
||||||
|
|
||||||
return Calamares::JobResult::ok();
|
return Calamares::JobResult::ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
PlasmaLnfJob::setConfigurationMap( const QVariantMap& configurationMap )
|
|
||||||
{
|
|
||||||
m_configurationMap = configurationMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
CALAMARES_PLUGIN_FACTORY_DEFINITION( PlasmaLnfJobFactory, registerPlugin<PlasmaLnfJob>(); )
|
|
||||||
|
@ -22,30 +22,24 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
|
|
||||||
#include <CppJob.h>
|
#include <Job.h>
|
||||||
|
|
||||||
#include <utils/PluginFactory.h>
|
class PlasmaLnfJob : public Calamares::Job
|
||||||
|
|
||||||
#include <PluginDllMacro.h>
|
|
||||||
|
|
||||||
class PLUGINDLLEXPORT PlasmaLnfJob : public Calamares::CppJob
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PlasmaLnfJob( QObject* parent = nullptr );
|
explicit PlasmaLnfJob( const QString& id );
|
||||||
virtual ~PlasmaLnfJob() override;
|
virtual ~PlasmaLnfJob() override;
|
||||||
|
|
||||||
QString prettyName() const override;
|
QString prettyName() const override;
|
||||||
|
QString prettyDescription() const override;
|
||||||
|
QString prettyStatusMessage() const override;
|
||||||
|
|
||||||
Calamares::JobResult exec() override;
|
Calamares::JobResult exec() override;
|
||||||
|
|
||||||
void setConfigurationMap( const QVariantMap& configurationMap ) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVariantMap m_configurationMap;
|
QString m_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
CALAMARES_PLUGIN_FACTORY_DECLARATION( PlasmaLnfJobFactory )
|
|
||||||
|
|
||||||
#endif // PLASMALNFJOB_H
|
#endif // PLASMALNFJOB_H
|
||||||
|
@ -64,4 +64,7 @@ PlasmaLnfPage::activated(const QString& name)
|
|||||||
; // OK
|
; // OK
|
||||||
else
|
else
|
||||||
cDebug() << "WARNING: could not apply look-and-feel" << name;
|
cDebug() << "WARNING: could not apply look-and-feel" << name;
|
||||||
|
|
||||||
|
|
||||||
|
emit plasmaThemeSelected( name );
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,9 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
void activated(const QString& name);
|
void activated(const QString& name);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void plasmaThemeSelected( const QString &id );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::PlasmaLnfPage* ui;
|
Ui::PlasmaLnfPage* ui;
|
||||||
};
|
};
|
||||||
|
@ -35,6 +35,7 @@ PlasmaLnfViewStep::PlasmaLnfViewStep( QObject* parent )
|
|||||||
: Calamares::ViewStep( parent )
|
: Calamares::ViewStep( parent )
|
||||||
, m_widget( new PlasmaLnfPage )
|
, m_widget( new PlasmaLnfPage )
|
||||||
{
|
{
|
||||||
|
connect( m_widget, &PlasmaLnfPage::plasmaThemeSelected, this, &PlasmaLnfViewStep::themeSelected );
|
||||||
emit nextStatusChanged( false );
|
emit nextStatusChanged( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,6 +112,10 @@ PlasmaLnfViewStep::jobs() const
|
|||||||
Calamares::JobList l;
|
Calamares::JobList l;
|
||||||
|
|
||||||
cDebug() << "Creating Plasma LNF jobs ..";
|
cDebug() << "Creating Plasma LNF jobs ..";
|
||||||
|
if ( !m_themeId.isEmpty() )
|
||||||
|
{
|
||||||
|
l.append( Calamares::job_ptr( new PlasmaLnfJob( m_themeId ) ) );
|
||||||
|
}
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,3 +124,9 @@ void
|
|||||||
PlasmaLnfViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
PlasmaLnfViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PlasmaLnfViewStep::themeSelected( const QString& id )
|
||||||
|
{
|
||||||
|
m_themeId = id;
|
||||||
|
}
|
||||||
|
@ -56,8 +56,12 @@ public:
|
|||||||
|
|
||||||
void setConfigurationMap( const QVariantMap& configurationMap ) override;
|
void setConfigurationMap( const QVariantMap& configurationMap ) override;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void themeSelected( const QString &id );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PlasmaLnfPage* m_widget;
|
PlasmaLnfPage* m_widget;
|
||||||
|
QString m_themeId;
|
||||||
};
|
};
|
||||||
|
|
||||||
CALAMARES_PLUGIN_FACTORY_DECLARATION( PlasmaLnfViewStepFactory )
|
CALAMARES_PLUGIN_FACTORY_DECLARATION( PlasmaLnfViewStepFactory )
|
||||||
|
Loading…
Reference in New Issue
Block a user