mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-29 18:35:37 -04:00
Signal-slot plumbing and splitter setup for Alongside.
This commit is contained in:
parent
46ea8a484e
commit
80018e1d5b
2 changed files with 68 additions and 8 deletions
|
@ -1,6 +1,6 @@
|
||||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
*
|
*
|
||||||
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
* Copyright 2014-2016, Teo Mrnjavac <teo@kde.org>
|
||||||
*
|
*
|
||||||
* Calamares is free software: you can redistribute it and/or modify
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -30,6 +30,7 @@
|
||||||
#include "ExpandableRadioButton.h"
|
#include "ExpandableRadioButton.h"
|
||||||
#include "PartitionBarsView.h"
|
#include "PartitionBarsView.h"
|
||||||
#include "PartitionLabelsView.h"
|
#include "PartitionLabelsView.h"
|
||||||
|
#include "PartitionSplitterWidget.h"
|
||||||
#include "DeviceInfoWidget.h"
|
#include "DeviceInfoWidget.h"
|
||||||
#include "ScanningDialog.h"
|
#include "ScanningDialog.h"
|
||||||
|
|
||||||
|
@ -452,6 +453,24 @@ ChoicePage::applyActionChoice( ChoicePage::Choice choice )
|
||||||
this, SLOT( doReplaceSelectedPartition( QModelIndex, QModelIndex ) ),
|
this, SLOT( doReplaceSelectedPartition( QModelIndex, QModelIndex ) ),
|
||||||
Qt::UniqueConnection );
|
Qt::UniqueConnection );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Alongside:
|
||||||
|
if ( m_core->isDirty() )
|
||||||
|
{
|
||||||
|
ScanningDialog::run( QtConcurrent::run( [ = ]
|
||||||
|
{
|
||||||
|
QMutexLocker locker( &m_coreMutex );
|
||||||
|
m_core->revertDevice( selectedDevice() );
|
||||||
|
} ),
|
||||||
|
[]{},
|
||||||
|
this );
|
||||||
|
}
|
||||||
|
setNextEnabled( !m_beforePartitionBarsView->selectionModel()->selectedRows().isEmpty() );
|
||||||
|
|
||||||
|
connect( m_beforePartitionBarsView->selectionModel(), SIGNAL( currentRowChanged( QModelIndex, QModelIndex ) ),
|
||||||
|
this, SLOT( doAlongsideSelectedPartition( QModelIndex, QModelIndex ) ),
|
||||||
|
Qt::UniqueConnection );
|
||||||
|
break;
|
||||||
case NoChoice:
|
case NoChoice:
|
||||||
case Manual:
|
case Manual:
|
||||||
break;
|
break;
|
||||||
|
@ -460,10 +479,26 @@ ChoicePage::applyActionChoice( ChoicePage::Choice choice )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ChoicePage::doAlongsideSelectedPartition( const QModelIndex& current,
|
||||||
|
const QModelIndex& previous )
|
||||||
|
{
|
||||||
|
Q_UNUSED( previous );
|
||||||
|
if ( !current.isValid() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cDebug() << "Partition selected for Alongside.";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ChoicePage::doReplaceSelectedPartition( const QModelIndex& current,
|
ChoicePage::doReplaceSelectedPartition( const QModelIndex& current,
|
||||||
const QModelIndex& previous )
|
const QModelIndex& previous )
|
||||||
{
|
{
|
||||||
|
Q_UNUSED( previous );
|
||||||
if ( !current.isValid() )
|
if ( !current.isValid() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -581,13 +616,35 @@ ChoicePage::updateActionChoicePreview( ChoicePage::Choice choice )
|
||||||
switch ( choice )
|
switch ( choice )
|
||||||
{
|
{
|
||||||
case Alongside:
|
case Alongside:
|
||||||
m_previewBeforeLabel->setText( tr( "Device:" ) );
|
{
|
||||||
m_previewAfterLabel->hide();
|
m_previewBeforeLabel->setText( tr( "Before:" ) );
|
||||||
// split widget goes here
|
m_selectLabel->setText( tr( "<strong>Select which partition to shrink, "
|
||||||
//label->setText( tr( "Drag to split:" ) );
|
"then drag to resize</strong>" ) );
|
||||||
m_selectLabel->hide();
|
m_selectLabel->show();
|
||||||
|
|
||||||
break;
|
m_afterPartitionSplitterWidget = new PartitionSplitterWidget;
|
||||||
|
layout->addWidget( m_afterPartitionSplitterWidget );
|
||||||
|
|
||||||
|
QLabel* sizeLabel = new QLabel;
|
||||||
|
layout->addWidget( sizeLabel );
|
||||||
|
sizeLabel->setWordWrap( true );
|
||||||
|
connect( m_afterPartitionSplitterWidget, &PartitionSplitterWidget::partitionResized,
|
||||||
|
this, [ this, sizeLabel ]( const QString& path, qint64 size, qint64 sizeNext )
|
||||||
|
{
|
||||||
|
sizeLabel->setText( tr( "%1 will be shrunk to %2MB and a new "
|
||||||
|
"%3MB partition will be created for %4." )
|
||||||
|
.arg( m_beforePartitionBarsView->selectionModel()->currentIndex().data().toString() )
|
||||||
|
.arg( size / ( 1024 * 1024 ) )
|
||||||
|
.arg( sizeNext / ( 1024 * 1024 ) )
|
||||||
|
.arg( Calamares::Branding::instance()->
|
||||||
|
string( Calamares::Branding::ShortProductName ) ) );
|
||||||
|
} );
|
||||||
|
|
||||||
|
m_previewAfterFrame->show();
|
||||||
|
m_previewAfterLabel->show();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
case Erase:
|
case Erase:
|
||||||
case Replace:
|
case Replace:
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
*
|
*
|
||||||
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
* Copyright 2014-2016, Teo Mrnjavac <teo@kde.org>
|
||||||
*
|
*
|
||||||
* Calamares is free software: you can redistribute it and/or modify
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -35,6 +35,7 @@ class QListView;
|
||||||
|
|
||||||
class ExpandableRadioButton;
|
class ExpandableRadioButton;
|
||||||
class PartitionBarsView;
|
class PartitionBarsView;
|
||||||
|
class PartitionSplitterWidget;
|
||||||
class PartitionLabelsView;
|
class PartitionLabelsView;
|
||||||
class PartitionCoreModule;
|
class PartitionCoreModule;
|
||||||
class PrettyRadioButton;
|
class PrettyRadioButton;
|
||||||
|
@ -71,6 +72,7 @@ signals:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void doReplaceSelectedPartition( const QModelIndex& current, const QModelIndex& previous );
|
void doReplaceSelectedPartition( const QModelIndex& current, const QModelIndex& previous );
|
||||||
|
void doAlongsideSelectedPartition( const QModelIndex& current, const QModelIndex& previous );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setNextEnabled( bool enabled );
|
void setNextEnabled( bool enabled );
|
||||||
|
@ -107,6 +109,7 @@ private:
|
||||||
QPointer< PartitionLabelsView > m_beforePartitionLabelsView;
|
QPointer< PartitionLabelsView > m_beforePartitionLabelsView;
|
||||||
QPointer< PartitionBarsView > m_afterPartitionBarsView;
|
QPointer< PartitionBarsView > m_afterPartitionBarsView;
|
||||||
QPointer< PartitionLabelsView > m_afterPartitionLabelsView;
|
QPointer< PartitionLabelsView > m_afterPartitionLabelsView;
|
||||||
|
QPointer< PartitionSplitterWidget > m_afterPartitionSplitterWidget;
|
||||||
|
|
||||||
int m_lastSelectedDeviceIndex;
|
int m_lastSelectedDeviceIndex;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue