[plasmalnf] Move the lookandfeeltool path setting to Config

This commit is contained in:
Adriaan de Groot 2020-11-11 13:21:16 +01:00
parent 0f07550006
commit 00293d1111
4 changed files with 23 additions and 15 deletions

View File

@ -9,12 +9,21 @@
#include "Config.h" #include "Config.h"
#include "utils/Logger.h"
#include "utils/Variant.h"
Config::Config( QObject* parent ) Config::Config( QObject* parent )
: QObject( parent ) : QObject( parent )
{ {
} }
void void
Config::setConfigurationMap( const QVariantMap& ) Config::setConfigurationMap( const QVariantMap& configurationMap )
{ {
m_lnfPath = CalamaresUtils::getString( configurationMap, "lnftool" );
if ( m_lnfPath.isEmpty() )
{
cWarning() << "no lnftool given for plasmalnf module.";
}
} }

View File

@ -21,6 +21,11 @@ public:
virtual ~Config() override = default; virtual ~Config() override = default;
void setConfigurationMap( const QVariantMap& ); void setConfigurationMap( const QVariantMap& );
QString lnfToolPath() const { return m_lnfPath; }
private:
QString m_lnfPath; // Path to the lnf tool
}; };
#endif #endif

View File

@ -113,9 +113,9 @@ PlasmaLnfViewStep::jobs() const
cDebug() << "Creating Plasma LNF jobs .."; cDebug() << "Creating Plasma LNF jobs ..";
if ( !m_themeId.isEmpty() ) if ( !m_themeId.isEmpty() )
{ {
if ( !m_lnfPath.isEmpty() ) if ( !m_config->lnfToolPath().isEmpty() )
{ {
l.append( Calamares::job_ptr( new PlasmaLnfJob( m_lnfPath, m_themeId ) ) ); l.append( Calamares::job_ptr( new PlasmaLnfJob( m_config->lnfToolPath(), m_themeId ) ) );
} }
else else
{ {
@ -130,13 +130,8 @@ void
PlasmaLnfViewStep::setConfigurationMap( const QVariantMap& configurationMap ) PlasmaLnfViewStep::setConfigurationMap( const QVariantMap& configurationMap )
{ {
m_config->setConfigurationMap( configurationMap ); m_config->setConfigurationMap( configurationMap );
m_lnfPath = CalamaresUtils::getString( configurationMap, "lnftool" );
m_widget->setLnfPath( m_lnfPath );
if ( m_lnfPath.isEmpty() ) m_widget->setLnfPath( m_config->lnfToolPath() );
{
cWarning() << "no lnftool given for plasmalnf module.";
}
m_liveUser = CalamaresUtils::getString( configurationMap, "liveuser" ); m_liveUser = CalamaresUtils::getString( configurationMap, "liveuser" );
@ -186,7 +181,7 @@ void
PlasmaLnfViewStep::themeSelected( const QString& id ) PlasmaLnfViewStep::themeSelected( const QString& id )
{ {
m_themeId = id; m_themeId = id;
if ( m_lnfPath.isEmpty() ) if ( m_config->lnfToolPath().isEmpty() )
{ {
cWarning() << "no lnftool given for plasmalnf module."; cWarning() << "no lnftool given for plasmalnf module.";
return; return;
@ -194,18 +189,18 @@ PlasmaLnfViewStep::themeSelected( const QString& id )
QProcess lnftool; QProcess lnftool;
if ( !m_liveUser.isEmpty() ) if ( !m_liveUser.isEmpty() )
lnftool.start( "sudo", { "-E", "-H", "-u", m_liveUser, m_lnfPath, "--resetLayout", "--apply", id } ); lnftool.start( "sudo", { "-E", "-H", "-u", m_liveUser, m_config->lnfToolPath(), "--resetLayout", "--apply", id } );
else else
lnftool.start( m_lnfPath, { "--resetLayout", "--apply", id } ); lnftool.start( m_config->lnfToolPath(), { "--resetLayout", "--apply", id } );
if ( !lnftool.waitForStarted( 1000 ) ) if ( !lnftool.waitForStarted( 1000 ) )
{ {
cWarning() << "could not start look-and-feel" << m_lnfPath; cWarning() << "could not start look-and-feel" << m_config->lnfToolPath();
return; return;
} }
if ( !lnftool.waitForFinished() ) if ( !lnftool.waitForFinished() )
{ {
cWarning() << m_lnfPath << "timed out."; cWarning() << m_config->lnfToolPath() << "timed out.";
return; return;
} }

View File

@ -47,7 +47,6 @@ public slots:
private: private:
Config* m_config; Config* m_config;
PlasmaLnfPage* m_widget; PlasmaLnfPage* m_widget;
QString m_lnfPath; // Path to the lnf tool
QString m_themeId; // Id of selected theme QString m_themeId; // Id of selected theme
QString m_liveUser; // Name of the live user (for OEM mode) QString m_liveUser; // Name of the live user (for OEM mode)
}; };