From 249150dd1b25544423335a05e1416c32e98af231 Mon Sep 17 00:00:00 2001 From: demmm Date: Mon, 20 Apr 2020 15:00:04 +0200 Subject: [PATCH 1/5] [welcomeq] add language bar reads data from languagesModel correctly, debug added to see index changes code cleanup button layout improved install info text added, better spacing of text about button no longer commented out, 3 reasons: - info provided by any about is standard, will be odd if it can't be found - about.qml is a seperate file, can be completely adjusted - not showing it takes away the options for new QML cala users to see what is possible with Loader, thus stopping new possible contributors --- .../welcomeq/img/language-icon-48px.png | Bin 0 -> 2315 bytes src/modules/welcomeq/welcomeq.qml | 85 ++++++++++++------ src/modules/welcomeq/welcomeq.qrc | 1 + 3 files changed, 58 insertions(+), 28 deletions(-) create mode 100644 src/modules/welcomeq/img/language-icon-48px.png diff --git a/src/modules/welcomeq/img/language-icon-48px.png b/src/modules/welcomeq/img/language-icon-48px.png new file mode 100644 index 0000000000000000000000000000000000000000..4012a4bee05f8f3e38a6f9efe0ff705361b094a7 GIT binary patch literal 2315 zcma)8XHXN`5>5hGKoA8(HDII$2wg*{N&->^Bs3|ZM2dvuL8N(+qF$sU0V7?J0SN*c z+NC6*NW0V#5CuXJFd&8|oq#X?et+JN-92;8w>$HFyE}7|>}<^i`6c-Q0Dz#y4U_{n zYW%TNC%E1jw4cZgr-?UQ!vFw*^M4HZiTQxTy#$lcE+o@XoHr?u5F+ash{pjmG}X2A z)HSt@iJ6^Tg!CW8Ey5jAgm)+oaLte4gOfE248=tdLhpvjn%>g=PyPHA001Nv=;%Un zv9U(_67X>EKQMSCo(KQ}Fpg$w2*Cfo1jMr^`_l6@L{H4d6nzM7&-K#zG9D&@RS3Scl&o1+V)JN(E4>uw?MZE6BE*=HY%~YImW&wHRg~ia3 znSxhuO>K(^tJ>!v7_TOAck(mgka6X%!Uv5h%4yILI&$DHZe*}BFQOaDLTZosmA%Hl zRH3!mQVu%1vUhsM5bVk~>ULv$iG~Nca97G_>%9UG*jh?UfSxX_enPcwTA{me=7L%M zM6je5UFQ58ZOVV$+XRvf8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aX2RxYupXQbDIo zwlYVoz14^kdxq;)=S^P&T+onBIflsNEMhsXF1N{=Xwm%qtl3}hJE81wB(vs2Pf5_ycTi;$1eNWOiT2VcN$`F4Os z0N^;y$=>MjU=6VDUst2&wHP?g(8q{{jm-KtKQh literal 0 HcmV?d00001 diff --git a/src/modules/welcomeq/welcomeq.qml b/src/modules/welcomeq/welcomeq.qml index 729b61b28..8d6d47dc1 100644 --- a/src/modules/welcomeq/welcomeq.qml +++ b/src/modules/welcomeq/welcomeq.qml @@ -16,6 +16,7 @@ * You should have received a copy of the GNU General Public License * along with Calamares. If not, see . */ +import io.calamares.core 1.0 import io.calamares.ui 1.0 import QtQuick 2.10 @@ -29,21 +30,21 @@ Page { id: welcome - header: Item - { + header: Item { width: parent.width height: parent.height - Text - { + Text { id: welcomeTopText anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top + horizontalAlignment: Text.AlignHCenter + padding: 40 // In QML, QString::arg() only takes one argument - text: qsTr("

Welcome to the %1 %2 installer

").arg(Branding.string(Branding.ProductName)).arg(Branding.string(Branding.Version)) + text: qsTr("

Welcome to the %1 %2 installer

+

This program will ask you some questions and set up %1 on your computer.

").arg(Branding.string(Branding.ProductName)).arg(Branding.string(Branding.Version)) } - Image - { + Image { id: welcomeImage anchors.centerIn: parent // imagePath() returns a full pathname, so make it refer to the filesystem @@ -55,36 +56,31 @@ Page fillMode: Image.PreserveAspectFit } - RowLayout - { + RowLayout { id: buttonBar - width: parent.width + width: parent.width / 1.5 height: 64 anchors.bottom: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter spacing: Kirigami.Units.largeSpacing* 2 -/* Traditionally Calamares has had an "About" button that talks about - * Calamares itself, which just isn't a very useful thing in someone - * else's installation ISO. - */ - Button - { + Button { Layout.fillWidth: true text: qsTr("About") icon.name: "dialog-information" Kirigami.Theme.backgroundColor: Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.4) Kirigami.Theme.textColor: Kirigami.Theme.textColor - visible: false + visible: true onClicked: { - //onClicked: load.source = "file:/usr/share/calamares/branding/kaos_branding/show.qml" + //onClicked: load.source = "file:/usr/share/calamares/branding/default/show.qml" onClicked: load.source = "about.qml" } } - Button - { + + Button { Layout.fillWidth: true text: qsTr("Support") icon.name: "system-help" @@ -94,8 +90,8 @@ Page visible: config.supportUrl !== "" onClicked: Qt.openUrlExternally(config.supportUrl) } - Button - { + + Button { Layout.fillWidth: true text: qsTr("Known issues") icon.name: "tools-report-bug" @@ -105,8 +101,8 @@ Page visible: config.knownIssuesUrl !== "" onClicked: Qt.openUrlExternally(config.knownIssuesUrl) } - Button - { + + Button { Layout.fillWidth: true text: qsTr("Release notes") icon.name: "folder-text" @@ -116,8 +112,8 @@ Page visible: config.releaseNotesUrl !== "" onClicked: Qt.openUrlExternally(config.releaseNotesUrl) } - Button - { + + Button { Layout.fillWidth: true text: qsTr("Donate") icon.name: "taxes-finances" @@ -128,8 +124,41 @@ Page onClicked: Qt.openUrlExternally(config.donateUrl) } } - Loader - { + + RowLayout { + id: languageBar + width: parent.width /1.2 + height: 48 + + anchors.bottom: parent.bottom + anchors.bottomMargin: parent.height /7 + anchors.horizontalCenter: parent.horizontalCenter + spacing: Kirigami.Units.largeSpacing* 4 + + Rectangle { + width: parent.width + Layout.fillWidth: true + focus: true + Image { + id: image + height: 48 + fillMode: Image.PreserveAspectFit + source: "img/language-icon-48px.png" + } + + ComboBox { + id: languages + anchors.left: image.right + width: languageBar.width /1.1 + textRole: "label" + currentIndex: 4 //model.currentIndex + model: config.languagesModel + onCurrentIndexChanged: console.debug(currentText, currentIndex) + } + } + } + + Loader { id:load anchors.fill: parent } diff --git a/src/modules/welcomeq/welcomeq.qrc b/src/modules/welcomeq/welcomeq.qrc index 84e598a27..82c449bf4 100644 --- a/src/modules/welcomeq/welcomeq.qrc +++ b/src/modules/welcomeq/welcomeq.qrc @@ -4,5 +4,6 @@ about.qml img/squid.png img/chevron-left-solid.svg + img/language-icon-48px.png From 828448b2ffded48dc7f5de8c98fa5d42e0440d0b Mon Sep 17 00:00:00 2001 From: demmm Date: Mon, 20 Apr 2020 16:47:12 +0200 Subject: [PATCH 2/5] [welcomeq] make release notes part of welcome window use Loader option for those notes too, commented out file shows it is possible to load from anywhere --- src/modules/welcomeq/release_notes.qml | 100 +++++++++++++++++++++++++ src/modules/welcomeq/welcomeq.qml | 3 +- src/modules/welcomeq/welcomeq.qrc | 1 + 3 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 src/modules/welcomeq/release_notes.qml diff --git a/src/modules/welcomeq/release_notes.qml b/src/modules/welcomeq/release_notes.qml new file mode 100644 index 000000000..ce9d1d4af --- /dev/null +++ b/src/modules/welcomeq/release_notes.qml @@ -0,0 +1,100 @@ +/* === This file is part of Calamares - === + * + * Copyright 2020, Anke Boersma + * + * 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 . + */ + +import io.calamares.ui 1.0 + +import QtQuick 2.7 +import QtQuick.Controls 2.2 +import QtQuick.Window 2.2 +import QtQuick.Layouts 1.3 + +Rectangle { + width: parent.width + height: parent.height + focus: true + color: "#f2f2f2" + + Flickable { + id: flick + anchors.fill: parent + contentHeight: 3500 + + ScrollBar.vertical: ScrollBar { + id: fscrollbar + width: 10 + policy: ScrollBar.AlwaysOn + } + + TextArea { + id: intro + x: 130 + y: 8 + width: 640 + font.pointSize: 14 + textFormat: Text.RichText + antialiasing: true + activeFocusOnPress: false + wrapMode: Text.WordWrap + + text: qsTr("

%1

+

This an example QML file, showing options in RichText with Flickable content.

+ +

QML with RichText can use HTML tags, Flickable content is useful for touchscreens.

+ +

This is bold text

+

This is italic text

+

This is underlined text

+

This text will be center-aligned.

+

This is strikethrough

+ +

Code example: + ls -l /home

+ +

Lists:

+
    +
  • Intel CPU systems
  • +
  • AMD CPU systems
  • +
+ +

The vertical scrollbar is adjustable, current width set to 10.

").arg(Branding.string(Branding.VersionedName)) + + } + } + + ToolButton { + id: toolButton + x: 19 + y: 29 + width: 105 + height: 48 + text: qsTr("Back") + hoverEnabled: true + onClicked: load.source = "" + + Image { + id: image1 + x: 0 + y: 13 + width: 22 + height: 22 + source: "img/chevron-left-solid.svg" + fillMode: Image.PreserveAspectFit + } + } + +} diff --git a/src/modules/welcomeq/welcomeq.qml b/src/modules/welcomeq/welcomeq.qml index 8d6d47dc1..6330f5116 100644 --- a/src/modules/welcomeq/welcomeq.qml +++ b/src/modules/welcomeq/welcomeq.qml @@ -110,7 +110,8 @@ Page Kirigami.Theme.textColor: Kirigami.Theme.textColor visible: config.releaseNotesUrl !== "" - onClicked: Qt.openUrlExternally(config.releaseNotesUrl) + onClicked: load.source = "release_notes.qml" + //onClicked: load.source = "file:/usr/share/calamares/release_notes.qml" } Button { diff --git a/src/modules/welcomeq/welcomeq.qrc b/src/modules/welcomeq/welcomeq.qrc index 82c449bf4..71431254e 100644 --- a/src/modules/welcomeq/welcomeq.qrc +++ b/src/modules/welcomeq/welcomeq.qrc @@ -2,6 +2,7 @@ welcomeq.qml about.qml + release_notes.qml img/squid.png img/chevron-left-solid.svg img/language-icon-48px.png From d6c373c48d6e229761432ad09b1212f785073b53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20PORTAY?= Date: Tue, 21 Apr 2020 18:11:16 -0400 Subject: [PATCH 3/5] [partition] Allow a configurable EFI System Partition name This commit adds the new configuration `efiSystemPartitionName` to the file partition.conf. This option sets the partition name to the EFI System Partition that is created. If this option is unset, the partition is left unnamed. --- src/modules/partition/core/PartitionActions.cpp | 4 ++++ src/modules/partition/gui/PartitionViewStep.cpp | 6 ++++++ src/modules/partition/partition.conf | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/src/modules/partition/core/PartitionActions.cpp b/src/modules/partition/core/PartitionActions.cpp index 5e785c9d1..d0de2c0d4 100644 --- a/src/modules/partition/core/PartitionActions.cpp +++ b/src/modules/partition/core/PartitionActions.cpp @@ -151,6 +151,10 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO KPM_PARTITION_FLAG( None ) ); PartitionInfo::setFormat( efiPartition, true ); PartitionInfo::setMountPoint( efiPartition, o.efiPartitionMountPoint ); + if ( gs->contains( "efiSystemPartitionName" ) ) + { + efiPartition->setLabel( gs->value( "efiSystemPartitionName" ).toString() ); + } core->createPartition( dev, efiPartition, KPM_PARTITION_FLAG_ESP ); firstFreeSector = lastSector + 1; } diff --git a/src/modules/partition/gui/PartitionViewStep.cpp b/src/modules/partition/gui/PartitionViewStep.cpp index ed35fafa4..48d250ca4 100644 --- a/src/modules/partition/gui/PartitionViewStep.cpp +++ b/src/modules/partition/gui/PartitionViewStep.cpp @@ -538,6 +538,12 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap ) gs->insert( "efiSystemPartitionSize", CalamaresUtils::getString( configurationMap, "efiSystemPartitionSize" ) ); } + // Read and parse key efiSystemPartitionName + if ( configurationMap.contains( "efiSystemPartitionName" ) ) + { + gs->insert( "efiSystemPartitionName", CalamaresUtils::getString( configurationMap, "efiSystemPartitionName" ) ); + } + // SWAP SETTINGS // // This is a bit convoluted because there's legacy settings to handle as well diff --git a/src/modules/partition/partition.conf b/src/modules/partition/partition.conf index 241e4ea05..f6cc34ee4 100644 --- a/src/modules/partition/partition.conf +++ b/src/modules/partition/partition.conf @@ -7,6 +7,10 @@ efiSystemPartition: "/boot/efi" # If nothing is specified, the default size of 300MiB will be used. # efiSystemPartitionSize: 300M +# This optional setting specifies the name of the EFI system partition. +# If nothing is specified, the partition name is left unset. +# efiSystemPartitionName: EFI + # In autogenerated partitioning, allow the user to select a swap size? # If there is exactly one choice, no UI is presented, and the user # cannot make a choice -- this setting is used. If there is more than From 77a31ac3b287beeb25a0e3757cc0bd7f0e6c8d44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20PORTAY?= Date: Tue, 17 Mar 2020 09:31:17 -0400 Subject: [PATCH 4/5] [partition] Update debug output The mount-point is known as mountPoint in the global storage. This commit updates the trace to reflect its real name. --- src/modules/partition/jobs/FillGlobalStorageJob.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/partition/jobs/FillGlobalStorageJob.cpp b/src/modules/partition/jobs/FillGlobalStorageJob.cpp index ac65b5ff6..a302a3f31 100644 --- a/src/modules/partition/jobs/FillGlobalStorageJob.cpp +++ b/src/modules/partition/jobs/FillGlobalStorageJob.cpp @@ -107,7 +107,7 @@ mapForPartition( Partition* partition, const QString& uuid ) Logger::CDebug deb; using TR = Logger::DebugRow< const char* const, const QString& >; deb << Logger::SubEntry << "mapping for" << partition->partitionPath() << partition->deviceNode() - << TR( "mtpoint:", PartitionInfo::mountPoint( partition ) ) << TR( "fs:", map[ "fs" ].toString() ) + << TR( "mountPoint:", PartitionInfo::mountPoint( partition ) ) << TR( "fs:", map[ "fs" ].toString() ) << TR( "fsName", map[ "fsName" ].toString() ) << TR( "uuid", uuid ) << TR( "claimed", map[ "claimed" ].toString() ); From ded923fb9545b8191ae84a091e3fdbabcc6bde5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20PORTAY?= Date: Tue, 21 Apr 2020 08:44:14 -0400 Subject: [PATCH 5/5] Docs: Add support for bash-completion --- CHANGES | 5 +++-- CMakeLists.txt | 8 ++++++++ data/completion/bash/calamares | 36 ++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 data/completion/bash/calamares diff --git a/CHANGES b/CHANGES index cf5f9637e..58602f256 100644 --- a/CHANGES +++ b/CHANGES @@ -6,10 +6,11 @@ website will have to do for older versions. # 3.2.24 (unreleased) # This release contains contributions from (alphabetically by first name): - - No external contributors yet + - Gaël PORTAY ## Core ## - - No core changes yet + - There is now a bash-completions script for Calamares; turn on + the (CMake-time) option INSTALL_COMPLETION to get it. (Thanks Gaël) ## Modules ## - No module changes yet diff --git a/CMakeLists.txt b/CMakeLists.txt index bc14780a9..6edece315 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,7 @@ set( CALAMARES_VERSION_RC 1 ) # Set to 0 during release cycle, 1 during develop # option( INSTALL_CONFIG "Install configuration files" OFF ) option( INSTALL_POLKIT "Install Polkit configuration" ON ) +option( INSTALL_COMPLETION "Install shell completions" OFF ) option( BUILD_TESTING "Build the testing tree." ON ) option( WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON ) option( WITH_PYTHONQT "Enable next generation Python modules API (experimental, requires PythonQt)." OFF ) @@ -389,6 +390,13 @@ list( SORT CALAMARES_TRANSLATION_LANGUAGES ) add_subdirectory( lang ) # i18n tools +if ( INSTALL_COMPLETION ) + if( NOT CMAKE_INSTALL_BASHCOMPLETIONDIR ) + set( CMAKE_INSTALL_BASHCOMPLETIONDIR "${CMAKE_INSTALL_DATADIR}/bash-completion/completions" ) + endif() + + install( FILES ${CMAKE_SOURCE_DIR}/data/completion/bash/calamares DESTINATION "${CMAKE_INSTALL_BASHCOMPLETIONDIR}" ) +endif() ### Example Distro # diff --git a/data/completion/bash/calamares b/data/completion/bash/calamares new file mode 100644 index 000000000..47c2bb268 --- /dev/null +++ b/data/completion/bash/calamares @@ -0,0 +1,36 @@ +# === This file is part of Calamares - === +# +# Copyright 2020, Gaël PORTAY +# +# 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 . + +_calamares() +{ + local cur prev words cword + _init_completion || return + + case "$prev" in + -D) + COMPREPLY=( $( compgen -W "$( seq 0 1 8 )" -- "$cur" ) ) + return + ;; + -c|--config) + _filedir + return + ;; + esac + + COMPREPLY=( $( compgen -W "-h --help -v --version -d --debug -D -c --config -X -xdg-config -T --debug-translation" -- "$cur" ) ) +} && +complete -F _calamares calamares