summaryrefslogtreecommitdiff
path: root/raveos-calamares-module/welcome
diff options
context:
space:
mode:
Diffstat (limited to 'raveos-calamares-module/welcome')
-rw-r--r--raveos-calamares-module/welcome/CMakeLists.txt3
-rw-r--r--raveos-calamares-module/welcome/RaveWelcomeViewStep.cpp32
-rw-r--r--raveos-calamares-module/welcome/RaveWelcomeViewStep.h1
3 files changed, 35 insertions, 1 deletions
diff --git a/raveos-calamares-module/welcome/CMakeLists.txt b/raveos-calamares-module/welcome/CMakeLists.txt
index e2b3f5b..9d28587 100644
--- a/raveos-calamares-module/welcome/CMakeLists.txt
+++ b/raveos-calamares-module/welcome/CMakeLists.txt
@@ -1,4 +1,4 @@
-find_package(Qt6 REQUIRED COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Widgets)
calamares_add_plugin(ravewelcome
TYPE viewmodule
@@ -6,6 +6,7 @@ calamares_add_plugin(ravewelcome
SOURCES
RaveWelcomeViewStep.cpp
LINK_LIBRARIES
+ Qt6::Core
Qt6::Widgets
Calamares::calamares
)
diff --git a/raveos-calamares-module/welcome/RaveWelcomeViewStep.cpp b/raveos-calamares-module/welcome/RaveWelcomeViewStep.cpp
index 6c4e4a3..b2108c6 100644
--- a/raveos-calamares-module/welcome/RaveWelcomeViewStep.cpp
+++ b/raveos-calamares-module/welcome/RaveWelcomeViewStep.cpp
@@ -6,6 +6,7 @@
#include <QLabel>
#include <QLocale>
#include <QPainter>
+#include <QProcess>
#include <QPixmap>
#include <QResizeEvent>
#include <QVBoxLayout>
@@ -103,6 +104,10 @@ void RaveWelcomeViewStep::buildWidget()
m_langCombo->setCurrentIndex(m_currentLocaleIndex);
+ // Make the live keyboard layout match the initial language right away,
+ // so the WiFi password input is not stuck on the boot default (US).
+ applyLiveKeyboardLayout(m_localeIds.value(m_currentLocaleIndex));
+
connect(m_langCombo, QOverload<int>::of(&QComboBox::activated),
this, &RaveWelcomeViewStep::onLanguageChanged);
@@ -168,6 +173,10 @@ void RaveWelcomeViewStep::onLanguageChanged(int index)
gs->insert("locale", lang);
}
}
+
+ // Apply the matching live keyboard layout immediately, so the WiFi
+ // password input follows the selected language (before the keyboard page).
+ applyLiveKeyboardLayout(localeId);
}
QString RaveWelcomeViewStep::brandingTranslationsPrefix() const
@@ -177,6 +186,29 @@ QString RaveWelcomeViewStep::brandingTranslationsPrefix() const
return QString();
}
+void RaveWelcomeViewStep::applyLiveKeyboardLayout(const QString& localeId)
+{
+ QString layout = QStringLiteral("us");
+ if (localeId.startsWith(QLatin1String("hu")))
+ {
+ layout = QStringLiteral("hu");
+ }
+ else if (localeId.startsWith(QLatin1String("de")))
+ {
+ layout = QStringLiteral("de");
+ }
+ else if (localeId == QLatin1String("en_GB"))
+ {
+ layout = QStringLiteral("gb");
+ }
+
+ // Best effort: apply the layout to the running X11 session so the WiFi
+ // password input matches the selected language immediately. A missing
+ // setxkbmap or non-X11 session must not break the installer.
+ const QStringList args { QStringLiteral("-layout"), layout };
+ QProcess::startDetached(QStringLiteral("setxkbmap"), args);
+}
+
bool RaveWelcomeViewStep::isNextEnabled() const { return true; }
bool RaveWelcomeViewStep::isBackEnabled() const { return false; }
bool RaveWelcomeViewStep::isAtBeginning() const { return true; }
diff --git a/raveos-calamares-module/welcome/RaveWelcomeViewStep.h b/raveos-calamares-module/welcome/RaveWelcomeViewStep.h
index 83c9264..af7bdff 100644
--- a/raveos-calamares-module/welcome/RaveWelcomeViewStep.h
+++ b/raveos-calamares-module/welcome/RaveWelcomeViewStep.h
@@ -37,6 +37,7 @@ private slots:
private:
void buildWidget();
QString brandingTranslationsPrefix() const;
+ void applyLiveKeyboardLayout(const QString& localeId);
QWidget* m_widget = nullptr;
QLabel* m_bgLabel = nullptr;