2020-08-25 16:05:56 +02:00
|
|
|
/* === This file is part of Calamares - <https://calamares.io> ===
|
2016-01-27 17:54:58 +01:00
|
|
|
*
|
2020-08-22 01:19:58 +02:00
|
|
|
* SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac <teo@kde.org>
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2016-01-27 17:54:58 +01:00
|
|
|
*
|
2020-08-25 16:05:56 +02:00
|
|
|
* Calamares is Free Software: see the License-Identifier above.
|
2016-01-27 17:54:58 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "BootInfoWidget.h"
|
2017-08-28 11:36:21 +02:00
|
|
|
#include "core/PartUtils.h"
|
2016-01-27 17:54:58 +01:00
|
|
|
|
2017-08-28 11:36:21 +02:00
|
|
|
#include "utils/CalamaresUtilsGui.h"
|
2020-10-24 12:49:56 +02:00
|
|
|
#include "utils/QtCompat.h"
|
2017-08-28 10:40:31 +02:00
|
|
|
#include "utils/Retranslator.h"
|
2016-01-27 17:54:58 +01:00
|
|
|
|
|
|
|
#include <QDir>
|
|
|
|
#include <QHBoxLayout>
|
2020-08-22 01:19:58 +02:00
|
|
|
#include <QLabel>
|
2016-01-27 17:54:58 +01:00
|
|
|
|
|
|
|
BootInfoWidget::BootInfoWidget( QWidget* parent )
|
|
|
|
: QWidget( parent )
|
|
|
|
, m_bootIcon( new QLabel )
|
|
|
|
, m_bootLabel( new QLabel )
|
|
|
|
{
|
2020-08-22 01:19:58 +02:00
|
|
|
m_bootIcon->setObjectName( "bootInfoIcon" );
|
|
|
|
m_bootLabel->setObjectName( "bootInfoLabel" );
|
2016-01-27 17:54:58 +01:00
|
|
|
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 );
|
2020-08-22 01:19:58 +02:00
|
|
|
m_bootIcon->setPixmap(
|
|
|
|
CalamaresUtils::defaultPixmap( CalamaresUtils::BootEnvironment, CalamaresUtils::Original, iconSize ) );
|
|
|
|
|
2016-01-27 17:54:58 +01:00
|
|
|
QFontMetrics fm = QFontMetrics( QFont() );
|
|
|
|
m_bootLabel->setMinimumWidth( fm.boundingRect( "BIOS" ).width() + CalamaresUtils::defaultFontHeight() / 2 );
|
|
|
|
m_bootLabel->setAlignment( Qt::AlignCenter );
|
|
|
|
|
|
|
|
QPalette palette;
|
2020-10-24 12:49:56 +02:00
|
|
|
palette.setBrush( WindowText, QColor( "#4D4D4D" ) ); //dark grey
|
2016-01-27 17:54:58 +01:00
|
|
|
|
|
|
|
m_bootIcon->setAutoFillBackground( true );
|
|
|
|
m_bootLabel->setAutoFillBackground( true );
|
|
|
|
m_bootIcon->setPalette( palette );
|
|
|
|
m_bootLabel->setPalette( palette );
|
|
|
|
|
2017-08-28 10:40:31 +02:00
|
|
|
CALAMARES_RETRANSLATE( retranslateUi(); )
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
BootInfoWidget::retranslateUi()
|
|
|
|
{
|
2016-01-27 17:54:58 +01:00
|
|
|
m_bootIcon->setToolTip( tr( "The <strong>boot environment</strong> of this system.<br><br>"
|
|
|
|
"Older x86 systems only support <strong>BIOS</strong>.<br>"
|
|
|
|
"Modern systems usually use <strong>EFI</strong>, but "
|
|
|
|
"may also show up as BIOS if started in compatibility "
|
|
|
|
"mode." ) );
|
|
|
|
|
|
|
|
QString bootToolTip;
|
2017-08-28 11:36:21 +02:00
|
|
|
if ( PartUtils::isEfiSystem() )
|
2016-01-27 17:54:58 +01:00
|
|
|
{
|
|
|
|
m_bootLabel->setText( "EFI " );
|
|
|
|
bootToolTip = tr( "This system was started with an <strong>EFI</strong> "
|
|
|
|
"boot environment.<br><br>"
|
|
|
|
"To configure startup from an EFI environment, this installer "
|
|
|
|
"must deploy a boot loader application, like <strong>GRUB"
|
|
|
|
"</strong> or <strong>systemd-boot</strong> on an <strong>"
|
|
|
|
"EFI System Partition</strong>. 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 <strong>BIOS</strong> "
|
|
|
|
"boot environment.<br><br>"
|
|
|
|
"To configure startup from a BIOS environment, this installer "
|
|
|
|
"must install a boot loader, like <strong>GRUB"
|
|
|
|
"</strong>, either at the beginning of a partition or "
|
|
|
|
"on the <strong>Master Boot Record</strong> 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 );
|
|
|
|
}
|