source: calamares/trunk/fuentes/src/modules/partition/gui/BootInfoWidget.cpp @ 7538

Last change on this file since 7538 was 7538, checked in by kbut, 13 months ago

sync with github

File size: 4.3 KB
Line 
1/* === This file is part of Calamares - <https://github.com/calamares> ===
2 *
3 *   Copyright 2015-2016, Teo Mrnjavac <teo@kde.org>
4 *
5 *   Calamares is free software: you can redistribute it and/or modify
6 *   it under the terms of the GNU General Public License as published by
7 *   the Free Software Foundation, either version 3 of the License, or
8 *   (at your option) any later version.
9 *
10 *   Calamares is distributed in the hope that it will be useful,
11 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 *   GNU General Public License for more details.
14 *
15 *   You should have received a copy of the GNU General Public License
16 *   along with Calamares. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19
20#include "BootInfoWidget.h"
21#include "core/PartUtils.h"
22
23#include "utils/CalamaresUtilsGui.h"
24#include "utils/Retranslator.h"
25
26#include <QDir>
27#include <QLabel>
28#include <QHBoxLayout>
29
30BootInfoWidget::BootInfoWidget( QWidget* parent )
31    : QWidget( parent )
32    , m_bootIcon( new QLabel )
33    , m_bootLabel( new QLabel )
34{
35    m_bootIcon->setObjectName("bootInfoIcon");
36    m_bootLabel->setObjectName("bootInfoLabel");
37    QHBoxLayout* mainLayout = new QHBoxLayout;
38    setLayout( mainLayout );
39
40    CalamaresUtils::unmarginLayout( mainLayout );
41
42    mainLayout->addWidget( m_bootIcon );
43    mainLayout->addWidget( m_bootLabel );
44
45    QSize iconSize = CalamaresUtils::defaultIconSize();
46
47    m_bootIcon->setMargin( 0 );
48    m_bootIcon->setFixedSize( iconSize );
49    m_bootIcon->setPixmap( CalamaresUtils::defaultPixmap( CalamaresUtils::BootEnvironment,
50                                                          CalamaresUtils::Original,
51                                                          iconSize ) );
52   
53    QFontMetrics fm = QFontMetrics( QFont() );
54    m_bootLabel->setMinimumWidth( fm.boundingRect( "BIOS" ).width() + CalamaresUtils::defaultFontHeight() / 2 );
55    m_bootLabel->setAlignment( Qt::AlignCenter );
56
57    QPalette palette;
58    palette.setBrush( QPalette::Foreground, QColor( "#4D4D4D" ) ); //dark grey
59
60    m_bootIcon->setAutoFillBackground( true );
61    m_bootLabel->setAutoFillBackground( true );
62    m_bootIcon->setPalette( palette );
63    m_bootLabel->setPalette( palette );
64
65    CALAMARES_RETRANSLATE( retranslateUi(); )
66}
67
68void
69BootInfoWidget::retranslateUi()
70{
71    m_bootIcon->setToolTip( tr( "The <strong>boot environment</strong> of this system.<br><br>"
72                                "Older x86 systems only support <strong>BIOS</strong>.<br>"
73                                "Modern systems usually use <strong>EFI</strong>, but "
74                                "may also show up as BIOS if started in compatibility "
75                                "mode." ) );
76
77    QString bootToolTip;
78    if ( PartUtils::isEfiSystem() )
79    {
80        m_bootLabel->setText( "EFI " );
81        bootToolTip = tr( "This system was started with an <strong>EFI</strong> "
82                          "boot environment.<br><br>"
83                          "To configure startup from an EFI environment, this installer "
84                          "must deploy a boot loader application, like <strong>GRUB"
85                          "</strong> or <strong>systemd-boot</strong> on an <strong>"
86                          "EFI System Partition</strong>. This is automatic, unless "
87                          "you choose manual partitioning, in which case you must "
88                          "choose it or create it on your own." );
89    }
90    else
91    {
92        m_bootLabel->setText( "BIOS" );
93        bootToolTip = tr( "This system was started with a <strong>BIOS</strong> "
94                          "boot environment.<br><br>"
95                          "To configure startup from a BIOS environment, this installer "
96                          "must install a boot loader, like <strong>GRUB"
97                          "</strong>, either at the beginning of a partition or "
98                          "on the <strong>Master Boot Record</strong> near the "
99                          "beginning of the partition table (preferred). "
100                          "This is automatic, unless "
101                          "you choose manual partitioning, in which case you must "
102                          "set it up on your own." );
103
104    }
105    m_bootLabel->setToolTip( bootToolTip );
106}
Note: See TracBrowser for help on using the repository browser.