[plasmalnf] Move the lookandfeeltool path setting to Config
This commit is contained in:
parent
0f07550006
commit
00293d1111
@ -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.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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)
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user