- Major styling improvements
- Some renaming
This commit is contained in:
parent
4cc66eb082
commit
fe5292afac
21 changed files with 493 additions and 171 deletions
|
@ -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 =
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 76e457593e889885fd410fdbcdd659706a1eceb8
|
||||
Subproject commit 1ec609e7c22308cacffe7fe03de14380463b8470
|
|
@ -1,7 +1,8 @@
|
|||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQuickStyle>
|
||||
#include <qbluetoothleuart.h>
|
||||
#include <qbluetoothleuartclient.h>
|
||||
#include <QTranslator>
|
||||
|
||||
#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<OmobiDisplayBackend>("de.itsblue.omobidisplayapp", 1, 0, "OmobiDisplayBackend");
|
||||
qmlRegisterUncreatableType<OmobiDisplayTextModel>("de.itsblue.omobidisplayapp", 1, 0, "OmobiDisplayTextModel", "OmobiDisplayTextModel cannot be created");
|
||||
QBluetoothLeUart::init();
|
||||
QBluetoothLeUartClient::init();
|
||||
|
||||
QQuickStyle::setStyle("Material");
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
#include <QJsonDocument>
|
||||
#include <QCryptographicHash>
|
||||
|
||||
#include <qbluetoothleuart.h>
|
||||
#include <qbluetoothleuartclient.h>
|
||||
#include <omobidisplaytextmodel.h>
|
||||
|
||||
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();
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -44,10 +44,11 @@ ItemDelegate {
|
|||
}
|
||||
|
||||
font.pixelSize: parent.height * 0.5
|
||||
font.styleName: fontAwesome.name
|
||||
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
||||
text: ">"
|
||||
text: "\uf105"
|
||||
}
|
||||
|
||||
Dialog {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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"
|
||||
|
||||
onClicked: {
|
||||
backend.bleClient.startScanningForDevices()
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
spacing: mainLayout.anchors.margins
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: width * 0.05
|
||||
anchors.rightMargin: 0
|
||||
|
||||
Text {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
font.pixelSize: parent.height * 0.4
|
||||
text: root.statusText
|
||||
}
|
||||
|
||||
fontSizeMode: Text.Fit
|
||||
font.pixelSize: 500
|
||||
minimumPixelSize: 1
|
||||
BusyIndicator {
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredWidth: height
|
||||
|
||||
text: qsTr("Available devices")
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,61 +10,52 @@ 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
|
||||
|
||||
interactive: false
|
||||
|
||||
color: "white"
|
||||
|
||||
RowLayout {
|
||||
spacing: mainLayout.anchors.margins
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: width * 0.05
|
||||
anchors.rightMargin: anchors.leftMargin
|
||||
|
||||
Text {
|
||||
Layout.fillHeight: true
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
fontSizeMode: Text.Fit
|
||||
font.pixelSize: 500
|
||||
minimumPixelSize: 1
|
||||
|
||||
color: root.Material.foreground
|
||||
|
||||
text: backend.bleController.currentDevice === null ? "":backend.bleController.currentDevice.name
|
||||
|
||||
ToolButton {
|
||||
id: editButton
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.right
|
||||
margins: parent.height * 0.1
|
||||
}
|
||||
|
||||
height: parent.height * 0.7
|
||||
width: height
|
||||
|
||||
font.styleName: fontAwesome.name
|
||||
font.pixelSize: height * 0.3
|
||||
|
||||
flat: true
|
||||
|
||||
text: "\uf044"
|
||||
|
||||
onClicked: displayEditDialog.edit()
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
Layout.alignment: Layout.Center
|
||||
|
||||
color: root.Material.foreground
|
||||
|
||||
text: qsTr("Brightness:")
|
||||
font.pixelSize: parent.height * 0.5
|
||||
text: "\uf186"
|
||||
}
|
||||
|
||||
Slider {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
from: 0
|
||||
to: 10
|
||||
|
@ -78,6 +69,20 @@ Page {
|
|||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
Layout.fillHeight: true
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
font.pixelSize: parent.height * 0.5
|
||||
text: "\uf185"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: mainLayout.height * 0.025
|
||||
}
|
||||
|
||||
DisplayTextModelListView {
|
||||
Layout.preferredWidth: parent.width
|
||||
Layout.fillHeight: true
|
||||
|
|
|
@ -72,7 +72,7 @@ Dialog {
|
|||
|
||||
reset()
|
||||
|
||||
nameTextField.value = backend.bleController.currentDevice.name
|
||||
nameTextField.value = backend.bleClient.currentDevice.name
|
||||
|
||||
open()
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ ItemDelegate {
|
|||
ColorAnimation {}
|
||||
}
|
||||
|
||||
text: model.scroll ? qsTr("scrolling"):qsTr("false")
|
||||
text: model.scroll ? qsTr("scrolling"):""
|
||||
|
||||
onClicked: {
|
||||
control.clicked()
|
||||
|
|
|
@ -45,10 +45,11 @@ ItemDelegate {
|
|||
}
|
||||
|
||||
font.pixelSize: parent.height * 0.5
|
||||
font.styleName: fontAwesome.name
|
||||
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
||||
text: ">"
|
||||
text: "\uf105"
|
||||
}
|
||||
|
||||
Dialog {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -116,7 +116,7 @@ Dialog {
|
|||
id: scrollCountSpinBox
|
||||
Layout.fillWidth: true
|
||||
from: 0
|
||||
text: qsTr("Scroll count:")
|
||||
text: qsTr("Scroll count")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
<file>DisplayTextModelListView.qml</file>
|
||||
<file>TextEditDialog.qml</file>
|
||||
<file>TextInputDelegate.qml</file>
|
||||
<file>NextPageDelegate.qml</file>
|
||||
<file>SpinBoxDelegate.qml</file>
|
||||
<file>ComboBoxDelegate.qml</file>
|
||||
<file>ColorPickerDelegate.qml</file>
|
||||
|
|
BIN
OmobiDisplayApp/ressources/translations/de.qm
Normal file
BIN
OmobiDisplayApp/ressources/translations/de.qm
Normal file
Binary file not shown.
163
OmobiDisplayApp/ressources/translations/de.ts
Normal file
163
OmobiDisplayApp/ressources/translations/de.ts
Normal file
|
@ -0,0 +1,163 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="de_DE" sourcelanguage="en">
|
||||
<context>
|
||||
<name>ConnectPage</name>
|
||||
<message>
|
||||
<source>Available devices</source>
|
||||
<translation type="vanished">Verfügbare Geräte</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Input code</source>
|
||||
<translation>Geben sie den Code ein</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>code</source>
|
||||
<translation>Code</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Tap here to scan</source>
|
||||
<translation>Tippe hier um zu suchen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scanning...</source>
|
||||
<translation>Suchen...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Please select a device or tap to scan again</source>
|
||||
<translation>Wähle ein Display, oder tippe um erneut zu suchen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>trying to authenticate...</source>
|
||||
<translation>Versuche anzumelden...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>trying to connect...</source>
|
||||
<translation>Versuche zu verbinden...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>loading data...</source>
|
||||
<translation>Lade Daten...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Available displays</source>
|
||||
<translation>Verfügbare Displays</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Still scanning</source>
|
||||
<translation>Suche läuft</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No displays found</source>
|
||||
<translation>Keine Displays gefunden</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>No displays found. Tap to scan again</source>
|
||||
<translation>Keine Displays gefunden. Tippe um erneut zu suchen</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ConnectedPage</name>
|
||||
<message>
|
||||
<source>Brightness:</source>
|
||||
<translation type="vanished">Helligkeit:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>loading...</source>
|
||||
<translation>laden...</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DisplayEditDialog</name>
|
||||
<message>
|
||||
<source>Edit display settings</source>
|
||||
<translation>Display Einstellungen bearbeiten</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Display name
|
||||
(needs restart)</source>
|
||||
<translation>Displayname\n(neutstart nötig)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Display code (4 digits)</source>
|
||||
<translation>Display Code (4 Zeichen)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enter new display code</source>
|
||||
<translation>Geben sie den neuen Display Code ein</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enter new display code again</source>
|
||||
<translation>Geben sie den neuen Display Code erneut ein</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DisplayTextDelegate</name>
|
||||
<message>
|
||||
<source>scrolling</source>
|
||||
<translation>scrollen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>false</source>
|
||||
<translation type="vanished">nein</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> active </source>
|
||||
<translation> aktiv </translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>inactive</source>
|
||||
<translation>inaktiv</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>TextEditDialog</name>
|
||||
<message>
|
||||
<source>Active</source>
|
||||
<translation>Aktiv</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Enter some text to be displayed</source>
|
||||
<translation>Geben sie den anzuzeigenden Text ein</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Text</source>
|
||||
<translation>Text</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Runtime (in s)</source>
|
||||
<translation>Laufzeit (in s)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Color</source>
|
||||
<translation>Farbe</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Alignment</source>
|
||||
<translation>Ausrichtung</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scroll</source>
|
||||
<translation>Scrollen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scroll speed</source>
|
||||
<translation>Scrollgeschwindigkeit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scroll count:</source>
|
||||
<translation type="vanished">Scrolldurchläufe</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Scroll count</source>
|
||||
<translation>Scrolldurchläufe</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>main</name>
|
||||
<message>
|
||||
<source>Itsblue smart display</source>
|
||||
<translation>Itsblue smart display</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
5
OmobiDisplayApp/ressources/translations/translations.qrc
Normal file
5
OmobiDisplayApp/ressources/translations/translations.qrc
Normal file
|
@ -0,0 +1,5 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>de.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
Loading…
Reference in a new issue