[plasmalnf] Replace hard-coded path with configurable one
This commit is contained in:
parent
62623a2376
commit
b3d299bbf1
@ -120,9 +120,21 @@ QStringList plasma_themes()
|
||||
return l;
|
||||
}
|
||||
|
||||
static QString *p_lnfPath = nullptr;
|
||||
|
||||
QString lnftool()
|
||||
{
|
||||
return "/home/adridg/bin/lookandfeeltool";
|
||||
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
|
||||
|
@ -19,11 +19,13 @@
|
||||
#ifndef PLASMALNFINFO_H
|
||||
#define PLASMALNFINFO_H
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
namespace Calamares
|
||||
{
|
||||
QString lnftool();
|
||||
void set_lnftool( const QString& );
|
||||
|
||||
/* Internal */
|
||||
QStringList themes_by_package();
|
||||
|
@ -36,8 +36,9 @@
|
||||
|
||||
#include "utils/Logger.h"
|
||||
|
||||
PlasmaLnfJob::PlasmaLnfJob( const QString& id )
|
||||
: m_id(id)
|
||||
PlasmaLnfJob::PlasmaLnfJob( const QString& lnfPath, const QString& id )
|
||||
: m_lnfPath( lnfPath )
|
||||
, m_id(id)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ class PlasmaLnfJob : public Calamares::Job
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PlasmaLnfJob( const QString& id );
|
||||
explicit PlasmaLnfJob( const QString& lnfPath, const QString& id );
|
||||
virtual ~PlasmaLnfJob() override;
|
||||
|
||||
QString prettyName() const override;
|
||||
@ -39,6 +39,7 @@ public:
|
||||
Calamares::JobResult exec() override;
|
||||
|
||||
private:
|
||||
QString m_lnfPath;
|
||||
QString m_id;
|
||||
};
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "utils/CalamaresUtils.h"
|
||||
#include "utils/CalamaresUtilsSystem.h"
|
||||
|
||||
#include "PlasmaLnfInfo.h"
|
||||
#include "PlasmaLnfJob.h"
|
||||
#include "PlasmaLnfPage.h"
|
||||
#include "PlasmaLnfViewStep.h"
|
||||
@ -112,9 +113,9 @@ PlasmaLnfViewStep::jobs() const
|
||||
Calamares::JobList l;
|
||||
|
||||
cDebug() << "Creating Plasma LNF jobs ..";
|
||||
if ( !m_themeId.isEmpty() )
|
||||
if ( !m_themeId.isEmpty() && !m_lnfPath.isEmpty() )
|
||||
{
|
||||
l.append( Calamares::job_ptr( new PlasmaLnfJob( m_themeId ) ) );
|
||||
l.append( Calamares::job_ptr( new PlasmaLnfJob( m_lnfPath, m_themeId ) ) );
|
||||
}
|
||||
return l;
|
||||
}
|
||||
@ -123,6 +124,11 @@ PlasmaLnfViewStep::jobs() const
|
||||
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
|
||||
|
@ -61,6 +61,7 @@ public slots:
|
||||
|
||||
private:
|
||||
PlasmaLnfPage* m_widget;
|
||||
QString m_lnfPath;
|
||||
QString m_themeId;
|
||||
};
|
||||
|
||||
|
@ -1,2 +1,4 @@
|
||||
--
|
||||
# PlasmaLnf module has no configuration
|
||||
---
|
||||
# Full path to the Plasma look-and-feel tool (CLI program
|
||||
# for querying and applying Plasma themes).
|
||||
lnftool: "/usr/bin/lookandfeeltool"
|
||||
|
Loading…
Reference in New Issue
Block a user