mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 19:05:46 -05:00
[plasmalnf] Prep-work for UI changes
This commit is contained in:
parent
11fc3e0507
commit
755c0cba18
2 changed files with 49 additions and 5 deletions
|
@ -53,7 +53,8 @@ PlasmaLnfPage::PlasmaLnfPage( QWidget* parent )
|
||||||
{
|
{
|
||||||
ui->retranslateUi( this );
|
ui->retranslateUi( this );
|
||||||
ui->generalExplanation->setText( tr( "Please choose a look-and-feel for the KDE Plasma Desktop, below." ) );
|
ui->generalExplanation->setText( tr( "Please choose a look-and-feel for the KDE Plasma Desktop, below." ) );
|
||||||
winnowThemes();
|
updateThemeNames();
|
||||||
|
fillUi();
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -87,21 +88,59 @@ PlasmaLnfPage::setEnabledThemes(const ThemeInfoList& themes)
|
||||||
m_enabledThemes = plasma_themes();
|
m_enabledThemes = plasma_themes();
|
||||||
else
|
else
|
||||||
m_enabledThemes = themes;
|
m_enabledThemes = themes;
|
||||||
|
|
||||||
|
updateThemeNames();
|
||||||
winnowThemes();
|
winnowThemes();
|
||||||
|
fillUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlasmaLnfPage::winnowThemes()
|
void PlasmaLnfPage::updateThemeNames()
|
||||||
{
|
{
|
||||||
auto plasmaThemes = plasma_themes();
|
auto plasmaThemes = plasma_themes();
|
||||||
ui->lnfCombo->clear();
|
|
||||||
for ( auto& enabled_theme : m_enabledThemes )
|
for ( auto& enabled_theme : m_enabledThemes )
|
||||||
{
|
{
|
||||||
ThemeInfo* t = plasmaThemes.findById( enabled_theme.id );
|
ThemeInfo* t = plasmaThemes.findById( enabled_theme.id );
|
||||||
if ( t != nullptr )
|
if ( t != nullptr )
|
||||||
{
|
{
|
||||||
enabled_theme.name = t->name;
|
enabled_theme.name = t->name;
|
||||||
ui->lnfCombo->addItem( enabled_theme.name );
|
|
||||||
cDebug() << "Enabled" << enabled_theme.id << "as" << enabled_theme.name;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlasmaLnfPage::winnowThemes()
|
||||||
|
{
|
||||||
|
auto plasmaThemes = plasma_themes();
|
||||||
|
bool winnowed = true;
|
||||||
|
int winnow_index = 0;
|
||||||
|
while ( winnowed )
|
||||||
|
{
|
||||||
|
winnowed = false;
|
||||||
|
winnow_index = 0;
|
||||||
|
|
||||||
|
for ( auto& enabled_theme : m_enabledThemes )
|
||||||
|
{
|
||||||
|
ThemeInfo* t = plasmaThemes.findById( enabled_theme.id );
|
||||||
|
if ( t == nullptr )
|
||||||
|
{
|
||||||
|
cDebug() << "Removing" << enabled_theme.id;
|
||||||
|
winnowed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++winnow_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( winnowed )
|
||||||
|
{
|
||||||
|
m_enabledThemes.removeAt( winnow_index );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlasmaLnfPage::fillUi()
|
||||||
|
{
|
||||||
|
ui->lnfCombo->clear();
|
||||||
|
for ( auto& theme : m_enabledThemes )
|
||||||
|
{
|
||||||
|
ui->lnfCombo->addItem( theme.name );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -47,7 +47,12 @@ signals:
|
||||||
void plasmaThemeSelected( const QString& id );
|
void plasmaThemeSelected( const QString& id );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/** @brief Intersect the list of enabled themes with the installed ones. */
|
||||||
void winnowThemes();
|
void winnowThemes();
|
||||||
|
/** @brief Get the translated names for all enabled themes. */
|
||||||
|
void updateThemeNames();
|
||||||
|
/** @brief show enabled themes in the UI. */
|
||||||
|
void fillUi();
|
||||||
|
|
||||||
Ui::PlasmaLnfPage* ui;
|
Ui::PlasmaLnfPage* ui;
|
||||||
QString m_lnfPath;
|
QString m_lnfPath;
|
||||||
|
|
Loading…
Add table
Reference in a new issue