From b34d2a54afa1581195e83003553959ae9ffba6c7 Mon Sep 17 00:00:00 2001 From: Floris Bos Date: Tue, 23 Nov 2021 12:09:03 +0100 Subject: [PATCH] Show keyboard instructions if no mouse / warning on custom repo --- CMakeLists.txt | 2 +- imagewriter.cpp | 10 ++++++++++ imagewriter.h | 2 ++ main.qml | 20 +++++++++++++++++++- 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab6fbe5..df6f9d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ set(IMAGER_VERSION_MAJOR 1) set(IMAGER_VERSION_MINOR 6) set(IMAGER_VERSION_STR "${IMAGER_VERSION_MAJOR}.${IMAGER_VERSION_MINOR}.3") set(IMAGER_VERSION_CSV "${IMAGER_VERSION_MAJOR},${IMAGER_VERSION_MINOR},3,0") -add_definitions(-DIMAGER_VERSION_STR="${IMAGER_VERSION_STR}beta") +add_definitions(-DIMAGER_VERSION_STR="${IMAGER_VERSION_STR}") add_definitions(-DIMAGER_VERSION_CSV=${IMAGER_VERSION_CSV}) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/imagewriter.cpp b/imagewriter.cpp index e2256df..a0fb70c 100644 --- a/imagewriter.cpp +++ b/imagewriter.cpp @@ -1213,6 +1213,16 @@ QString ImageWriter::detectPiKeyboard() return QString(); } +bool ImageWriter::hasMouse() +{ + return !_embeddedMode || QFile::exists("/dev/input/mouse0"); +} + +bool ImageWriter::customRepo() +{ + return _repo.toString() != OSLIST_URL; +} + void MountUtilsLog(std::string msg) { Q_UNUSED(msg) //qDebug() << "mountutils:" << msg.c_str(); diff --git a/imagewriter.h b/imagewriter.h index d7ab931..e2c16f3 100644 --- a/imagewriter.h +++ b/imagewriter.h @@ -119,9 +119,11 @@ public: Q_INVOKABLE QString getCurrentKeyboard(); Q_INVOKABLE void changeLanguage(const QString &newLanguageName); Q_INVOKABLE void changeKeyboard(const QString &newKeymapLayout); + Q_INVOKABLE bool customRepo(); void replaceTranslator(QTranslator *trans); QString detectPiKeyboard(); + Q_INVOKABLE bool hasMouse(); signals: /* We are emiting signals with QVariant as parameters because QML likes it that way */ diff --git a/main.qml b/main.qml index 4055f31..5f041f7 100644 --- a/main.qml +++ b/main.qml @@ -83,7 +83,7 @@ ApplicationWindow { anchors.rightMargin: 50 anchors.leftMargin: 50 - rows: 4 + rows: 6 columns: 3 columnSpacing: 25 @@ -269,6 +269,24 @@ ApplicationWindow { } } + Text { + Layout.columnSpan: 3 + color: "#ffffff" + font.pixelSize: 18 + font.family: roboto.name + visible: imageWriter.isEmbeddedMode() && imageWriter.customRepo() + text: qsTr("Using custom repository: %1").arg(imageWriter.constantOsListUrl()) + } + + Text { + Layout.columnSpan: 3 + color: "#ffffff" + font.pixelSize: 18 + font.family: roboto.name + visible: !imageWriter.hasMouse() + text: qsTr("Keyboard navigation: navigate to next button press button/select item go up/down in lists") + } + RowLayout { id: langbar Layout.columnSpan: 3