[plasmalnf] C++ style and reduce includes

This commit is contained in:
Adriaan de Groot 2017-12-04 06:44:37 -05:00
parent eb92755b0a
commit b10b19e9ee
5 changed files with 27 additions and 54 deletions

View File

@ -18,22 +18,8 @@
#include "PlasmaLnfJob.h"
#include <QDateTime>
#include <QDir>
#include <QProcess>
#include <QStandardPaths>
#include <QThread>
#include <KService>
#include <KServiceTypeTrader>
#include <KPluginLoader> // Future
#include <Plasma/PluginLoader> // TODO: port to KPluginLoader
#include "CalamaresVersion.h"
#include "JobQueue.h"
#include "GlobalStorage.h"
#include "JobQueue.h"
#include "utils/CalamaresUtilsSystem.h"
#include "utils/Logger.h"
@ -75,9 +61,11 @@ PlasmaLnfJob::exec()
auto system = CalamaresUtils::System::instance();
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
QStringList command( {
QStringList command(
{
"sudo", "-E", "-H", "-u", gs->value( "username" ).toString(),
m_lnfPath, "-platform", "minimal", "--resetLayout", "--apply", m_id } );
m_lnfPath, "-platform", "minimal", "--resetLayout", "--apply", m_id
} );
int r = system->targetEnvCall( command );
if ( r )

View File

@ -20,28 +20,20 @@
#include "ui_page_plasmalnf.h"
#include "Branding.h"
#include "JobQueue.h"
#include "GlobalStorage.h"
#include "utils/Logger.h"
#include "utils/CalamaresUtilsGui.h"
#include "utils/Retranslator.h"
#include "ViewManager.h"
#include <KPackage/Package>
#include <KPackage/PackageLoader>
#include <QButtonGroup>
#include <QDesktopServices>
#include <QLabel>
static PlasmaLnfList plasma_themes()
{
PlasmaLnfList packages;
QList<KPluginMetaData> pkgs = KPackage::PackageLoader::self()->listPackages( "Plasma/LookAndFeel" );
for (const KPluginMetaData &data : pkgs) {
for ( const KPluginMetaData& data : pkgs )
{
packages << PlasmaLnfDescriptor{ data.pluginId(), data.name() };
cDebug() << "LNF Package" << data.pluginId();
cDebug() << " .." << data.name();
@ -57,19 +49,18 @@ PlasmaLnfPage::PlasmaLnfPage(QWidget *parent)
: QWidget( parent )
, ui( new Ui::PlasmaLnfPage )
{
using StringEntry = Calamares::Branding::StringEntry;
ui->setupUi( this );
CALAMARES_RETRANSLATE(
{
ui->retranslateUi( this );
ui->generalExplanation->setText( tr( "Please choose a look-and-feel for the KDE Plasma Desktop, below." ) );
m_availableLnf = plasma_themes();
ui->lnfCombo->clear();
for ( const auto& p : m_availableLnf )
ui->lnfCombo->addItem( p.name );
}
)
QObject::connect<void( QComboBox::* )( int )>( ui->lnfCombo, &QComboBox::activated, this, &PlasmaLnfPage::activated );
}

View File

@ -19,8 +19,9 @@
#ifndef PLASMALNFPAGE_H
#define PLASMALNFPAGE_H
#include <QList>
#include <QString>
#include <QWidget>
#include <QUrl>
namespace Ui
{

View File

@ -15,18 +15,13 @@
* You should have received a copy of the GNU General Public License
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#include "JobQueue.h"
#include "GlobalStorage.h"
#include "utils/Logger.h"
#include "utils/CalamaresUtils.h"
#include "utils/CalamaresUtilsSystem.h"
#include "PlasmaLnfViewStep.h"
#include "PlasmaLnfJob.h"
#include "PlasmaLnfPage.h"
#include "PlasmaLnfViewStep.h"
#include <QDesktopServices>
#include "utils/Logger.h"
#include <QProcess>
#include <QVariantMap>
@ -114,9 +109,7 @@ PlasmaLnfViewStep::jobs() const
cDebug() << "Creating Plasma LNF jobs ..";
if ( !m_themeId.isEmpty() && !m_lnfPath.isEmpty() )
{
l.append( Calamares::job_ptr( new PlasmaLnfJob( m_lnfPath, m_themeId ) ) );
}
return l;
}