- Major styling improvements

- Some renaming
This commit is contained in:
Dorian Zedler 2020-10-17 21:51:33 +02:00
parent 4cc66eb082
commit fe5292afac
Signed by: dorian
GPG key ID: D3B255CB8BC7CD37
21 changed files with 493 additions and 171 deletions

View file

@ -20,7 +20,11 @@ HEADERS += \
RESOURCES += \ RESOURCES += \
ressources/qml/qml.qrc \ 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 # Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH = QML_IMPORT_PATH =

@ -1 +1 @@
Subproject commit 76e457593e889885fd410fdbcdd659706a1eceb8 Subproject commit 1ec609e7c22308cacffe7fe03de14380463b8470

View file

@ -1,7 +1,8 @@
#include <QGuiApplication> #include <QGuiApplication>
#include <QQmlApplicationEngine> #include <QQmlApplicationEngine>
#include <QQuickStyle> #include <QQuickStyle>
#include <qbluetoothleuart.h> #include <qbluetoothleuartclient.h>
#include <QTranslator>
#include "omobidisplaybackend.h" #include "omobidisplaybackend.h"
#include "omobidisplaytextmodel.h" #include "omobidisplaytextmodel.h"
@ -12,9 +13,14 @@ int main(int argc, char *argv[])
QGuiApplication app(argc, 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"); qmlRegisterType<OmobiDisplayBackend>("de.itsblue.omobidisplayapp", 1, 0, "OmobiDisplayBackend");
qmlRegisterUncreatableType<OmobiDisplayTextModel>("de.itsblue.omobidisplayapp", 1, 0, "OmobiDisplayTextModel", "OmobiDisplayTextModel cannot be created"); qmlRegisterUncreatableType<OmobiDisplayTextModel>("de.itsblue.omobidisplayapp", 1, 0, "OmobiDisplayTextModel", "OmobiDisplayTextModel cannot be created");
QBluetoothLeUart::init(); QBluetoothLeUartClient::init();
QQuickStyle::setStyle("Material"); QQuickStyle::setStyle("Material");

View file

@ -2,8 +2,8 @@
OmobiDisplayBackend::OmobiDisplayBackend(QObject *parent) : QObject(parent) OmobiDisplayBackend::OmobiDisplayBackend(QObject *parent) : QObject(parent)
{ {
this->ble = new QBluetoothLeUart(); this->bleClient = new QBluetoothLeUartClient();
this->ble->setUUIDs("92fecb20-1406-426a-afa5-cd5c1f306462", "92fecb21-1406-426a-afa5-cd5c1f306462", "92fecb22-1406-426a-afa5-cd5c1f306462"); this->bleClient->setUUIDs("92fecb20-1406-426a-afa5-cd5c1f306462", "92fecb21-1406-426a-afa5-cd5c1f306462", "92fecb22-1406-426a-afa5-cd5c1f306462");
this->displayTextModel = new OmobiDisplayTextModel(this); this->displayTextModel = new OmobiDisplayTextModel(this);
this->textSetsBuffer.clear(); this->textSetsBuffer.clear();
this->displayBrightness = -1; this->displayBrightness = -1;
@ -14,65 +14,65 @@ OmobiDisplayBackend::OmobiDisplayBackend(QObject *parent) : QObject(parent)
this->keepAliveTimer->setSingleShot(false); this->keepAliveTimer->setSingleShot(false);
connect(this->keepAliveTimer, &QTimer::timeout, this, &OmobiDisplayBackend::sendBluetoothKeepAlive); connect(this->keepAliveTimer, &QTimer::timeout, this, &OmobiDisplayBackend::sendBluetoothKeepAlive);
connect(this->ble, &QBluetoothLeUart::stateChanged, this, &OmobiDisplayBackend::handleBluetoothStateChange); connect(this->bleClient, &QBluetoothLeUartClient::stateChanged, this, &OmobiDisplayBackend::handleBluetoothStateChange);
connect(this->ble, &QBluetoothLeUart::foundNewDevice, this, &OmobiDisplayBackend::handleFoundNewDevice); connect(this->bleClient, &QBluetoothLeUartClient::foundNewDevice, this, &OmobiDisplayBackend::handleFoundNewDevice);
connect(this->ble, &QBluetoothLeUart::dataReceived, this, &OmobiDisplayBackend::handleBluetoothDataReceived); connect(this->bleClient, &QBluetoothLeUartClient::dataReceived, this, &OmobiDisplayBackend::handleBluetoothDataReceived);
connect(this->ble, &QBluetoothLeUart::connectedToDevice, this, &OmobiDisplayBackend::handleBluetoothDeviceConected); connect(this->bleClient, &QBluetoothLeUartClient::connectedToDevice, this, &OmobiDisplayBackend::handleBluetoothDeviceConected);
connect(this->displayTextModel, &OmobiDisplayTextModel::dataChanged, this, &OmobiDisplayBackend::handleDisplayTextModelDataChanged); connect(this->displayTextModel, &OmobiDisplayTextModel::dataChanged, this, &OmobiDisplayBackend::handleDisplayTextModelDataChanged);
connect(this->displayTextModel, &OmobiDisplayTextModel::rowsInserted, this, &OmobiDisplayBackend::handleDisplayTextModelRowsInserted); connect(this->displayTextModel, &OmobiDisplayTextModel::rowsInserted, this, &OmobiDisplayBackend::handleDisplayTextModelRowsInserted);
connect(this->displayTextModel, &OmobiDisplayTextModel::rowsRemoved, this, &OmobiDisplayBackend::handleDisplayTextModelRowsRemoved); connect(this->displayTextModel, &OmobiDisplayTextModel::rowsRemoved, this, &OmobiDisplayBackend::handleDisplayTextModelRowsRemoved);
this->setState(Idle); this->setState(Idle);
this->ble->startScanningForDevices(); this->bleClient->startScanningForDevices();
} }
void OmobiDisplayBackend::startScanning() { void OmobiDisplayBackend::startScanning() {
this->ble->startScanningForDevices(); this->bleClient->startScanningForDevices();
} }
void OmobiDisplayBackend::authenticate(QString code) { void OmobiDisplayBackend::authenticate(QString code) {
// tell display to send over existing model data // tell display to send over existing model data
this->setState(Authenticating); 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(); QString secret = QCryptographicHash::hash(combinedCode.toUtf8(), QCryptographicHash::Sha256).toHex();
this->sendBluetoothCommand(AuthorizeSessionCommand, QVariantMap{{"secret", secret}}); this->sendBluetoothCommand(AuthorizeSessionCommand, QVariantMap{{"secret", secret}});
} }
void OmobiDisplayBackend::handleBluetoothStateChange(QBluetoothLeUart::BluetoothLeUartState state){ void OmobiDisplayBackend::handleBluetoothStateChange(QBluetoothLeUartClient::BluetoothLeUartClientState state){
switch(state){ switch(state){
case QBluetoothLeUart::Idle: { case QBluetoothLeUartClient::Idle: {
this->setState(Idle); this->setState(Idle);
break; break;
} }
case QBluetoothLeUart::Scanning: { case QBluetoothLeUartClient::Scanning: {
this->setState(Scanning); this->setState(Scanning);
break; break;
} }
case QBluetoothLeUart::ScanFinished: { case QBluetoothLeUartClient::ScanFinished: {
this->setState(ReadyToConnect); this->setState(ReadyToConnect);
break; break;
} }
case QBluetoothLeUart::Connecting: { case QBluetoothLeUartClient::Connecting: {
this->setState(Connecting); this->setState(Connecting);
break; break;
} }
case QBluetoothLeUart::ScanningForService: { case QBluetoothLeUartClient::ScanningForService: {
this->setState(Connecting); this->setState(Connecting);
break; break;
} }
case QBluetoothLeUart::ServiceFound: { case QBluetoothLeUartClient::ServiceFound: {
this->setState(Connecting); this->setState(Connecting);
break; break;
} }
case QBluetoothLeUart::Connected: case QBluetoothLeUartClient::Connected:
{ {
break; break;
} }
} }
if(state == QBluetoothLeUart::Connected) if(state == QBluetoothLeUartClient::Connected)
this->keepAliveTimer->start(); this->keepAliveTimer->start();
else if(this->keepAliveTimer->isActive()) else if(this->keepAliveTimer->isActive())
this->keepAliveTimer->stop(); this->keepAliveTimer->stop();
@ -80,6 +80,7 @@ void OmobiDisplayBackend::handleBluetoothStateChange(QBluetoothLeUart::Bluetooth
void OmobiDisplayBackend::handleBluetoothDeviceConected() { void OmobiDisplayBackend::handleBluetoothDeviceConected() {
this->setState(AuthenticationRequired); this->setState(AuthenticationRequired);
this->authenticate("1234");
// TODO: stuff // TODO: stuff
} }
@ -124,7 +125,7 @@ void OmobiDisplayBackend::sendBluetoothCommand(OmobiDisplayCommand command, QVar
if(this->state == Connected) if(this->state == Connected)
this->setState(Loading); this->setState(Loading);
this->ble->sendData(doc.toJson(QJsonDocument::Compact)); this->bleClient->sendData(doc.toJson(QJsonDocument::Compact));
} }
void OmobiDisplayBackend::sendBluetoothKeepAlive() { void OmobiDisplayBackend::sendBluetoothKeepAlive() {
@ -132,7 +133,7 @@ void OmobiDisplayBackend::sendBluetoothKeepAlive() {
qDebug() << "Sending keep alive: \n" << qPrintable(doc.toJson(QJsonDocument::Indented)); 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){ void OmobiDisplayBackend::handleBluetoothDataReceived(QString s){
@ -240,8 +241,8 @@ void OmobiDisplayBackend::updateDisplayTextSetParameter(int index, int parameter
this->sendBluetoothCommand(SetTextSetParameterCommand, dataMap); this->sendBluetoothCommand(SetTextSetParameterCommand, dataMap);
} }
QBluetoothLeUart* OmobiDisplayBackend::getBleController() { QBluetoothLeUartClient* OmobiDisplayBackend::getBleClient() {
return this->ble; return this->bleClient;
} }
@ -277,7 +278,7 @@ void OmobiDisplayBackend::setState(OmobiDisplayAppState state) {
qDebug() << "Now in " << state << " state"; qDebug() << "Now in " << state << " state";
if(this->state == Idle) if(this->state == Idle)
this->ble->startScanningForDevices(); this->bleClient->startScanningForDevices();
} }
int OmobiDisplayBackend::getDisplayBrightness() { int OmobiDisplayBackend::getDisplayBrightness() {

View file

@ -6,13 +6,13 @@
#include <QJsonDocument> #include <QJsonDocument>
#include <QCryptographicHash> #include <QCryptographicHash>
#include <qbluetoothleuart.h> #include <qbluetoothleuartclient.h>
#include <omobidisplaytextmodel.h> #include <omobidisplaytextmodel.h>
class OmobiDisplayBackend : public QObject class OmobiDisplayBackend : public QObject
{ {
Q_OBJECT 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(OmobiDisplayAppState state READ getState WRITE setState NOTIFY stateChanged)
Q_PROPERTY(OmobiDisplayTextModel* displayTextModel READ getDisplayTextModel NOTIFY displayTextModelChanged) Q_PROPERTY(OmobiDisplayTextModel* displayTextModel READ getDisplayTextModel NOTIFY displayTextModelChanged)
Q_PROPERTY(int displayBrightness READ getDisplayBrightness WRITE setDisplayBrightness NOTIFY displayBrightnessChanged) Q_PROPERTY(int displayBrightness READ getDisplayBrightness WRITE setDisplayBrightness NOTIFY displayBrightnessChanged)
@ -52,7 +52,7 @@ private:
}; };
OmobiDisplayAppState state; OmobiDisplayAppState state;
QBluetoothLeUart *ble; QBluetoothLeUartClient *bleClient;
QTimer *keepAliveTimer; QTimer *keepAliveTimer;
OmobiDisplayTextModel* displayTextModel; OmobiDisplayTextModel* displayTextModel;
int waitingCommands; int waitingCommands;
@ -62,7 +62,7 @@ private:
public slots: public slots:
Q_INVOKABLE void startScanning(); Q_INVOKABLE void startScanning();
Q_INVOKABLE void authenticate(QString secret); Q_INVOKABLE void authenticate(QString secret);
Q_INVOKABLE QBluetoothLeUart* getBleController(); Q_INVOKABLE QBluetoothLeUartClient* getBleClient();
Q_INVOKABLE OmobiDisplayAppState getState(); Q_INVOKABLE OmobiDisplayAppState getState();
Q_INVOKABLE OmobiDisplayTextModel* getDisplayTextModel(); Q_INVOKABLE OmobiDisplayTextModel* getDisplayTextModel();
Q_INVOKABLE int getDisplayBrightness(); Q_INVOKABLE int getDisplayBrightness();
@ -71,7 +71,7 @@ public slots:
Q_INVOKABLE void setDisplayName(QString name); Q_INVOKABLE void setDisplayName(QString name);
private slots: private slots:
void handleBluetoothStateChange(QBluetoothLeUart::BluetoothLeUartState state); void handleBluetoothStateChange(QBluetoothLeUartClient::BluetoothLeUartClientState state);
void handleFoundNewDevice(QBluetoothLeUartDevice* device); void handleFoundNewDevice(QBluetoothLeUartDevice* device);
void handleBluetoothDeviceConected(); void handleBluetoothDeviceConected();
@ -90,7 +90,7 @@ private slots:
signals: signals:
void stateChanged(); void stateChanged();
void bleControllerChanged(); void bleClientChanged();
void displayTextModelChanged(); void displayTextModelChanged();
void displayBrightnessChanged(); void displayBrightnessChanged();

View file

@ -14,11 +14,11 @@ Item {
property string text: "" property string text: ""
property string color: "" property string color: ""
property bool isDarkColor: control.checkIsDarkColor(color) property bool isDarkColor: control.checkIsDarkColor(color)
property double glowRadius: 0.001 property double glowRadius: 0.01
property double glowSpread: 0.2 property double glowSpread: 0.01
property bool glowVisible: true property bool glowVisible: true
property double glowScale: 0.9 property double glowScale: 1
property double glowOpacity: Math.pow( control.opacity, 100 ) property double glowOpacity: Math.pow( control.opacity, 100 ) * 0.5
property bool interactive: true property bool interactive: true
signal clicked signal clicked

View file

@ -44,10 +44,11 @@ ItemDelegate {
} }
font.pixelSize: parent.height * 0.5 font.pixelSize: parent.height * 0.5
font.styleName: fontAwesome.name
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
text: ">" text: "\uf105"
} }
Dialog { Dialog {

View file

@ -42,12 +42,13 @@ ItemDelegate {
} }
font.pixelSize: parent.height * 0.5 font.pixelSize: parent.height * 0.5
font.styleName: fontAwesome.name
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
color: control.Material.foreground color: control.Material.foreground
text: ">" text: "\uf105"
} }
Dialog { Dialog {

View file

@ -9,34 +9,67 @@ import QtGraphicalEffects 1.0
Page { Page {
id: root id: root
property bool actionButtonVisible: false
property bool backButtonVisible: false
property string statusText property string statusText
property bool working property bool working
title: qsTr("Available displays")
ColumnLayout { ColumnLayout {
id: mainLayout
anchors { anchors {
fill: parent fill: parent
margins: parent.height * 0.01 margins: Math.min(parent.height, parent.width) * 0.05
topMargin: 0
} }
Text { Chip {
Layout.preferredWidth: parent.width * 0.6 Layout.fillWidth: true
Layout.preferredHeight: parent.height * 0.1 Layout.preferredHeight: mainLayout.height * 0.05
Layout.alignment: Layout.Center Layout.alignment: Layout.Center
color: "white"
verticalAlignment: Text.AlignVCenter onClicked: {
horizontalAlignment: Text.AlignHCenter backend.bleClient.startScanningForDevices()
}
fontSizeMode: Text.Fit RowLayout {
font.pixelSize: 500 spacing: mainLayout.anchors.margins
minimumPixelSize: 1
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 { ListView {
id: availableDevicesListView id: availableDisplaysListView
Layout.preferredWidth: parent.width Layout.preferredWidth: parent.width
Layout.fillHeight: true Layout.fillHeight: true
@ -45,7 +78,7 @@ Page {
clip: true clip: true
boundsBehavior: Flickable.OvershootBounds boundsBehavior: Flickable.OvershootBounds
model: backend.bleController.availableDevicesModel model: backend.bleClient.availableDevicesModel
add: Transition { add: Transition {
NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 200 } NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 200 }
@ -59,64 +92,19 @@ Page {
spacing: 5 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 { delegate: ItemDelegate {
width: parent.width width: parent.width
text: name text: name
onClicked: backend.bleController.connectToDevice(device) onClicked: backend.bleClient.connectToDevice(device)
Rectangle { Rectangle {
anchors { anchors {
top: parent.top top: parent.top
left: parent.left left: parent.left
right: parent.right right: parent.right
topMargin: - availableDevicesListView.spacing * 0.5 topMargin: - availableDisplaysListView.spacing * 0.5
} }
color: "lightgrey" color: "lightgrey"
@ -124,6 +112,61 @@ Page {
visible: index !== 0 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: { onRejected: {
backend.bleController.disconnectFromDevice() backend.bleClient.disconnectFromDevice()
} }
contentItem: TextField { contentItem: TextField {
@ -172,7 +215,7 @@ Page {
PropertyChanges { PropertyChanges {
target: root target: root
statusText: "Tap here to scan" statusText: qsTr("Tap here to scan")
working: false working: false
} }
}, },
@ -181,7 +224,7 @@ Page {
PropertyChanges { PropertyChanges {
target: root target: root
statusText: "Scanning..." statusText: qsTr("Scanning...")
working: true working: true
} }
}, },
@ -190,7 +233,7 @@ Page {
PropertyChanges { PropertyChanges {
target: root 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 working: false
} }
}, },
@ -204,13 +247,13 @@ Page {
} }
PropertyChanges { PropertyChanges {
target: availableDevicesListView target: availableDisplaysListView
enabled: false enabled: false
} }
PropertyChanges { PropertyChanges {
target: root target: root
statusText: "trying to authenticate..." statusText: qsTr("trying to authenticate...")
working: true working: true
} }
}, },
@ -218,13 +261,13 @@ Page {
name: OmobiDisplayBackend.Authenticating name: OmobiDisplayBackend.Authenticating
PropertyChanges { PropertyChanges {
target: availableDevicesListView target: availableDisplaysListView
enabled: false enabled: false
} }
PropertyChanges { PropertyChanges {
target: root target: root
statusText: "trying to authenticate..." statusText: qsTr("trying to authenticate...")
working: true working: true
} }
}, },
@ -233,13 +276,13 @@ Page {
name: OmobiDisplayBackend.Connecting name: OmobiDisplayBackend.Connecting
PropertyChanges { PropertyChanges {
target: availableDevicesListView target: availableDisplaysListView
enabled: false enabled: false
} }
PropertyChanges { PropertyChanges {
target: root target: root
statusText: "trying to connect..." statusText: qsTr("trying to connect...")
working: true working: true
} }
}, },
@ -247,13 +290,13 @@ Page {
name: OmobiDisplayBackend.Initing name: OmobiDisplayBackend.Initing
PropertyChanges { PropertyChanges {
target: availableDevicesListView target: availableDisplaysListView
enabled: false enabled: false
} }
PropertyChanges { PropertyChanges {
target: root target: root
statusText: "loading data..." statusText: qsTr("loading data...")
working: true working: true
} }
} }

View file

@ -10,72 +10,77 @@ import de.itsblue.bluetoothleuart 1.0
Page { Page {
id: root 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 { ColumnLayout {
id: mainLayout
anchors { anchors {
fill: parent fill: parent
margins: parent.height * 0.01 margins: Math.min(parent.height, parent.width) * 0.05
topMargin: 0
} }
Text { Chip {
Layout.preferredWidth: parent.width * 0.6 Layout.fillWidth: true
Layout.preferredHeight: parent.height * 0.1 Layout.preferredHeight: mainLayout.height * 0.05
Layout.alignment: Layout.Center Layout.alignment: Layout.Center
verticalAlignment: Text.AlignVCenter interactive: false
horizontalAlignment: Text.AlignHCenter
fontSizeMode: Text.Fit color: "white"
font.pixelSize: 500
minimumPixelSize: 1
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 { Text {
id: editButton Layout.fillHeight: true
anchors { verticalAlignment: Text.AlignVCenter
verticalCenter: parent.verticalCenter font.pixelSize: parent.height * 0.5
left: parent.right text: "\uf186"
margins: parent.height * 0.1
} }
height: parent.height * 0.7 Slider {
width: height Layout.fillWidth: true
Layout.fillHeight: true
font.styleName: fontAwesome.name from: 0
font.pixelSize: height * 0.3 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 { Item {
Layout.alignment: Layout.Center
color: root.Material.foreground
text: qsTr("Brightness:")
}
Slider {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: mainLayout.height * 0.025
from: 0
to: 10
stepSize: 1
value: backend.displayBrightness
onPressedChanged: {
if(!pressed)
backend.displayBrightness = value
}
} }
DisplayTextModelListView { DisplayTextModelListView {

View file

@ -72,7 +72,7 @@ Dialog {
reset() reset()
nameTextField.value = backend.bleController.currentDevice.name nameTextField.value = backend.bleClient.currentDevice.name
open() open()
} }

View file

@ -56,7 +56,7 @@ ItemDelegate {
ColorAnimation {} ColorAnimation {}
} }
text: model.scroll ? qsTr("scrolling"):qsTr("false") text: model.scroll ? qsTr("scrolling"):""
onClicked: { onClicked: {
control.clicked() control.clicked()

View file

@ -45,10 +45,11 @@ ItemDelegate {
} }
font.pixelSize: parent.height * 0.5 font.pixelSize: parent.height * 0.5
font.styleName: fontAwesome.name
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
text: ">" text: "\uf105"
} }
Dialog { Dialog {

View file

@ -38,12 +38,13 @@ ItemDelegate {
} }
font.pixelSize: parent.height * 0.5 font.pixelSize: parent.height * 0.5
font.styleName: fontAwesome.name
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
color: control.Material.foreground color: control.Material.foreground
text: ">" text: "\uf105"
} }
Dialog { Dialog {

View file

@ -116,7 +116,7 @@ Dialog {
id: scrollCountSpinBox id: scrollCountSpinBox
Layout.fillWidth: true Layout.fillWidth: true
from: 0 from: 0
text: qsTr("Scroll count:") text: qsTr("Scroll count")
} }
} }
} }

View file

@ -22,7 +22,7 @@ ItemDelegate {
rightMargin: control.padding rightMargin: control.padding
} }
width: parent.width * 0.6 width: parent.width * 0.4
elide: Text.ElideRight elide: Text.ElideRight
font.pixelSize: parent.font.pixelSize font.pixelSize: parent.font.pixelSize
@ -43,12 +43,13 @@ ItemDelegate {
} }
font.pixelSize: parent.height * 0.5 font.pixelSize: parent.height * 0.5
font.styleName: fontAwesome.name
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
color: control.textColor color: control.textColor
text: ">" text: "\uf105"
} }
Dialog { Dialog {

View file

@ -4,12 +4,13 @@ import QtQuick.Window 2.12
import de.itsblue.omobidisplayapp 1.0 import de.itsblue.omobidisplayapp 1.0
import de.itsblue.bluetoothleuart 1.0 import de.itsblue.bluetoothleuart 1.0
import QtQuick.Controls.Material 2.0 import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.0
ApplicationWindow { ApplicationWindow {
width: 540 width: 540
height: 960 height: 960
visible: true visible: true
title: qsTr("Hello World") title: qsTr("Itsblue smart display")
Page { Page {
id: app id: app
@ -26,16 +27,73 @@ ApplicationWindow {
Material.theme: Material.System Material.theme: Material.System
header: ToolBar { header: ToolBar {
id: headerToolBar
height: 50
implicitWidth: parent.width
Material.background: "white" Material.background: "white"
Image { RowLayout {
anchors.fill: parent anchors.fill: parent
anchors.margins: parent.height * 0.1
fillMode: Image.PreserveAspectFit ToolButton {
source: "qrc:/omobi.png" 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 { OmobiDisplayBackend {
@ -61,6 +119,22 @@ ApplicationWindow {
initialItem: connectedPageComp initialItem: connectedPageComp
replaceEnter: Transition {
NumberAnimation {
properties: "opacity"
from: 0
to: 1
}
}
replaceExit: Transition {
NumberAnimation {
properties: "opacity"
from: 1
to: 0
}
}
Component { Component {
id: connectPageComp id: connectPageComp
ConnectPage { ConnectPage {
@ -71,6 +145,7 @@ ApplicationWindow {
Component { Component {
id: connectedPageComp id: connectedPageComp
ConnectedPage { ConnectedPage {
opacity: 0
state: app.state state: app.state
} }
} }
@ -92,7 +167,7 @@ ApplicationWindow {
currentComponent: connectPageComp currentComponent: connectPageComp
} }
}, },
State { State {
name: OmobiDisplayBackend.ReadyToConnect name: OmobiDisplayBackend.ReadyToConnect
PropertyChanges { PropertyChanges {
@ -139,6 +214,14 @@ ApplicationWindow {
target: mainStack target: mainStack
currentComponent: connectedPageComp currentComponent: connectedPageComp
} }
PropertyChanges {
target: headerToolBar
state: "open"
}
PropertyChanges {
target: backToolButton
enabled: true
}
}, },
State { State {
@ -147,6 +230,14 @@ ApplicationWindow {
target: mainStack target: mainStack
currentComponent: connectedPageComp currentComponent: connectedPageComp
} }
PropertyChanges {
target: headerToolBar
state: "open"
}
PropertyChanges {
target: backToolButton
enabled: true
}
} }
] ]
} }

View file

@ -7,7 +7,6 @@
<file>DisplayTextModelListView.qml</file> <file>DisplayTextModelListView.qml</file>
<file>TextEditDialog.qml</file> <file>TextEditDialog.qml</file>
<file>TextInputDelegate.qml</file> <file>TextInputDelegate.qml</file>
<file>NextPageDelegate.qml</file>
<file>SpinBoxDelegate.qml</file> <file>SpinBoxDelegate.qml</file>
<file>ComboBoxDelegate.qml</file> <file>ComboBoxDelegate.qml</file>
<file>ColorPickerDelegate.qml</file> <file>ColorPickerDelegate.qml</file>

Binary file not shown.

View 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>

View file

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file>de.qm</file>
</qresource>
</RCC>