diff options
Diffstat (limited to 'raveos-calamares-module/wifi-onallo')
5 files changed, 226 insertions, 0 deletions
diff --git a/raveos-calamares-module/wifi-onallo/CMakeLists.txt b/raveos-calamares-module/wifi-onallo/CMakeLists.txt new file mode 100644 index 0000000..0c23149 --- /dev/null +++ b/raveos-calamares-module/wifi-onallo/CMakeLists.txt @@ -0,0 +1,37 @@ +find_package(Qt6 REQUIRED COMPONENTS DBus Gui Qml Quick) + +set(RAVEOS_WIFI_QML_DIR "${CMAKE_INSTALL_PREFIX}/lib/raveos-wifi/qml") +set(RAVEOS_WIFI_UI_DIR "${CMAKE_INSTALL_PREFIX}/lib/calamares/modules/wifi/ui") + +add_executable(raveos-wifi + main.cpp + ../wifi/NetworkManager.cpp +) + +set_target_properties(raveos-wifi PROPERTIES AUTOMOC ON) + +target_compile_definitions(raveos-wifi PRIVATE + RAVEOS_WIFI_QML_DIR="${RAVEOS_WIFI_QML_DIR}" + RAVEOS_WIFI_UI_DIR="${RAVEOS_WIFI_UI_DIR}" +) + +target_link_libraries(raveos-wifi PRIVATE + Qt6::DBus + Qt6::Gui + Qt6::Qml + Qt6::Quick +) + +install(TARGETS raveos-wifi DESTINATION bin) + +install( + FILES qml/Onallo.qml + DESTINATION lib/raveos-wifi/qml +) + +install( + FILES + qml/io/calamares/ui/qmldir + qml/io/calamares/ui/ViewManager.qml + DESTINATION lib/raveos-wifi/qml/io/calamares/ui +) diff --git a/raveos-calamares-module/wifi-onallo/main.cpp b/raveos-calamares-module/wifi-onallo/main.cpp new file mode 100644 index 0000000..3fb6747 --- /dev/null +++ b/raveos-calamares-module/wifi-onallo/main.cpp @@ -0,0 +1,31 @@ +#include "../wifi/NetworkManager.h" + +#include <QGuiApplication> +#include <QLocale> +#include <QQmlApplicationEngine> +#include <QQmlContext> +#include <QUrl> + +int main(int argc, char* argv[]) +{ + QGuiApplication app(argc, argv); + app.setApplicationName(QStringLiteral("raveos-wifi")); + + NetworkManager nm; + + QQmlApplicationEngine engine; + engine.addImportPath(QStringLiteral(RAVEOS_WIFI_QML_DIR)); + engine.addImportPath(QStringLiteral("/etc/calamares/branding/raveos")); + engine.addImportPath(QStringLiteral(RAVEOS_WIFI_UI_DIR)); + engine.rootContext()->setContextProperty(QStringLiteral("nm"), &nm); + engine.rootContext()->setContextProperty(QStringLiteral("systemLocale"), QLocale::system().name()); + engine.rootContext()->setContextProperty(QStringLiteral("wifiOldal"), + QUrl::fromLocalFile(QStringLiteral(RAVEOS_WIFI_UI_DIR "/wifi.qml"))); + + QObject::connect( + &engine, &QQmlApplicationEngine::objectCreationFailed, &app, [] { QCoreApplication::exit(2); }, + Qt::QueuedConnection); + engine.load(QUrl::fromLocalFile(QStringLiteral(RAVEOS_WIFI_QML_DIR "/Onallo.qml"))); + + return app.exec(); +} diff --git a/raveos-calamares-module/wifi-onallo/qml/Onallo.qml b/raveos-calamares-module/wifi-onallo/qml/Onallo.qml new file mode 100644 index 0000000..eea0e79 --- /dev/null +++ b/raveos-calamares-module/wifi-onallo/qml/Onallo.qml @@ -0,0 +1,150 @@ +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Layouts 1.15 +import QtQuick.Window 2.15 +import RaveOS 1.0 + +Window { + id: ablak + visible: true + x: 0 + y: 0 + width: Screen.width + height: Screen.height + visibility: Window.FullScreen + color: Stilus.hatter + title: "RaveOS Wi-Fi" + + readonly property bool magyar: systemLocale.startsWith("hu") + + function kilep(kod) { + Qt.exit(kod) + } + + Timer { + id: tovabbIdozito + interval: 1500 + onTriggered: ablak.kilep(0) + } + + Component.onCompleted: { + if (nm.connected) + tovabbIdozito.restart() + } + + Connections { + target: nm + function onConnectionChanged() { + if (nm.connected) + tovabbIdozito.restart() + else + tovabbIdozito.stop() + } + } + + Shortcut { + sequence: "Esc" + onActivated: ablak.kilep(1) + } + + component KeretesGomb: Button { + id: gomb + Layout.preferredHeight: 44 + leftPadding: 20 + rightPadding: 20 + background: Rectangle { + color: gomb.hovered ? Stilus.aktiv : "transparent" + border.width: 1 + border.color: Stilus.keretErosebb + } + contentItem: Text { + text: gomb.text + color: Stilus.szoveg + font.family: Stilus.font + font.pixelSize: 14 + font.weight: Font.Medium + verticalAlignment: Text.AlignVCenter + } + } + + component ZoldGomb: Button { + id: gomb + Layout.preferredHeight: 44 + leftPadding: 24 + rightPadding: 24 + background: Rectangle { + color: !gomb.enabled ? "transparent" : (gomb.hovered ? Stilus.zoldHover : Stilus.zold) + border.width: gomb.enabled ? 0 : 1 + border.color: Stilus.keret + } + contentItem: Text { + text: gomb.text + color: gomb.enabled ? Stilus.zoldonSzoveg : Stilus.szovegHalvany + font.family: Stilus.font + font.pixelSize: 14 + font.weight: Font.DemiBold + verticalAlignment: Text.AlignVCenter + } + } + + ColumnLayout { + anchors.fill: parent + spacing: 0 + + Loader { + Layout.fillWidth: true + Layout.fillHeight: true + source: wifiOldal + onStatusChanged: { + if (status === Loader.Error) + ablak.kilep(2) + } + } + + Rectangle { + Layout.fillWidth: true + Layout.preferredHeight: 73 + color: Stilus.hatter + + Rectangle { + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + height: 1 + color: Stilus.keret + } + + RowLayout { + anchors.fill: parent + anchors.topMargin: 15 + anchors.bottomMargin: 14 + anchors.leftMargin: 56 + anchors.rightMargin: 56 + spacing: 12 + + Text { + Layout.fillWidth: true + text: ablak.magyar + ? "A KAPCSOLAT UTÁN A TELEPÍTŐ FRISSÍTI MAGÁT" + : "THE INSTALLER UPDATES ITSELF ONCE CONNECTED" + elide: Text.ElideRight + color: Stilus.szovegHalvany + font.family: Stilus.mono + font.pixelSize: 12 + font.letterSpacing: 1 + } + + KeretesGomb { + text: ablak.magyar ? "Kihagyás" : "Skip" + onClicked: ablak.kilep(1) + } + + ZoldGomb { + text: ablak.magyar ? "Tovább" : "Continue" + enabled: nm.connected + onClicked: ablak.kilep(0) + } + } + } + } +} diff --git a/raveos-calamares-module/wifi-onallo/qml/io/calamares/ui/ViewManager.qml b/raveos-calamares-module/wifi-onallo/qml/io/calamares/ui/ViewManager.qml new file mode 100644 index 0000000..66fd4d7 --- /dev/null +++ b/raveos-calamares-module/wifi-onallo/qml/io/calamares/ui/ViewManager.qml @@ -0,0 +1,6 @@ +pragma Singleton +import QtQuick 2.15 + +QtObject { + readonly property int currentStepIndex: 1 +} diff --git a/raveos-calamares-module/wifi-onallo/qml/io/calamares/ui/qmldir b/raveos-calamares-module/wifi-onallo/qml/io/calamares/ui/qmldir new file mode 100644 index 0000000..43c37f8 --- /dev/null +++ b/raveos-calamares-module/wifi-onallo/qml/io/calamares/ui/qmldir @@ -0,0 +1,2 @@ +module io.calamares.ui +singleton ViewManager 1.0 ViewManager.qml |