feat: The Steamify page's Summary line shows the chosen items' labels and where it starts, not raw ids (patch on packagechooserq, applied by build-calamares-modules.sh)

This commit is contained in:
theupriser committed 2026-09-28 16:56:45 +02:00
1 parent 62402ce4c8
commit 8246209a7e
2 files changed
+77 -1

No files matched your search

+3 -1
View File
@@ -14,7 +14,7 @@ dest=archiso/airootfs/usr/lib/calamares/modules/packagechooserq
src_url=https://github.com/CachyOS/cachyos-calamares/archive/refs/heads/cachyos.tar.gz src_url=https://github.com/CachyOS/cachyos-calamares/archive/refs/heads/cachyos.tar.gz
pacman -S --needed --noconfirm cachyos-calamares-next cmake extra-cmake-modules \ pacman -S --needed --noconfirm cachyos-calamares-next cmake extra-cmake-modules \
qt6-declarative qt6-tools qt6-svg kcoreaddons yaml-cpp base-devel >/dev/null qt6-declarative qt6-tools qt6-svg kcoreaddons yaml-cpp base-devel patch >/dev/null
work="$(mktemp -d)" work="$(mktemp -d)"
mkdir -p "$work/src" "$work/cmake" mkdir -p "$work/src" "$work/cmake"
# The module and the packagechooser sources it shares (Config, PackageModel), # The module and the packagechooser sources it shares (Config, PackageModel),
@@ -24,6 +24,8 @@ tar -xzf "$work/calamares.tar.gz" --strip-components=3 -C "$work/src" \
cachyos-calamares-cachyos/src/modules/packagechooserq cachyos-calamares-cachyos/src/modules/packagechooser cachyos-calamares-cachyos/src/modules/packagechooserq cachyos-calamares-cachyos/src/modules/packagechooser
tar -xzf "$work/calamares.tar.gz" --strip-components=2 -C "$work/cmake" \ tar -xzf "$work/calamares.tar.gz" --strip-components=2 -C "$work/cmake" \
cachyos-calamares-cachyos/CMakeModules/AppStreamHelper.cmake cachyos-calamares-cachyos/CMakeModules/AppStreamHelper.cmake
# The Steamify page's Summary line shows labels instead of ids.
patch -s -d "$work/src" -p1 < patches/packagechooserq-steamify-summary.patch
# KF6CoreAddons before Calamares: Calamares' CMake config needs its target. # KF6CoreAddons before Calamares: Calamares' CMake config needs its target.
cat > "$work/src/CMakeLists.txt" << EOF cat > "$work/src/CMakeLists.txt" << EOF
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
@@ -0,0 +1,74 @@
diff -ruN a/packagechooserq/PackageChooserQmlViewStep.cpp b/packagechooserq/PackageChooserQmlViewStep.cpp
--- a/packagechooserq/PackageChooserQmlViewStep.cpp 2026-09-28 16:56:21
+++ b/packagechooserq/PackageChooserQmlViewStep.cpp 2026-09-28 16:56:21
@@ -17,6 +17,12 @@
#include "utils/System.h"
#include "utils/Variant.h"
+#include <QFile>
+#include <QHash>
+#include <QJsonArray>
+#include <QJsonDocument>
+#include <QJsonObject>
+
CALAMARES_PLUGIN_FACTORY_DEFINITION( PackageChooserQmlViewStepFactory, registerPlugin< PackageChooserQmlViewStep >(); )
PackageChooserQmlViewStep::PackageChooserQmlViewStep( QObject* parent )
@@ -35,9 +41,54 @@
QString
PackageChooserQmlViewStep::prettyStatus() const
{
- //QString option = m_pkgc;
- //return tr( "Install option: %1" ).arg( option );
- return m_config->prettyStatus();
+ // Steamify page (steammachine-cachyos-live-iso): its choice is Steamify's
+ // item ids ("boot" = start in the desktop, "none" = nothing on); show
+ // their labels, from the rows calamares-online.sh writes next to the
+ // page, instead of the raw ids. Any other use keeps the stock text.
+ const QString choice = m_config->packageChoice();
+ QFile rows( QStringLiteral( "/usr/local/share/steamify/qml/items.json" ) );
+ if ( moduleInstanceKey().id() != QStringLiteral( "steamifypage" ) || choice.isEmpty()
+ || !rows.open( QIODevice::ReadOnly ) )
+ {
+ return m_config->prettyStatus();
+ }
+ QHash< QString, QString > labels;
+ const auto items = QJsonDocument::fromJson( rows.readAll() ).array();
+ for ( const auto& item : items )
+ {
+ const auto row = item.toObject();
+ labels.insert( row.value( QStringLiteral( "id" ) ).toString(),
+ row.value( QStringLiteral( "label" ) ).toString() );
+ }
+ if ( labels.isEmpty() )
+ {
+ return m_config->prettyStatus();
+ }
+ QStringList on;
+ bool desktop = false, gaming = false;
+ for ( const auto& part : choice.split( QLatin1Char( ',' ) ) )
+ {
+ const QString id = part.trimmed();
+ if ( id.isEmpty() || id == QStringLiteral( "none" ) )
+ {
+ continue;
+ }
+ if ( id == QStringLiteral( "boot" ) )
+ {
+ desktop = true;
+ continue;
+ }
+ gaming = gaming || id == QStringLiteral( "gaming" );
+ on << labels.value( id, id ).toHtmlEscaped();
+ }
+ QString status = on.isEmpty() ? tr( "Steamify: <strong>nothing</strong>" )
+ : tr( "Steamify: <strong>%1</strong>" ).arg( on.join( QStringLiteral( ", " ) ) );
+ if ( gaming )
+ {
+ status += QStringLiteral( "<br/>" )
+ + ( desktop ? tr( "Starts in: <strong>the desktop</strong>" ) : tr( "Starts in: <strong>gaming mode</strong>" ) );
+ }
+ return status;
}
bool