Merge branch 'branding' of https://github.com/raurodse/calamares into raurodse-branding

This commit is contained in:
Adriaan de Groot 2018-05-21 11:02:08 -04:00
commit 47805209c6
7 changed files with 38 additions and 3 deletions

View File

@ -34,6 +34,8 @@
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QLabel> #include <QLabel>
#include <QTreeView> #include <QTreeView>
#include <QFile>
#include <QFileInfo>
CalamaresWindow::CalamaresWindow( QWidget* parent ) CalamaresWindow::CalamaresWindow( QWidget* parent )
: QWidget( parent ) : QWidget( parent )
@ -51,6 +53,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
using CalamaresUtils::windowPreferredWidth; using CalamaresUtils::windowPreferredWidth;
QSize availableSize = qApp->desktop()->availableGeometry( this ).size(); QSize availableSize = qApp->desktop()->availableGeometry( this ).size();
this->setObjectName("mainApp");
cDebug() << "Available size" << availableSize; cDebug() << "Available size" << availableSize;
@ -71,10 +74,12 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
setLayout( mainLayout ); setLayout( mainLayout );
QWidget* sideBox = new QWidget( this ); QWidget* sideBox = new QWidget( this );
sideBox->setObjectName("sidebarApp");
mainLayout->addWidget( sideBox ); mainLayout->addWidget( sideBox );
QBoxLayout* sideLayout = new QVBoxLayout; QBoxLayout* sideLayout = new QVBoxLayout;
sideBox->setLayout( sideLayout ); sideBox->setLayout( sideLayout );
// Set this attribute into qss file
sideBox->setFixedWidth( qBound( 100, CalamaresUtils::defaultFontHeight() * 12, w < windowPreferredWidth ? 100 : 190 ) ); sideBox->setFixedWidth( qBound( 100, CalamaresUtils::defaultFontHeight() * 12, w < windowPreferredWidth ? 100 : 190 ) );
sideBox->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); sideBox->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
@ -82,6 +87,8 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
sideLayout->addLayout( logoLayout ); sideLayout->addLayout( logoLayout );
logoLayout->addStretch(); logoLayout->addStretch();
QLabel* logoLabel = new QLabel( sideBox ); QLabel* logoLabel = new QLabel( sideBox );
logoLabel->setObjectName("logoApp");
//Define all values into qss file
{ {
QPalette plt = sideBox->palette(); QPalette plt = sideBox->palette();
sideBox->setAutoFillBackground( true ); sideBox->setAutoFillBackground( true );
@ -142,6 +149,28 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
connect( m_viewManager, &Calamares::ViewManager::enlarge, this, &CalamaresWindow::enlarge ); connect( m_viewManager, &Calamares::ViewManager::enlarge, this, &CalamaresWindow::enlarge );
mainLayout->addWidget( m_viewManager->centralWidget() ); mainLayout->addWidget( m_viewManager->centralWidget() );
QString brandingComponentName = Calamares::Settings::instance()->brandingComponentName();
if ( brandingComponentName.simplified().isEmpty() )
{
cError() << "FATAL: branding component not set in settings.conf";
::exit( EXIT_FAILURE );
}
QString brandingQSSDescriptorPath = QString( "/etc/calamares/branding/%1/stylesheet.qss" )
.arg( brandingComponentName );
QFileInfo importQSSPath = QFileInfo( brandingQSSDescriptorPath );
if ( importQSSPath.exists() && importQSSPath.isReadable() )
{
QFile File(brandingQSSDescriptorPath);
File.open(QFile::ReadOnly);
QString StyleSheet = QLatin1String(File.readAll());
this->setStyleSheet(StyleSheet);
}
} }
void void

View File

@ -35,6 +35,7 @@ ProgressTreeView::ProgressTreeView( QWidget* parent )
{ {
s_instance = this; //FIXME: should assert when s_instance gets written and it wasn't nullptr s_instance = this; //FIXME: should assert when s_instance gets written and it wasn't nullptr
this->setObjectName("sidebarMenuApp");
setFrameShape( QFrame::NoFrame ); setFrameShape( QFrame::NoFrame );
setContentsMargins( 0, 0, 0, 0 ); setContentsMargins( 0, 0, 0, 0 );

View File

@ -32,6 +32,8 @@ BootInfoWidget::BootInfoWidget( QWidget* parent )
, m_bootIcon( new QLabel ) , m_bootIcon( new QLabel )
, m_bootLabel( new QLabel ) , m_bootLabel( new QLabel )
{ {
m_bootIcon->setObjectName("bootInfoIcon");
m_bootLabel->setObjectName("bootInfoLabel");
QHBoxLayout* mainLayout = new QHBoxLayout; QHBoxLayout* mainLayout = new QHBoxLayout;
setLayout( mainLayout ); setLayout( mainLayout );

View File

@ -39,7 +39,8 @@ DeviceInfoWidget::DeviceInfoWidget( QWidget* parent )
setLayout( mainLayout ); setLayout( mainLayout );
CalamaresUtils::unmarginLayout( mainLayout ); CalamaresUtils::unmarginLayout( mainLayout );
m_ptLabel->setObjectName("deviceInfoLabel");
m_ptIcon->setObjectName("deviceInfoIcon");
mainLayout->addWidget( m_ptIcon ); mainLayout->addWidget( m_ptIcon );
mainLayout->addWidget( m_ptLabel ); mainLayout->addWidget( m_ptLabel );

View File

@ -57,6 +57,7 @@ PartitionBarsView::PartitionBarsView( QWidget* parent )
, canBeSelected( []( const QModelIndex& ) { return true; } ) , canBeSelected( []( const QModelIndex& ) { return true; } )
, m_hoveredIndex( QModelIndex() ) , m_hoveredIndex( QModelIndex() )
{ {
this->setObjectName("partitionBarView");
setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
setFrameStyle( QFrame::NoFrame ); setFrameStyle( QFrame::NoFrame );
setSelectionBehavior( QAbstractItemView::SelectRows ); setSelectionBehavior( QAbstractItemView::SelectRows );

View File

@ -61,7 +61,7 @@ PartitionLabelsView::PartitionLabelsView( QWidget* parent )
setFrameStyle( QFrame::NoFrame ); setFrameStyle( QFrame::NoFrame );
setSelectionBehavior( QAbstractItemView::SelectRows ); setSelectionBehavior( QAbstractItemView::SelectRows );
setSelectionMode( QAbstractItemView::SingleSelection ); setSelectionMode( QAbstractItemView::SingleSelection );
this->setObjectName("partitionLabel");
// Debug // Debug
connect( this, &PartitionLabelsView::clicked, connect( this, &PartitionLabelsView::clicked,
this, [=]( const QModelIndex& index ) this, [=]( const QModelIndex& index )

View File

@ -39,6 +39,7 @@ SummaryPage::SummaryPage( const SummaryViewStep* thisViewStep, QWidget* parent )
, m_contentWidget( nullptr ) , m_contentWidget( nullptr )
, m_scrollArea( new QScrollArea( this ) ) , m_scrollArea( new QScrollArea( this ) )
{ {
this->setObjectName("summaryStep");
Q_UNUSED( parent ); Q_UNUSED( parent );
Q_ASSERT( m_thisViewStep ); Q_ASSERT( m_thisViewStep );
QVBoxLayout* layout = new QVBoxLayout( this ); QVBoxLayout* layout = new QVBoxLayout( this );