Hook up ReplacePage in ChoicePage and PartitionViewStep.
This commit is contained in:
parent
2f2ef73f20
commit
0da99d0866
@ -97,8 +97,16 @@ ChoicePage::init( PartitionCoreModule* core, const OsproberEntryList& osproberEn
|
||||
iconSize ) );
|
||||
grp->addButton( eraseButton->buttonWidget() );
|
||||
|
||||
PrettyRadioButton* replaceButton = new PrettyRadioButton;
|
||||
replaceButton->setIconSize( iconSize );
|
||||
replaceButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::Replace,
|
||||
CalamaresUtils::Original,
|
||||
iconSize ) );
|
||||
grp->addButton( replaceButton->buttonWidget() );
|
||||
|
||||
m_itemsLayout->addWidget( eraseButton );
|
||||
m_itemsLayout->addWidget( alongsideButton );
|
||||
m_itemsLayout->addWidget( replaceButton );
|
||||
m_itemsLayout->setSpacing( CalamaresUtils::defaultFontHeight() / 2 );
|
||||
|
||||
if ( osproberEntries.count() == 0 )
|
||||
@ -114,6 +122,7 @@ ChoicePage::init( PartitionCoreModule* core, const OsproberEntryList& osproberEn
|
||||
string( Calamares::Branding::VersionedName ) ) );
|
||||
)
|
||||
|
||||
replaceButton->hide();
|
||||
alongsideButton->hide();
|
||||
}
|
||||
else if ( osproberEntries.count() == 1 )
|
||||
@ -135,13 +144,19 @@ ChoicePage::init( PartitionCoreModule* core, const OsproberEntryList& osproberEn
|
||||
.arg( Calamares::Branding::instance()->
|
||||
string( Calamares::Branding::VersionedName ) ) );
|
||||
|
||||
eraseButton->setText( tr( "<b>Replace %1 with %2</b><br/>"
|
||||
eraseButton->setText( tr( "<b>Erase entire disk with %1 and install %2</b><br/>"
|
||||
"<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()->
|
||||
string( Calamares::Branding::VersionedName ) ) );
|
||||
|
||||
replaceButton->setText( tr( "<b>Install %1 on an existing partition</b><br/>"
|
||||
"<font color=\"red\">Warning: </font>This will delete all files "
|
||||
"on the selected partition." )
|
||||
.arg( Calamares::Branding::instance()->
|
||||
string( Calamares::Branding::VersionedName ) ) );
|
||||
)
|
||||
}
|
||||
else
|
||||
@ -162,6 +177,12 @@ ChoicePage::init( PartitionCoreModule* core, const OsproberEntryList& osproberEn
|
||||
"documents, photos, music, and any other files." )
|
||||
.arg( Calamares::Branding::instance()->
|
||||
string( Calamares::Branding::VersionedName ) ) );
|
||||
|
||||
replaceButton->setText( tr( "<b>Install %1 on an existing partition</b><br/>"
|
||||
"<font color=\"red\">Warning: </font>This will delete all files "
|
||||
"on the selected partition." )
|
||||
.arg( Calamares::Branding::instance()->
|
||||
string( Calamares::Branding::VersionedName ) ) );
|
||||
)
|
||||
}
|
||||
if ( !osproberEntries.first().canBeResized )
|
||||
@ -198,6 +219,12 @@ ChoicePage::init( PartitionCoreModule* core, const OsproberEntryList& osproberEn
|
||||
"documents, photos, music, and any other files." )
|
||||
.arg( Calamares::Branding::instance()->
|
||||
string( Calamares::Branding::VersionedName ) ) );
|
||||
|
||||
replaceButton->setText( tr( "<b>Install %1 on an existing partition</b><br/>"
|
||||
"<font color=\"red\">Warning: </font>This will delete all files "
|
||||
"on the selected partition." )
|
||||
.arg( Calamares::Branding::instance()->
|
||||
string( Calamares::Branding::VersionedName ) ) );
|
||||
)
|
||||
|
||||
if ( !atLeastOneCanBeResized )
|
||||
@ -239,6 +266,14 @@ ChoicePage::init( PartitionCoreModule* core, const OsproberEntryList& osproberEn
|
||||
setNextEnabled( true );
|
||||
} );
|
||||
|
||||
connect( replaceButton->buttonWidget(), &QRadioButton::toggled,
|
||||
this, [ this ]( bool checked )
|
||||
{
|
||||
if ( checked )
|
||||
m_choice = Replace;
|
||||
setNextEnabled( true );
|
||||
} );
|
||||
|
||||
connect( somethingElseButton->buttonWidget(), &QRadioButton::toggled,
|
||||
this, [ this ]( bool checked )
|
||||
{
|
||||
|
@ -37,6 +37,7 @@ public:
|
||||
NoChoice,
|
||||
Alongside,
|
||||
Erase,
|
||||
Replace,
|
||||
Manual
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -28,6 +29,7 @@
|
||||
#include <gui/EraseDiskPage.h>
|
||||
#include <gui/AlongsidePage.h>
|
||||
#include <gui/PartitionPage.h>
|
||||
#include <gui/ReplacePage.h>
|
||||
#include <gui/PartitionPreview.h>
|
||||
#include "OsproberEntry.h"
|
||||
|
||||
@ -55,6 +57,7 @@ PartitionViewStep::PartitionViewStep( QObject* parent )
|
||||
, m_erasePage( new EraseDiskPage() )
|
||||
, m_alongsidePage( new AlongsidePage() )
|
||||
, m_manualPartitionPage( new PartitionPage( m_core ) )
|
||||
, m_replacePage( new ReplacePage( m_core ) )
|
||||
{
|
||||
m_widget->setContentsMargins( 0, 0, 0, 0 );
|
||||
|
||||
@ -118,6 +121,7 @@ PartitionViewStep::PartitionViewStep( QObject* parent )
|
||||
m_widget->addWidget( m_manualPartitionPage );
|
||||
m_widget->addWidget( m_alongsidePage );
|
||||
m_widget->addWidget( m_erasePage );
|
||||
m_widget->addWidget( m_replacePage );
|
||||
m_widget->removeWidget( waitingWidget );
|
||||
waitingWidget->deleteLater();
|
||||
|
||||
@ -133,6 +137,8 @@ PartitionViewStep::PartitionViewStep( QObject* parent )
|
||||
this, &PartitionViewStep::nextStatusChanged );
|
||||
connect( m_alongsidePage, &AlongsidePage::nextStatusChanged,
|
||||
this, &PartitionViewStep::nextStatusChanged );
|
||||
connect( m_replacePage, &ReplacePage::nextStatusChanged,
|
||||
this, &PartitionViewStep::nextStatusChanged );
|
||||
}
|
||||
|
||||
|
||||
@ -206,6 +212,12 @@ PartitionViewStep::next()
|
||||
m_core->revert();
|
||||
m_widget->setCurrentWidget( m_alongsidePage );
|
||||
}
|
||||
else if ( m_choicePage->currentChoice() == ChoicePage::Replace )
|
||||
{
|
||||
if ( m_core->isDirty() )
|
||||
m_core->revert();
|
||||
m_widget->setCurrentWidget( m_replacePage );
|
||||
}
|
||||
cDebug() << "Choice applied: " << m_choicePage->currentChoice();
|
||||
return;
|
||||
}
|
||||
@ -248,7 +260,8 @@ PartitionViewStep::isAtBeginning() const
|
||||
{
|
||||
if ( m_widget->currentWidget() == m_manualPartitionPage ||
|
||||
m_widget->currentWidget() == m_erasePage ||
|
||||
m_widget->currentWidget() == m_alongsidePage )
|
||||
m_widget->currentWidget() == m_alongsidePage ||
|
||||
m_widget->currentWidget() == m_replacePage )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@ -270,6 +283,10 @@ PartitionViewStep::onLeave()
|
||||
{
|
||||
m_alongsidePage->applyChanges();
|
||||
}
|
||||
else if ( m_widget->currentWidget() == m_replacePage )
|
||||
{
|
||||
m_replacePage->applyChanges();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
|
||||
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -28,6 +29,7 @@ class ChoicePage;
|
||||
class EraseDiskPage;
|
||||
class AlongsidePage;
|
||||
class PartitionPage;
|
||||
class ReplacePage;
|
||||
class PartitionCoreModule;
|
||||
class QStackedWidget;
|
||||
|
||||
@ -71,6 +73,7 @@ private:
|
||||
EraseDiskPage* m_erasePage;
|
||||
AlongsidePage* m_alongsidePage;
|
||||
PartitionPage* m_manualPartitionPage;
|
||||
ReplacePage* m_replacePage;
|
||||
};
|
||||
|
||||
#endif // PARTITIONVIEWSTEP_H
|
||||
|
Loading…
Reference in New Issue
Block a user