2014-09-03 18:09:37 +02:00
|
|
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
|
|
|
*
|
2015-03-11 18:13:39 +01:00
|
|
|
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
2014-09-03 18:09:37 +02:00
|
|
|
*
|
|
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ChoicePage.h"
|
|
|
|
|
2014-09-19 16:27:39 +02:00
|
|
|
#include "core/PartitionCoreModule.h"
|
|
|
|
#include "core/DeviceModel.h"
|
|
|
|
#include "core/PartitionModel.h"
|
2015-09-18 15:41:07 +02:00
|
|
|
#include "core/OsproberEntry.h"
|
2014-09-19 16:27:39 +02:00
|
|
|
|
2014-09-03 18:09:37 +02:00
|
|
|
#include "PrettyRadioButton.h"
|
2015-09-18 17:25:55 +02:00
|
|
|
#include "PartitionPreview.h"
|
2014-09-03 18:09:37 +02:00
|
|
|
|
|
|
|
#include "utils/CalamaresUtilsGui.h"
|
2014-09-19 16:27:39 +02:00
|
|
|
#include "utils/Logger.h"
|
2014-11-11 17:09:33 +01:00
|
|
|
#include "utils/Retranslator.h"
|
2014-10-16 17:00:08 +02:00
|
|
|
#include "Branding.h"
|
2014-09-03 18:09:37 +02:00
|
|
|
|
2015-09-18 17:25:55 +02:00
|
|
|
#include <kpmcore/core/device.h>
|
|
|
|
|
2014-09-03 18:09:37 +02:00
|
|
|
#include <QBoxLayout>
|
|
|
|
#include <QButtonGroup>
|
2015-05-28 19:24:39 +02:00
|
|
|
#include <QDir>
|
2014-09-03 18:09:37 +02:00
|
|
|
#include <QLabel>
|
2015-09-18 17:25:55 +02:00
|
|
|
#include <QListView>
|
2014-09-03 18:09:37 +02:00
|
|
|
|
|
|
|
ChoicePage::ChoicePage( QWidget* parent )
|
|
|
|
: QWidget( parent )
|
|
|
|
, m_choice( NoChoice )
|
|
|
|
, m_nextEnabled( false )
|
2015-06-14 00:55:26 +02:00
|
|
|
, m_core( nullptr )
|
2014-09-03 18:09:37 +02:00
|
|
|
{
|
2015-09-30 17:24:37 +02:00
|
|
|
setupUi( this );
|
2014-09-03 18:09:37 +02:00
|
|
|
|
|
|
|
m_messageLabel->setWordWrap( true );
|
|
|
|
|
|
|
|
CalamaresUtils::unmarginLayout( m_itemsLayout );
|
|
|
|
|
2015-09-30 17:24:37 +02:00
|
|
|
// Drive selector + preview
|
|
|
|
CALAMARES_RETRANSLATE( m_drivesLabel->setText( tr( "Select drive:" ) ); )
|
2015-09-18 17:25:55 +02:00
|
|
|
|
2015-09-30 17:24:37 +02:00
|
|
|
m_drivesView->setViewMode( QListView::ListMode );
|
2015-09-18 17:25:55 +02:00
|
|
|
m_drivesView->setWrapping( false );
|
2015-09-30 17:24:37 +02:00
|
|
|
m_drivesView->setFlow( QListView::TopToBottom );
|
2015-09-18 17:25:55 +02:00
|
|
|
m_drivesView->setSelectionRectVisible( false );
|
|
|
|
m_drivesView->setWordWrap( true );
|
|
|
|
m_drivesView->setUniformItemSizes( true );
|
|
|
|
m_drivesView->setSelectionMode( QAbstractItemView::SingleSelection );
|
|
|
|
|
2015-09-30 17:24:37 +02:00
|
|
|
m_drivesView->setIconSize( CalamaresUtils::defaultIconSize() / 2 );
|
|
|
|
// m_drivesView->setGridSize( QSize( CalamaresUtils::defaultFontHeight() * 8,
|
|
|
|
// m_drivesView->iconSize().height() +
|
|
|
|
// CalamaresUtils::defaultFontHeight() * 4 ) );
|
|
|
|
// m_drivesView->setMinimumHeight( m_drivesView->gridSize().height() +
|
|
|
|
// CalamaresUtils::defaultFontHeight() / 2 );
|
2015-09-18 17:25:55 +02:00
|
|
|
|
|
|
|
m_previewFrame->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding );
|
|
|
|
// end
|
2014-09-03 18:09:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ChoicePage::~ChoicePage()
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2015-09-18 17:25:55 +02:00
|
|
|
void
|
|
|
|
ChoicePage::updatePreviews()
|
|
|
|
{
|
|
|
|
QMutexLocker locker( &m_previewsMutex );
|
|
|
|
|
|
|
|
cDebug() << "Updating partitioning preview widgets.";
|
|
|
|
qDeleteAll( m_previewFrame->children() );
|
|
|
|
m_previewFrame->layout()->deleteLater();
|
|
|
|
|
|
|
|
if ( m_drivesView->selectionModel()->currentIndex() == QModelIndex() )
|
|
|
|
{
|
|
|
|
cDebug() << "No disk selected, bailing out.";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Device* dev = m_core->deviceModel()->deviceForIndex( m_drivesView->selectionModel()->currentIndex() );
|
|
|
|
|
|
|
|
QVBoxLayout* layout = new QVBoxLayout;
|
|
|
|
m_previewFrame->setLayout( layout );
|
|
|
|
layout->setMargin( 0 );
|
|
|
|
|
|
|
|
PartitionPreview* preview = new PartitionPreview( m_previewFrame );
|
|
|
|
preview->setLabelsVisible( true );
|
|
|
|
PartitionModel* model = new PartitionModel( m_previewFrame );
|
|
|
|
model->init( dev );
|
|
|
|
preview->setModel( model );
|
|
|
|
layout->addWidget( preview );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-09-03 18:09:37 +02:00
|
|
|
void
|
2014-09-23 17:42:11 +02:00
|
|
|
ChoicePage::init( PartitionCoreModule* core, const OsproberEntryList& osproberEntries )
|
2014-09-03 18:09:37 +02:00
|
|
|
{
|
|
|
|
m_core = core;
|
|
|
|
|
2015-09-18 17:25:55 +02:00
|
|
|
// Drive selector + preview
|
|
|
|
m_drivesView->setModel( core->deviceModel() );
|
|
|
|
|
|
|
|
connect( m_drivesView->selectionModel(), &QItemSelectionModel::currentChanged,
|
|
|
|
this, [ this ]( const QModelIndex& index,
|
|
|
|
const QModelIndex& oldIndex )
|
|
|
|
{
|
|
|
|
updatePreviews();
|
|
|
|
} );
|
|
|
|
// end
|
|
|
|
|
2014-09-03 18:09:37 +02:00
|
|
|
// sample os-prober output:
|
|
|
|
// /dev/sda2:Windows 7 (loader):Windows:chain
|
|
|
|
// /dev/sda6::Arch:linux
|
|
|
|
//
|
|
|
|
// There are three possibilities we have to consider:
|
|
|
|
// - There are no operating systems present
|
|
|
|
// - There is one operating system present
|
|
|
|
// - There are multiple operating systems present
|
|
|
|
//
|
|
|
|
// There are three outcomes we have to provide:
|
|
|
|
// 1) Wipe+autopartition
|
|
|
|
// 2) Resize+autopartition
|
|
|
|
// 3) Manual
|
|
|
|
// TBD: upgrade option?
|
|
|
|
|
|
|
|
QSize iconSize( CalamaresUtils::defaultIconSize().width() * 3,
|
|
|
|
CalamaresUtils::defaultIconSize().height() * 3 );
|
|
|
|
QButtonGroup* grp = new QButtonGroup( this );
|
|
|
|
|
|
|
|
PrettyRadioButton* alongsideButton = new PrettyRadioButton;
|
|
|
|
alongsideButton->setIconSize( iconSize );
|
2015-04-02 14:21:14 +02:00
|
|
|
alongsideButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionAlongside,
|
2014-09-03 18:09:37 +02:00
|
|
|
CalamaresUtils::Original,
|
|
|
|
iconSize ) );
|
|
|
|
grp->addButton( alongsideButton->buttonWidget() );
|
|
|
|
|
|
|
|
PrettyRadioButton* eraseButton = new PrettyRadioButton;
|
|
|
|
eraseButton->setIconSize( iconSize );
|
2015-04-02 14:21:14 +02:00
|
|
|
eraseButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionEraseAuto,
|
2014-09-03 18:09:37 +02:00
|
|
|
CalamaresUtils::Original,
|
|
|
|
iconSize ) );
|
|
|
|
grp->addButton( eraseButton->buttonWidget() );
|
|
|
|
|
2014-12-16 17:04:09 +01:00
|
|
|
PrettyRadioButton* replaceButton = new PrettyRadioButton;
|
|
|
|
replaceButton->setIconSize( iconSize );
|
2015-04-02 14:21:14 +02:00
|
|
|
replaceButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionReplaceOs,
|
2014-12-16 17:04:09 +01:00
|
|
|
CalamaresUtils::Original,
|
|
|
|
iconSize ) );
|
|
|
|
grp->addButton( replaceButton->buttonWidget() );
|
|
|
|
|
2014-09-25 16:49:58 +02:00
|
|
|
m_itemsLayout->addWidget( alongsideButton );
|
2014-12-16 17:04:09 +01:00
|
|
|
m_itemsLayout->addWidget( replaceButton );
|
2015-04-16 18:14:01 +02:00
|
|
|
m_itemsLayout->addWidget( eraseButton );
|
2014-09-22 17:27:10 +02:00
|
|
|
m_itemsLayout->setSpacing( CalamaresUtils::defaultFontHeight() / 2 );
|
2014-09-03 18:09:37 +02:00
|
|
|
|
2014-09-23 17:42:11 +02:00
|
|
|
if ( osproberEntries.count() == 0 )
|
2014-09-03 18:09:37 +02:00
|
|
|
{
|
2014-11-11 17:09:33 +01:00
|
|
|
CALAMARES_RETRANSLATE(
|
|
|
|
m_messageLabel->setText( tr( "This computer currently does not seem to have an operating system on it. "
|
|
|
|
"What would you like to do?" ) );
|
2014-09-03 18:09:37 +02:00
|
|
|
|
2015-03-11 18:13:39 +01:00
|
|
|
if ( core->deviceModel()->rowCount() < 2 )
|
2015-04-10 13:31:49 +02:00
|
|
|
eraseButton->setText( tr( "<strong>Erase disk and install %1</strong><br/>"
|
2015-03-11 18:13:39 +01:00
|
|
|
"<font color=\"red\">Warning: </font>This will delete all of your programs, "
|
|
|
|
"documents, photos, music, and any other files." )
|
|
|
|
.arg( Calamares::Branding::instance()->
|
2015-03-18 20:11:53 +01:00
|
|
|
string( Calamares::Branding::ShortVersionedName ) ) );
|
2015-03-11 18:13:39 +01:00
|
|
|
else
|
2015-04-10 13:31:49 +02:00
|
|
|
eraseButton->setText( tr( "<strong>Erase disk and install %1</strong><br/>"
|
2015-03-11 18:13:39 +01:00
|
|
|
"You will be offered a choice of which disk to erase." )
|
|
|
|
.arg( Calamares::Branding::instance()->
|
2015-03-18 20:11:53 +01:00
|
|
|
string( Calamares::Branding::ShortVersionedName ) ) );
|
2014-11-11 17:09:33 +01:00
|
|
|
)
|
2014-09-03 18:09:37 +02:00
|
|
|
|
2014-12-16 17:04:09 +01:00
|
|
|
replaceButton->hide();
|
2014-09-03 18:09:37 +02:00
|
|
|
alongsideButton->hide();
|
|
|
|
}
|
2014-09-23 17:42:11 +02:00
|
|
|
else if ( osproberEntries.count() == 1 )
|
2014-09-03 18:09:37 +02:00
|
|
|
{
|
2014-09-23 17:42:11 +02:00
|
|
|
QString osName = osproberEntries.first().prettyName;
|
|
|
|
|
|
|
|
if ( !osName.isEmpty() )
|
2014-09-03 18:09:37 +02:00
|
|
|
{
|
2014-11-11 17:09:33 +01:00
|
|
|
CALAMARES_RETRANSLATE(
|
|
|
|
m_messageLabel->setText( tr( "This computer currently has %1 on it. "
|
|
|
|
"What would you like to do?" )
|
|
|
|
.arg( osName ) );
|
|
|
|
|
2015-04-10 13:31:49 +02:00
|
|
|
alongsideButton->setText( tr( "<strong>Install %2 alongside %1</strong><br/>"
|
2015-03-18 20:11:53 +01:00
|
|
|
"The installer will shrink the %1 volume to make room for %2. "
|
2014-11-11 17:09:33 +01:00
|
|
|
"You can choose which operating system you want each time the "
|
|
|
|
"computer starts up." )
|
|
|
|
.arg( osName )
|
|
|
|
.arg( Calamares::Branding::instance()->
|
2015-03-18 20:11:53 +01:00
|
|
|
string( Calamares::Branding::ShortVersionedName ) ) );
|
2014-11-11 17:09:33 +01:00
|
|
|
|
2015-03-11 18:13:39 +01:00
|
|
|
if ( core->deviceModel()->rowCount() < 2 )
|
2015-04-10 13:31:49 +02:00
|
|
|
eraseButton->setText( tr( "<strong>Erase entire disk with %1 and install %2</strong><br/>"
|
2015-03-11 18:13:39 +01:00
|
|
|
"<font color=\"red\">Warning: </font>This will erase the whole disk and "
|
|
|
|
"delete all of your %1 programs, "
|
|
|
|
"documents, photos, music, and any other files." )
|
|
|
|
.arg( osName )
|
|
|
|
.arg( Calamares::Branding::instance()->
|
2015-03-18 20:11:53 +01:00
|
|
|
string( Calamares::Branding::ShortVersionedName ) ) );
|
2015-03-11 18:13:39 +01:00
|
|
|
else
|
2015-04-10 13:31:49 +02:00
|
|
|
eraseButton->setText( tr( "<strong>Erase disk and install %1</strong><br/>"
|
2015-03-11 18:13:39 +01:00
|
|
|
"You will be offered a choice of which disk to erase." )
|
|
|
|
.arg( Calamares::Branding::instance()->
|
2015-03-18 20:11:53 +01:00
|
|
|
string( Calamares::Branding::ShortVersionedName ) ) );
|
2014-12-16 17:04:09 +01:00
|
|
|
|
2015-04-10 13:31:49 +02:00
|
|
|
replaceButton->setText( tr( "<strong>Replace a partition with %1</strong><br/>"
|
2015-03-11 18:13:39 +01:00
|
|
|
"You will be offered a choice of which partition to erase." )
|
2014-12-16 17:04:09 +01:00
|
|
|
.arg( Calamares::Branding::instance()->
|
2015-03-18 20:11:53 +01:00
|
|
|
string( Calamares::Branding::ShortVersionedName ) ) );
|
2014-11-11 17:09:33 +01:00
|
|
|
)
|
2014-09-03 18:09:37 +02:00
|
|
|
}
|
2014-09-19 16:27:39 +02:00
|
|
|
else
|
2014-09-23 17:42:11 +02:00
|
|
|
{
|
2014-11-11 17:09:33 +01:00
|
|
|
CALAMARES_RETRANSLATE(
|
|
|
|
m_messageLabel->setText( tr( "This computer already has an operating system on it. "
|
|
|
|
"What would you like to do?" ) );
|
|
|
|
|
2015-04-10 13:31:49 +02:00
|
|
|
alongsideButton->setText( tr( "<strong>Install %1 alongside your current operating system</strong><br/>"
|
2015-03-18 20:11:53 +01:00
|
|
|
"The installer will shrink an existing volume to make room for %2. "
|
2014-11-11 17:09:33 +01:00
|
|
|
"You can choose which operating system you want each time the "
|
|
|
|
"computer starts up." )
|
|
|
|
.arg( Calamares::Branding::instance()->
|
2015-05-16 18:48:18 +02:00
|
|
|
string( Calamares::Branding::ShortVersionedName ) )
|
|
|
|
.arg( Calamares::Branding::instance()->
|
|
|
|
string( Calamares::Branding::ShortProductName ) ) );
|
2014-11-11 17:09:33 +01:00
|
|
|
|
2015-03-11 18:13:39 +01:00
|
|
|
if ( core->deviceModel()->rowCount() < 2 )
|
2015-04-10 13:31:49 +02:00
|
|
|
eraseButton->setText( tr( "<strong>Erase disk and install %1</strong><br/>"
|
2015-03-11 18:13:39 +01:00
|
|
|
"<font color=\"red\">Warning: </font>This will delete all of your programs, "
|
|
|
|
"documents, photos, music, and any other files." )
|
|
|
|
.arg( Calamares::Branding::instance()->
|
2015-03-18 20:11:53 +01:00
|
|
|
string( Calamares::Branding::ShortVersionedName ) ) );
|
2015-03-11 18:13:39 +01:00
|
|
|
else
|
2015-04-10 13:31:49 +02:00
|
|
|
eraseButton->setText( tr( "<strong>Erase disk and install %1</strong><br/>"
|
2015-03-11 18:13:39 +01:00
|
|
|
"You will be offered a choice of which disk to erase." )
|
|
|
|
.arg( Calamares::Branding::instance()->
|
2015-03-18 20:11:53 +01:00
|
|
|
string( Calamares::Branding::ShortVersionedName ) ) );
|
2014-12-16 17:04:09 +01:00
|
|
|
|
2015-04-10 13:31:49 +02:00
|
|
|
replaceButton->setText( tr( "<strong>Replace a partition with %1</strong><br/>"
|
2015-03-11 18:13:39 +01:00
|
|
|
"You will be offered a choice of which partition to erase." )
|
2014-12-16 17:04:09 +01:00
|
|
|
.arg( Calamares::Branding::instance()->
|
2015-03-18 20:11:53 +01:00
|
|
|
string( Calamares::Branding::ShortVersionedName ) ) );
|
2014-11-11 17:09:33 +01:00
|
|
|
)
|
2014-09-23 17:42:11 +02:00
|
|
|
}
|
|
|
|
if ( !osproberEntries.first().canBeResized )
|
2014-09-19 16:27:39 +02:00
|
|
|
alongsideButton->hide();
|
2014-09-03 18:09:37 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-22 17:21:50 +02:00
|
|
|
// m_osproberLines has at least 2 items.
|
2014-09-03 18:09:37 +02:00
|
|
|
|
2014-09-22 17:21:50 +02:00
|
|
|
bool atLeastOneCanBeResized = false;
|
2014-09-03 18:09:37 +02:00
|
|
|
|
2014-09-23 17:42:11 +02:00
|
|
|
foreach ( const OsproberEntry& entry, osproberEntries )
|
2014-09-22 17:21:50 +02:00
|
|
|
{
|
2014-09-23 17:42:11 +02:00
|
|
|
if ( entry.canBeResized )
|
2014-09-22 17:21:50 +02:00
|
|
|
{
|
|
|
|
atLeastOneCanBeResized = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-11 17:09:33 +01:00
|
|
|
CALAMARES_RETRANSLATE(
|
|
|
|
m_messageLabel->setText( tr( "This computer currently has multiple operating systems on it. "
|
|
|
|
"What would you like to do?" ) );
|
|
|
|
|
2015-04-10 13:31:49 +02:00
|
|
|
alongsideButton->setText( tr( "<strong>Install %1 alongside your current operating systems</strong><br/>"
|
2015-03-18 20:11:53 +01:00
|
|
|
"The installer will shrink an existing volume to make room for %2. "
|
2014-11-11 17:09:33 +01:00
|
|
|
"You can choose which operating system you want each time the "
|
|
|
|
"computer starts up." )
|
|
|
|
.arg( Calamares::Branding::instance()->
|
2015-05-16 18:48:18 +02:00
|
|
|
string( Calamares::Branding::ShortVersionedName ) )
|
|
|
|
.arg( Calamares::Branding::instance()->
|
|
|
|
string( Calamares::Branding::ShortProductName ) ) );
|
2014-09-22 17:21:50 +02:00
|
|
|
|
2015-03-11 18:13:39 +01:00
|
|
|
if ( core->deviceModel()->rowCount() < 2 )
|
2015-04-10 13:31:49 +02:00
|
|
|
eraseButton->setText( tr( "<strong>Erase disk and install %1</strong><br/>"
|
2015-03-11 18:13:39 +01:00
|
|
|
"<font color=\"red\">Warning: </font>This will delete all of your programs, "
|
|
|
|
"documents, photos, music, and any other files." )
|
|
|
|
.arg( Calamares::Branding::instance()->
|
2015-03-18 20:11:53 +01:00
|
|
|
string( Calamares::Branding::ShortVersionedName ) ) );
|
2015-03-11 18:13:39 +01:00
|
|
|
else
|
2015-04-10 13:31:49 +02:00
|
|
|
eraseButton->setText( tr( "<strong>Erase disk and install %1</strong><br/>"
|
2015-03-11 18:13:39 +01:00
|
|
|
"You will be offered a choice of which disk to erase." )
|
|
|
|
.arg( Calamares::Branding::instance()->
|
2015-03-18 20:11:53 +01:00
|
|
|
string( Calamares::Branding::ShortVersionedName ) ) );
|
2014-12-16 17:04:09 +01:00
|
|
|
|
2015-04-10 13:31:49 +02:00
|
|
|
replaceButton->setText( tr( "<strong>Replace a partition with %1</strong><br/>"
|
2015-03-11 18:13:39 +01:00
|
|
|
"You will be offered a choice of which partition to erase." )
|
2014-12-16 17:04:09 +01:00
|
|
|
.arg( Calamares::Branding::instance()->
|
2015-03-18 20:11:53 +01:00
|
|
|
string( Calamares::Branding::ShortVersionedName ) ) );
|
2014-11-11 17:09:33 +01:00
|
|
|
)
|
2014-09-23 17:42:11 +02:00
|
|
|
|
|
|
|
if ( !atLeastOneCanBeResized )
|
2014-09-22 17:21:50 +02:00
|
|
|
alongsideButton->hide();
|
2014-09-03 18:09:37 +02:00
|
|
|
}
|
|
|
|
|
2015-05-28 19:24:39 +02:00
|
|
|
bool isEfi = QDir( "/sys/firmware/efi/efivars" ).exists();
|
|
|
|
bool efiSystemPartitionFound = !m_core->efiSystemPartitions().isEmpty();
|
|
|
|
|
|
|
|
if ( isEfi && !efiSystemPartitionFound )
|
|
|
|
{
|
|
|
|
cDebug() << "WARNING: system is EFI but there's not EFI system partition, "
|
|
|
|
"DISABLING alongside and replace features.";
|
|
|
|
alongsideButton->hide();
|
|
|
|
replaceButton->hide();
|
|
|
|
}
|
|
|
|
|
2014-09-03 18:09:37 +02:00
|
|
|
QFrame* hLine = new QFrame;
|
|
|
|
hLine->setFrameStyle( QFrame::HLine );
|
|
|
|
m_itemsLayout->addWidget( hLine );
|
|
|
|
|
|
|
|
PrettyRadioButton* somethingElseButton = new PrettyRadioButton;
|
2014-11-11 17:09:33 +01:00
|
|
|
CALAMARES_RETRANSLATE(
|
2015-04-10 13:31:49 +02:00
|
|
|
somethingElseButton->setText( tr( "<strong>Manual partitioning</strong><br/>"
|
2014-11-11 17:09:33 +01:00
|
|
|
"You can create or resize partitions yourself, or choose "
|
|
|
|
"multiple partitions for %1." )
|
|
|
|
.arg( Calamares::Branding::instance()->
|
|
|
|
string( Calamares::Branding::ShortVersionedName ) ) );
|
|
|
|
)
|
2014-09-03 18:09:37 +02:00
|
|
|
somethingElseButton->setIconSize( iconSize );
|
2015-04-02 14:21:14 +02:00
|
|
|
somethingElseButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionManual,
|
2014-09-03 18:09:37 +02:00
|
|
|
CalamaresUtils::Original,
|
|
|
|
iconSize ) );
|
|
|
|
m_itemsLayout->addWidget( somethingElseButton );
|
|
|
|
grp->addButton( somethingElseButton->buttonWidget() );
|
|
|
|
|
|
|
|
connect( alongsideButton->buttonWidget(), &QRadioButton::toggled,
|
|
|
|
this, [ this ]( bool checked )
|
|
|
|
{
|
|
|
|
if ( checked )
|
|
|
|
m_choice = Alongside;
|
|
|
|
setNextEnabled( true );
|
|
|
|
} );
|
|
|
|
|
|
|
|
connect( eraseButton->buttonWidget(), &QRadioButton::toggled,
|
|
|
|
this, [ this ]( bool checked )
|
|
|
|
{
|
|
|
|
if ( checked )
|
|
|
|
m_choice = Erase;
|
|
|
|
setNextEnabled( true );
|
|
|
|
} );
|
|
|
|
|
2014-12-16 17:04:09 +01:00
|
|
|
connect( replaceButton->buttonWidget(), &QRadioButton::toggled,
|
|
|
|
this, [ this ]( bool checked )
|
|
|
|
{
|
|
|
|
if ( checked )
|
|
|
|
m_choice = Replace;
|
|
|
|
setNextEnabled( true );
|
|
|
|
} );
|
|
|
|
|
2014-09-03 18:09:37 +02:00
|
|
|
connect( somethingElseButton->buttonWidget(), &QRadioButton::toggled,
|
|
|
|
this, [ this ]( bool checked )
|
|
|
|
{
|
|
|
|
if ( checked )
|
|
|
|
m_choice = Manual;
|
|
|
|
setNextEnabled( true );
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
2015-04-15 12:20:01 +02:00
|
|
|
ChoicePage::isNextEnabled() const
|
2014-09-03 18:09:37 +02:00
|
|
|
{
|
|
|
|
return m_nextEnabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ChoicePage::Choice
|
2015-04-15 12:20:01 +02:00
|
|
|
ChoicePage::currentChoice() const
|
2014-09-03 18:09:37 +02:00
|
|
|
{
|
|
|
|
return m_choice;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
ChoicePage::setNextEnabled( bool enabled )
|
|
|
|
{
|
|
|
|
if ( enabled == m_nextEnabled )
|
|
|
|
return;
|
|
|
|
|
|
|
|
m_nextEnabled = enabled;
|
|
|
|
emit nextStatusChanged( enabled );
|
|
|
|
}
|
2014-09-19 16:27:39 +02:00
|
|
|
|