diff options
| author | Nippy <nippy@Nippy-Mac-mini.local> | 2026-09-17 16:14:58 +0200 |
|---|---|---|
| committer | Nippy <nippy@Nippy-Mac-mini.local> | 2026-09-17 16:14:58 +0200 |
| commit | 8839d02e786f5ece0e1a502980fcaada6594e859 (patch) | |
| tree | d96aa79d2014cbb337ee68f3ca4f554a7cd94edc /raveos-calamares-module/desktopselect | |
| parent | f676fc2bad71c23605c846027a6d3691508075fd (diff) | |
| download | RaveOS-PKGBUILD-8839d02e786f5ece0e1a502980fcaada6594e859.tar.gz RaveOS-PKGBUILD-8839d02e786f5ece0e1a502980fcaada6594e859.zip | |
desktop new/fix
Diffstat (limited to 'raveos-calamares-module/desktopselect')
9 files changed, 224 insertions, 33 deletions
diff --git a/raveos-calamares-module/desktopselect/CMakeLists.txt b/raveos-calamares-module/desktopselect/CMakeLists.txt index c10c57c..60a0fee 100644 --- a/raveos-calamares-module/desktopselect/CMakeLists.txt +++ b/raveos-calamares-module/desktopselect/CMakeLists.txt @@ -25,6 +25,7 @@ install( install( FILES ui/desktopselect.qml + ui/Translations.qml ui/qmldir DESTINATION lib/calamares/modules/desktopselect/ui ) diff --git a/raveos-calamares-module/desktopselect/DesktopBackend.cpp b/raveos-calamares-module/desktopselect/DesktopBackend.cpp index 9fd1cc2..c5c2fec 100644 --- a/raveos-calamares-module/desktopselect/DesktopBackend.cpp +++ b/raveos-calamares-module/desktopselect/DesktopBackend.cpp @@ -1,23 +1,71 @@ #include "DesktopBackend.h" +#include <QLocale> +#include <QVariantMap> + DesktopBackend::DesktopBackend(QObject* parent) : QObject(parent) + , m_locale(QLocale::system().name()) {} void DesktopBackend::setDesktops(const QVariantList& desktops) { - m_desktops = desktops; + m_rawDesktops = desktops; m_selectedIndex = -1; + rebuildDesktops(); emit desktopsChanged(); emit selectedIndexChanged(); } -void DesktopBackend::selectDesktop(int index) +void DesktopBackend::setLocale(const QString& locale) { - if (index == m_selectedIndex) + if (m_locale == locale) return; + m_locale = locale; + rebuildDesktops(); + emit localeChanged(); + emit desktopsChanged(); +} + +void DesktopBackend::rebuildDesktops() +{ + const bool hungarian = m_locale.startsWith(QLatin1String("hu")); + const bool german = m_locale.startsWith(QLatin1String("de")); + + m_desktops.clear(); + for (const QVariant& v : m_rawDesktops) + { + const QVariantMap raw = v.toMap(); + + QVariantMap item; + item.insert(QStringLiteral("name"), raw.value(QStringLiteral("name"))); + item.insert( + QStringLiteral("description"), + hungarian ? raw.value(QStringLiteral("description_hu"), raw.value(QStringLiteral("description"))) + : german ? raw.value(QStringLiteral("description_de"), raw.value(QStringLiteral("description"))) + : raw.value(QStringLiteral("description_en"), raw.value(QStringLiteral("description")))); + item.insert( + QStringLiteral("badge"), + hungarian ? raw.value(QStringLiteral("badge_hu"), raw.value(QStringLiteral("badge"))) + : german ? raw.value(QStringLiteral("badge_de"), raw.value(QStringLiteral("badge"))) + : raw.value(QStringLiteral("badge_en"), raw.value(QStringLiteral("badge")))); + item.insert(QStringLiteral("badge_color"), raw.value(QStringLiteral("badge_color"))); + item.insert(QStringLiteral("available"), raw.value(QStringLiteral("available"), true)); + item.insert(QStringLiteral("packages"), raw.value(QStringLiteral("packages"))); + + m_desktops.append(item); + } +} + +void DesktopBackend::selectDesktop(int index) +{ if (index < 0 || index >= m_desktops.size()) return; + if (!m_desktops[index].toMap().value(QStringLiteral("available"), true).toBool()) + return; + if (index == m_selectedIndex) + return; + m_selectedIndex = index; emit selectedIndexChanged(); emit selectionMade(); @@ -29,7 +77,7 @@ QStringList DesktopBackend::selectedPackages() const return {}; const QVariantMap desktop = m_desktops[m_selectedIndex].toMap(); QStringList pkgs; - for (const auto& v : desktop.value("packages").toList()) + for (const auto& v : desktop.value(QStringLiteral("packages")).toList()) pkgs << v.toString(); return pkgs; } diff --git a/raveos-calamares-module/desktopselect/DesktopBackend.h b/raveos-calamares-module/desktopselect/DesktopBackend.h index 4ceb6cb..a3d2397 100644 --- a/raveos-calamares-module/desktopselect/DesktopBackend.h +++ b/raveos-calamares-module/desktopselect/DesktopBackend.h @@ -8,14 +8,17 @@ class DesktopBackend : public QObject Q_OBJECT Q_PROPERTY(QVariantList desktops READ desktops NOTIFY desktopsChanged) Q_PROPERTY(int selectedIndex READ selectedIndex NOTIFY selectedIndexChanged) + Q_PROPERTY(QString locale READ locale WRITE setLocale NOTIFY localeChanged) public: explicit DesktopBackend(QObject* parent = nullptr); QVariantList desktops() const { return m_desktops; } int selectedIndex() const { return m_selectedIndex; } + QString locale() const { return m_locale; } void setDesktops(const QVariantList& desktops); + void setLocale(const QString& locale); QStringList selectedPackages() const; Q_INVOKABLE void selectDesktop(int index); @@ -24,8 +27,13 @@ signals: void desktopsChanged(); void selectedIndexChanged(); void selectionMade(); + void localeChanged(); private: + void rebuildDesktops(); + + QVariantList m_rawDesktops; QVariantList m_desktops; int m_selectedIndex = -1; + QString m_locale; }; diff --git a/raveos-calamares-module/desktopselect/DesktopSelectViewStep.cpp b/raveos-calamares-module/desktopselect/DesktopSelectViewStep.cpp index 4af261c..a570f58 100644 --- a/raveos-calamares-module/desktopselect/DesktopSelectViewStep.cpp +++ b/raveos-calamares-module/desktopselect/DesktopSelectViewStep.cpp @@ -2,6 +2,8 @@ #include <QDir> #include <QFile> +#include <QLocale> +#include <QQuickItem> #include <QSet> #include <QVBoxLayout> #include <QQuickWidget> @@ -49,6 +51,10 @@ void DesktopSelectViewStep::buildWidget() m_quickWidget->engine()->addImportPath(modulePath); m_quickWidget->rootContext()->setContextProperty("backend", m_backend); + m_locale = getLocale(); + m_backend->setLocale(m_locale); + m_quickWidget->rootContext()->setContextProperty("systemLocale", m_locale); + QString qmlPath = QStringLiteral("/usr/lib/calamares/modules/desktopselect/ui/desktopselect.qml"); if (!QFile::exists(qmlPath)) qmlPath = QDir::currentPath() + QStringLiteral("/desktopselect/ui/desktopselect.qml"); @@ -75,6 +81,25 @@ bool DesktopSelectViewStep::isAtEnd() const { return true; } Calamares::JobList DesktopSelectViewStep::jobs() const { return {}; } +void DesktopSelectViewStep::onActivate() +{ + const QString newLocale = getLocale(); + if (newLocale != m_locale) + { + m_locale = newLocale; + m_backend->setLocale(m_locale); + if (m_quickWidget) + m_quickWidget->rootContext()->setContextProperty("systemLocale", m_locale); + } + + if (m_quickWidget) + { + QQuickItem* root = m_quickWidget->rootObject(); + if (root) + QMetaObject::invokeMethod(root, "updateLanguage", Qt::DirectConnection); + } +} + void DesktopSelectViewStep::onLeave() { if (!m_backend || m_backend->selectedIndex() < 0) @@ -115,3 +140,33 @@ void DesktopSelectViewStep::setConfigurationMap(const QVariantMap& config) m_backend->setDesktops(desktops); } + +QString DesktopSelectViewStep::getLocale() const +{ + if (Calamares::JobQueue::instance()) + { + Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); + if (gs) + { + if (gs->contains("locale")) + { + const QString loc = gs->value("locale").toString(); + if (!loc.isEmpty()) + return loc; + } + + if (gs->contains("localeConf")) + { + const QVariantMap localeConf = gs->value("localeConf").toMap(); + if (localeConf.contains("LANG")) + { + const QString loc = localeConf.value("LANG").toString(); + if (!loc.isEmpty()) + return loc; + } + } + } + } + + return QLocale::system().name(); +} diff --git a/raveos-calamares-module/desktopselect/DesktopSelectViewStep.h b/raveos-calamares-module/desktopselect/DesktopSelectViewStep.h index 4874ba3..b6696f3 100644 --- a/raveos-calamares-module/desktopselect/DesktopSelectViewStep.h +++ b/raveos-calamares-module/desktopselect/DesktopSelectViewStep.h @@ -28,15 +28,18 @@ public: Calamares::JobList jobs() const override; void setConfigurationMap(const QVariantMap& config) override; + void onActivate() override; void onLeave() override; private: void buildWidget(); + QString getLocale() const; QWidget* m_widget = nullptr; QQuickWidget* m_quickWidget = nullptr; DesktopBackend* m_backend = nullptr; QStringList m_mandatoryPackages; + QString m_locale; }; CALAMARES_PLUGIN_FACTORY_DECLARATION(DesktopSelectViewStepFactory) diff --git a/raveos-calamares-module/desktopselect/desktopselect.conf b/raveos-calamares-module/desktopselect/desktopselect.conf index d310fdd..e3981cf 100644 --- a/raveos-calamares-module/desktopselect/desktopselect.conf +++ b/raveos-calamares-module/desktopselect/desktopselect.conf @@ -52,8 +52,12 @@ mandatory_packages: desktops: - name: "KDE Plasma Desktop" - description: "Alap KDE RaveOS Témával. Teljes értékű asztali környezet." - badge: "STABIL" + description_hu: "Alap KDE RaveOS Témával. Teljes értékű asztali környezet." + description_de: "Basis-KDE mit dem RaveOS-Theme. Vollwertige Desktop-Umgebung." + description_en: "Base KDE with the RaveOS theme. Full desktop environment." + badge_hu: "STABIL" + badge_de: "STABIL" + badge_en: "STABLE" badge_color: "#2e7d32" packages: - plasma @@ -69,8 +73,12 @@ desktops: - raveos-plasma-theme - name: "GNOME Desktop" - description: "Teljes RaveOS Flavour. Modern, letisztult felület." - badge: "STABIL" + description_hu: "Teljes RaveOS Flavour. Modern, letisztult felület." + description_de: "Volle RaveOS-Variante. Moderne, aufgeräumte Oberfläche." + description_en: "Full RaveOS flavour. Modern, clean interface." + badge_hu: "STABIL" + badge_de: "STABIL" + badge_en: "STABLE" badge_color: "#2e7d32" packages: - gnome-session @@ -99,26 +107,23 @@ desktops: - gnome-shell-extensions - raveos-gnome-theme - - name: "Cosmic Desktop" - description: "RaveOS témával, de erősen BÉTA még mindig." - badge: "BÉTA" - badge_color: "#c62828" - packages: - - cosmic - - cosmic-text-editor - - cosmic-files - - cosmic-terminal - - cosmic-player - - cosmic-wallpapers - - raveos-cosmic-theme - - gvfs - - gvfs-smb - - gvfs-nfs - - gvfs-mtp + - name: "Cinnamon Desktop" + description_hu: "Hamarosan érkezik." + description_de: "Kommt bald." + description_en: "Coming soon." + badge_hu: "HAMAROSAN" + badge_de: "BALD" + badge_en: "SOON" + badge_color: "#e65100" + available: false - name: "Hyprland" - description: "FULLOS RaveOS Konfigurációval, kulcsra készen." - badge: "HAMAROSAN" + description_hu: "FULLOS RaveOS Konfigurációval, kulcsra készen." + description_de: "Komplette RaveOS-Konfiguration, startklar." + description_en: "Full RaveOS configuration, ready to go." + badge_hu: "HAMAROSAN" + badge_de: "BALD" + badge_en: "SOON" badge_color: "#e65100" packages: - hyprland diff --git a/raveos-calamares-module/desktopselect/ui/Translations.qml b/raveos-calamares-module/desktopselect/ui/Translations.qml new file mode 100644 index 0000000..389bf72 --- /dev/null +++ b/raveos-calamares-module/desktopselect/ui/Translations.qml @@ -0,0 +1,54 @@ +pragma Singleton +import QtQuick 2.15 + +/** + * Desktop Selector Modul Fordítások + * ================================== + * + * Támogatott nyelvek: + * - hu_HU: Magyar + * - de_DE: Német + * - en_US, en_GB, stb.: Angol (alapértelmezett) + * + * Használat QML-ben: + * Text { text: Translations.title } + */ + +QtObject { + id: root + + // Aktuális nyelv kód (pl. "hu_HU", "en_US") + property string currentLanguage: "en_US" + + // Modul fő címe + property string title: "Select Desktop" + + // Figyelmeztető banner + property string banner: "Choose a desktop environment. You can only choose one!" + + function setLanguage(locale) { + currentLanguage = locale + + // ================== + // MAGYAR + // ================== + if (locale.startsWith("hu")) { + title = "Desktop kiválasztása" + banner = "Válassz egy desktop környezetet. Csak egyet választhatsz!" + } + // ================== + // NÉMET + // ================== + else if (locale.startsWith("de")) { + title = "Desktop auswählen" + banner = "Wähle eine Desktop-Umgebung. Du kannst nur eine auswählen!" + } + // ================== + // ANGOL (alapértelmezett) + // ================== + else { + title = "Select Desktop" + banner = "Choose a desktop environment. You can only choose one!" + } + } +} diff --git a/raveos-calamares-module/desktopselect/ui/desktopselect.qml b/raveos-calamares-module/desktopselect/ui/desktopselect.qml index 02cb365..077947b 100644 --- a/raveos-calamares-module/desktopselect/ui/desktopselect.qml +++ b/raveos-calamares-module/desktopselect/ui/desktopselect.qml @@ -1,11 +1,22 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 +import "." as DesktopSelectModule Rectangle { id: root color: "#404040" + // Function to update language - called from C++ + function updateLanguage() { + DesktopSelectModule.Translations.setLanguage(systemLocale) + } + + // Initialize translations on load + Component.onCompleted: { + DesktopSelectModule.Translations.setLanguage(systemLocale) + } + // Nagy külső keret — cím, banner, kártyák mind benne Rectangle { anchors.fill: parent @@ -20,7 +31,7 @@ Rectangle { // Cím Text { - text: "Desktop kiválasztása" + text: DesktopSelectModule.Translations.title font.pixelSize: 24 font.bold: true color: "#ffffff" @@ -37,7 +48,7 @@ Rectangle { Text { anchors.centerIn: parent - text: "Válassz egy desktop környezetet. Csak egyet választhatsz!" + text: DesktopSelectModule.Translations.banner color: "#e0e0e0" font.pixelSize: 13 } @@ -53,11 +64,15 @@ Rectangle { model: backend.desktops delegate: Rectangle { + id: card width: desktopList.width height: 78 radius: 8 - color: backend.selectedIndex === index ? "#2a4a2a" : "#333333" - border.color: backend.selectedIndex === index ? "#5cb85c" : "#555555" + + property bool selectable: modelData.available !== false + + color: !selectable ? "#2a2a2a" : (backend.selectedIndex === index ? "#2a4a2a" : "#333333") + border.color: !selectable ? "#444444" : (backend.selectedIndex === index ? "#5cb85c" : "#555555") border.width: 2 RowLayout { @@ -72,14 +87,14 @@ Rectangle { Text { text: modelData.name || "" - color: "#ffffff" + color: card.selectable ? "#ffffff" : "#9a9a9a" font.pixelSize: 15 font.bold: true } Text { text: modelData.description || "" - color: "#b2b2b2" + color: card.selectable ? "#b2b2b2" : "#8a8a8a" font.pixelSize: 12 width: parent.width elide: Text.ElideRight @@ -105,7 +120,8 @@ Rectangle { MouseArea { anchors.fill: parent - cursorShape: Qt.PointingHandCursor + cursorShape: card.selectable ? Qt.PointingHandCursor : Qt.ArrowCursor + enabled: card.selectable onClicked: backend.selectDesktop(index) } } diff --git a/raveos-calamares-module/desktopselect/ui/qmldir b/raveos-calamares-module/desktopselect/ui/qmldir index 442b282..8968813 100644 --- a/raveos-calamares-module/desktopselect/ui/qmldir +++ b/raveos-calamares-module/desktopselect/ui/qmldir @@ -1 +1,2 @@ module DesktopSelectModule +singleton Translations 1.0 Translations.qml |