diff --git a/src/modules/partition/gui/BootInfoWidget.cpp b/src/modules/partition/gui/BootInfoWidget.cpp new file mode 100644 index 000000000..605144271 --- /dev/null +++ b/src/modules/partition/gui/BootInfoWidget.cpp @@ -0,0 +1,100 @@ +/* === This file is part of Calamares - === + * + * Copyright 2015-2016, Teo Mrnjavac + * + * 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 . + */ + + +#include "BootInfoWidget.h" + +#include + +#include +#include +#include + +BootInfoWidget::BootInfoWidget( QWidget* parent ) + : QWidget( parent ) + , m_bootIcon( new QLabel ) + , m_bootLabel( new QLabel ) +{ + QHBoxLayout* mainLayout = new QHBoxLayout; + setLayout( mainLayout ); + + CalamaresUtils::unmarginLayout( mainLayout ); + + mainLayout->addWidget( m_bootIcon ); + mainLayout->addWidget( m_bootLabel ); + + QSize iconSize = CalamaresUtils::defaultIconSize(); + + m_bootIcon->setMargin( 0 ); + m_bootIcon->setFixedSize( iconSize ); + m_bootIcon->setPixmap( CalamaresUtils::defaultPixmap( CalamaresUtils::BootEnvironment, + CalamaresUtils::Original, + iconSize ) ); + + QFontMetrics fm = QFontMetrics( QFont() ); + m_bootLabel->setMinimumWidth( fm.boundingRect( "BIOS" ).width() + CalamaresUtils::defaultFontHeight() / 2 ); + m_bootLabel->setAlignment( Qt::AlignCenter ); + + QPalette palette; + palette.setBrush( QPalette::Foreground, QColor( "#4D4D4D" ) ); //dark grey + + m_bootIcon->setAutoFillBackground( true ); + m_bootLabel->setAutoFillBackground( true ); + m_bootIcon->setPalette( palette ); + m_bootLabel->setPalette( palette ); + + m_bootIcon->setToolTip( tr( "The boot environment of this system.

" + "Older x86 systems only support BIOS.
" + "Modern systems usually use EFI, but " + "may also show up as BIOS if started in compatibility " + "mode." ) ); + + bool isEfi = false; + if ( QDir( "/sys/firmware/efi/efivars" ).exists() ) + isEfi = true; + + QString bootToolTip; + if ( isEfi ) + { + m_bootLabel->setText( "EFI " ); + bootToolTip = tr( "This system was started with an EFI " + "boot environment.

" + "To configure startup from an EFI environment, this installer " + "must deploy a boot loader application, like GRUB" + " or systemd-boot on an " + "EFI System Partition. This is automatic, unless " + "you choose manual partitioning, in which case you must " + "choose it or create it on your own." ); + } + else + { + m_bootLabel->setText( "BIOS" ); + bootToolTip = tr( "This system was started with a BIOS " + "boot environment.

" + "To configure startup from a BIOS environment, this installer " + "must install a boot loader, like GRUB" + ", either at the beginning of a partition or " + "on the Master Boot Record near the " + "beginning of the partition table (preferred). " + "This is automatic, unless " + "you choose manual partitioning, in which case you must " + "set it up on your own." ); + + } + m_bootLabel->setToolTip( bootToolTip ); +} diff --git a/src/modules/partition/gui/BootInfoWidget.h b/src/modules/partition/gui/BootInfoWidget.h new file mode 100644 index 000000000..b8012b361 --- /dev/null +++ b/src/modules/partition/gui/BootInfoWidget.h @@ -0,0 +1,38 @@ +/* === This file is part of Calamares - === + * + * Copyright 2015-2016, Teo Mrnjavac + * + * 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 . + */ + + +#ifndef BOOTINFOWIDGET_H +#define BOOTINFOWIDGET_H + +#include + +class QLabel; + +class BootInfoWidget : public QWidget +{ + Q_OBJECT +public: + explicit BootInfoWidget( QWidget* parent = nullptr ); + +private: + QLabel* m_bootIcon; + QLabel* m_bootLabel; +}; + +#endif // BOOTINFOWIDGET_H