Files
steamify-cachyos-live-iso/patches/packagechooserq-steamify-summary.patch
theupriser f408f70e76 docs: use the renamed steamify-cachyos-live-iso repo name
- README clone instructions and the packagechooserq patch comment
2026-09-30 07:47:47 +02:00

82 lines
2.9 KiB
Diff

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:57:29
@@ -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,61 @@
QString
PackageChooserQmlViewStep::prettyStatus() const
{
- //QString option = m_pkgc;
- //return tr( "Install option: %1" ).arg( option );
- return m_config->prettyStatus();
+ // Steamify page (steamify-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();
+ }
+ if ( gaming )
+ {
+ on << ( desktop ? tr( "Starts in the desktop" ) : tr( "Starts in gaming mode" ) );
+ }
+ if ( on.isEmpty() )
+ {
+ return tr( "Steamify: <strong>nothing</strong>" );
+ }
+ QString status = tr( "Steamify:" ) + QStringLiteral( "<ul>" );
+ for ( const auto& item : on )
+ {
+ status += QStringLiteral( "<li>" ) + item + QStringLiteral( "</li>" );
+ }
+ status += QStringLiteral( "</ul>" );
+ return status;
}
bool