Merge branch '3.1.x-stable' of https://github.com/calamares/calamares into 3.1.x-stable

This commit is contained in:
Philip 2017-12-23 07:33:30 -05:00
commit 47ed3630cb
19 changed files with 1006 additions and 13 deletions

View File

@ -176,7 +176,7 @@ set( CALAMARES_TRANSLATION_LANGUAGES ar ast bg ca cs_CZ da de el en en_GB es_MX
### Bump version here
set( CALAMARES_VERSION_MAJOR 3 )
set( CALAMARES_VERSION_MINOR 1 )
set( CALAMARES_VERSION_PATCH 10 )
set( CALAMARES_VERSION_PATCH 11 )
set( CALAMARES_VERSION_RC 0 )
set( CALAMARES_VERSION ${CALAMARES_VERSION_MAJOR}.${CALAMARES_VERSION_MINOR}.${CALAMARES_VERSION_PATCH} )

View File

@ -256,5 +256,10 @@ System::getTotalMemoryB()
#endif
}
bool
System::doChroot() const
{
return m_doChroot;
}
} // namespace

View File

@ -114,6 +114,8 @@ public:
*/
DLLEXPORT QPair<quint64, float> getTotalMemoryB();
DLLEXPORT bool doChroot() const;
private:
static System* s_instance;

View File

@ -0,0 +1,22 @@
find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE)
find_package( KF5 5.29 REQUIRED CoreAddons Plasma Package )
calamares_add_plugin( plasmalnf
TYPE viewmodule
EXPORT_MACRO PLUGINDLLEXPORT_PRO
SOURCES
PlasmaLnfViewStep.cpp
PlasmaLnfPage.cpp
PlasmaLnfJob.cpp
ThemeWidget.cpp
RESOURCES
page_plasmalnf.qrc
UI
page_plasmalnf.ui
LINK_PRIVATE_LIBRARIES
calamaresui
KF5::Package
KF5::Plasma
SHARED_LIB
)

View File

@ -0,0 +1,78 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Calamares is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#include "PlasmaLnfJob.h"
#include "GlobalStorage.h"
#include "JobQueue.h"
#include "utils/CalamaresUtilsSystem.h"
#include "utils/Logger.h"
PlasmaLnfJob::PlasmaLnfJob( const QString& lnfPath, const QString& id )
: m_lnfPath( lnfPath )
, m_id( id )
{
}
PlasmaLnfJob::~PlasmaLnfJob()
{
}
QString
PlasmaLnfJob::prettyName() const
{
return tr( "Plasma Look-and-Feel Job" );
}
QString
PlasmaLnfJob::prettyDescription() const
{
return prettyName();
}
QString PlasmaLnfJob::prettyStatusMessage() const
{
return prettyName();
}
Calamares::JobResult
PlasmaLnfJob::exec()
{
cDebug() << "Plasma Look-and-Feel Job";
auto system = CalamaresUtils::System::instance();
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
QStringList command(
{
"sudo", "-E", "-H", "-u", gs->value( "username" ).toString(),
m_lnfPath, "-platform", "minimal", "--resetLayout", "--apply", m_id
} );
int r = system->targetEnvCall( command );
if ( r )
return Calamares::JobResult::error(
tr( "Could not select KDE Plasma Look-and-Feel package" ),
tr( "Could not select KDE Plasma Look-and-Feel package" ) );
return Calamares::JobResult::ok();
}

View File

@ -0,0 +1,46 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Calamares is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PLASMALNFJOB_H
#define PLASMALNFJOB_H
#include <QObject>
#include <QVariantMap>
#include <Job.h>
class PlasmaLnfJob : public Calamares::Job
{
Q_OBJECT
public:
explicit PlasmaLnfJob( const QString& lnfPath, const QString& id );
virtual ~PlasmaLnfJob() override;
QString prettyName() const override;
QString prettyDescription() const override;
QString prettyStatusMessage() const override;
Calamares::JobResult exec() override;
private:
QString m_lnfPath;
QString m_id;
};
#endif // PLASMALNFJOB_H

View File

@ -0,0 +1,167 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Calamares is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#include "PlasmaLnfPage.h"
#include "ui_page_plasmalnf.h"
#include "utils/Logger.h"
#include "utils/Retranslator.h"
#include <KPackage/Package>
#include <KPackage/PackageLoader>
ThemeInfo::ThemeInfo( const KPluginMetaData& data )
: id( data.pluginId() )
, name( data.name() )
, description( data.description() )
, widget( nullptr )
{
}
static ThemeInfoList plasma_themes()
{
ThemeInfoList packages;
QList<KPluginMetaData> pkgs = KPackage::PackageLoader::self()->listPackages( "Plasma/LookAndFeel" );
for ( const KPluginMetaData& data : pkgs )
{
if ( data.isValid() && !data.isHidden() && !data.name().isEmpty() )
{
packages << ThemeInfo{ data };
}
}
return packages;
}
PlasmaLnfPage::PlasmaLnfPage( QWidget* parent )
: QWidget( parent )
, ui( new Ui::PlasmaLnfPage )
, 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." ) );
updateThemeNames();
fillUi();
}
)
}
void
PlasmaLnfPage::setLnfPath( const QString& path )
{
m_lnfPath = path;
}
void
PlasmaLnfPage::setEnabledThemes(const ThemeInfoList& themes)
{
m_enabledThemes = themes;
updateThemeNames();
winnowThemes();
fillUi();
}
void
PlasmaLnfPage::setEnabledThemesAll()
{
setEnabledThemes( plasma_themes() );
}
void PlasmaLnfPage::updateThemeNames()
{
auto plasmaThemes = plasma_themes();
for ( auto& enabled_theme : m_enabledThemes )
{
ThemeInfo* t = plasmaThemes.findById( enabled_theme.id );
if ( t != nullptr )
{
enabled_theme.name = t->name;
enabled_theme.description = t->description;
}
}
}
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()
{
if ( m_enabledThemes.isEmpty() )
{
return;
}
if ( !m_buttonGroup )
{
m_buttonGroup = new QButtonGroup( this );
m_buttonGroup->setExclusive( true );
}
int c = 1; // After the general explanation
for ( auto& theme : m_enabledThemes )
{
if ( !theme.widget )
{
ThemeWidget* w = new ThemeWidget( theme );
m_buttonGroup->addButton( w->button() );
ui->verticalLayout->insertWidget( c, w );
connect( w, &ThemeWidget::themeSelected, this, &PlasmaLnfPage::plasmaThemeSelected);
theme.widget = w;
}
else
{
theme.widget->updateThemeName( theme );
}
++c;
}
}

View File

@ -0,0 +1,73 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Calamares is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PLASMALNFPAGE_H
#define PLASMALNFPAGE_H
#include <QButtonGroup>
#include <QList>
#include <QString>
#include <QStringList>
#include <QWidget>
#include "ThemeInfo.h"
#include "ThemeWidget.h"
namespace Ui
{
class PlasmaLnfPage;
}
/** @brief Page for selecting a Plasma Look-and-Feel theme.
*
* You must call setEnabledThemes -- either overload -- once
* to get the selection widgets. Note that calling that with
* an empty list will result in zero (0) selectable themes.
*/
class PlasmaLnfPage : public QWidget
{
Q_OBJECT
public:
explicit PlasmaLnfPage( QWidget* parent = nullptr );
void setLnfPath( const QString& path );
/** @brief enable only the listed themes. */
void setEnabledThemes( const ThemeInfoList& themes );
/** @brief enable all installed plasma themes. */
void setEnabledThemesAll();
signals:
void plasmaThemeSelected( const QString& id );
private:
/** @brief Intersect the list of enabled themes with the installed ones. */
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;
QString m_lnfPath;
ThemeInfoList m_enabledThemes;
QButtonGroup *m_buttonGroup;
QList< ThemeWidget* > m_widgets;
};
#endif //PLASMALNFPAGE_H

View File

@ -0,0 +1,196 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Calamares is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#include "PlasmaLnfViewStep.h"
#include "PlasmaLnfJob.h"
#include "PlasmaLnfPage.h"
#include "ThemeInfo.h"
#include "utils/Logger.h"
#include <QProcess>
#include <QVariantMap>
CALAMARES_PLUGIN_FACTORY_DEFINITION( PlasmaLnfViewStepFactory, registerPlugin<PlasmaLnfViewStep>(); )
PlasmaLnfViewStep::PlasmaLnfViewStep( QObject* parent )
: Calamares::ViewStep( parent )
, m_widget( new PlasmaLnfPage )
{
connect( m_widget, &PlasmaLnfPage::plasmaThemeSelected, this, &PlasmaLnfViewStep::themeSelected );
emit nextStatusChanged( false );
}
PlasmaLnfViewStep::~PlasmaLnfViewStep()
{
if ( m_widget && m_widget->parent() == nullptr )
m_widget->deleteLater();
}
QString
PlasmaLnfViewStep::prettyName() const
{
return tr( "Look-and-Feel" );
}
QWidget*
PlasmaLnfViewStep::widget()
{
return m_widget;
}
void
PlasmaLnfViewStep::next()
{
emit done();
}
void
PlasmaLnfViewStep::back()
{}
bool
PlasmaLnfViewStep::isNextEnabled() const
{
return true;
}
bool
PlasmaLnfViewStep::isBackEnabled() const
{
return true;
}
bool
PlasmaLnfViewStep::isAtBeginning() const
{
return true;
}
bool
PlasmaLnfViewStep::isAtEnd() const
{
return true;
}
void PlasmaLnfViewStep::onLeave()
{
}
QList<Calamares::job_ptr>
PlasmaLnfViewStep::jobs() const
{
QList<Calamares::job_ptr> l;
cDebug() << "Creating Plasma LNF jobs ..";
if ( !m_themeId.isEmpty() )
{
if ( !m_lnfPath.isEmpty() )
l.append( Calamares::job_ptr( new PlasmaLnfJob( m_lnfPath, m_themeId ) ) );
else
cDebug() << "WARNING: no lnftool given for plasmalnf module.";
}
return l;
}
void
PlasmaLnfViewStep::setConfigurationMap( const QVariantMap& configurationMap )
{
QString lnfPath;
if ( configurationMap.contains( "lnftool" ) && configurationMap.value( "lnftool" ).type() == QVariant::String )
lnfPath = configurationMap.value( "lnftool" ).toString();
m_lnfPath = lnfPath;
m_widget->setLnfPath( m_lnfPath );
if ( m_lnfPath.isEmpty() )
cDebug() << "WARNING: no lnftool given for plasmalnf module.";
QString liveUser;
if ( configurationMap.contains( "liveuser" ) && configurationMap.value( "liveuser" ).type() == QVariant::String )
liveUser = configurationMap.value( "liveuser" ).toString();
m_liveUser = liveUser;
if ( configurationMap.contains( "themes" ) &&
configurationMap.value( "themes" ).type() == QVariant::List )
{
ThemeInfoList allThemes;
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)
// are filled in by update_names() in PlasmaLnfPage.
for ( const auto& i : themeList )
if ( i.type() == QVariant::Map )
{
auto iv = i.toMap();
allThemes.append( ThemeInfo( iv.value( "theme" ).toString(), iv.value( "image" ).toString() ) );
}
else if ( i.type() == QVariant::String )
allThemes.append( ThemeInfo( i.toString() ) );
if ( allThemes.length() == 1 )
cDebug() << "WARNING: only one theme enabled in plasmalnf";
m_widget->setEnabledThemes( allThemes );
}
else
m_widget->setEnabledThemesAll(); // All of them
}
void
PlasmaLnfViewStep::themeSelected( const QString& id )
{
m_themeId = id;
if ( m_lnfPath.isEmpty() )
{
cDebug() << "WARNING: no lnftool given for plasmalnf module.";
return;
}
QProcess lnftool;
if ( !m_liveUser.isEmpty() )
lnftool.start( "sudo", {"-E", "-H", "-u", m_liveUser, m_lnfPath, "--resetLayout", "--apply", id} );
else
lnftool.start( m_lnfPath, {"--resetLayout", "--apply", id} );
if ( !lnftool.waitForStarted( 1000 ) )
{
cDebug() << "WARNING: could not start look-and-feel" << m_lnfPath;
return;
}
if ( !lnftool.waitForFinished() )
{
cDebug() << "WARNING:" << m_lnfPath << "timed out.";
return;
}
if ( ( lnftool.exitCode() == 0 ) && ( lnftool.exitStatus() == QProcess::NormalExit ) )
cDebug() << "Plasma look-and-feel applied" << id;
else
cDebug() << "WARNING: could not apply look-and-feel" << id;
}

View File

@ -0,0 +1,71 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2017, Adriaan de Groot <groot@kde..org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Calamares is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PLASMALNFVIEWSTEP_H
#define PLASMALNFVIEWSTEP_H
#include <utils/PluginFactory.h>
#include <viewpages/ViewStep.h>
#include <PluginDllMacro.h>
#include <QObject>
#include <QUrl>
#include <QVariantMap>
class PlasmaLnfPage;
class PLUGINDLLEXPORT PlasmaLnfViewStep : public Calamares::ViewStep
{
Q_OBJECT
public:
explicit PlasmaLnfViewStep( QObject* parent = nullptr );
virtual ~PlasmaLnfViewStep() override;
QString prettyName() const override;
QWidget* widget() override;
void next() override;
void back() override;
bool isNextEnabled() const override;
bool isBackEnabled() const override;
bool isAtBeginning() const override;
bool isAtEnd() const override;
void onLeave() override;
QList<Calamares::job_ptr> jobs() const override;
void setConfigurationMap( const QVariantMap& configurationMap ) override;
public slots:
void themeSelected( const QString& id );
private:
PlasmaLnfPage* m_widget;
QString m_lnfPath;
QString m_themeId;
QString m_liveUser;
};
CALAMARES_PLUGIN_FACTORY_DECLARATION( PlasmaLnfViewStepFactory )
#endif // PLASMALNFVIEWSTEP_H

View File

@ -0,0 +1,97 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Calamares is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PLASMALNF_THEMEINFO_H
#define PLASMALNF_THEMEINFO_H
#include <QList>
#include <QString>
class KPluginMetaData;
class ThemeWidget;
/** @brief describes a single plasma LnF theme.
*
* A theme description has an id, which is really the name of the desktop
* file (e.g. org.kde.breeze.desktop), a name which is human-readable and
* translated, and an optional image Page, which points to a local screenshot
* of that theme.
*/
struct ThemeInfo
{
QString id;
QString name;
QString description;
QString imagePath;
ThemeWidget* widget;
ThemeInfo()
: widget( nullptr )
{}
explicit ThemeInfo( const QString& _id )
: id( _id )
, widget( nullptr )
{
}
explicit ThemeInfo( const QString& _id, const QString& image )
: id( _id )
, imagePath( image )
, widget( nullptr )
{}
// Defined in PlasmaLnfPage.cpp
explicit ThemeInfo( const KPluginMetaData& );
bool isValid() const { return !id.isEmpty(); }
} ;
class ThemeInfoList : public QList< ThemeInfo >
{
public:
/** @brief Looks for a given @p id in the list of themes, returns nullptr if not found. */
ThemeInfo* findById( const QString& id )
{
for ( ThemeInfo& i : *this )
{
if ( i.id == id )
return &i;
}
return nullptr;
}
/** @brief Looks for a given @p id in the list of themes, returns nullptr if not found. */
const ThemeInfo* findById( const QString& id ) const
{
for ( const ThemeInfo& i : *this )
{
if ( i.id == id )
return &i;
}
return nullptr;
}
/** @brief Checks if a given @p id is in the list of themes. */
bool contains( const QString& id ) const
{
return findById( id ) != nullptr;
}
} ;
#endif

View File

@ -0,0 +1,85 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Calamares is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ThemeWidget.h"
#include "ThemeInfo.h"
#include "utils/Logger.h"
#include <QHBoxLayout>
#include <QLabel>
#include <QRadioButton>
ThemeWidget::ThemeWidget(const ThemeInfo& info, QWidget* parent)
: QWidget( parent )
, m_check( new QRadioButton( info.name.isEmpty() ? info.id : info.name, parent ) )
, m_description( new QLabel( info.description, parent ) )
, m_id( info.id )
{
QHBoxLayout* layout = new QHBoxLayout( this );
this->setLayout( layout );
layout->addWidget( m_check, 1 );
constexpr QSize image_size{120, 80};
QPixmap image( info.imagePath );
if ( info.imagePath.isEmpty() )
{
// Image can't possibly be valid
image = QPixmap( ":/view-preview.png" );
}
else if ( image.isNull() )
{
// Not found or not specified, so convert the name into some (horrible, likely)
// color instead.
image = QPixmap( image_size );
uint hash_color = qHash( info.imagePath.isEmpty() ? info.id : info.imagePath );
cDebug() << "Theme image" << info.imagePath << "not found, hash" << hash_color;
image.fill( QColor( QRgb( hash_color ) ) );
}
else
image.scaled( image_size );
QLabel* image_label = new QLabel( this );
image_label->setPixmap( image );
layout->addWidget( image_label, 1 );
layout->addWidget( m_description, 3 );
connect( m_check, &QRadioButton::clicked, this, &ThemeWidget::clicked );
}
void
ThemeWidget::clicked( bool checked )
{
if ( checked )
emit themeSelected( m_id );
}
QAbstractButton*
ThemeWidget::button() const
{
return m_check;
}
void ThemeWidget::updateThemeName(const ThemeInfo& info)
{
m_check->setText( info.name );
m_description->setText( info.description );
}

View File

@ -0,0 +1,53 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Calamares is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PLASMALNF_THEMEWIDGET_H
#define PLASMALNF_THEMEWIDGET_H
#include <QWidget>
class QAbstractButton;
class QLabel;
class QRadioButton;
struct ThemeInfo;
class ThemeWidget : public QWidget
{
Q_OBJECT
public:
explicit ThemeWidget( const ThemeInfo& info, QWidget* parent = nullptr );
QAbstractButton* button() const;
void updateThemeName( const ThemeInfo& info );
signals:
void themeSelected( const QString& id );
public slots:
void clicked( bool );
private:
QString m_id;
QRadioButton* m_check;
QLabel* m_description;
} ;
#endif

View File

@ -0,0 +1,5 @@
<RCC>
<qresource>
<file>view-preview.png</file>
</qresource>
</RCC>

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PlasmaLnfPage</class>
<widget class="QWidget" name="PlasmaLnfPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>799</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0">
<item>
<widget class="QLabel" name="generalExplanation">
<property name="text">
<string>Placeholder</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources>
<include location="page_plasmalnf.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,29 @@
---
# Full path to the Plasma look-and-feel tool (CLI program
# for querying and applying Plasma themes). If this is not
# set, no LNF setting will happen.
lnftool: "/usr/bin/lookandfeeltool"
# For systems where the user Calamares runs as (usually root,
# via either sudo or pkexec) has a clean environment, set this
# to the originating username; the lnftool will be run through
# "sudo -H -u <liveuser>" instead of directly.
#
# liveuser: "live"
# 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!).
#
# 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.
# Themes with no image get a "missing screenshot" image; if the
# image file is not found, they get a color swatch based on the image name.
themes:
- org.kde.fuzzy-pig.desktop
- theme: org.kde.breeze.desktop
image: "breeze.png"
- theme: org.kde.breezedark.desktop
image: "breeze-dark.png"
- org.kde.fluffy-bunny.desktop

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 B

View File

@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#4d4d4d;
}
</style>
</defs>
<path style="fill:currentColor;fill-opacity:1;stroke:none"
d="m4 4v24h24v-24zm1 1h22v22h-22zm6 2a4 4 0 0 0 -4 4 4 4 0 0 0 4 4 4 4 0 0 0 4 -4 4 4 0 0 0 -4 -4m0 1a3 3 0 0 1 3 3 3 3 0 0 1 -3 3 3 3 0 0 1 -3 -3 3 3 0 0 1 3 -3m9.5 6.793l-5 5-2-2-6.5 6.5.707.707 5.793-5.793 2 2 5-5 3.793 3.793.707-.707z"
class="ColorScheme-Text"
/>
</svg>

After

Width:  |  Height:  |  Size: 570 B

View File

@ -213,12 +213,16 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap )
bool ok = false;
m_requiredStorageGB = configurationMap.value( "requiredStorage" ).toDouble( &ok );
if ( !ok )
{
cDebug() << "WARNING: RequirementsChecker entry 'requiredStorage' is invalid.";
m_requiredStorageGB = 3.;
}
Calamares::JobQueue::instance()->globalStorage()->insert( "requiredStorageGB", m_requiredStorageGB );
}
else
{
cDebug() << "WARNING: RequirementsChecker entry 'requiredStorage' is missing.";
m_requiredStorageGB = 3.;
incompleteConfiguration = true;
}
@ -231,12 +235,14 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap )
m_requiredRamGB = configurationMap.value( "requiredRam" ).toDouble( &ok );
if ( !ok )
{
cDebug() << "WARNING: RequirementsChecker entry 'requiredRam' is invalid.";
m_requiredRamGB = 1.;
incompleteConfiguration = true;
}
}
else
{
cDebug() << "WARNING: RequirementsChecker entry 'requiredRam' is missing.";
m_requiredRamGB = 1.;
incompleteConfiguration = true;
}
@ -248,7 +254,7 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap )
if ( m_checkHasInternetUrl.isEmpty() ||
!QUrl( m_checkHasInternetUrl ).isValid() )
{
cDebug() << "Invalid internetCheckUrl in welcome.conf" << m_checkHasInternetUrl
cDebug() << "WARNING: RequirementsChecker entry 'internetCheckUrl' is invalid in welcome.conf" << m_checkHasInternetUrl
<< "reverting to default (http://example.com).";
m_checkHasInternetUrl = "http://example.com";
incompleteConfiguration = true;
@ -256,8 +262,9 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap )
}
else
{
cDebug() << "internetCheckUrl is undefined in welcome.conf, "
cDebug() << "WARNING: RequirementsChecker entry 'internetCheckUrl' is undefined in welcome.conf,"
"reverting to default (http://example.com).";
m_checkHasInternetUrl = "http://example.com";
incompleteConfiguration = true;
}
@ -269,7 +276,10 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap )
m_entriesToCheck.append( configurationMap.value( "check" ).toStringList() );
}
else
{
cDebug() << "WARNING: RequirementsChecker entry 'check' is incomplete.";
incompleteConfiguration = true;
}
if ( configurationMap.contains( "required" ) &&
configurationMap.value( "required" ).type() == QVariant::List )
@ -278,18 +288,13 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap )
m_entriesToRequire.append( configurationMap.value( "required" ).toStringList() );
}
else
{
cDebug() << "WARNING: RequirementsChecker entry 'required' is incomplete.";
incompleteConfiguration = true;
}
if ( incompleteConfiguration )
{
cDebug() << "WARNING: The RequirementsChecker configuration map provided by "
"the welcome module configuration file is incomplete or "
"incorrect.\n"
"Startup will continue for debugging purposes, but one or "
"more checks might not function correctly.\n"
"RequirementsChecker configuration map:\n"
<< configurationMap;
}
cDebug() << "WARNING: RequirementsChecker configuration map:\n" << configurationMap;
}