From 360a114ed43678695f7ab829cd00c1db7e8e9cc1 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 5 Sep 2017 03:36:03 -0400 Subject: [PATCH 1/4] Be more explicit on why a device is winnowed from the list --- src/modules/partition/core/DeviceList.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/modules/partition/core/DeviceList.cpp b/src/modules/partition/core/DeviceList.cpp index 055c18dbc..05616335b 100644 --- a/src/modules/partition/core/DeviceList.cpp +++ b/src/modules/partition/core/DeviceList.cpp @@ -137,12 +137,14 @@ QList< Device* > getDevices( DeviceType which, qint64 minimumSize ) it = erase(devices, it ); } - else if ( writableOnly && ( - hasRootPartition( *it ) || - isIso9660( *it ) ) - ) + else if ( writableOnly && hasRootPartition( *it ) ) { - cDebug() << " .. Removing root-or-CD" << it; + cDebug() << " .. Removing device with root filesystem (/) on it" << it; + it = erase(devices, it ); + } + else if ( writableOnly && isIso9660( *it ) ) + { + cDebug() << " .. Removing device with iso9660 filesystem (probably a CD) on it" << it; it = erase(devices, it ); } else if ( (minimumSize >= 0) && !( (*it)->capacity() > minimumSize ) ) From ec265c073ac3080cfc7007b9fbf53346ec794e06 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 5 Sep 2017 03:39:34 -0400 Subject: [PATCH 2/4] One more have_dracut check (thanks to @crazy) --- src/modules/grubcfg/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/grubcfg/main.py b/src/modules/grubcfg/main.py index 8acacbb72..5b1028c58 100644 --- a/src/modules/grubcfg/main.py +++ b/src/modules/grubcfg/main.py @@ -91,7 +91,7 @@ def modify_grub_default(partitions, root_mount_point, distributor): if swap_uuid: kernel_params.append("resume=UUID={!s}".format(swap_uuid)) - if dracut_bin == 0 and swap_outer_uuid: + if have_dracut and swap_outer_uuid: kernel_params.append("rd.luks.uuid={!s}".format(swap_outer_uuid)) distributor_line = "GRUB_DISTRIBUTOR='{!s}'".format(distributor_replace) From 1859808227563619c23f69c1fbc86393e114d46e Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 5 Sep 2017 03:50:08 -0400 Subject: [PATCH 3/4] Move development-related scripts, tools, into ci/ --- HACKING.md => ci/HACKING.md | 0 {hacking => ci}/RELEASE.md | 0 {hacking => ci}/astylerc | 0 {hacking => ci}/calamaresstyle | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename HACKING.md => ci/HACKING.md (100%) rename {hacking => ci}/RELEASE.md (100%) rename {hacking => ci}/astylerc (100%) rename {hacking => ci}/calamaresstyle (100%) diff --git a/HACKING.md b/ci/HACKING.md similarity index 100% rename from HACKING.md rename to ci/HACKING.md diff --git a/hacking/RELEASE.md b/ci/RELEASE.md similarity index 100% rename from hacking/RELEASE.md rename to ci/RELEASE.md diff --git a/hacking/astylerc b/ci/astylerc similarity index 100% rename from hacking/astylerc rename to ci/astylerc diff --git a/hacking/calamaresstyle b/ci/calamaresstyle similarity index 100% rename from hacking/calamaresstyle rename to ci/calamaresstyle From 73a75e837b69b0525076dcbdc63a4115b909ca47 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 5 Sep 2017 08:18:23 -0400 Subject: [PATCH 4/4] Auto-resize the main window. If the summary widget is large, it gets a scrollbar. This looks really weird, so prefer to grow the installer window instead. Discussed with @sitter and settled on this solution. ViewSteps can signal the ViewManager that they need more space (in pixels), which may or may not be honored. FIXES #778 --- src/calamares/CalamaresWindow.cpp | 17 ++++++++++++++--- src/calamares/CalamaresWindow.h | 9 +++++++++ src/libcalamaresui/ViewManager.cpp | 23 +++++++---------------- src/libcalamaresui/ViewManager.h | 2 ++ src/libcalamaresui/viewpages/ViewStep.h | 12 +++++++++++- src/modules/summary/SummaryPage.cpp | 17 ++++++++++++++++- 6 files changed, 59 insertions(+), 21 deletions(-) diff --git a/src/calamares/CalamaresWindow.cpp b/src/calamares/CalamaresWindow.cpp index 260d56139..eb3289083 100644 --- a/src/calamares/CalamaresWindow.cpp +++ b/src/calamares/CalamaresWindow.cpp @@ -55,7 +55,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent ) cDebug() << "Available size" << availableSize; - if ( (availableSize.width() < windowPreferredWidth) || (availableSize.height() < windowPreferredHeight) ) + if ( ( availableSize.width() < windowPreferredWidth ) || ( availableSize.height() < windowPreferredHeight ) ) cDebug() << " Small screen detected."; QSize minimumSize( qBound( windowMinimumWidth, availableSize.width(), windowPreferredWidth ), qBound( windowMinimumHeight, availableSize.height(), windowPreferredHeight ) ); @@ -131,9 +131,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent ) else { if ( m_debugWindow ) - { m_debugWindow->deleteLater(); - } } } ); } @@ -142,6 +140,19 @@ CalamaresWindow::CalamaresWindow( QWidget* parent ) CalamaresUtils::unmarginLayout( mainLayout ); Calamares::ViewManager* vm = Calamares::ViewManager::instance( this ); + connect( vm, &Calamares::ViewManager::enlarge, this, &CalamaresWindow::enlarge ); mainLayout->addWidget( vm->centralWidget() ); } + +void +CalamaresWindow::enlarge( QSize enlarge ) +{ + auto mainGeometry = this->geometry(); + QSize availableSize = qApp->desktop()->availableGeometry( this ).size(); + + auto h = qBound( 0, mainGeometry.height() + enlarge.height(), availableSize.height() ); + auto w = this->size().width(); + + resize( w, h ); +} diff --git a/src/calamares/CalamaresWindow.h b/src/calamares/CalamaresWindow.h index 7b2cfa6fa..00f790f5a 100644 --- a/src/calamares/CalamaresWindow.h +++ b/src/calamares/CalamaresWindow.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * * Copyright 2014-2015, Teo Mrnjavac + * Copyright 2017, Adriaan de Groot * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,6 +38,14 @@ public: CalamaresWindow( QWidget* parent = nullptr ); virtual ~CalamaresWindow() {} +public slots: + /** + * This asks the main window to grow by @p enlarge pixels, to accomodate + * larger-than-expected window contents. The enlargement may be silently + * ignored. + */ + void enlarge( QSize enlarge ); + private: QPointer< Calamares::DebugWindow > m_debugWindow; }; diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index 4a8b7acf5..7b5df155b 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -109,9 +109,7 @@ ViewManager::ViewManager( QObject* parent ) qApp->quit(); } else // Means we're at the end, no need to confirm. - { qApp->quit(); - } } ); connect( JobQueue::instance(), &JobQueue::failed, @@ -145,16 +143,15 @@ ViewManager::addViewStep( ViewStep* step ) void -ViewManager::insertViewStep( int before, ViewStep* step) +ViewManager::insertViewStep( int before, ViewStep* step ) { m_steps.insert( before, step ); QLayout* layout = step->widget()->layout(); if ( layout ) - { layout->setContentsMargins( 0, 0, 0, 0 ); - } m_stack->insertWidget( before, step->widget() ); + connect( step, &ViewStep::enlarge, this, &ViewManager::enlarge ); connect( step, &ViewStep::nextStatusChanged, this, [this]( bool status ) { @@ -180,19 +177,17 @@ ViewManager::onInstallationFailed( const QString& message, const QString& detail QMessageBox* msgBox = new QMessageBox(); msgBox->setIcon( QMessageBox::Critical ); - msgBox->setWindowTitle( tr("Error") ); + msgBox->setWindowTitle( tr( "Error" ) ); msgBox->setText( "" + tr( "Installation Failed" ) + "" ); msgBox->setStandardButtons( QMessageBox::Close ); msgBox->button( QMessageBox::Close )->setText( tr( "&Close" ) ); QString text = "

" + message + "

"; if ( !details.isEmpty() ) - { text += "

" + details + "

"; - } msgBox->setInformativeText( text ); - connect(msgBox, &QMessageBox::buttonClicked, qApp, &QApplication::quit); + connect( msgBox, &QMessageBox::buttonClicked, qApp, &QApplication::quit ); cLog() << "Calamares will quit when the dialog closes."; msgBox->show(); } @@ -230,8 +225,8 @@ ViewManager::next() // and right before switching to an execution phase. // Depending on Calamares::Settings, we show an "are you sure" prompt or not. if ( Calamares::Settings::instance()->showPromptBeforeExecution() && - m_currentStep + 1 < m_steps.count() && - qobject_cast< ExecutionViewStep* >( m_steps.at( m_currentStep + 1 ) ) ) + m_currentStep + 1 < m_steps.count() && + qobject_cast< ExecutionViewStep* >( m_steps.at( m_currentStep + 1 ) ) ) { int reply = QMessageBox::question( m_widget, @@ -263,15 +258,13 @@ ViewManager::next() } } else - { step->next(); - } m_next->setEnabled( !executing && m_steps.at( m_currentStep )->isNextEnabled() ); m_back->setEnabled( !executing && m_steps.at( m_currentStep )->isBackEnabled() ); if ( m_currentStep == m_steps.count() -1 && - m_steps.last()->isAtEnd() ) + m_steps.last()->isAtEnd() ) { m_quit->setText( tr( "&Done" ) ); m_quit->setToolTip( tr( "The installation is complete. Close the installer." ) ); @@ -292,9 +285,7 @@ ViewManager::back() emit currentStepChanged(); } else if ( !step->isAtBeginning() ) - { step->back(); - } else return; m_next->setEnabled( m_steps.at( m_currentStep )->isNextEnabled() ); diff --git a/src/libcalamaresui/ViewManager.h b/src/libcalamaresui/ViewManager.h index f2f0ca57a..38ddda70a 100644 --- a/src/libcalamaresui/ViewManager.h +++ b/src/libcalamaresui/ViewManager.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * * Copyright 2014-2015, Teo Mrnjavac + * Copyright 2017, Adriaan de Groot * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -111,6 +112,7 @@ public slots: signals: void currentStepChanged(); + void enlarge( QSize enlarge ) const; // See ViewStep::enlarge() private: explicit ViewManager( QObject* parent = nullptr ); diff --git a/src/libcalamaresui/viewpages/ViewStep.h b/src/libcalamaresui/viewpages/ViewStep.h index 27bab23c8..2c07dace5 100644 --- a/src/libcalamaresui/viewpages/ViewStep.h +++ b/src/libcalamaresui/viewpages/ViewStep.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * * Copyright 2014-2015, Teo Mrnjavac + * Copyright 2017, Adriaan de Groot * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -93,7 +94,10 @@ public: virtual QList< job_ptr > jobs() const = 0; void setModuleInstanceKey( const QString& instanceKey ); - QString moduleInstanceKey() const { return m_instanceKey; } + QString moduleInstanceKey() const + { + return m_instanceKey; + } virtual void setConfigurationMap( const QVariantMap& configurationMap ); @@ -101,6 +105,12 @@ signals: void nextStatusChanged( bool status ); void done(); + /* Emitted when the viewstep thinks it needs more space than is currently + * available for display. @p enlarge is the requested additional space, + * e.g. 24px vertical. This request may be silently ignored. + */ + void enlarge( QSize enlarge ) const; + protected: QString m_instanceKey; }; diff --git a/src/modules/summary/SummaryPage.cpp b/src/modules/summary/SummaryPage.cpp index 6d53ba8b6..c13ec1ccd 100644 --- a/src/modules/summary/SummaryPage.cpp +++ b/src/modules/summary/SummaryPage.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * * Copyright 2014-2015, Teo Mrnjavac + * Copyright 2017, Adriaan de Groot * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,6 +24,7 @@ #include "ExecutionViewStep.h" #include "utils/Retranslator.h" #include "utils/CalamaresUtilsGui.h" +#include "utils/Logger.h" #include "ViewManager.h" #include @@ -96,6 +98,20 @@ SummaryPage::onActivate() itemBodyLayout->addSpacing( CalamaresUtils::defaultFontHeight() * 2 ); } m_layout->addStretch(); + + m_scrollArea->setWidget( m_contentWidget ); + + auto summarySize = m_contentWidget->sizeHint(); + if ( summarySize.height() > m_scrollArea->size().height() ) + { + auto enlarge = 2 + summarySize.height() - m_scrollArea->size().height(); + auto widgetSize = this->size(); + widgetSize.setHeight( widgetSize.height() + enlarge ); + + cDebug() << "Summary widget is larger than viewport, enlarge by" << enlarge << "to" << widgetSize; + + emit m_thisViewStep->enlarge( QSize( 0, enlarge ) ); // Only expand height + } } Calamares::ViewStepList @@ -133,7 +149,6 @@ SummaryPage::createContentWidget() m_contentWidget = new QWidget; m_layout = new QVBoxLayout( m_contentWidget ); CalamaresUtils::unmarginLayout( m_layout ); - m_scrollArea->setWidget( m_contentWidget ); } QLabel*