Merge branch '3.1.x-stable'

This commit is contained in:
Adriaan de Groot 2018-03-29 17:35:36 -04:00
commit 20e9c2c8e3
8 changed files with 143 additions and 22 deletions

View File

@ -6,22 +6,42 @@
# Distributions using systemd can list available
# time zones by using the timedatectl command.
# timedatectl list-timezones
#
# The starting timezone (e.g. the pin-on-the-map) when entering
# the locale page can be set through keys *region* and *zone*.
# If either is not set, defaults to America/New_York.
#
region: "America"
zone: "New_York"
# System locales are detected in the following order:
#
# /usr/share/i18n/SUPPORTED
# localeGenPath (defaults to /etc/locale.gen if not set)
# 'locale -a' output
# - /usr/share/i18n/SUPPORTED
# - localeGenPath (defaults to /etc/locale.gen if not set)
# - 'locale -a' output
#
# Enable only when your Distribution is using an
# custom path for locale.gen
#localeGenPath: "PATH_TO/locale.gen"
# GeoIP based Language settings:
# GeoIP need an working Internet connecion.
# This can be managed from welcome.conf by adding
#
# GeoIP need an working Internet connection.
# This can be managed from `welcome.conf` by adding
# internet to the list of required conditions.
#
# Leave commented out to disable GeoIP.
#
# An HTTP request is made to http://*geoipUrl*/json (which just happens
# to be the GET path needed by freegeoip.net, so calling this a URL
# is a stretch). The request must return valid JSON data; there should
# be an attribute *time_zone*, with a string value set to the
# timezone, in <region>/<zone> form.
#
# Suitable data looks like
# ```
# {"time_zone":"America/New_York"}
# ```
#
#geoipUrl: "freegeoip.net"

View File

@ -4,8 +4,13 @@ find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE)
# needs a runtime support component (which we don't test for).
set( lnf_ver 5.41 )
find_package( KF5Config ${lnf_ver} )
find_package( KF5Plasma ${lnf_ver} )
find_package( KF5Package ${lnf_ver} )
set_package_properties(
KF5Config PROPERTIES
PURPOSE "For finding default Plasma Look-and-Feel"
)
set_package_properties(
KF5Plasma PROPERTIES
PURPOSE "For Plasma Look-and-Feel selection"
@ -16,11 +21,19 @@ set_package_properties(
)
if ( KF5Plasma_FOUND AND KF5Package_FOUND )
find_package( KF5 ${lnf_ver} REQUIRED CoreAddons Plasma Package )
if ( KF5Config_FOUND )
set( option_kf5 Config )
set( option_defs WITH_KCONFIG )
# set( option_libs KF5::Config ) # Not needed anyway
endif()
find_package( KF5 ${lnf_ver} REQUIRED CoreAddons Plasma Package ${option_kf5} )
calamares_add_plugin( plasmalnf
TYPE viewmodule
EXPORT_MACRO PLUGINDLLEXPORT_PRO
COMPILE_DEFINITIONS
${option_defs}
SOURCES
PlasmaLnfViewStep.cpp
PlasmaLnfPage.cpp
@ -32,6 +45,7 @@ if ( KF5Plasma_FOUND AND KF5Package_FOUND )
page_plasmalnf.ui
LINK_PRIVATE_LIBRARIES
calamaresui
${option_libs}
KF5::Package
KF5::Plasma
SHARED_LIB

View File

@ -23,6 +23,8 @@
#include "utils/Logger.h"
#include "utils/Retranslator.h"
#include <QAbstractButton>
#include <KPackage/Package>
#include <KPackage/PackageLoader>
@ -55,13 +57,18 @@ static ThemeInfoList plasma_themes()
PlasmaLnfPage::PlasmaLnfPage( QWidget* parent )
: QWidget( parent )
, ui( new Ui::PlasmaLnfPage )
, m_showAll( false )
, m_buttonGroup( nullptr )
{
ui->setupUi( this );
CALAMARES_RETRANSLATE(
{
ui->retranslateUi( this );
ui->generalExplanation->setText( tr( "Please choose a look-and-feel for the KDE Plasma Desktop. You can also skip this step and configure the look-and-feel once the system is installed." ) );
ui->generalExplanation->setText( tr(
"Please choose a look-and-feel for the KDE Plasma Desktop. "
"You can also skip this step and configure the look-and-feel "
"once the system is installed. Clicking on a look-and-feel "
"selection will give you a live preview of that look-and-feel.") );
updateThemeNames();
fillUi();
}
@ -75,10 +82,18 @@ PlasmaLnfPage::setLnfPath( const QString& path )
}
void
PlasmaLnfPage::setEnabledThemes(const ThemeInfoList& themes)
PlasmaLnfPage::setEnabledThemes(const ThemeInfoList& themes, bool showAll )
{
m_enabledThemes = themes;
if ( showAll )
{
auto plasmaThemes = plasma_themes();
for ( auto& installed_theme : plasmaThemes )
if ( !m_enabledThemes.findById( installed_theme.id ) )
m_enabledThemes.append( installed_theme );
}
updateThemeNames();
winnowThemes();
fillUi();
@ -87,9 +102,18 @@ PlasmaLnfPage::setEnabledThemes(const ThemeInfoList& themes)
void
PlasmaLnfPage::setEnabledThemesAll()
{
setEnabledThemes( plasma_themes() );
// Don't need to set showAll=true, because we're already passing in
// the complete list of installed themes.
setEnabledThemes( plasma_themes(), false );
}
void
PlasmaLnfPage::setPreselect( const QString& id )
{
m_preselect = id;
if ( !m_enabledThemes.isEmpty() )
fillUi();
}
void PlasmaLnfPage::updateThemeNames()
{
@ -162,6 +186,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;
}
}

View File

@ -46,10 +46,17 @@ public:
explicit PlasmaLnfPage( QWidget* parent = nullptr );
void setLnfPath( const QString& path );
/** @brief enable only the listed themes. */
void setEnabledThemes( const ThemeInfoList& themes );
/** @brief enable only the listed themes.
*
* Shows the listed @p themes with full information (e.g. screenshot).
* If @p showAll is true, then also show all installed themes
* not explicitly listed (without a screenshot).
*/
void setEnabledThemes( const ThemeInfoList& themes, bool showAll );
/** @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 +71,8 @@ private:
Ui::PlasmaLnfPage* ui;
QString m_lnfPath;
QString m_preselect;
bool m_showAll; // If true, don't winnow according to enabledThemes
ThemeInfoList m_enabledThemes;
QButtonGroup *m_buttonGroup;

View File

@ -27,8 +27,25 @@
#include <QProcess>
#include <QVariantMap>
#ifdef WITH_KCONFIG
#include <KConfigGroup>
#include <KSharedConfig>
#endif
CALAMARES_PLUGIN_FACTORY_DEFINITION( PlasmaLnfViewStepFactory, registerPlugin<PlasmaLnfViewStep>(); )
static QString
currentPlasmaTheme()
{
#ifdef WITH_KCONFIG
KConfigGroup cg( KSharedConfig::openConfig( QStringLiteral( "kdeglobals" ) ), "KDE" );
return cg.readEntry( "LookAndFeelPackage", QString() );
#else
cWarning() << "No KConfig support, cannot determine Plasma theme.";
return QString();
#endif
}
PlasmaLnfViewStep::PlasmaLnfViewStep( QObject* parent )
: Calamares::ViewStep( parent )
, m_widget( new PlasmaLnfPage )
@ -132,10 +149,18 @@ PlasmaLnfViewStep::setConfigurationMap( const QVariantMap& configurationMap )
m_liveUser = CalamaresUtils::getString( configurationMap, "liveuser" );
QString preselect = CalamaresUtils::getString( configurationMap, "preselect" );
if ( preselect == QStringLiteral( "*" ) )
preselect = currentPlasmaTheme();
if ( !preselect.isEmpty() )
m_widget->setPreselect( preselect );
bool showAll = CalamaresUtils::getBool( configurationMap, "showAll", false );
if ( configurationMap.contains( "themes" ) &&
configurationMap.value( "themes" ).type() == QVariant::List )
{
ThemeInfoList allThemes;
ThemeInfoList listedThemes;
auto themeList = configurationMap.value( "themes" ).toList();
// Create the ThemInfo objects for the listed themes; information
// about the themes from Plasma (e.g. human-readable name and description)
@ -144,14 +169,14 @@ PlasmaLnfViewStep::setConfigurationMap( const QVariantMap& configurationMap )
if ( i.type() == QVariant::Map )
{
auto iv = i.toMap();
allThemes.append( ThemeInfo( iv.value( "theme" ).toString(), iv.value( "image" ).toString() ) );
listedThemes.append( ThemeInfo( iv.value( "theme" ).toString(), iv.value( "image" ).toString() ) );
}
else if ( i.type() == QVariant::String )
allThemes.append( ThemeInfo( i.toString() ) );
listedThemes.append( ThemeInfo( i.toString() ) );
if ( allThemes.length() == 1 )
if ( listedThemes.length() == 1 )
cWarning() << "only one theme enabled in plasmalnf";
m_widget->setEnabledThemes( allThemes );
m_widget->setEnabledThemes( listedThemes, showAll );
}
else
m_widget->setEnabledThemesAll(); // All of them

View File

@ -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 )

View File

@ -65,7 +65,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

View File

@ -23,8 +23,9 @@ lnftool: "/usr/bin/lookandfeeltool"
# You can limit the list of Plasma look-and-feel themes by listing ids
# here. If this key is not present, all of the installed themes are listed.
# If the key is present, only installed themes that are *also* included
# in the list are shown (could be none!).
# If the key is present, only installed themes that are **also** included
# in the list are shown (could be none!). See the *showAll* key, below,
# to change that.
#
# Themes may be listed by id, (e.g. fluffy-bunny, below) or as a theme
# and an image (e.g. breeze) which will be used to show a screenshot.
@ -49,3 +50,26 @@ themes:
- theme: org.kde.breezedark.desktop
image: "breeze-dark.png"
- org.kde.fluffy-bunny.desktop
# If *showAll* is true, then all installed themes are shown in the
# UI for selection, even if they are not listed in *themes*. This
# allows selection of all themes even while not all of them are
# listed in *themes* -- which is useful to show screenshots for those
# you do have a screenshot for.
showAll: false
# 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.
#
# As a special setting, use "*", to try to find the currently-
# selected theme by reading the Plasma configuration. This requires
# KF5::Config at build- and run-time.
preselect: "*"