[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/Logger.h"
|
||||||
#include "utils/Retranslator.h"
|
#include "utils/Retranslator.h"
|
||||||
|
|
||||||
|
#include <QAbstractButton>
|
||||||
|
|
||||||
#include <KPackage/Package>
|
#include <KPackage/Package>
|
||||||
#include <KPackage/PackageLoader>
|
#include <KPackage/PackageLoader>
|
||||||
|
|
||||||
@ -94,6 +96,14 @@ PlasmaLnfPage::setEnabledThemesAll()
|
|||||||
setEnabledThemes( plasma_themes() );
|
setEnabledThemes( plasma_themes() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PlasmaLnfPage::setPreselect( const QString& id )
|
||||||
|
{
|
||||||
|
m_preselect = id;
|
||||||
|
if ( !m_enabledThemes.isEmpty() )
|
||||||
|
fillUi();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void PlasmaLnfPage::updateThemeNames()
|
void PlasmaLnfPage::updateThemeNames()
|
||||||
{
|
{
|
||||||
@ -166,6 +176,11 @@ void PlasmaLnfPage::fillUi()
|
|||||||
{
|
{
|
||||||
theme.widget->updateThemeName( theme );
|
theme.widget->updateThemeName( theme );
|
||||||
}
|
}
|
||||||
|
if ( theme.id == m_preselect )
|
||||||
|
{
|
||||||
|
const QSignalBlocker b( theme.widget->button() );
|
||||||
|
theme.widget->button()->setChecked( true );
|
||||||
|
}
|
||||||
++c;
|
++c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,8 @@ public:
|
|||||||
void setEnabledThemes( const ThemeInfoList& themes );
|
void setEnabledThemes( const ThemeInfoList& themes );
|
||||||
/** @brief enable all installed plasma themes. */
|
/** @brief enable all installed plasma themes. */
|
||||||
void setEnabledThemesAll();
|
void setEnabledThemesAll();
|
||||||
|
/** @brief set which theme is to be preselected. */
|
||||||
|
void setPreselect( const QString& id );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void plasmaThemeSelected( const QString& id );
|
void plasmaThemeSelected( const QString& id );
|
||||||
@ -64,6 +66,7 @@ private:
|
|||||||
|
|
||||||
Ui::PlasmaLnfPage* ui;
|
Ui::PlasmaLnfPage* ui;
|
||||||
QString m_lnfPath;
|
QString m_lnfPath;
|
||||||
|
QString m_preselect;
|
||||||
ThemeInfoList m_enabledThemes;
|
ThemeInfoList m_enabledThemes;
|
||||||
|
|
||||||
QButtonGroup *m_buttonGroup;
|
QButtonGroup *m_buttonGroup;
|
||||||
|
@ -137,6 +137,12 @@ PlasmaLnfViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
liveUser = configurationMap.value( "liveuser" ).toString();
|
liveUser = configurationMap.value( "liveuser" ).toString();
|
||||||
m_liveUser = liveUser;
|
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" ) &&
|
if ( configurationMap.contains( "themes" ) &&
|
||||||
configurationMap.value( "themes" ).type() == QVariant::List )
|
configurationMap.value( "themes" ).type() == QVariant::List )
|
||||||
{
|
{
|
||||||
|
@ -61,9 +61,9 @@ public slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
PlasmaLnfPage* m_widget;
|
PlasmaLnfPage* m_widget;
|
||||||
QString m_lnfPath;
|
QString m_lnfPath; // Path to the lnf tool
|
||||||
QString m_themeId;
|
QString m_themeId; // Id of selected theme
|
||||||
QString m_liveUser;
|
QString m_liveUser; // Name of the live user (for OEM mode)
|
||||||
};
|
};
|
||||||
|
|
||||||
CALAMARES_PLUGIN_FACTORY_DECLARATION( PlasmaLnfViewStepFactory )
|
CALAMARES_PLUGIN_FACTORY_DECLARATION( PlasmaLnfViewStepFactory )
|
||||||
|
@ -62,7 +62,7 @@ ThemeWidget::ThemeWidget(const ThemeInfo& info, QWidget* parent)
|
|||||||
layout->addWidget( image_label, 1 );
|
layout->addWidget( image_label, 1 );
|
||||||
layout->addWidget( m_description, 3 );
|
layout->addWidget( m_description, 3 );
|
||||||
|
|
||||||
connect( m_check, &QRadioButton::clicked, this, &ThemeWidget::clicked );
|
connect( m_check, &QRadioButton::toggled, this, &ThemeWidget::clicked );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -27,3 +27,15 @@ themes:
|
|||||||
- theme: org.kde.breezedark.desktop
|
- theme: org.kde.breezedark.desktop
|
||||||
image: "breeze-dark.png"
|
image: "breeze-dark.png"
|
||||||
- org.kde.fluffy-bunny.desktop
|
- 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