Merge pull request #1 from manjaro/development

merge manjaro-dev
This commit is contained in:
Bernhard Landauer 2017-01-20 07:31:15 +01:00 committed by GitHub
commit 6bfa27ec00
48 changed files with 310 additions and 111 deletions

View File

@ -6,7 +6,7 @@ function( calamares_add_plugin )
set( NAME ${ARGV0} )
set( options NO_INSTALL SHARED_LIB )
set( oneValueArgs NAME TYPE EXPORT_MACRO RESOURCES )
set( multiValueArgs SOURCES UI LINK_LIBRARIES COMPILE_DEFINITIONS )
set( multiValueArgs SOURCES UI LINK_LIBRARIES LINK_PRIVATE_LIBRARIES COMPILE_DEFINITIONS )
cmake_parse_arguments( PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
set( PLUGIN_NAME ${NAME} )
set( PLUGIN_DESTINATION ${CMAKE_INSTALL_LIBDIR}/calamares/modules/${PLUGIN_NAME} )
@ -22,6 +22,7 @@ function( calamares_add_plugin )
if( NOT CMAKE_BUILD_TYPE STREQUAL "Release" )
message( " ${Green}TYPE:${ColorReset} ${PLUGIN_TYPE}" )
message( " ${Green}LINK_LIBRARIES:${ColorReset} ${PLUGIN_LINK_LIBRARIES}" )
message( " ${Green}LINK_PRIVATE_LIBRARIES:${ColorReset} ${PLUGIN_LINK_PRIVATE_LIBRARIES}" )
# message( " ${Green}SOURCES:${ColorReset} ${PLUGIN_SOURCES}" )
# message( " ${Green}UI:${ColorReset} ${PLUGIN_UI}" )
# message( " ${Green}EXPORT_MACRO:${ColorReset} ${PLUGIN_EXPORT_MACRO}" )
@ -60,6 +61,10 @@ function( calamares_add_plugin )
list( APPEND calamares_add_library_args "LINK_LIBRARIES" "${PLUGIN_LINK_LIBRARIES}" )
endif()
if( PLUGIN_LINK_PRIVATE_LIBRARIES )
list( APPEND calamares_add_library_args "LINK_PRIVATE_LIBRARIES" "${PLUGIN_LINK_PRIVATE_LIBRARIES}" )
endif()
if( PLUGIN_COMPILE_DEFINITIONS )
list( APPEND calamares_add_library_args "COMPILE_DEFINITIONS" ${PLUGIN_COMPILE_DEFINITIONS} )
endif()

View File

@ -27,7 +27,7 @@ Modules:
* partition:
* extra-cmake-modules
* KF5: KCoreAddons, KConfig, KI18n, KIconThemes, KIO, KService
* KPMcore >= 2.2
* KPMcore >= 3.0
* bootloader:
* systemd-boot or GRUB
* unpackfs:

View File

@ -4,10 +4,10 @@ componentName: manjaro-kde
strings:
productName: Manjaro Linux
shortProductName: Manjaro
version: 16.10
shortVersion: 16.10
versionedName: Manjaro Linux 16.10 "Fringilla"
shortVersionedName: Manjaro 16.10
version: 17.0
shortVersion: 17.0
versionedName: Manjaro Linux 17.0 "Gellivara"
shortVersionedName: Manjaro 17.0
bootloaderEntryName: Manjaro
images:

View File

@ -4,10 +4,10 @@ componentName: manjaro-xfce
strings:
productName: Manjaro Linux
shortProductName: Manjaro
version: 16.10
shortVersion: 16.10
versionedName: Manjaro Linux 16.10 "Fringilla"
shortVersionedName: Manjaro 16.10
version: 17.0
shortVersion: 17.0
versionedName: Manjaro Linux 17.0 "Gellivara"
shortVersionedName: Manjaro 17.0
bootloaderEntryName: Manjaro
images:

View File

@ -4,10 +4,10 @@ componentName: manjaro
strings:
productName: Manjaro Linux
shortProductName: Manjaro
version: 16.10
shortVersion: 16.10
versionedName: Manjaro Linux 16.10 "Fringilla"
shortVersionedName: Manjaro 16.10
version: 17.0
shortVersion: 17.0
versionedName: Manjaro Linux 17.0 "Gellivara"
shortVersionedName: Manjaro 17.0
bootloaderEntryName: Manjaro
images:

View File

@ -59,12 +59,12 @@ endif()
qt5_use_modules( calamares_bin Core Widgets )
target_link_libraries( calamares_bin
${CALAMARES_LIBRARIES}
calamaresui
Qt5::Core
Qt5::Widgets
yaml-cpp
${LINK_LIBRARIES}
PRIVATE
${CALAMARES_LIBRARIES}
calamaresui
Qt5::Core
Qt5::Widgets
${LINK_LIBRARIES}
)
install( TARGETS calamares_bin

View File

@ -62,10 +62,10 @@ calamares_add_library( ${CALAMARESUI_LIBRARY_TARGET}
SOURCES ${${CALAMARESUI_LIBRARY_TARGET}_SOURCES}
UI ${${CALAMARESUI_LIBRARY_TARGET}_UI}
EXPORT_MACRO UIDLLEXPORT_PRO
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
yaml-cpp
Qt5::Svg
Qt5::QuickWidgets
Qt5::QuickWidgets
${OPTIONAL_PRIVATE_LIBRARIES}
RESOURCES libcalamaresui.qrc
EXPORT CalamaresLibraryDepends

View File

@ -3,7 +3,7 @@ calamares_add_plugin( dracutlukscfg
EXPORT_MACRO PLUGINDLLEXPORT_PRO
SOURCES
DracutLuksCfgJob.cpp
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
calamares
SHARED_LIB
)

View File

@ -3,7 +3,7 @@ calamares_add_plugin( dummycpp
EXPORT_MACRO PLUGINDLLEXPORT_PRO
SOURCES
DummyCppJob.cpp
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
calamares
SHARED_LIB
)

View File

@ -7,7 +7,7 @@ calamares_add_plugin( finished
FinishedPage.cpp
UI
FinishedPage.ui
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
calamaresui
SHARED_LIB
)

View File

@ -19,7 +19,7 @@ calamares_add_plugin( interactiveterminal
SOURCES
InteractiveTerminalViewStep.cpp
InteractiveTerminalPage.cpp
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
calamaresui
KF5::Service
KF5::Parts

View File

@ -14,7 +14,7 @@ calamares_add_plugin( keyboard
KeyboardPage.ui
RESOURCES
keyboard.qrc
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
calamaresui
SHARED_LIB
)

View File

@ -29,6 +29,7 @@ KeyboardViewStep::KeyboardViewStep( QObject* parent )
: Calamares::ViewStep( parent )
, m_widget( new KeyboardPage() )
, m_nextEnabled( false )
, m_writeEtcDefaultKeyboard( true )
{
m_widget->init();
m_nextEnabled = true;

View File

@ -15,7 +15,7 @@ set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
LicensePage.cpp
UI
LicensePage.ui
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
calamaresui
SHARED_LIB
)

View File

@ -14,7 +14,9 @@ calamares_add_plugin( locale
UI
RESOURCES
locale.qrc
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
calamaresui
Qt5::Network
yaml-cpp
SHARED_LIB
)

View File

@ -12,7 +12,9 @@ calamares_add_plugin( netinstall
widgets/groupselectionwidget.ui
RESOURCES
netinstall.qrc
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
calamaresui
Qt5::Network
yaml-cpp
SHARED_LIB
)

View File

@ -10,7 +10,7 @@ find_package( KF5 REQUIRED CoreAddons )
# These are needed because KPMcore links publicly against ConfigCore, I18n, IconThemes, KIOCore and Service
find_package( KF5 REQUIRED Config I18n IconThemes KIO Service )
find_package( KPMcore 2.2 REQUIRED )
find_package( KPMcore 3.0.0 REQUIRED )
add_subdirectory( tests )
@ -66,7 +66,7 @@ calamares_add_plugin( partition
gui/EncryptWidget.ui
gui/PartitionPage.ui
gui/ReplaceWidget.ui
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
kpmcore
calamaresui
KF5::CoreAddons

View File

@ -151,6 +151,12 @@ createNewEncryptedPartition( PartitionNode* parent,
FileSystemFactory::create( FileSystem::Luks,
firstSector,
lastSector ) );
if ( !fs )
{
qDebug() << "ERROR: cannot create LUKS filesystem. Giving up.";
return nullptr;
}
fs->createInnerFileSystem( fsType );
fs->setPassphrase( passphrase );
Partition* p = new Partition( parent,

View File

@ -51,8 +51,9 @@ canBeReplaced( Partition* candidate )
qint64 requiredStorageB = ( requiredStorageGB + 0.5 ) * 1024 * 1024 * 1024;
cDebug() << "Required storage B:" << requiredStorageB
<< QString( "(%1GB)" ).arg( requiredStorageB / 1024 / 1024 / 1024 );
cDebug() << "Available storage B:" << availableStorageB
<< QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 );
cDebug() << "Storage capacity B:" << availableStorageB
<< QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 )
<< "for" << candidate->partitionPath() << " length:" << candidate->length();
if ( ok &&
availableStorageB > requiredStorageB )
@ -102,7 +103,9 @@ canBeResized( Partition* candidate )
cDebug() << "Required storage B:" << requiredStorageB
<< QString( "(%1GB)" ).arg( requiredStorageB / 1024 / 1024 / 1024 );
cDebug() << "Available storage B:" << availableStorageB
<< QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 );
<< QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 )
<< "for" << candidate->partitionPath() << " length:" << candidate->length()
<< " sectorsUsed:" << candidate->sectorsUsed() << " fsType:" << candidate->fileSystem().name();
if ( ok &&
availableStorageB > requiredStorageB )

View File

@ -128,11 +128,11 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
empty_space_size = 1;
}
qint64 firstFreeSector = empty_space_size MiB / dev->logicalSectorSize() + 1;
qint64 firstFreeSector = empty_space_size MiB / dev->logicalSize() + 1;
if ( isEfi )
{
qint64 lastSector = firstFreeSector + ( uefisys_part_size MiB / dev->logicalSectorSize() );
qint64 lastSector = firstFreeSector + ( uefisys_part_size MiB / dev->logicalSize() );
core->createPartitionTable( dev, PartitionTable::gpt );
Partition* efiPartition = KPMHelpers::createNewPartition(
dev->partitionTable(),
@ -157,7 +157,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
}
bool shouldCreateSwap = false;
qint64 availableSpaceB = ( dev->totalSectors() - firstFreeSector ) * dev->logicalSectorSize();
qint64 availableSpaceB = ( dev->totalLogical() - firstFreeSector ) * dev->logicalSize();
qint64 suggestedSwapSizeB = swapSuggestion( availableSpaceB );
qint64 requiredSpaceB =
( Calamares::JobQueue::instance()->
@ -168,10 +168,10 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
// If there is enough room for ESP + root + swap, create swap, otherwise don't.
shouldCreateSwap = availableSpaceB > requiredSpaceB;
qint64 lastSectorForRoot = dev->totalSectors() - 1; //last sector of the device
qint64 lastSectorForRoot = dev->totalLogical() - 1; //last sector of the device
if ( shouldCreateSwap )
{
lastSectorForRoot -= suggestedSwapSizeB / dev->logicalSectorSize() + 1;
lastSectorForRoot -= suggestedSwapSizeB / dev->logicalSize() + 1;
}
Partition* rootPartition = nullptr;
@ -213,7 +213,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
PartitionRole( PartitionRole::Primary ),
FileSystem::LinuxSwap,
lastSectorForRoot + 1,
dev->totalSectors() - 1
dev->totalLogical() - 1
);
}
else
@ -224,7 +224,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
PartitionRole( PartitionRole::Primary ),
FileSystem::LinuxSwap,
lastSectorForRoot + 1,
dev->totalSectors() - 1,
dev->totalLogical() - 1,
luksPassphrase
);
}

View File

@ -97,6 +97,7 @@ isIso9660( const Device* device )
PartitionCoreModule::DeviceInfo::DeviceInfo( Device* _device )
: device( _device )
, partitionModel( new PartitionModel )
, immutableDevice( new Device( *_device ) )
{}
PartitionCoreModule::DeviceInfo::~DeviceInfo()
@ -235,7 +236,7 @@ PartitionCoreModule::bootLoaderModel() const
}
PartitionModel*
PartitionCoreModule::partitionModelForDevice( Device* device ) const
PartitionCoreModule::partitionModelForDevice( const Device* device ) const
{
DeviceInfo* info = infoForDevice( device );
Q_ASSERT( info );
@ -244,14 +245,14 @@ PartitionCoreModule::partitionModelForDevice( Device* device ) const
Device*
PartitionCoreModule::createImmutableDeviceCopy( Device* device )
PartitionCoreModule::immutableDeviceCopy( const Device* device )
{
CoreBackend* backend = CoreBackendManager::self()->backend();
Q_ASSERT( device );
DeviceInfo* info = infoForDevice( device );
if ( !info )
return nullptr;
QString node = device->deviceNode();
cDebug() << "Creating immutable copy for node:" << node;
Device* deviceBefore = backend->scanDevice( node );
return deviceBefore;
return info->immutableDevice.data();
}
@ -440,6 +441,7 @@ PartitionCoreModule::jobs() const
lst << info->jobs;
devices << info->device.data();
}
cDebug() << "Creating FillGlobalStorageJob with bootLoader path" << m_bootLoaderInstallPath;
lst << Calamares::job_ptr( new FillGlobalStorageJob( devices, m_bootLoaderInstallPath ) );
@ -566,12 +568,15 @@ PartitionCoreModule::scanForEfiSystemPartitions()
}
PartitionCoreModule::DeviceInfo*
PartitionCoreModule::infoForDevice( Device* device ) const
PartitionCoreModule::infoForDevice( const Device* device ) const
{
for ( auto deviceInfo : m_deviceInfos )
for ( auto it = m_deviceInfos.constBegin();
it != m_deviceInfos.constEnd(); ++it )
{
if ( deviceInfo->device.data() == device )
return deviceInfo;
if ( ( *it )->device.data() == device )
return *it;
if ( ( *it )->immutableDevice.data() == device )
return *it;
}
return nullptr;
}
@ -592,6 +597,7 @@ PartitionCoreModule::findPartitionByMountPoint( const QString& mountPoint ) cons
void
PartitionCoreModule::setBootLoaderInstallPath( const QString& path )
{
cDebug() << "PCM::setBootLoaderInstallPath" << path;
m_bootLoaderInstallPath = path;
}
@ -681,7 +687,6 @@ QList< PartitionCoreModule::SummaryInfo >
PartitionCoreModule::createSummaryInfo() const
{
QList< SummaryInfo > lst;
CoreBackend* backend = CoreBackendManager::self()->backend();
for ( auto deviceInfo : m_deviceInfos )
{
if ( !deviceInfo->isDirty() )
@ -690,7 +695,7 @@ PartitionCoreModule::createSummaryInfo() const
summaryInfo.deviceName = deviceInfo->device->name();
summaryInfo.deviceNode = deviceInfo->device->deviceNode();
Device* deviceBefore = backend->scanDevice( deviceInfo->device->deviceNode() );
Device* deviceBefore = deviceInfo->immutableDevice.data();
summaryInfo.partitionModelBefore = new PartitionModel;
summaryInfo.partitionModelBefore->init( deviceBefore, m_osproberLines );
// Make deviceBefore a child of partitionModelBefore so that it is not

View File

@ -68,7 +68,7 @@ public:
DeviceModel* deviceModel() const;
PartitionModel* partitionModelForDevice( Device* device ) const;
PartitionModel* partitionModelForDevice( const Device* device ) const;
//HACK: all devices change over time, and together make up the state of the CoreModule.
// However this makes it hard to show the *original* state of a device.
@ -77,7 +77,7 @@ public:
// This should probably be redone some other way.
// -- Teo 4/2015
//FIXME: make this horrible method private. -- Teo 12/2015
static Device* createImmutableDeviceCopy( Device* device );
Device* immutableDeviceCopy( const Device* device );
QAbstractItemModel* bootLoaderModel() const;
@ -147,6 +147,7 @@ private:
~DeviceInfo();
QScopedPointer< Device > device;
QScopedPointer< PartitionModel > partitionModel;
const QScopedPointer< Device > immutableDevice;
QList< Calamares::job_ptr > jobs;
void forgetChanges();
@ -166,7 +167,7 @@ private:
void updateIsDirty();
void scanForEfiSystemPartitions();
DeviceInfo* infoForDevice( Device* ) const;
DeviceInfo* infoForDevice( const Device* ) const;
OsproberEntryList m_osproberLines;

View File

@ -83,6 +83,7 @@ PartitionIterator::operator!=( const PartitionIterator& other ) const
PartitionIterator
PartitionIterator::begin( Device* device )
{
Q_ASSERT(device);
PartitionTable* table = device->partitionTable();
if ( !table )
return PartitionIterator( nullptr );

View File

@ -148,7 +148,7 @@ PartitionModel::data( const QModelIndex& index, int role ) const
return PartitionInfo::mountPoint( partition );
if ( col == SizeColumn )
{
qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize();
qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSize();
return KFormat().formatByteSize( size );
}
cDebug() << "Unknown column" << col;
@ -175,12 +175,12 @@ PartitionModel::data( const QModelIndex& index, int role ) const
}
}
QString prettyFileSystem = KPMHelpers::prettyNameForFileSystemType( partition->fileSystem().type() );
qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize();
qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSize();
QString prettySize = KFormat().formatByteSize( size );
return QVariant(name + " " + prettyFileSystem + " " + prettySize);
}
case SizeRole:
return ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize();
return ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSize();
case IsFreeSpaceRole:
return KPMHelpers::isPartitionFreeSpace( partition );

View File

@ -594,7 +594,7 @@ ChoicePage::doAlongsideApply()
qint64 oldLastSector = candidate->lastSector();
qint64 newLastSector = firstSector +
m_afterPartitionSplitterWidget->splitPartitionSize() /
dev->logicalSectorSize();
dev->logicalSize();
m_core->resizePartition( dev, candidate, firstSector, newLastSector );
Partition* newPartition = nullptr;
@ -817,7 +817,7 @@ ChoicePage::updateDeviceStatePreview()
m_beforePartitionLabelsView = new PartitionLabelsView( m_previewBeforeFrame );
m_beforePartitionLabelsView->setExtendedPartitionHidden( mode == PartitionBarsView::NoNestedPartitions );
Device* deviceBefore = m_core->createImmutableDeviceCopy( currentDevice );
Device* deviceBefore = m_core->immutableDeviceCopy( currentDevice );
PartitionModel* model = new PartitionModel( m_beforePartitionBarsView );
model->init( deviceBefore, m_core->osproberEntries() );
@ -1106,7 +1106,7 @@ ChoicePage::createBootloaderComboBox( QWidget* parent )
// When the chosen bootloader device changes, we update the choice in the PCM
connect( bcb, static_cast< void (QComboBox::*)(int) >( &QComboBox::currentIndexChanged ),
[this]( int newIndex )
this, [this]( int newIndex )
{
QComboBox* bcb = qobject_cast< QComboBox* >( sender() );
if ( bcb )

View File

@ -40,8 +40,9 @@
// Qt
#include <QComboBox>
#include <QDir>
#include <QSet>
#include <QListWidgetItem>
#include <QPushButton>
#include <QSet>
static QSet< FileSystem::Type > s_unmountableFS(
{
@ -52,12 +53,13 @@ static QSet< FileSystem::Type > s_unmountableFS(
FileSystem::Lvm2_PV
} );
CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* parentPartition, QWidget* parentWidget )
CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* parentPartition, const QStringList& usedMountPoints, QWidget* parentWidget )
: QDialog( parentWidget )
, m_ui( new Ui_CreatePartitionDialog )
, m_partitionSizeController( new PartitionSizeController( this ) )
, m_device( device )
, m_parent( parentPartition )
, m_usedMountPoints( usedMountPoints )
{
m_ui->setupUi( this );
m_ui->encryptWidget->setText( tr( "En&crypt" ) );
@ -101,11 +103,15 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* par
connect( m_ui->fsComboBox, SIGNAL( activated( int ) ), SLOT( updateMountPointUi() ) );
connect( m_ui->extendedRadioButton, SIGNAL( toggled( bool ) ), SLOT( updateMountPointUi() ) );
connect( m_ui->mountPointComboBox, &QComboBox::currentTextChanged, this, &CreatePartitionDialog::checkMountPointSelection );
// Select a default
m_ui->fsComboBox->setCurrentIndex( defaultFsIndex );
updateMountPointUi();
setupFlagsList();
// Checks the initial selection.
checkMountPointSelection();
}
CreatePartitionDialog::~CreatePartitionDialog()
@ -252,6 +258,20 @@ CreatePartitionDialog::updateMountPointUi()
m_ui->mountPointComboBox->setCurrentText( QString() );
}
void
CreatePartitionDialog::checkMountPointSelection()
{
const QString& selection = m_ui->mountPointComboBox->currentText();
if (m_usedMountPoints.contains(selection)) {
m_ui->labelMountPoint->setText("Mountpoint already in use. Please select another one.");
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
} else {
m_ui->labelMountPoint->setText( QString() );
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
}
}
void
CreatePartitionDialog::initPartResizerWidget( Partition* partition )
{

View File

@ -42,7 +42,7 @@ class CreatePartitionDialog : public QDialog
{
Q_OBJECT
public:
CreatePartitionDialog( Device* device, PartitionNode* parentPartition, QWidget* parentWidget = nullptr );
CreatePartitionDialog( Device* device, PartitionNode* parentPartition, const QStringList& usedMountPoints, QWidget* parentWidget = nullptr );
~CreatePartitionDialog();
/**
@ -61,6 +61,7 @@ public:
private Q_SLOTS:
void updateMountPointUi();
void checkMountPointSelection();
private:
void setupFlagsList();
@ -69,6 +70,7 @@ private:
Device* m_device;
PartitionNode* m_parent;
PartitionRole m_role = PartitionRole( PartitionRole::None );
QStringList m_usedMountPoints;
void initGptPartitionTypeUi();
void initMbrPartitionTypeUi();

View File

@ -108,7 +108,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>12</height>
<height>13</height>
</size>
</property>
</spacer>
@ -126,6 +126,9 @@
<item row="3" column="1">
<widget class="QComboBox" name="fsComboBox"/>
</item>
<item row="4" column="1">
<widget class="EncryptWidget" name="encryptWidget" native="true"/>
</item>
<item row="5" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
@ -162,14 +165,26 @@
</property>
</widget>
</item>
<item row="7" column="0">
<item row="7" column="1">
<widget class="QLabel" name="labelMountPoint">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Flags:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="QListWidget" name="m_listFlags">
<property name="alternatingRowColors">
<bool>true</bool>
@ -182,7 +197,7 @@
</property>
</widget>
</item>
<item row="8" column="0">
<item row="9" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -195,9 +210,6 @@
</property>
</spacer>
</item>
<item row="4" column="1">
<widget class="EncryptWidget" name="encryptWidget" native="true"/>
</item>
</layout>
</item>
<item>

View File

@ -43,13 +43,15 @@
// Qt
#include <QComboBox>
#include <QDir>
#include <QPushButton>
EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partition* partition, QWidget* parentWidget )
EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partition* partition, const QStringList& usedMountPoints, QWidget* parentWidget )
: QDialog( parentWidget )
, m_ui( new Ui_EditExistingPartitionDialog )
, m_device( device )
, m_partition( partition )
, m_partitionSizeController( new PartitionSizeController( this ) )
, m_usedMountPoints( usedMountPoints )
{
m_ui->setupUi( this );
@ -65,6 +67,7 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partit
m_partitionSizeController->setSpinBox( m_ui->sizeSpinBox );
m_ui->mountPointComboBox->setCurrentText( PartitionInfo::mountPoint( partition ) );
connect( m_ui->mountPointComboBox, &QComboBox::currentTextChanged, this, &EditExistingPartitionDialog::checkMountPointSelection );
replacePartResizerWidget();
@ -291,3 +294,17 @@ EditExistingPartitionDialog::updateMountPointPicker()
if ( !canMount )
m_ui->mountPointComboBox->setCurrentText( QString() );
}
void
EditExistingPartitionDialog::checkMountPointSelection()
{
const QString& selection = m_ui->mountPointComboBox->currentText();
if (m_usedMountPoints.contains(selection)) {
m_ui->labelMountPoint->setText("Mountpoint already in use. Please select another one.");
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
} else {
m_ui->labelMountPoint->setText( QString() );
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
}
}

View File

@ -40,16 +40,20 @@ class EditExistingPartitionDialog : public QDialog
{
Q_OBJECT
public:
EditExistingPartitionDialog( Device* device, Partition* partition, QWidget* parentWidget = nullptr );
EditExistingPartitionDialog( Device* device, Partition* partition, const QStringList& usedMountPoints, QWidget* parentWidget = nullptr );
~EditExistingPartitionDialog();
void applyChanges( PartitionCoreModule* module );
private slots:
void checkMountPointSelection();
private:
QScopedPointer< Ui_EditExistingPartitionDialog > m_ui;
Device* m_device;
Partition* m_partition;
PartitionSizeController* m_partitionSizeController;
QStringList m_usedMountPoints;
PartitionTable::Flags newFlags() const;
void setupFlagsList();

View File

@ -139,14 +139,14 @@
<item row="5" column="1">
<widget class="QComboBox" name="fileSystemComboBox"/>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Flags:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="QListWidget" name="m_listFlags">
<property name="alternatingRowColors">
<bool>true</bool>
@ -159,6 +159,18 @@
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLabel" name="labelMountPoint">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>

View File

@ -47,7 +47,7 @@ QStringList
buildUnknownDisklabelTexts( Device* dev )
{
QStringList texts = { QObject::tr( "Unpartitioned space or unknown partition table" ),
KFormat().formatByteSize( dev->totalSectors() * dev->logicalSectorSize() ) };
KFormat().formatByteSize( dev->totalLogical() * dev->logicalSize() ) };
return texts;
}

View File

@ -23,6 +23,7 @@
#include "core/BootLoaderModel.h"
#include "core/DeviceModel.h"
#include "core/PartitionCoreModule.h"
#include "core/PartitionInfo.h"
#include "core/PartitionModel.h"
#include "core/KPMHelpers.h"
#include "gui/CreatePartitionDialog.h"
@ -176,7 +177,7 @@ PartitionPage::onCreateClicked()
Partition* partition = model->partitionForIndex( index );
Q_ASSERT( partition );
QPointer<CreatePartitionDialog> dlg = new CreatePartitionDialog( model->device(), partition->parent(), this );
QPointer<CreatePartitionDialog> dlg = new CreatePartitionDialog( model->device(), partition->parent(), getCurrentUsedMountpoints(), this );
dlg->initFromFreeSpace( partition );
if ( dlg->exec() == QDialog::Accepted )
{
@ -265,7 +266,10 @@ PartitionPage::onPartitionViewActivated()
void
PartitionPage::updatePartitionToCreate( Device* device, Partition* partition )
{
QPointer<CreatePartitionDialog> dlg = new CreatePartitionDialog( device, partition->parent(), this );
QStringList mountPoints = getCurrentUsedMountpoints();
mountPoints.removeOne( PartitionInfo::mountPoint( partition ) );
QPointer<CreatePartitionDialog> dlg = new CreatePartitionDialog( device, partition->parent(), mountPoints, this );
dlg->initFromPartitionToCreate( partition );
if ( dlg->exec() == QDialog::Accepted )
{
@ -279,7 +283,10 @@ PartitionPage::updatePartitionToCreate( Device* device, Partition* partition )
void
PartitionPage::editExistingPartition( Device* device, Partition* partition )
{
QPointer<EditExistingPartitionDialog> dlg = new EditExistingPartitionDialog( device, partition, this );
QStringList mountPoints = getCurrentUsedMountpoints();
mountPoints.removeOne( PartitionInfo::mountPoint( partition ) );
QPointer<EditExistingPartitionDialog> dlg = new EditExistingPartitionDialog( device, partition, mountPoints, this );
if ( dlg->exec() == QDialog::Accepted )
dlg->applyChanges( m_core );
delete dlg;
@ -291,6 +298,7 @@ PartitionPage::updateBootLoaderInstallPath()
QVariant var = m_ui->bootLoaderComboBox->currentData( BootLoaderModel::BootLoaderPathRole );
if ( !var.isValid() )
return;
qDebug() << "PartitionPage::updateBootLoaderInstallPath" << var.toString();
m_core->setBootLoaderInstallPath( var.toString() );
}
@ -375,3 +383,24 @@ PartitionPage::updateBootLoaderIndex()
m_ui->bootLoaderComboBox->setCurrentIndex( m_lastSelectedBootLoaderIndex );
}
}
QStringList
PartitionPage::getCurrentUsedMountpoints()
{
QModelIndex index = m_core->deviceModel()->index( m_ui->deviceComboBox->currentIndex(), 0 );
if ( !index.isValid() )
return QStringList();
Device* device = m_core->deviceModel()->deviceForIndex( index );
QStringList mountPoints;
for (Partition* partition : device->partitionTable()->children()) {
const QString& mountPoint = PartitionInfo::mountPoint( partition );
if (!mountPoint.isEmpty()) {
mountPoints << mountPoint;
}
}
return mountPoints;
}

View File

@ -62,6 +62,8 @@ private:
void updateFromCurrentDevice();
void updateBootLoaderIndex();
QStringList getCurrentUsedMountpoints();
QMutex m_revertMutex;
int m_lastSelectedBootLoaderIndex;
};

View File

@ -135,7 +135,7 @@ PartitionSizeController::updatePartResizerWidget()
return;
m_updating = true;
qint64 sectorSize = qint64( m_spinBox->value() ) * 1024 * 1024 / m_device->logicalSectorSize();
qint64 sectorSize = qint64( m_spinBox->value() ) * 1024 * 1024 / m_device->logicalSize();
qint64 firstSector = m_partition->firstSector();
qint64 lastSector = firstSector + sectorSize - 1;
@ -185,7 +185,7 @@ PartitionSizeController::doUpdateSpinBox()
{
if ( !m_spinBox )
return;
qint64 mbSize = m_partition->length() * m_device->logicalSectorSize() / 1024 / 1024;
qint64 mbSize = m_partition->length() * m_device->logicalSize() / 1024 / 1024;
m_spinBox->setValue( mbSize );
if ( m_currentSpinBoxValue != -1 && //if it's not the first time we're setting it
m_currentSpinBoxValue != mbSize ) //and the operation changes the SB value

View File

@ -1,7 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
* Copyright 2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2015-2016, 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
@ -86,10 +86,13 @@ mapForPartition( Partition* partition, const QString& uuid )
map[ "device" ] = partition->partitionPath();
map[ "mountPoint" ] = PartitionInfo::mountPoint( partition );
map[ "fs" ] = partition->fileSystem().name();
if ( partition->fileSystem().type() == FileSystem::Luks &&
dynamic_cast< FS::luks& >( partition->fileSystem() ).innerFS() )
map[ "fs" ] = dynamic_cast< FS::luks& >( partition->fileSystem() ).innerFS()->name();
map[ "uuid" ] = uuid;
cDebug() << partition->partitionPath()
<< "mtpoint:" << PartitionInfo::mountPoint( partition )
<< "fs:" << partition->fileSystem().name()
<< "fs:" << map[ "fs" ]
<< uuid;
if ( partition->roles().has( PartitionRole::Luks ) )
@ -98,7 +101,7 @@ mapForPartition( Partition* partition, const QString& uuid )
const FS::luks* luksFs = dynamic_cast< const FS::luks* >( &fsRef );
if ( luksFs )
{
map[ "luksMapperName" ] = luksFs->mapperName( partition->partitionPath() ).split( "/" ).last();
map[ "luksMapperName" ] = luksFs->mapperName().split( "/" ).last();
map[ "luksUuid" ] = getLuksUuid( partition->partitionPath() );
map[ "luksPassphrase" ] = luksFs->passphrase();
cDebug() << "luksMapperName:" << map[ "luksMapperName" ];
@ -195,10 +198,12 @@ FillGlobalStorageJob::exec()
QVariant var = createBootLoaderMap();
if ( !var.isValid() )
cDebug() << "Failed to find path for boot loader";
cDebug() << "FillGlobalStorageJob writing bootLoader path:" << var;
storage->insert( "bootLoader", var );
}
else
{
cDebug() << "FillGlobalStorageJob writing empty bootLoader value";
storage->insert( "bootLoader", QVariant() );
}
return Calamares::JobResult::ok();

View File

@ -93,7 +93,7 @@ public:
break;
case FileSystem::cmdSupportFileSystem:
{
qint64 byteLength = m_device->logicalSectorSize() * m_length;
qint64 byteLength = m_device->logicalSize() * m_length;
bool ok = fs.resize( report, m_partition->partitionPath(), byteLength );
if ( !ok )
return Calamares::JobResult::error(

View File

@ -44,7 +44,15 @@ SetPartFlagsJob::SetPartFlagsJob( Device* device,
QString
SetPartFlagsJob::prettyName() const
{
return tr( "Set flags on partition %1." ).arg( partition()->partitionPath() );
if ( !partition()->partitionPath().isEmpty() )
return tr( "Set flags on partition %1." ).arg( partition()->partitionPath() );
if ( !partition()->fileSystem().name().isEmpty() )
return tr( "Set flags on %1MB %2 partition." )
.arg( partition()->capacity() /1024 /1024)
.arg( partition()->fileSystem().name() );
return tr( "Set flags on new partition." );
}
@ -53,13 +61,34 @@ SetPartFlagsJob::prettyDescription() const
{
QStringList flagsList = PartitionTable::flagNames( m_flags );
if ( flagsList.count() == 0 )
return tr( "Clear flags on partition <strong>%1</strong>." )
.arg( partition()->partitionPath() );
{
if ( !partition()->partitionPath().isEmpty() )
return tr( "Clear flags on partition <strong>%1</strong>." )
.arg( partition()->partitionPath() );
return tr( "Flag partition <strong>%1</strong> as "
"<strong>%2</strong>." )
.arg( partition()->partitionPath() )
.arg( flagsList.join( ", " ) );
if ( !partition()->fileSystem().name().isEmpty() )
return tr( "Clear flags on %1MB <strong>%2</strong> partition." )
.arg( partition()->capacity() /1024 /1024)
.arg( partition()->fileSystem().name() );
return tr( "Clear flags on new partition." );
}
if ( !partition()->partitionPath().isEmpty() )
return tr( "Flag partition <strong>%1</strong> as "
"<strong>%2</strong>." )
.arg( partition()->partitionPath() )
.arg( flagsList.join( ", " ) );
if ( !partition()->fileSystem().name().isEmpty() )
return tr( "Flag %1MB <strong>%2</strong> partition as "
"<strong>%3</strong>." )
.arg( partition()->capacity() /1024 /1024)
.arg( partition()->fileSystem().name() )
.arg( flagsList.join( ", " ) );
return tr( "Flag new partition as <strong>%1</strong>." )
.arg( flagsList.join( ", " ) );
}
@ -68,13 +97,34 @@ SetPartFlagsJob::prettyStatusMessage() const
{
QStringList flagsList = PartitionTable::flagNames( m_flags );
if ( flagsList.count() == 0 )
return tr( "Clearing flags on partition <strong>%1</strong>." )
.arg( partition()->partitionPath() );
{
if ( !partition()->partitionPath().isEmpty() )
return tr( "Clearing flags on partition <strong>%1</strong>." )
.arg( partition()->partitionPath() );
return tr( "Setting flags <strong>%2</strong> on partition "
"<strong>%1</strong>." )
.arg( partition()->partitionPath() )
.arg( flagsList.join( ", " ) );
if ( !partition()->fileSystem().name().isEmpty() )
return tr( "Clearing flags on %1MB <strong>%2</strong> partition." )
.arg( partition()->capacity() /1024 /1024)
.arg( partition()->fileSystem().name() );
return tr( "Clearing flags on new partition." );
}
if ( !partition()->partitionPath().isEmpty() )
return tr( "Setting flags <strong>%2</strong> on partition "
"<strong>%1</strong>." )
.arg( partition()->partitionPath() )
.arg( flagsList.join( ", " ) );
if ( !partition()->fileSystem().name().isEmpty() )
return tr( "Setting flags <strong>%3</strong> on "
"%1MB <strong>%2</strong> partition." )
.arg( partition()->capacity() /1024 /1024)
.arg( partition()->fileSystem().name() )
.arg( flagsList.join( ", " ) );
return tr( "Setting flags <strong>%1</strong> on new partition." )
.arg( flagsList.join( ", " ) );
}

View File

@ -15,3 +15,6 @@ targets:
disable:
- name: "pacman-init"
mandatory: false
# Example to express an empty list:
# disable: []

View File

@ -6,7 +6,7 @@ calamares_add_plugin( summary
SummaryViewStep.cpp
SummaryPage.cpp
UI
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
calamaresui
SHARED_LIB
)

View File

@ -19,7 +19,7 @@ calamares_add_plugin( users
gui/adduserdialog.ui
RESOURCES
users.qrc
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
calamaresui
${CRYPT_LIBRARIES}
SHARED_LIB

View File

@ -12,5 +12,4 @@ The following settings are available in **users.conf**:
- ```sudoersGroup```: group for sudoers usage.
- ```setRootPassword```: allow to set the root password in the installed system. Defaults to false.
- ```availableShells```: comma-separated list of available shells for new users. If not present, new users will not have any explicit shell in /etc/passwd, therefore the system default (usually, /bin/bash) will be used.
- ```avatarFilePath```: path where to copy user avatars to; ~ can be used to represent the user's home directory. If not present or empty, we won't allow users to set avatars.
- ```avatarFilePath```: path where to copy the user avatar to, including the target file name; ~ can be used to represent the user's home directory; $HOME or other environment variables are not currently supported. If a path is not present or empty, we won't allow users to set avatars.

View File

@ -22,6 +22,7 @@
#include "JobQueue.h"
#include "GlobalStorage.h"
#include "utils/Logger.h"
CALAMARES_PLUGIN_FACTORY_DEFINITION( UsersViewStepFactory, registerPlugin<UsersViewStep>(); )
@ -161,9 +162,14 @@ UsersViewStep::setConfigurationMap( const QVariantMap& configurationMap )
}
if ( configurationMap.contains( "availableShells" ) &&
configurationMap.value( "availableShells" ).type() == QVariant::List )
configurationMap.value( "availableShells" ).type() == QVariant::String )
{
m_widget->setAvailableShells( configurationMap.value( "availableShells" ).toStringList() );
QStringList shells;
for (QString& shell : configurationMap.value( "availableShells" ).toString().split(",")) {
shells.append( shell.trimmed() );
}
m_widget->setAvailableShells(shells);
}
if ( configurationMap.contains( "avatarFilePath" ) &&

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>712</width>
<height>383</height>
<height>388</height>
</rect>
</property>
<property name="sizePolicy">
@ -376,6 +376,12 @@ as the Administrator password</string>
<tabstop>userNameLine</tabstop>
<tabstop>passLine</tabstop>
<tabstop>confirmPassLine</tabstop>
<tabstop>nameLine</tabstop>
<tabstop>autoLoginCheckBox</tabstop>
<tabstop>rootUsesUserPwCheckBox</tabstop>
<tabstop>loginShellSelection</tabstop>
<tabstop>selectImageButton</tabstop>
<tabstop>avatarFileLine</tabstop>
</tabstops>
<resources/>
<connections/>

View File

@ -44,7 +44,7 @@ calamares_add_plugin( webview
EXPORT_MACRO PLUGINDLLEXPORT_PRO
SOURCES
WebViewStep.cpp
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
${CALA_WEBVIEW_LINK_LIBRARIES}
SHARED_LIB
)

View File

@ -25,6 +25,7 @@
#include <QWebView>
#else
#include <QWebEngineView>
#include <QtWebEngine>
#endif
CALAMARES_PLUGIN_FACTORY_DEFINITION( WebViewStepFactory, registerPlugin<WebViewStep>(); )
@ -33,6 +34,9 @@ WebViewStep::WebViewStep( QObject* parent )
: Calamares::ViewStep( parent )
{
emit nextStatusChanged( true );
#ifdef WEBVIEW_WITH_WEBENGINE
QtWebEngine::initialize();
#endif
m_view = new C_QWEBVIEW();
#ifdef WEBVIEW_WITH_WEBKIT
m_view->settings()->setFontFamily( QWebSettings::StandardFont,

View File

@ -26,7 +26,7 @@ calamares_add_plugin( welcome
WelcomePage.cpp
UI
WelcomePage.ui
LINK_LIBRARIES
LINK_PRIVATE_LIBRARIES
calamaresui
${CHECKER_LINK_LIBRARIES}
SHARED_LIB

View File

@ -338,7 +338,9 @@ bool
RequirementsChecker::checkHasInternet()
{
// default to true in the QNetworkAccessManager::UnknownAccessibility case
return QNetworkAccessManager(this).networkAccessible() != QNetworkAccessManager::NotAccessible;
bool hasInternet = QNetworkAccessManager(this).networkAccessible() != QNetworkAccessManager::NotAccessible;
Calamares::JobQueue::instance()->globalStorage()->insert( "hasInternet", hasInternet );
return hasInternet;
}