commit
08e4090354
3
CHANGES
3
CHANGES
@ -17,6 +17,7 @@ This release contains contributions from (alphabetically by first name):
|
||||
This release contains contributions from (alphabetically by first name):
|
||||
- Arnaud Ferraris
|
||||
- Dominic Hayes (feren)
|
||||
- Raul Rodrigo Segura (raurodse)
|
||||
|
||||
## Core ##
|
||||
|
||||
@ -24,6 +25,8 @@ This release contains contributions from (alphabetically by first name):
|
||||
builds without warnings when Clang 8 is used.
|
||||
* A new *disable-cancel-during-exec* setting provides more fine-grained
|
||||
control than *disable-cancel* (which hides the button entirely).
|
||||
* A branding module can now also cause a stylesheet to be loaded, which
|
||||
will be applied to the widgets inside Calamares. (Thanks to Raul)
|
||||
|
||||
## Modules ##
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
*
|
||||
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2017-2018, Adriaan de Groot <groot@kde.org>
|
||||
* Copyright 2018, Raul Rodrigo Segura (raurodse)
|
||||
* Copyright 2019, Collabora Ltd <arnaud.ferraris@collabora.com>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
@ -35,6 +36,8 @@
|
||||
#include <QDesktopWidget>
|
||||
#include <QLabel>
|
||||
#include <QTreeView>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
|
||||
static inline int
|
||||
windowDimensionToPixels( const Calamares::Branding::WindowDimension& u )
|
||||
@ -67,6 +70,8 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
|
||||
using CalamaresUtils::windowPreferredHeight;
|
||||
using CalamaresUtils::windowPreferredWidth;
|
||||
|
||||
this->setObjectName("mainApp");
|
||||
|
||||
QSize availableSize = qApp->desktop()->availableGeometry( this ).size();
|
||||
QSize minimumSize( qBound( windowMinimumWidth, availableSize.width(), windowPreferredWidth ),
|
||||
qBound( windowMinimumHeight, availableSize.height(), windowPreferredHeight ) );
|
||||
@ -86,10 +91,12 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
|
||||
setLayout( mainLayout );
|
||||
|
||||
QWidget* sideBox = new QWidget( this );
|
||||
sideBox->setObjectName("sidebarApp");
|
||||
mainLayout->addWidget( sideBox );
|
||||
|
||||
QBoxLayout* sideLayout = new QVBoxLayout;
|
||||
sideBox->setLayout( sideLayout );
|
||||
// Set this attribute into qss file
|
||||
sideBox->setFixedWidth( qBound( 100, CalamaresUtils::defaultFontHeight() * 12, w < windowPreferredWidth ? 100 : 190 ) );
|
||||
sideBox->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
|
||||
|
||||
@ -97,6 +104,8 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
|
||||
sideLayout->addLayout( logoLayout );
|
||||
logoLayout->addStretch();
|
||||
QLabel* logoLabel = new QLabel( sideBox );
|
||||
logoLabel->setObjectName("logoApp");
|
||||
//Define all values into qss file
|
||||
{
|
||||
QPalette plt = sideBox->palette();
|
||||
sideBox->setAutoFillBackground( true );
|
||||
@ -154,6 +163,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
|
||||
connect( m_viewManager, &Calamares::ViewManager::enlarge, this, &CalamaresWindow::enlarge );
|
||||
|
||||
mainLayout->addWidget( m_viewManager->centralWidget() );
|
||||
setStyleSheet( Calamares::Branding::instance()->stylesheet() );
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -35,6 +35,7 @@ ProgressTreeView::ProgressTreeView( QWidget* parent )
|
||||
{
|
||||
s_instance = this; //FIXME: should assert when s_instance gets written and it wasn't nullptr
|
||||
|
||||
this->setObjectName("sidebarMenuApp");
|
||||
setFrameShape( QFrame::NoFrame );
|
||||
setContentsMargins( 0, 0, 0, 0 );
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
*
|
||||
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2017-2018, Adriaan de Groot <groot@kde.org>
|
||||
* Copyright 2018, Raul Rodrigo Segura (raurodse)
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -91,7 +92,6 @@ Branding::Branding( const QString& brandingFilePath,
|
||||
QObject* parent )
|
||||
: QObject( parent )
|
||||
, m_descriptorPath( brandingFilePath )
|
||||
, m_componentName()
|
||||
, m_welcomeStyleCalamares( false )
|
||||
, m_welcomeExpandingLogo( true )
|
||||
{
|
||||
@ -198,6 +198,16 @@ Branding::Branding( const QString& brandingFilePath,
|
||||
m_translationsPathPrefix.append( QString( "%1calamares-%2" )
|
||||
.arg( QDir::separator() )
|
||||
.arg( m_componentName ) );
|
||||
|
||||
QFileInfo importQSSPath( componentDir.filePath( "stylesheet.qss" ) );
|
||||
if ( importQSSPath.exists() && importQSSPath.isReadable() )
|
||||
{
|
||||
QFile stylesheetFile( importQSSPath.filePath() );
|
||||
stylesheetFile.open( QFile::ReadOnly );
|
||||
m_stylesheet = stylesheetFile.readAll();
|
||||
}
|
||||
else
|
||||
cWarning() << "the branding component" << componentDir.absolutePath() << "does not ship stylesheet.qss.";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -216,20 +226,6 @@ Branding::Branding( const QString& brandingFilePath,
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Branding::descriptorPath() const
|
||||
{
|
||||
return m_descriptorPath;
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Branding::componentName() const
|
||||
{
|
||||
return m_componentName;
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Branding::componentDirectory() const
|
||||
{
|
||||
@ -238,13 +234,6 @@ Branding::componentDirectory() const
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Branding::translationsPathPrefix() const
|
||||
{
|
||||
return m_translationsPathPrefix;
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Branding::string( Branding::StringEntry stringEntry ) const
|
||||
{
|
||||
@ -281,12 +270,6 @@ Branding::image( Branding::ImageEntry imageEntry, const QSize& size ) const
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Branding::slideshowPath() const
|
||||
{
|
||||
return m_slideshowPath;
|
||||
}
|
||||
|
||||
void
|
||||
Branding::setGlobals( GlobalStorage* globalStorage ) const
|
||||
{
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2017, Adriaan de Groot <groot@kde.org>
|
||||
* Copyright 2017-2018, Adriaan de Groot <groot@kde.org>
|
||||
* Copyright 2018, Raul Rodrigo Segura (raurodse)
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -101,16 +102,30 @@ public:
|
||||
explicit Branding( const QString& brandingFilePath,
|
||||
QObject* parent = nullptr );
|
||||
|
||||
QString descriptorPath() const;
|
||||
QString componentName() const;
|
||||
/** @brief Complete path of the branding descriptor file. */
|
||||
QString descriptorPath() const { return m_descriptorPath; }
|
||||
/** @brief The component name found in the descriptor file.
|
||||
*
|
||||
* The component name always matches the last directory name in the path.
|
||||
*/
|
||||
QString componentName() const { return m_componentName; }
|
||||
/** @brief The directory holding all of the branding assets. */
|
||||
QString componentDirectory() const;
|
||||
QString translationsPathPrefix() const;
|
||||
/** @brief The directory where branding translations live.
|
||||
*
|
||||
* This is componentDir + "/lang".
|
||||
*/
|
||||
QString translationsDirectory() const { return m_translationsPathPrefix; }
|
||||
|
||||
/** @brief Path to the slideshow QML file, if any. */
|
||||
QString slideshowPath() const { return m_slideshowPath; }
|
||||
|
||||
QString string( Branding::StringEntry stringEntry ) const;
|
||||
QString styleString( Branding::StyleEntry styleEntry ) const;
|
||||
QString imagePath( Branding::ImageEntry imageEntry ) const;
|
||||
QPixmap image( Branding::ImageEntry imageEntry, const QSize& size ) const;
|
||||
QString slideshowPath() const;
|
||||
/** @brief Stylesheet to apply for this branding. May be empty. */
|
||||
QString stylesheet() const { return m_stylesheet; }
|
||||
|
||||
bool welcomeStyleCalamares() const { return m_welcomeStyleCalamares; }
|
||||
bool welcomeExpandingLogo() const { return m_welcomeExpandingLogo; }
|
||||
@ -144,6 +159,7 @@ private:
|
||||
QMap< QString, QString > m_style;
|
||||
QString m_slideshowPath;
|
||||
QString m_translationsPathPrefix;
|
||||
QString m_stylesheet; // Text from file
|
||||
|
||||
/** @brief Initialize the simple settings below */
|
||||
void initSimpleSettings( const YAML::Node& doc );
|
||||
|
@ -32,6 +32,8 @@ BootInfoWidget::BootInfoWidget( QWidget* parent )
|
||||
, m_bootIcon( new QLabel )
|
||||
, m_bootLabel( new QLabel )
|
||||
{
|
||||
m_bootIcon->setObjectName("bootInfoIcon");
|
||||
m_bootLabel->setObjectName("bootInfoLabel");
|
||||
QHBoxLayout* mainLayout = new QHBoxLayout;
|
||||
setLayout( mainLayout );
|
||||
|
||||
|
@ -39,7 +39,8 @@ DeviceInfoWidget::DeviceInfoWidget( QWidget* parent )
|
||||
setLayout( mainLayout );
|
||||
|
||||
CalamaresUtils::unmarginLayout( mainLayout );
|
||||
|
||||
m_ptLabel->setObjectName("deviceInfoLabel");
|
||||
m_ptIcon->setObjectName("deviceInfoIcon");
|
||||
mainLayout->addWidget( m_ptIcon );
|
||||
mainLayout->addWidget( m_ptLabel );
|
||||
|
||||
|
@ -57,6 +57,7 @@ PartitionBarsView::PartitionBarsView( QWidget* parent )
|
||||
, canBeSelected( []( const QModelIndex& ) { return true; } )
|
||||
, m_hoveredIndex( QModelIndex() )
|
||||
{
|
||||
this->setObjectName("partitionBarView");
|
||||
setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
|
||||
setFrameStyle( QFrame::NoFrame );
|
||||
setSelectionBehavior( QAbstractItemView::SelectRows );
|
||||
|
@ -61,7 +61,7 @@ PartitionLabelsView::PartitionLabelsView( QWidget* parent )
|
||||
setFrameStyle( QFrame::NoFrame );
|
||||
setSelectionBehavior( QAbstractItemView::SelectRows );
|
||||
setSelectionMode( QAbstractItemView::SingleSelection );
|
||||
|
||||
this->setObjectName("partitionLabel");
|
||||
// Debug
|
||||
connect( this, &PartitionLabelsView::clicked,
|
||||
this, [=]( const QModelIndex& index )
|
||||
|
@ -42,6 +42,9 @@ SummaryPage::SummaryPage( const SummaryViewStep* thisViewStep, QWidget* parent )
|
||||
, m_scrollArea( new QScrollArea( this ) )
|
||||
{
|
||||
Q_UNUSED( parent )
|
||||
|
||||
this->setObjectName("summaryStep");
|
||||
|
||||
Q_ASSERT( m_thisViewStep );
|
||||
QVBoxLayout* layout = new QVBoxLayout( this );
|
||||
layout->setContentsMargins( 0, 0, 0, 0 );
|
||||
|
@ -167,7 +167,7 @@ WelcomePage::initLanguages()
|
||||
QString name = m_languages->locale( matchedLocaleIndex ).name();
|
||||
cDebug() << Logger::SubEntry << "Matched with index" << matchedLocaleIndex << name;
|
||||
|
||||
CalamaresUtils::installTranslator( name, Calamares::Branding::instance()->translationsPathPrefix(), qApp );
|
||||
CalamaresUtils::installTranslator( name, Calamares::Branding::instance()->translationsDirectory(), qApp );
|
||||
ui->languageWidget->setCurrentIndex( matchedLocaleIndex );
|
||||
}
|
||||
else
|
||||
@ -183,7 +183,7 @@ WelcomePage::initLanguages()
|
||||
|
||||
QLocale::setDefault( selectedLocale );
|
||||
CalamaresUtils::installTranslator( selectedLocale,
|
||||
Calamares::Branding::instance()->translationsPathPrefix(),
|
||||
Calamares::Branding::instance()->translationsDirectory(),
|
||||
qApp );
|
||||
} );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user