[plasmalnf] Add pre-selected theme
- For OEM modes where there is already a theme, add a preselect: key to pick a specific theme and have that one come up as already- selected in the list. - Don't re-run the lnftool if an already-selected theme is clicked again. Use toggled() instead of clicked().
This commit is contained in:
parent
94000b6847
commit
11652c5856
@ -23,6 +23,8 @@
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Retranslator.h"
|
||||
|
||||
#include <QAbstractButton>
|
||||
|
||||
#include <KPackage/Package>
|
||||
#include <KPackage/PackageLoader>
|
||||
|
||||
@ -94,6 +96,14 @@ PlasmaLnfPage::setEnabledThemesAll()
|
||||
setEnabledThemes( plasma_themes() );
|
||||
}
|
||||
|
||||
void
|
||||
PlasmaLnfPage::setPreselect( const QString& id )
|
||||
{
|
||||
m_preselect = id;
|
||||
if ( !m_enabledThemes.isEmpty() )
|
||||
fillUi();
|
||||
}
|
||||
|
||||
|
||||
void PlasmaLnfPage::updateThemeNames()
|
||||
{
|
||||
@ -166,6 +176,11 @@ void PlasmaLnfPage::fillUi()
|
||||
{
|
||||
theme.widget->updateThemeName( theme );
|
||||
}
|
||||
if ( theme.id == m_preselect )
|
||||
{
|
||||
const QSignalBlocker b( theme.widget->button() );
|
||||
theme.widget->button()->setChecked( true );
|
||||
}
|
||||
++c;
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,8 @@ public:
|
||||
void setEnabledThemes( const ThemeInfoList& themes );
|
||||
/** @brief enable all installed plasma themes. */
|
||||
void setEnabledThemesAll();
|
||||
/** @brief set which theme is to be preselected. */
|
||||
void setPreselect( const QString& id );
|
||||
|
||||
signals:
|
||||
void plasmaThemeSelected( const QString& id );
|
||||
@ -64,6 +66,7 @@ private:
|
||||
|
||||
Ui::PlasmaLnfPage* ui;
|
||||
QString m_lnfPath;
|
||||
QString m_preselect;
|
||||
ThemeInfoList m_enabledThemes;
|
||||
|
||||
QButtonGroup *m_buttonGroup;
|
||||
|
@ -137,6 +137,12 @@ PlasmaLnfViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
liveUser = configurationMap.value( "liveuser" ).toString();
|
||||
m_liveUser = liveUser;
|
||||
|
||||
QString preselect;
|
||||
if ( configurationMap.contains( "preselect" ) && configurationMap.value( "preselect" ).type() == QVariant::String )
|
||||
preselect = configurationMap.value( "preselect" ).toString();
|
||||
if ( !preselect.isEmpty() )
|
||||
m_widget->setPreselect( preselect );
|
||||
|
||||
if ( configurationMap.contains( "themes" ) &&
|
||||
configurationMap.value( "themes" ).type() == QVariant::List )
|
||||
{
|
||||
|
@ -61,9 +61,9 @@ public slots:
|
||||
|
||||
private:
|
||||
PlasmaLnfPage* m_widget;
|
||||
QString m_lnfPath;
|
||||
QString m_themeId;
|
||||
QString m_liveUser;
|
||||
QString m_lnfPath; // Path to the lnf tool
|
||||
QString m_themeId; // Id of selected theme
|
||||
QString m_liveUser; // Name of the live user (for OEM mode)
|
||||
};
|
||||
|
||||
CALAMARES_PLUGIN_FACTORY_DECLARATION( PlasmaLnfViewStepFactory )
|
||||
|
@ -62,7 +62,7 @@ ThemeWidget::ThemeWidget(const ThemeInfo& info, QWidget* parent)
|
||||
layout->addWidget( image_label, 1 );
|
||||
layout->addWidget( m_description, 3 );
|
||||
|
||||
connect( m_check, &QRadioButton::clicked, this, &ThemeWidget::clicked );
|
||||
connect( m_check, &QRadioButton::toggled, this, &ThemeWidget::clicked );
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -27,3 +27,15 @@ themes:
|
||||
- theme: org.kde.breezedark.desktop
|
||||
image: "breeze-dark.png"
|
||||
- org.kde.fluffy-bunny.desktop
|
||||
|
||||
# You can pre-select one of the themes; it is not applied
|
||||
# immediately, but its radio-button is switched on to indicate
|
||||
# that that is the theme (that is most likely) currently in use.
|
||||
# Do this only on Live images where you are reasonably sure
|
||||
# that the user is not going to change the theme out from under
|
||||
# themselves before running the installer.
|
||||
#
|
||||
# If this key is present, its value should be the id of the theme
|
||||
# which should be pre-selected. If absent, empty, or the pre-selected
|
||||
# theme is not found on the live system, no theme will be pre-selected.
|
||||
preselect: org.kde.breeze.desktop
|
||||
|
Loading…
Reference in New Issue
Block a user