From fe5292afacd631b471415edc96e788453b34884a Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sat, 17 Oct 2020 21:51:33 +0200 Subject: [PATCH] - Major styling improvements - Some renaming --- OmobiDisplayApp/OmobiDisplayApp.pro | 6 +- OmobiDisplayApp/QBluetoothLeUart | 2 +- OmobiDisplayApp/main.cpp | 10 +- OmobiDisplayApp/omobidisplaybackend.cpp | 47 ++--- OmobiDisplayApp/omobidisplaybackend.h | 12 +- OmobiDisplayApp/ressources/qml/Chip.qml | 8 +- .../ressources/qml/ColorPickerDelegate.qml | 3 +- .../ressources/qml/ComboBoxDelegate.qml | 3 +- .../ressources/qml/ConnectPage.qml | 187 +++++++++++------- .../ressources/qml/ConnectedPage.qml | 95 ++++----- .../ressources/qml/DisplayEditDialog.qml | 2 +- .../ressources/qml/DisplayTextDelegate.qml | 2 +- .../ressources/qml/PasswordInputDelegate.qml | 3 +- .../ressources/qml/SpinBoxDelegate.qml | 3 +- .../ressources/qml/TextEditDialog.qml | 2 +- .../ressources/qml/TextInputDelegate.qml | 5 +- OmobiDisplayApp/ressources/qml/main.qml | 105 +++++++++- OmobiDisplayApp/ressources/qml/qml.qrc | 1 - OmobiDisplayApp/ressources/translations/de.qm | Bin 0 -> 3073 bytes OmobiDisplayApp/ressources/translations/de.ts | 163 +++++++++++++++ .../ressources/translations/translations.qrc | 5 + 21 files changed, 493 insertions(+), 171 deletions(-) create mode 100644 OmobiDisplayApp/ressources/translations/de.qm create mode 100644 OmobiDisplayApp/ressources/translations/de.ts create mode 100644 OmobiDisplayApp/ressources/translations/translations.qrc diff --git a/OmobiDisplayApp/OmobiDisplayApp.pro b/OmobiDisplayApp/OmobiDisplayApp.pro index 900cbb2..0ec8ca4 100644 --- a/OmobiDisplayApp/OmobiDisplayApp.pro +++ b/OmobiDisplayApp/OmobiDisplayApp.pro @@ -20,7 +20,11 @@ HEADERS += \ RESOURCES += \ ressources/qml/qml.qrc \ - ressources/shared/shared.qrc + ressources/shared/shared.qrc \ + ressources/translations/translations.qrc + +TRANSLATIONS += \ + ressources/translations/de.ts # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = diff --git a/OmobiDisplayApp/QBluetoothLeUart b/OmobiDisplayApp/QBluetoothLeUart index 76e4575..1ec609e 160000 --- a/OmobiDisplayApp/QBluetoothLeUart +++ b/OmobiDisplayApp/QBluetoothLeUart @@ -1 +1 @@ -Subproject commit 76e457593e889885fd410fdbcdd659706a1eceb8 +Subproject commit 1ec609e7c22308cacffe7fe03de14380463b8470 diff --git a/OmobiDisplayApp/main.cpp b/OmobiDisplayApp/main.cpp index 4d73779..79e3c05 100644 --- a/OmobiDisplayApp/main.cpp +++ b/OmobiDisplayApp/main.cpp @@ -1,7 +1,8 @@ #include #include #include -#include +#include +#include #include "omobidisplaybackend.h" #include "omobidisplaytextmodel.h" @@ -12,9 +13,14 @@ int main(int argc, char *argv[]) QGuiApplication app(argc, argv); + QTranslator translator; + translator.load(":/" + QLocale::system().name() + ".qm"); + translator.load(":/de.qm"); + app.installTranslator(&translator); + qmlRegisterType("de.itsblue.omobidisplayapp", 1, 0, "OmobiDisplayBackend"); qmlRegisterUncreatableType("de.itsblue.omobidisplayapp", 1, 0, "OmobiDisplayTextModel", "OmobiDisplayTextModel cannot be created"); - QBluetoothLeUart::init(); + QBluetoothLeUartClient::init(); QQuickStyle::setStyle("Material"); diff --git a/OmobiDisplayApp/omobidisplaybackend.cpp b/OmobiDisplayApp/omobidisplaybackend.cpp index b9dbcc4..393dc51 100644 --- a/OmobiDisplayApp/omobidisplaybackend.cpp +++ b/OmobiDisplayApp/omobidisplaybackend.cpp @@ -2,8 +2,8 @@ OmobiDisplayBackend::OmobiDisplayBackend(QObject *parent) : QObject(parent) { - this->ble = new QBluetoothLeUart(); - this->ble->setUUIDs("92fecb20-1406-426a-afa5-cd5c1f306462", "92fecb21-1406-426a-afa5-cd5c1f306462", "92fecb22-1406-426a-afa5-cd5c1f306462"); + this->bleClient = new QBluetoothLeUartClient(); + this->bleClient->setUUIDs("92fecb20-1406-426a-afa5-cd5c1f306462", "92fecb21-1406-426a-afa5-cd5c1f306462", "92fecb22-1406-426a-afa5-cd5c1f306462"); this->displayTextModel = new OmobiDisplayTextModel(this); this->textSetsBuffer.clear(); this->displayBrightness = -1; @@ -14,65 +14,65 @@ OmobiDisplayBackend::OmobiDisplayBackend(QObject *parent) : QObject(parent) this->keepAliveTimer->setSingleShot(false); connect(this->keepAliveTimer, &QTimer::timeout, this, &OmobiDisplayBackend::sendBluetoothKeepAlive); - connect(this->ble, &QBluetoothLeUart::stateChanged, this, &OmobiDisplayBackend::handleBluetoothStateChange); - connect(this->ble, &QBluetoothLeUart::foundNewDevice, this, &OmobiDisplayBackend::handleFoundNewDevice); - connect(this->ble, &QBluetoothLeUart::dataReceived, this, &OmobiDisplayBackend::handleBluetoothDataReceived); - connect(this->ble, &QBluetoothLeUart::connectedToDevice, this, &OmobiDisplayBackend::handleBluetoothDeviceConected); + connect(this->bleClient, &QBluetoothLeUartClient::stateChanged, this, &OmobiDisplayBackend::handleBluetoothStateChange); + connect(this->bleClient, &QBluetoothLeUartClient::foundNewDevice, this, &OmobiDisplayBackend::handleFoundNewDevice); + connect(this->bleClient, &QBluetoothLeUartClient::dataReceived, this, &OmobiDisplayBackend::handleBluetoothDataReceived); + connect(this->bleClient, &QBluetoothLeUartClient::connectedToDevice, this, &OmobiDisplayBackend::handleBluetoothDeviceConected); connect(this->displayTextModel, &OmobiDisplayTextModel::dataChanged, this, &OmobiDisplayBackend::handleDisplayTextModelDataChanged); connect(this->displayTextModel, &OmobiDisplayTextModel::rowsInserted, this, &OmobiDisplayBackend::handleDisplayTextModelRowsInserted); connect(this->displayTextModel, &OmobiDisplayTextModel::rowsRemoved, this, &OmobiDisplayBackend::handleDisplayTextModelRowsRemoved); this->setState(Idle); - this->ble->startScanningForDevices(); + this->bleClient->startScanningForDevices(); } void OmobiDisplayBackend::startScanning() { - this->ble->startScanningForDevices(); + this->bleClient->startScanningForDevices(); } void OmobiDisplayBackend::authenticate(QString code) { // tell display to send over existing model data this->setState(Authenticating); - QString combinedCode = this->ble->getCurrentDevice()->getAddress().toUpper() + code; + QString combinedCode = this->bleClient->getCurrentDevice()->getAddress().toUpper() + code; QString secret = QCryptographicHash::hash(combinedCode.toUtf8(), QCryptographicHash::Sha256).toHex(); this->sendBluetoothCommand(AuthorizeSessionCommand, QVariantMap{{"secret", secret}}); } -void OmobiDisplayBackend::handleBluetoothStateChange(QBluetoothLeUart::BluetoothLeUartState state){ +void OmobiDisplayBackend::handleBluetoothStateChange(QBluetoothLeUartClient::BluetoothLeUartClientState state){ switch(state){ - case QBluetoothLeUart::Idle: { + case QBluetoothLeUartClient::Idle: { this->setState(Idle); break; } - case QBluetoothLeUart::Scanning: { + case QBluetoothLeUartClient::Scanning: { this->setState(Scanning); break; } - case QBluetoothLeUart::ScanFinished: { + case QBluetoothLeUartClient::ScanFinished: { this->setState(ReadyToConnect); break; } - case QBluetoothLeUart::Connecting: { + case QBluetoothLeUartClient::Connecting: { this->setState(Connecting); break; } - case QBluetoothLeUart::ScanningForService: { + case QBluetoothLeUartClient::ScanningForService: { this->setState(Connecting); break; } - case QBluetoothLeUart::ServiceFound: { + case QBluetoothLeUartClient::ServiceFound: { this->setState(Connecting); break; } - case QBluetoothLeUart::Connected: + case QBluetoothLeUartClient::Connected: { break; } } - if(state == QBluetoothLeUart::Connected) + if(state == QBluetoothLeUartClient::Connected) this->keepAliveTimer->start(); else if(this->keepAliveTimer->isActive()) this->keepAliveTimer->stop(); @@ -80,6 +80,7 @@ void OmobiDisplayBackend::handleBluetoothStateChange(QBluetoothLeUart::Bluetooth void OmobiDisplayBackend::handleBluetoothDeviceConected() { this->setState(AuthenticationRequired); + this->authenticate("1234"); // TODO: stuff } @@ -124,7 +125,7 @@ void OmobiDisplayBackend::sendBluetoothCommand(OmobiDisplayCommand command, QVar if(this->state == Connected) this->setState(Loading); - this->ble->sendData(doc.toJson(QJsonDocument::Compact)); + this->bleClient->sendData(doc.toJson(QJsonDocument::Compact)); } void OmobiDisplayBackend::sendBluetoothKeepAlive() { @@ -132,7 +133,7 @@ void OmobiDisplayBackend::sendBluetoothKeepAlive() { qDebug() << "Sending keep alive: \n" << qPrintable(doc.toJson(QJsonDocument::Indented)); - this->ble->sendData(doc.toJson(QJsonDocument::Compact)); + this->bleClient->sendData(doc.toJson(QJsonDocument::Compact)); } void OmobiDisplayBackend::handleBluetoothDataReceived(QString s){ @@ -240,8 +241,8 @@ void OmobiDisplayBackend::updateDisplayTextSetParameter(int index, int parameter this->sendBluetoothCommand(SetTextSetParameterCommand, dataMap); } -QBluetoothLeUart* OmobiDisplayBackend::getBleController() { - return this->ble; +QBluetoothLeUartClient* OmobiDisplayBackend::getBleClient() { + return this->bleClient; } @@ -277,7 +278,7 @@ void OmobiDisplayBackend::setState(OmobiDisplayAppState state) { qDebug() << "Now in " << state << " state"; if(this->state == Idle) - this->ble->startScanningForDevices(); + this->bleClient->startScanningForDevices(); } int OmobiDisplayBackend::getDisplayBrightness() { diff --git a/OmobiDisplayApp/omobidisplaybackend.h b/OmobiDisplayApp/omobidisplaybackend.h index 377fe2a..8da8338 100644 --- a/OmobiDisplayApp/omobidisplaybackend.h +++ b/OmobiDisplayApp/omobidisplaybackend.h @@ -6,13 +6,13 @@ #include #include -#include +#include #include class OmobiDisplayBackend : public QObject { Q_OBJECT - Q_PROPERTY(QBluetoothLeUart* bleController READ getBleController NOTIFY bleControllerChanged) + Q_PROPERTY(QBluetoothLeUartClient* bleClient READ getBleClient NOTIFY bleClientChanged) Q_PROPERTY(OmobiDisplayAppState state READ getState WRITE setState NOTIFY stateChanged) Q_PROPERTY(OmobiDisplayTextModel* displayTextModel READ getDisplayTextModel NOTIFY displayTextModelChanged) Q_PROPERTY(int displayBrightness READ getDisplayBrightness WRITE setDisplayBrightness NOTIFY displayBrightnessChanged) @@ -52,7 +52,7 @@ private: }; OmobiDisplayAppState state; - QBluetoothLeUart *ble; + QBluetoothLeUartClient *bleClient; QTimer *keepAliveTimer; OmobiDisplayTextModel* displayTextModel; int waitingCommands; @@ -62,7 +62,7 @@ private: public slots: Q_INVOKABLE void startScanning(); Q_INVOKABLE void authenticate(QString secret); - Q_INVOKABLE QBluetoothLeUart* getBleController(); + Q_INVOKABLE QBluetoothLeUartClient* getBleClient(); Q_INVOKABLE OmobiDisplayAppState getState(); Q_INVOKABLE OmobiDisplayTextModel* getDisplayTextModel(); Q_INVOKABLE int getDisplayBrightness(); @@ -71,7 +71,7 @@ public slots: Q_INVOKABLE void setDisplayName(QString name); private slots: - void handleBluetoothStateChange(QBluetoothLeUart::BluetoothLeUartState state); + void handleBluetoothStateChange(QBluetoothLeUartClient::BluetoothLeUartClientState state); void handleFoundNewDevice(QBluetoothLeUartDevice* device); void handleBluetoothDeviceConected(); @@ -90,7 +90,7 @@ private slots: signals: void stateChanged(); - void bleControllerChanged(); + void bleClientChanged(); void displayTextModelChanged(); void displayBrightnessChanged(); diff --git a/OmobiDisplayApp/ressources/qml/Chip.qml b/OmobiDisplayApp/ressources/qml/Chip.qml index 601f1e0..351bc8a 100644 --- a/OmobiDisplayApp/ressources/qml/Chip.qml +++ b/OmobiDisplayApp/ressources/qml/Chip.qml @@ -14,11 +14,11 @@ Item { property string text: "" property string color: "" property bool isDarkColor: control.checkIsDarkColor(color) - property double glowRadius: 0.001 - property double glowSpread: 0.2 + property double glowRadius: 0.01 + property double glowSpread: 0.01 property bool glowVisible: true - property double glowScale: 0.9 - property double glowOpacity: Math.pow( control.opacity, 100 ) + property double glowScale: 1 + property double glowOpacity: Math.pow( control.opacity, 100 ) * 0.5 property bool interactive: true signal clicked diff --git a/OmobiDisplayApp/ressources/qml/ColorPickerDelegate.qml b/OmobiDisplayApp/ressources/qml/ColorPickerDelegate.qml index a5f799e..848075e 100644 --- a/OmobiDisplayApp/ressources/qml/ColorPickerDelegate.qml +++ b/OmobiDisplayApp/ressources/qml/ColorPickerDelegate.qml @@ -44,10 +44,11 @@ ItemDelegate { } font.pixelSize: parent.height * 0.5 + font.styleName: fontAwesome.name verticalAlignment: Text.AlignVCenter - text: ">" + text: "\uf105" } Dialog { diff --git a/OmobiDisplayApp/ressources/qml/ComboBoxDelegate.qml b/OmobiDisplayApp/ressources/qml/ComboBoxDelegate.qml index 9ad453f..8b82948 100644 --- a/OmobiDisplayApp/ressources/qml/ComboBoxDelegate.qml +++ b/OmobiDisplayApp/ressources/qml/ComboBoxDelegate.qml @@ -42,12 +42,13 @@ ItemDelegate { } font.pixelSize: parent.height * 0.5 + font.styleName: fontAwesome.name verticalAlignment: Text.AlignVCenter color: control.Material.foreground - text: ">" + text: "\uf105" } Dialog { diff --git a/OmobiDisplayApp/ressources/qml/ConnectPage.qml b/OmobiDisplayApp/ressources/qml/ConnectPage.qml index 17e34a9..a8d229c 100644 --- a/OmobiDisplayApp/ressources/qml/ConnectPage.qml +++ b/OmobiDisplayApp/ressources/qml/ConnectPage.qml @@ -9,34 +9,67 @@ import QtGraphicalEffects 1.0 Page { id: root + property bool actionButtonVisible: false + property bool backButtonVisible: false property string statusText property bool working + title: qsTr("Available displays") + ColumnLayout { + id: mainLayout anchors { fill: parent - margins: parent.height * 0.01 - topMargin: 0 + margins: Math.min(parent.height, parent.width) * 0.05 } - Text { - Layout.preferredWidth: parent.width * 0.6 - Layout.preferredHeight: parent.height * 0.1 + Chip { + Layout.fillWidth: true + Layout.preferredHeight: mainLayout.height * 0.05 Layout.alignment: Layout.Center + color: "white" - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter + onClicked: { + backend.bleClient.startScanningForDevices() + } - fontSizeMode: Text.Fit - font.pixelSize: 500 - minimumPixelSize: 1 + RowLayout { + spacing: mainLayout.anchors.margins - text: qsTr("Available devices") + anchors.fill: parent + anchors.leftMargin: width * 0.05 + anchors.rightMargin: 0 + + Text { + Layout.fillHeight: true + Layout.fillWidth: true + verticalAlignment: Text.AlignVCenter + font.pixelSize: parent.height * 0.4 + text: root.statusText + } + + BusyIndicator { + Layout.fillHeight: true + Layout.preferredWidth: height + + id: busyIndicator + + scale: 0.8 + + opacity: root.working ? 1:0 + } + + } + } + + Item { + Layout.fillWidth: true + Layout.preferredHeight: mainLayout.height * 0.025 } ListView { - id: availableDevicesListView + id: availableDisplaysListView Layout.preferredWidth: parent.width Layout.fillHeight: true @@ -45,7 +78,7 @@ Page { clip: true boundsBehavior: Flickable.OvershootBounds - model: backend.bleController.availableDevicesModel + model: backend.bleClient.availableDevicesModel add: Transition { NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 200 } @@ -59,64 +92,19 @@ Page { spacing: 5 - header: ItemDelegate { - id: headerDelegate - - width: parent.width - height: implicitHeight * 0.8 - - topInset: 10 - bottomInset: 10 - - text: root.statusText - - onClicked: backend.bleController.startScanningForDevices() - - Rectangle { - anchors.fill: parent - anchors.topMargin: 10 - anchors.bottomMargin: 10 - color: "transparent" - border.color: "lightgrey" - border.width: 3 - } - - Item { - anchors { - right: parent.right - rightMargin: parent.height * 0.15 - verticalCenter: parent.verticalCenter - } - - height: (parent.height - 20) * 0.7 - width: height - - BusyIndicator { - id: busyIndicator - - anchors.centerIn: parent - - width: parent.width - height: parent.height - - opacity: root.working ? 1:0 - } - } - } - delegate: ItemDelegate { width: parent.width text: name - onClicked: backend.bleController.connectToDevice(device) + onClicked: backend.bleClient.connectToDevice(device) Rectangle { anchors { top: parent.top left: parent.left right: parent.right - topMargin: - availableDevicesListView.spacing * 0.5 + topMargin: - availableDisplaysListView.spacing * 0.5 } color: "lightgrey" @@ -124,6 +112,61 @@ Page { visible: index !== 0 } } + + Item { + anchors.centerIn: parent + + width: Math.min(parent.height, parent.width) + height: Math.min(parent.height, parent.width) + + opacity: availableDisplaysListView.model.rowCount === 0 ? 1:0 + + Behavior on opacity { + NumberAnimation {} + } + + Rectangle { + id: noDisplaysRect + + anchors { + top: parent.top + topMargin: parent.height * 0.2 + horizontalCenter: parent.horizontalCenter + } + + width: parent.width * 0.7 + height: width * 0.3 + + color: "transparent" + + border.width: height * 0.15 + border.color: "lightgrey" + + Text { + anchors.centerIn: parent + anchors.verticalCenterOffset: text === "..." ? -height * 0.25:0 + color: "lightgrey" + font.pixelSize: parent.height * 0.6 + font.bold: true + text: parseInt(root.state) === OmobiDisplayBackend.Scanning ? "...":"?" + } + } + + Text { + id: noDisplaysText + anchors { + top: noDisplaysRect.bottom + topMargin: noDisplaysRect.height * 0.15 + horizontalCenter: parent.horizontalCenter + } + + font.bold: true + font.pixelSize: noDisplaysRect.height * 0.3 + + color: Qt.darker("lightgrey", 1.1) + text: parseInt(root.state) === OmobiDisplayBackend.Scanning ? qsTr("Still scanning"):qsTr("No displays found") + } + } } } @@ -156,7 +199,7 @@ Page { } onRejected: { - backend.bleController.disconnectFromDevice() + backend.bleClient.disconnectFromDevice() } contentItem: TextField { @@ -172,7 +215,7 @@ Page { PropertyChanges { target: root - statusText: "Tap here to scan" + statusText: qsTr("Tap here to scan") working: false } }, @@ -181,7 +224,7 @@ Page { PropertyChanges { target: root - statusText: "Scanning..." + statusText: qsTr("Scanning...") working: true } }, @@ -190,7 +233,7 @@ Page { PropertyChanges { target: root - statusText: availableDevicesListView.model.rowCount() > 0 ? "Please select a device or tap to scan again":"No devices found. Tap to scan again" + statusText: availableDisplaysListView.model.rowCount > 0 ? qsTr("Please select a device or tap to scan again"):qsTr("No displays found. Tap to scan again") working: false } }, @@ -204,13 +247,13 @@ Page { } PropertyChanges { - target: availableDevicesListView + target: availableDisplaysListView enabled: false } PropertyChanges { target: root - statusText: "trying to authenticate..." + statusText: qsTr("trying to authenticate...") working: true } }, @@ -218,13 +261,13 @@ Page { name: OmobiDisplayBackend.Authenticating PropertyChanges { - target: availableDevicesListView + target: availableDisplaysListView enabled: false } PropertyChanges { target: root - statusText: "trying to authenticate..." + statusText: qsTr("trying to authenticate...") working: true } }, @@ -233,13 +276,13 @@ Page { name: OmobiDisplayBackend.Connecting PropertyChanges { - target: availableDevicesListView + target: availableDisplaysListView enabled: false } PropertyChanges { target: root - statusText: "trying to connect..." + statusText: qsTr("trying to connect...") working: true } }, @@ -247,13 +290,13 @@ Page { name: OmobiDisplayBackend.Initing PropertyChanges { - target: availableDevicesListView + target: availableDisplaysListView enabled: false } PropertyChanges { target: root - statusText: "loading data..." + statusText: qsTr("loading data...") working: true } } diff --git a/OmobiDisplayApp/ressources/qml/ConnectedPage.qml b/OmobiDisplayApp/ressources/qml/ConnectedPage.qml index b001671..9788b0b 100644 --- a/OmobiDisplayApp/ressources/qml/ConnectedPage.qml +++ b/OmobiDisplayApp/ressources/qml/ConnectedPage.qml @@ -10,72 +10,77 @@ import de.itsblue.bluetoothleuart 1.0 Page { id: root + property bool actionButtonVisible: true + property bool backButtonVisible: true + + title: backend.bleClient.currentDevice === null ? "":backend.bleClient.currentDevice.name + + function backButtonClicked() { + backend.bleClient.disconnectFromDevice() + } + + function actionButtonClicked() { + displayEditDialog.edit() + } + ColumnLayout { + id: mainLayout anchors { fill: parent - margins: parent.height * 0.01 - topMargin: 0 + margins: Math.min(parent.height, parent.width) * 0.05 } - Text { - Layout.preferredWidth: parent.width * 0.6 - Layout.preferredHeight: parent.height * 0.1 + Chip { + Layout.fillWidth: true + Layout.preferredHeight: mainLayout.height * 0.05 Layout.alignment: Layout.Center - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter + interactive: false - fontSizeMode: Text.Fit - font.pixelSize: 500 - minimumPixelSize: 1 + color: "white" - color: root.Material.foreground + RowLayout { + spacing: mainLayout.anchors.margins - text: backend.bleController.currentDevice === null ? "":backend.bleController.currentDevice.name + anchors.fill: parent + anchors.leftMargin: width * 0.05 + anchors.rightMargin: anchors.leftMargin - ToolButton { - id: editButton - anchors { - verticalCenter: parent.verticalCenter - left: parent.right - margins: parent.height * 0.1 + Text { + Layout.fillHeight: true + verticalAlignment: Text.AlignVCenter + font.pixelSize: parent.height * 0.5 + text: "\uf186" } - height: parent.height * 0.7 - width: height + Slider { + Layout.fillWidth: true + Layout.fillHeight: true - font.styleName: fontAwesome.name - font.pixelSize: height * 0.3 + from: 0 + to: 10 + stepSize: 1 - flat: true + value: backend.displayBrightness - text: "\uf044" + onPressedChanged: { + if(!pressed) + backend.displayBrightness = value + } + } - onClicked: displayEditDialog.edit() + Text { + Layout.fillHeight: true + verticalAlignment: Text.AlignVCenter + font.pixelSize: parent.height * 0.5 + text: "\uf185" + } } } - Text { - Layout.alignment: Layout.Center - - color: root.Material.foreground - - text: qsTr("Brightness:") - } - - Slider { + Item { Layout.fillWidth: true - - from: 0 - to: 10 - stepSize: 1 - - value: backend.displayBrightness - - onPressedChanged: { - if(!pressed) - backend.displayBrightness = value - } + Layout.preferredHeight: mainLayout.height * 0.025 } DisplayTextModelListView { diff --git a/OmobiDisplayApp/ressources/qml/DisplayEditDialog.qml b/OmobiDisplayApp/ressources/qml/DisplayEditDialog.qml index ee26b5a..1dd331b 100644 --- a/OmobiDisplayApp/ressources/qml/DisplayEditDialog.qml +++ b/OmobiDisplayApp/ressources/qml/DisplayEditDialog.qml @@ -72,7 +72,7 @@ Dialog { reset() - nameTextField.value = backend.bleController.currentDevice.name + nameTextField.value = backend.bleClient.currentDevice.name open() } diff --git a/OmobiDisplayApp/ressources/qml/DisplayTextDelegate.qml b/OmobiDisplayApp/ressources/qml/DisplayTextDelegate.qml index 25df49e..1daff2c 100644 --- a/OmobiDisplayApp/ressources/qml/DisplayTextDelegate.qml +++ b/OmobiDisplayApp/ressources/qml/DisplayTextDelegate.qml @@ -56,7 +56,7 @@ ItemDelegate { ColorAnimation {} } - text: model.scroll ? qsTr("scrolling"):qsTr("false") + text: model.scroll ? qsTr("scrolling"):"" onClicked: { control.clicked() diff --git a/OmobiDisplayApp/ressources/qml/PasswordInputDelegate.qml b/OmobiDisplayApp/ressources/qml/PasswordInputDelegate.qml index 00326e4..707ca94 100644 --- a/OmobiDisplayApp/ressources/qml/PasswordInputDelegate.qml +++ b/OmobiDisplayApp/ressources/qml/PasswordInputDelegate.qml @@ -45,10 +45,11 @@ ItemDelegate { } font.pixelSize: parent.height * 0.5 + font.styleName: fontAwesome.name verticalAlignment: Text.AlignVCenter - text: ">" + text: "\uf105" } Dialog { diff --git a/OmobiDisplayApp/ressources/qml/SpinBoxDelegate.qml b/OmobiDisplayApp/ressources/qml/SpinBoxDelegate.qml index 34c13d2..f8d8d98 100644 --- a/OmobiDisplayApp/ressources/qml/SpinBoxDelegate.qml +++ b/OmobiDisplayApp/ressources/qml/SpinBoxDelegate.qml @@ -38,12 +38,13 @@ ItemDelegate { } font.pixelSize: parent.height * 0.5 + font.styleName: fontAwesome.name verticalAlignment: Text.AlignVCenter color: control.Material.foreground - text: ">" + text: "\uf105" } Dialog { diff --git a/OmobiDisplayApp/ressources/qml/TextEditDialog.qml b/OmobiDisplayApp/ressources/qml/TextEditDialog.qml index 58ba22e..f248110 100644 --- a/OmobiDisplayApp/ressources/qml/TextEditDialog.qml +++ b/OmobiDisplayApp/ressources/qml/TextEditDialog.qml @@ -116,7 +116,7 @@ Dialog { id: scrollCountSpinBox Layout.fillWidth: true from: 0 - text: qsTr("Scroll count:") + text: qsTr("Scroll count") } } } diff --git a/OmobiDisplayApp/ressources/qml/TextInputDelegate.qml b/OmobiDisplayApp/ressources/qml/TextInputDelegate.qml index 0e708ad..54d3618 100644 --- a/OmobiDisplayApp/ressources/qml/TextInputDelegate.qml +++ b/OmobiDisplayApp/ressources/qml/TextInputDelegate.qml @@ -22,7 +22,7 @@ ItemDelegate { rightMargin: control.padding } - width: parent.width * 0.6 + width: parent.width * 0.4 elide: Text.ElideRight font.pixelSize: parent.font.pixelSize @@ -43,12 +43,13 @@ ItemDelegate { } font.pixelSize: parent.height * 0.5 + font.styleName: fontAwesome.name verticalAlignment: Text.AlignVCenter color: control.textColor - text: ">" + text: "\uf105" } Dialog { diff --git a/OmobiDisplayApp/ressources/qml/main.qml b/OmobiDisplayApp/ressources/qml/main.qml index d7e292a..31f4139 100644 --- a/OmobiDisplayApp/ressources/qml/main.qml +++ b/OmobiDisplayApp/ressources/qml/main.qml @@ -4,12 +4,13 @@ import QtQuick.Window 2.12 import de.itsblue.omobidisplayapp 1.0 import de.itsblue.bluetoothleuart 1.0 import QtQuick.Controls.Material 2.0 +import QtQuick.Layouts 1.0 ApplicationWindow { width: 540 height: 960 visible: true - title: qsTr("Hello World") + title: qsTr("Itsblue smart display") Page { id: app @@ -26,16 +27,73 @@ ApplicationWindow { Material.theme: Material.System header: ToolBar { + id: headerToolBar + + height: 50 + implicitWidth: parent.width + Material.background: "white" - Image { + RowLayout { anchors.fill: parent - anchors.margins: parent.height * 0.1 - fillMode: Image.PreserveAspectFit - source: "qrc:/omobi.png" + ToolButton { + id: backToolButton + + enabled: false + Layout.fillHeight: true + Layout.preferredWidth: height + + opacity: mainStack.currentItem.backButtonVisible ? 1:0 + + font.styleName: fontAwesome.name + font.pixelSize: height * 0.6 + Material.foreground: "black" + + text: "\uf104" + + contentItem: Item {} + + Text { + anchors.centerIn: parent + font.pixelSize: parent.font.pixelSize + text: parent.text + } + + onClicked: mainStack.currentItem.backButtonClicked() + } + + Text { + Layout.fillHeight: true + Layout.fillWidth: true + Layout.alignment: Layout.Center + + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + + text: mainStack.currentItem.title + } + + ToolButton { + id: actionToolButton + + Layout.fillHeight: true + Layout.preferredWidth: height + + opacity: mainStack.currentItem.actionButtonVisible ? 1:0 + + font.styleName: fontAwesome.name + font.pixelSize: height * 0.4 + Material.foreground: "black" + + flat: true + + text: "\uf013" + + onClicked: mainStack.currentItem.actionButtonClicked() + + } } - } OmobiDisplayBackend { @@ -61,6 +119,22 @@ ApplicationWindow { initialItem: connectedPageComp + replaceEnter: Transition { + NumberAnimation { + properties: "opacity" + from: 0 + to: 1 + } + } + + replaceExit: Transition { + NumberAnimation { + properties: "opacity" + from: 1 + to: 0 + } + } + Component { id: connectPageComp ConnectPage { @@ -71,6 +145,7 @@ ApplicationWindow { Component { id: connectedPageComp ConnectedPage { + opacity: 0 state: app.state } } @@ -92,7 +167,7 @@ ApplicationWindow { currentComponent: connectPageComp } }, - + State { name: OmobiDisplayBackend.ReadyToConnect PropertyChanges { @@ -139,6 +214,14 @@ ApplicationWindow { target: mainStack currentComponent: connectedPageComp } + PropertyChanges { + target: headerToolBar + state: "open" + } + PropertyChanges { + target: backToolButton + enabled: true + } }, State { @@ -147,6 +230,14 @@ ApplicationWindow { target: mainStack currentComponent: connectedPageComp } + PropertyChanges { + target: headerToolBar + state: "open" + } + PropertyChanges { + target: backToolButton + enabled: true + } } ] } diff --git a/OmobiDisplayApp/ressources/qml/qml.qrc b/OmobiDisplayApp/ressources/qml/qml.qrc index 20565fe..40ec2cd 100644 --- a/OmobiDisplayApp/ressources/qml/qml.qrc +++ b/OmobiDisplayApp/ressources/qml/qml.qrc @@ -7,7 +7,6 @@ DisplayTextModelListView.qml TextEditDialog.qml TextInputDelegate.qml - NextPageDelegate.qml SpinBoxDelegate.qml ComboBoxDelegate.qml ColorPickerDelegate.qml diff --git a/OmobiDisplayApp/ressources/translations/de.qm b/OmobiDisplayApp/ressources/translations/de.qm new file mode 100644 index 0000000000000000000000000000000000000000..55c0917ba5ede975236b059af17271dc54f395f3 GIT binary patch literal 3073 zcmb_eOK2oj6uq5v_jJ1Rn>Z8AOwbn<>5QQnF)JCxm_&`r5KNqih*(|qQYox{)mFVu zCRzAd=~5UK6o0dbZiXO2qCtkN1QB%S!i7H^(Vd$hE_Cp`S6$WVo~ocCP1pC`b3f z%?MHU)2^4c)`+^^?cV+V0_-Te@!@A!hx5lcA9*o*dE_a)uV(iyY!PMpa$~_)IB(}} zuAT+XX6}v0;D@$yZ@xZ3)bm2_(%bI<p^b&Y!4E0`G$!bLki0?G-=zaUSQp zOWixqVcqkkAO3n3aTZGZpPN|!erf-z1kP@+`QF#SeZ2SLE#r9qO5a^4??E25zN={r2%8TeVku5hP=#lLpL@-{k0oP1iQKgp&l8Mx-eXoegLs7@}P ztW!|HQp)2$G_`6tu2FS4vz(yr8tcIkJT6UpLU2>g8#d1<+zEOBI92=w&;p<-RI7PE zO`g7HxOYgz=*2lvZ%Af(7EeU2(8HmHM(cSuYNkEqe`NCBj?( z4xTD-xrhYn_^I?7RKrn~Q{dPjiMtJ)RRJ1g(h8oolD+kspek(9s59xYz%&FiY{L%U=lGZZ5*xWR#Y_!*-GbU zP?531eI7BAh+d#(GsiJyQ``3hJ%Vvkt*O{Dz=|4=_L2;^o?#&sW*O2*E6YT4YFll^ z04H>_)d1=?C#@ZNMEdIr84YGM{&!E_@6(MmN#Xv6dq<)P*!3 zgIZuhS!fTo*sMd-vacyH+=?aUbVtXthzV4;Op`c1fjFIL?r1z_==zyZy0p-+@+7pu zc4RQF2tL|;H)}a^#xY#a)_QiP!c6RnC}dtLvJ~FY@zp22yHc@N{GKYa(Ne*uLP1(Ed>C zLF_ChsP=Rd9Nb-c0@L?gw<(IL?u#@Pg&(`lPwBvw<9-!y$0!WLqyfKvbGBsIe6e}Y zlgN#Fp|Cv-SFxoAkrnZKXW<{emXxjZVEXMyc+Z! zNh(#W#ve6Ye;_1ff1}oLwF`yb6mnT}sCN05#`HhhfW88}> + + + + ConnectPage + + Available devices + Verfügbare Geräte + + + Input code + Geben sie den Code ein + + + code + Code + + + Tap here to scan + Tippe hier um zu suchen + + + Scanning... + Suchen... + + + Please select a device or tap to scan again + Wähle ein Display, oder tippe um erneut zu suchen + + + trying to authenticate... + Versuche anzumelden... + + + trying to connect... + Versuche zu verbinden... + + + loading data... + Lade Daten... + + + Available displays + Verfügbare Displays + + + Still scanning + Suche läuft + + + No displays found + Keine Displays gefunden + + + No displays found. Tap to scan again + Keine Displays gefunden. Tippe um erneut zu suchen + + + + ConnectedPage + + Brightness: + Helligkeit: + + + loading... + laden... + + + + DisplayEditDialog + + Edit display settings + Display Einstellungen bearbeiten + + + Display name +(needs restart) + Displayname\n(neutstart nötig) + + + Display code (4 digits) + Display Code (4 Zeichen) + + + Enter new display code + Geben sie den neuen Display Code ein + + + Enter new display code again + Geben sie den neuen Display Code erneut ein + + + + DisplayTextDelegate + + scrolling + scrollen + + + false + nein + + + active + aktiv + + + inactive + inaktiv + + + + TextEditDialog + + Active + Aktiv + + + Enter some text to be displayed + Geben sie den anzuzeigenden Text ein + + + Text + Text + + + Runtime (in s) + Laufzeit (in s) + + + Color + Farbe + + + Alignment + Ausrichtung + + + Scroll + Scrollen + + + Scroll speed + Scrollgeschwindigkeit + + + Scroll count: + Scrolldurchläufe + + + Scroll count + Scrolldurchläufe + + + + main + + Itsblue smart display + Itsblue smart display + + + diff --git a/OmobiDisplayApp/ressources/translations/translations.qrc b/OmobiDisplayApp/ressources/translations/translations.qrc new file mode 100644 index 0000000..4923ee3 --- /dev/null +++ b/OmobiDisplayApp/ressources/translations/translations.qrc @@ -0,0 +1,5 @@ + + + de.qm + +