From d867e9cfcf80e47349b517b6810ad712a1ca9f50 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sun, 18 Oct 2020 15:08:04 +0200 Subject: [PATCH 1/8] renamings --- .../{omobidisplaybackend.cpp => leddisplaybackend.cpp} | 0 OmobiDisplayApp/{omobidisplaybackend.h => leddisplaybackend.h} | 0 .../{omobidisplaytextmodel.h => leddisplaytextmodel.h} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename OmobiDisplayApp/{omobidisplaybackend.cpp => leddisplaybackend.cpp} (100%) rename OmobiDisplayApp/{omobidisplaybackend.h => leddisplaybackend.h} (100%) rename OmobiDisplayApp/{omobidisplaytextmodel.h => leddisplaytextmodel.h} (100%) diff --git a/OmobiDisplayApp/omobidisplaybackend.cpp b/OmobiDisplayApp/leddisplaybackend.cpp similarity index 100% rename from OmobiDisplayApp/omobidisplaybackend.cpp rename to OmobiDisplayApp/leddisplaybackend.cpp diff --git a/OmobiDisplayApp/omobidisplaybackend.h b/OmobiDisplayApp/leddisplaybackend.h similarity index 100% rename from OmobiDisplayApp/omobidisplaybackend.h rename to OmobiDisplayApp/leddisplaybackend.h diff --git a/OmobiDisplayApp/omobidisplaytextmodel.h b/OmobiDisplayApp/leddisplaytextmodel.h similarity index 100% rename from OmobiDisplayApp/omobidisplaytextmodel.h rename to OmobiDisplayApp/leddisplaytextmodel.h From 107928ccdf9c7c116294cb29c89640c2910cdc9c Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sun, 18 Oct 2020 15:08:12 +0200 Subject: [PATCH 2/8] renamings --- .../.gitignore | 0 .../LedDisplayController.pro | 15 +++- .../android/AndroidManifest.xml | 0 .../leddisplaybackend.cpp | 79 ++++++++---------- .../leddisplaybackend.h | 17 ++-- .../leddisplaytextmodel.cpp | 36 ++++---- .../leddisplaytextmodel.h | 20 ++--- .../main.cpp | 7 +- .../ressources/qml/Chip.qml | 7 +- .../ressources/qml/ColorPicker.qml | 0 .../ressources/qml/ColorPickerDelegate.qml | 0 .../ressources/qml/ComboBoxDelegate.qml | 0 .../ressources/qml/ConnectPage.qml | 70 +++++++--------- .../ressources/qml/ConnectedPage.qml | 8 +- .../ressources/qml/DisplayEditDialog.qml | 2 +- .../ressources/qml/DisplayTextDelegate.qml | 0 .../qml/DisplayTextModelListView.qml | 2 +- .../ressources/qml/PasswordInputDelegate.qml | 0 .../ressources/qml/SpinBoxDelegate.qml | 0 .../ressources/qml/TextEditDialog.qml | 11 +-- .../ressources/qml/TextInputDelegate.qml | 0 .../ressources/qml/main.qml | 28 +++---- .../ressources/qml/qml.qrc | 0 .../ressources/shared/fa5brands.woff | Bin .../ressources/shared/fa5solid.woff | Bin .../ressources/shared/itsblue.png | Bin .../ressources/shared/omobi.png | Bin .../ressources/shared/shared.qrc | 0 .../ressources/translations/de.qm | Bin 3071 -> 3872 bytes .../ressources/translations/de.ts | 18 ++++ .../ressources/translations/translations.qrc | 0 OmobiDisplayApp/QBluetoothLeUart | 1 - 32 files changed, 171 insertions(+), 150 deletions(-) rename {OmobiDisplayApp => LedDisplayController}/.gitignore (100%) rename OmobiDisplayApp/OmobiDisplayApp.pro => LedDisplayController/LedDisplayController.pro (85%) rename {OmobiDisplayApp => LedDisplayController}/android/AndroidManifest.xml (100%) rename {OmobiDisplayApp => LedDisplayController}/leddisplaybackend.cpp (72%) rename {OmobiDisplayApp => LedDisplayController}/leddisplaybackend.h (83%) rename OmobiDisplayApp/omobidisplaytextmodel.cpp => LedDisplayController/leddisplaytextmodel.cpp (70%) rename {OmobiDisplayApp => LedDisplayController}/leddisplaytextmodel.h (82%) rename {OmobiDisplayApp => LedDisplayController}/main.cpp (80%) rename {OmobiDisplayApp => LedDisplayController}/ressources/qml/Chip.qml (93%) rename {OmobiDisplayApp => LedDisplayController}/ressources/qml/ColorPicker.qml (100%) rename {OmobiDisplayApp => LedDisplayController}/ressources/qml/ColorPickerDelegate.qml (100%) rename {OmobiDisplayApp => LedDisplayController}/ressources/qml/ComboBoxDelegate.qml (100%) rename {OmobiDisplayApp => LedDisplayController}/ressources/qml/ConnectPage.qml (88%) rename {OmobiDisplayApp => LedDisplayController}/ressources/qml/ConnectedPage.qml (94%) rename {OmobiDisplayApp => LedDisplayController}/ressources/qml/DisplayEditDialog.qml (97%) rename {OmobiDisplayApp => LedDisplayController}/ressources/qml/DisplayTextDelegate.qml (100%) rename {OmobiDisplayApp => LedDisplayController}/ressources/qml/DisplayTextModelListView.qml (97%) rename {OmobiDisplayApp => LedDisplayController}/ressources/qml/PasswordInputDelegate.qml (100%) rename {OmobiDisplayApp => LedDisplayController}/ressources/qml/SpinBoxDelegate.qml (100%) rename {OmobiDisplayApp => LedDisplayController}/ressources/qml/TextEditDialog.qml (96%) rename {OmobiDisplayApp => LedDisplayController}/ressources/qml/TextInputDelegate.qml (100%) rename {OmobiDisplayApp => LedDisplayController}/ressources/qml/main.qml (90%) rename {OmobiDisplayApp => LedDisplayController}/ressources/qml/qml.qrc (100%) rename {OmobiDisplayApp => LedDisplayController}/ressources/shared/fa5brands.woff (100%) rename {OmobiDisplayApp => LedDisplayController}/ressources/shared/fa5solid.woff (100%) rename {OmobiDisplayApp => LedDisplayController}/ressources/shared/itsblue.png (100%) rename {OmobiDisplayApp => LedDisplayController}/ressources/shared/omobi.png (100%) rename {OmobiDisplayApp => LedDisplayController}/ressources/shared/shared.qrc (100%) rename {OmobiDisplayApp => LedDisplayController}/ressources/translations/de.qm (55%) rename {OmobiDisplayApp => LedDisplayController}/ressources/translations/de.ts (86%) rename {OmobiDisplayApp => LedDisplayController}/ressources/translations/translations.qrc (100%) delete mode 160000 OmobiDisplayApp/QBluetoothLeUart diff --git a/OmobiDisplayApp/.gitignore b/LedDisplayController/.gitignore similarity index 100% rename from OmobiDisplayApp/.gitignore rename to LedDisplayController/.gitignore diff --git a/OmobiDisplayApp/OmobiDisplayApp.pro b/LedDisplayController/LedDisplayController.pro similarity index 85% rename from OmobiDisplayApp/OmobiDisplayApp.pro rename to LedDisplayController/LedDisplayController.pro index c436c0b..60d6e2e 100644 --- a/OmobiDisplayApp/OmobiDisplayApp.pro +++ b/LedDisplayController/LedDisplayController.pro @@ -11,13 +11,13 @@ TEMPLATE = app #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ + leddisplaybackend.cpp \ main.cpp \ - omobidisplaybackend.cpp \ - omobidisplaytextmodel.cpp + leddisplaytextmodel.cpp HEADERS += \ - omobidisplaybackend.h \ - omobidisplaytextmodel.h + leddisplaybackend.h \ + leddisplaytextmodel.h RESOURCES += \ ressources/qml/qml.qrc \ @@ -63,3 +63,10 @@ contains(ANDROID_TARGET_ARCH,armeabi-v7a) { ANDROID_ABIS = \ armeabi-v7a } + +contains(ANDROID_TARGET_ARCH,) { + ANDROID_ABIS = \ + armeabi-v7a +} + +ANDROID_ABIS = armeabi-v7a arm64-v8a diff --git a/OmobiDisplayApp/android/AndroidManifest.xml b/LedDisplayController/android/AndroidManifest.xml similarity index 100% rename from OmobiDisplayApp/android/AndroidManifest.xml rename to LedDisplayController/android/AndroidManifest.xml diff --git a/OmobiDisplayApp/leddisplaybackend.cpp b/LedDisplayController/leddisplaybackend.cpp similarity index 72% rename from OmobiDisplayApp/leddisplaybackend.cpp rename to LedDisplayController/leddisplaybackend.cpp index cc96875..6386573 100644 --- a/OmobiDisplayApp/leddisplaybackend.cpp +++ b/LedDisplayController/leddisplaybackend.cpp @@ -1,10 +1,10 @@ -#include "omobidisplaybackend.h" +#include "leddisplaybackend.h" -OmobiDisplayBackend::OmobiDisplayBackend(QObject *parent) : QObject(parent) +LedDisplayBackend::LedDisplayBackend(QObject *parent) : QObject(parent) { 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->displayTextModel = new LedDisplayTextModel(this); this->textSetsBuffer.clear(); this->displayBrightness = -1; this->waitingCommands = 0; @@ -14,26 +14,26 @@ OmobiDisplayBackend::OmobiDisplayBackend(QObject *parent) : QObject(parent) this->keepAliveTimer = new QTimer(this); this->keepAliveTimer->setInterval(5000); this->keepAliveTimer->setSingleShot(false); - connect(this->keepAliveTimer, &QTimer::timeout, this, &OmobiDisplayBackend::sendBluetoothKeepAlive); + connect(this->keepAliveTimer, &QTimer::timeout, this, &LedDisplayBackend::sendBluetoothKeepAlive); - 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); + connect(this->bleClient, &QBluetoothLeUartClient::stateChanged, this, &LedDisplayBackend::handleBluetoothStateChange); + connect(this->bleClient, &QBluetoothLeUartClient::foundNewDevice, this, &LedDisplayBackend::handleFoundNewDevice); + connect(this->bleClient, &QBluetoothLeUartClient::dataReceived, this, &LedDisplayBackend::handleBluetoothDataReceived); + connect(this->bleClient, &QBluetoothLeUartClient::connectedToDevice, this, &LedDisplayBackend::handleBluetoothDeviceConected); + connect(this->displayTextModel, &LedDisplayTextModel::dataChanged, this, &LedDisplayBackend::handleDisplayTextModelDataChanged); + connect(this->displayTextModel, &LedDisplayTextModel::rowsInserted, this, &LedDisplayBackend::handleDisplayTextModelRowsInserted); + connect(this->displayTextModel, &LedDisplayTextModel::rowsRemoved, this, &LedDisplayBackend::handleDisplayTextModelRowsRemoved); this->setState(Idle); this->bleClient->startScanningForDevices(); } -void OmobiDisplayBackend::startScanning() { +void LedDisplayBackend::startScanning() { this->bleClient->startScanningForDevices(); } -void OmobiDisplayBackend::authenticate(QString code) { +void LedDisplayBackend::authenticate(QString code) { // tell display to send over existing model data this->setState(Authenticating); @@ -47,16 +47,11 @@ void OmobiDisplayBackend::authenticate(QString code) { this->sendBluetoothCommand(AuthenticateCommand, QVariantMap{{"secret", this->lastDisplaySecret}}); } -void OmobiDisplayBackend::handleBluetoothScanningError(QBluetoothLeUartClient::BluetoothScanError error) { - if(error == QBluetoothLeUartClient::LocationPermissionDeniedError) { -#ifdef Q_OS_ANDROID - // try to get permission - //QtAndroid::requestPermissions({"android.permission.ACCESS_FINE_LOCATION", "android.permission.ACCESS_COARSE_LOCATION"}, NULL); -#endif - } +void LedDisplayBackend::handleBluetoothScanningError(QBluetoothLeUartClient::BluetoothScanError error) { + Q_UNUSED(error) } -void OmobiDisplayBackend::handleBluetoothStateChange(QBluetoothLeUartClient::BluetoothLeUartClientState state){ +void LedDisplayBackend::handleBluetoothStateChange(QBluetoothLeUartClient::BluetoothLeUartClientState state){ switch(state){ case QBluetoothLeUartClient::Idle: { this->setState(Idle); @@ -102,18 +97,18 @@ void OmobiDisplayBackend::handleBluetoothStateChange(QBluetoothLeUartClient::Blu this->keepAliveTimer->stop(); } -void OmobiDisplayBackend::handleBluetoothDeviceConected() { +void LedDisplayBackend::handleBluetoothDeviceConected() { if(this->settings->contains(this->bleClient->getCurrentDevice()->getAddress())) this->authenticate(this->settings->value(this->bleClient->getCurrentDevice()->getAddress()).toString()); else this->setState(AuthenticationRequired); } -void OmobiDisplayBackend::handleFoundNewDevice(QBluetoothLeUartDevice* device) { +void LedDisplayBackend::handleFoundNewDevice(QBluetoothLeUartDevice* device) { qDebug() << "Found a device: name: " << device->getName() << " address: " << device->getAddress(); } -void OmobiDisplayBackend::handleDisplayTextModelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &roles) { +void LedDisplayBackend::handleDisplayTextModelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &roles) { qDebug() << "Data changed: topLeft: " << topLeft << " bottomRight: " << bottomRight << " roles: " << roles; @@ -121,21 +116,21 @@ void OmobiDisplayBackend::handleDisplayTextModelDataChanged(const QModelIndex &t this->updateDisplayTextSetParameter(topLeft.row(), role); } -void OmobiDisplayBackend::handleDisplayTextModelRowsInserted(const QModelIndex &parent, int first, int last) { +void LedDisplayBackend::handleDisplayTextModelRowsInserted(const QModelIndex &parent, int first, int last) { qDebug() << "Rows inserted: parent: " << parent << " first: " << first << " last " << last; - for(int i = 0; i < OmobiDisplayTextModel::OmobiDisplayTextModelRoleCount; i++) { + for(int i = 0; i < LedDisplayTextModel::LedDisplayTextModelRoleCount; i++) { this->updateDisplayTextSetParameter(first, i); } } -void OmobiDisplayBackend::handleDisplayTextModelRowsRemoved(const QModelIndex &parent, int first, int last) { +void LedDisplayBackend::handleDisplayTextModelRowsRemoved(const QModelIndex &parent, int first, int last) { qDebug() << "Rows removed: parent: " << parent << " first: " << first << " last " << last; // Setting Text to "" will delete the item - this->updateDisplayTextSetParameter(first, OmobiDisplayTextModel::TextRole, ""); + this->updateDisplayTextSetParameter(first, LedDisplayTextModel::TextRole, ""); } -void OmobiDisplayBackend::sendBluetoothCommand(OmobiDisplayCommand command, QVariant data) { +void LedDisplayBackend::sendBluetoothCommand(OmobiDisplayCommand command, QVariant data) { QVariantMap commandMap = { {"header", command}, {"data", data} @@ -153,7 +148,7 @@ void OmobiDisplayBackend::sendBluetoothCommand(OmobiDisplayCommand command, QVar this->bleClient->sendData(doc.toJson(QJsonDocument::Compact)); } -void OmobiDisplayBackend::sendBluetoothKeepAlive() { +void LedDisplayBackend::sendBluetoothKeepAlive() { QJsonDocument doc = QJsonDocument::fromVariant(QVariantMap{{"header", KeepAliveCommand}}); //qDebug() << "Sending keep alive: \n" << qPrintable(doc.toJson(QJsonDocument::Indented)); @@ -161,7 +156,7 @@ void OmobiDisplayBackend::sendBluetoothKeepAlive() { this->bleClient->sendData(doc.toJson(QJsonDocument::Compact)); } -void OmobiDisplayBackend::handleBluetoothDataReceived(QString s){ +void LedDisplayBackend::handleBluetoothDataReceived(QString s){ //qDebug() << "New data: \n" << qPrintable(s); QJsonParseError parseError; @@ -251,11 +246,11 @@ void OmobiDisplayBackend::handleBluetoothDataReceived(QString s){ } -void OmobiDisplayBackend::updateDisplayTextSetParameter(int index, int parameter) { +void LedDisplayBackend::updateDisplayTextSetParameter(int index, int parameter) { this->updateDisplayTextSetParameter(index, parameter, this->displayTextModel->data(index, parameter).toString()); } -void OmobiDisplayBackend::updateDisplayTextSetParameter(int index, int parameter, QString value) { +void LedDisplayBackend::updateDisplayTextSetParameter(int index, int parameter, QString value) { if(this->state == Initing) return; qDebug() << "Updating data at index: " << index << " parameter: " << parameter << " and value: " << value; @@ -269,20 +264,20 @@ void OmobiDisplayBackend::updateDisplayTextSetParameter(int index, int parameter this->sendBluetoothCommand(SetTextSetParameterCommand, dataMap); } -QBluetoothLeUartClient* OmobiDisplayBackend::getBleClient() { +QBluetoothLeUartClient* LedDisplayBackend::getBleClient() { return this->bleClient; } -OmobiDisplayTextModel* OmobiDisplayBackend::getDisplayTextModel() { +LedDisplayTextModel* LedDisplayBackend::getDisplayTextModel() { return this->displayTextModel; } -OmobiDisplayBackend::OmobiDisplayAppState OmobiDisplayBackend::getState() { +LedDisplayBackend::OmobiDisplayAppState LedDisplayBackend::getState() { return this->state; } -void OmobiDisplayBackend::refreshLoadingState() { +void LedDisplayBackend::refreshLoadingState() { if(this->state != Initing && this->state != Loading) return; @@ -296,7 +291,7 @@ void OmobiDisplayBackend::refreshLoadingState() { this->waitingCommands--; } -void OmobiDisplayBackend::setState(OmobiDisplayAppState state) { +void LedDisplayBackend::setState(OmobiDisplayAppState state) { if(state == this->state) return; @@ -309,11 +304,11 @@ void OmobiDisplayBackend::setState(OmobiDisplayAppState state) { this->bleClient->startScanningForDevices(); } -int OmobiDisplayBackend::getDisplayBrightness() { +int LedDisplayBackend::getDisplayBrightness() { return this->displayBrightness; } -void OmobiDisplayBackend::setDisplayBrightness(int brightness) { +void LedDisplayBackend::setDisplayBrightness(int brightness) { if(brightness == this->displayBrightness) return; @@ -325,11 +320,11 @@ void OmobiDisplayBackend::setDisplayBrightness(int brightness) { } -void OmobiDisplayBackend::setDisplayCode(QString code) { +void LedDisplayBackend::setDisplayCode(QString code) { this->sendBluetoothCommand(SetDisplayCodeCommand, QVariantMap{{"displayCode",code}}); } -void OmobiDisplayBackend::setDisplayName(QString name) { +void LedDisplayBackend::setDisplayName(QString name) { // This will restart the display!! this->sendBluetoothCommand(SetDisplayNameCommand, QVariantMap{{"displayName", name}}); } diff --git a/OmobiDisplayApp/leddisplaybackend.h b/LedDisplayController/leddisplaybackend.h similarity index 83% rename from OmobiDisplayApp/leddisplaybackend.h rename to LedDisplayController/leddisplaybackend.h index 22692be..5e64c5e 100644 --- a/OmobiDisplayApp/leddisplaybackend.h +++ b/LedDisplayController/leddisplaybackend.h @@ -8,18 +8,18 @@ #include #include -#include +#include -class OmobiDisplayBackend : public QObject +class LedDisplayBackend : public QObject { Q_OBJECT 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(LedDisplayTextModel* displayTextModel READ getDisplayTextModel NOTIFY displayTextModelChanged) Q_PROPERTY(int displayBrightness READ getDisplayBrightness WRITE setDisplayBrightness NOTIFY displayBrightnessChanged) public: - explicit OmobiDisplayBackend(QObject *parent = nullptr); + explicit LedDisplayBackend(QObject *parent = nullptr); enum OmobiDisplayAppState { Idle, @@ -36,6 +36,11 @@ public: }; Q_ENUM(OmobiDisplayAppState) + static void init() { + qmlRegisterType("de.itsblue.LedDisplayController", 1, 0, "LedDisplayBackend"); + qmlRegisterUncreatableType("de.itsblue.LedDisplayController", 1, 0, "LedDisplayTextModel", "LedDisplayTextModel cannot be created"); + }; + private: enum OmobiDisplayCommand { AuthenticateCommand = 0, @@ -57,7 +62,7 @@ private: OmobiDisplayAppState state; QBluetoothLeUartClient *bleClient; QTimer *keepAliveTimer; - OmobiDisplayTextModel* displayTextModel; + LedDisplayTextModel* displayTextModel; int waitingCommands; QList> textSetsBuffer; int displayBrightness; @@ -70,7 +75,7 @@ public slots: Q_INVOKABLE void authenticate(QString secret); Q_INVOKABLE QBluetoothLeUartClient* getBleClient(); Q_INVOKABLE OmobiDisplayAppState getState(); - Q_INVOKABLE OmobiDisplayTextModel* getDisplayTextModel(); + Q_INVOKABLE LedDisplayTextModel* getDisplayTextModel(); Q_INVOKABLE int getDisplayBrightness(); Q_INVOKABLE void setDisplayBrightness(int brightness); Q_INVOKABLE void setDisplayCode(QString code); diff --git a/OmobiDisplayApp/omobidisplaytextmodel.cpp b/LedDisplayController/leddisplaytextmodel.cpp similarity index 70% rename from OmobiDisplayApp/omobidisplaytextmodel.cpp rename to LedDisplayController/leddisplaytextmodel.cpp index 169d15d..7a7d138 100644 --- a/OmobiDisplayApp/omobidisplaytextmodel.cpp +++ b/LedDisplayController/leddisplaytextmodel.cpp @@ -1,39 +1,39 @@ -#include "omobidisplaytextmodel.h" +#include "leddisplaytextmodel.h" -OmobiDisplayTextModel::OmobiDisplayTextModel(QObject* parent) : QAbstractListModel(parent) +LedDisplayTextModel::LedDisplayTextModel(QObject* parent) : QAbstractListModel(parent) { this->maximumTextSets = 0; this->maximumTextLength = 0; - connect(this, &OmobiDisplayTextModel::rowsInserted, this, &OmobiDisplayTextModel::rowCountChanged); - connect(this, &OmobiDisplayTextModel::rowsRemoved, this, &OmobiDisplayTextModel::rowCountChanged); + connect(this, &LedDisplayTextModel::rowsInserted, this, &LedDisplayTextModel::rowCountChanged); + connect(this, &LedDisplayTextModel::rowsRemoved, this, &LedDisplayTextModel::rowCountChanged); } -int OmobiDisplayTextModel::rowCount(const QModelIndex &) const +int LedDisplayTextModel::rowCount(const QModelIndex &) const { return this->texts.length(); } -QVariant OmobiDisplayTextModel::data(const QModelIndex &index, int role) const +QVariant LedDisplayTextModel::data(const QModelIndex &index, int role) const { return this->data(index.row(), role); } -QVariant OmobiDisplayTextModel::data(int row, int role) const { +QVariant LedDisplayTextModel::data(int row, int role) const { if (row < rowCount()) { if(this->texts[row].contains(role)) { if(role == IndexRole) return row; QVariant value = this->texts[row][role]; - value.convert(this->roleDataTypes[OmobiDisplayTextModelRole(role)]); + value.convert(this->roleDataTypes[LedDisplayTextModelRole(role)]); return value; } } return QVariant(); } -QHash OmobiDisplayTextModel::roleNames() const +QHash LedDisplayTextModel::roleNames() const { static const QHash roles { { TextRole, "text" }, @@ -49,7 +49,7 @@ QHash OmobiDisplayTextModel::roleNames() const return roles; } -void OmobiDisplayTextModel::append( +void LedDisplayTextModel::append( QString text, bool active, unsigned int runtime, @@ -81,14 +81,14 @@ void OmobiDisplayTextModel::append( this->append(roles); } -void OmobiDisplayTextModel::append(const QMap &roles) { +void LedDisplayTextModel::append(const QMap &roles) { int row = this->texts.length(); this->beginInsertRows(QModelIndex(), row, row); this->texts.insert(row, roles); this->endInsertRows(); } -bool OmobiDisplayTextModel::setData(const QModelIndex &index, const QVariant &value, int role) { +bool LedDisplayTextModel::setData(const QModelIndex &index, const QVariant &value, int role) { if (index.row() >= rowCount() || !this->texts[index.row()].contains(role)) return false; @@ -107,7 +107,7 @@ bool OmobiDisplayTextModel::setData(const QModelIndex &index, const QVariant &va return true; } -void OmobiDisplayTextModel::remove(int row) +void LedDisplayTextModel::remove(int row) { if (row < 0 || row >= this->rowCount()) return; @@ -117,12 +117,12 @@ void OmobiDisplayTextModel::remove(int row) endRemoveRows(); } -void OmobiDisplayTextModel::clear() { +void LedDisplayTextModel::clear() { for(int i = 0; i < this->texts.length(); i++) this->remove(i); } -bool OmobiDisplayTextModel::setTexts(QList> texts) { +bool LedDisplayTextModel::setTexts(QList> texts) { this->beginResetModel(); this->resetInternalData(); this->texts.clear(); @@ -134,11 +134,11 @@ bool OmobiDisplayTextModel::setTexts(QList> texts) { return true; } -QList> OmobiDisplayTextModel::getTexts() { +QList> LedDisplayTextModel::getTexts() { return this->texts; } -QMap OmobiDisplayTextModel::getText(const QModelIndex &index) { +QMap LedDisplayTextModel::getText(const QModelIndex &index) { if (index.row() < this->rowCount()) return this->texts[index.row()]; @@ -146,6 +146,6 @@ QMap OmobiDisplayTextModel::getText(const QModelIndex &index) { } -int OmobiDisplayTextModel::getMaximumTextSets() { +int LedDisplayTextModel::getMaximumTextSets() { return this->maximumTextSets; } diff --git a/OmobiDisplayApp/leddisplaytextmodel.h b/LedDisplayController/leddisplaytextmodel.h similarity index 82% rename from OmobiDisplayApp/leddisplaytextmodel.h rename to LedDisplayController/leddisplaytextmodel.h index 765c8b2..c13e905 100644 --- a/OmobiDisplayApp/leddisplaytextmodel.h +++ b/LedDisplayController/leddisplaytextmodel.h @@ -1,21 +1,21 @@ -#ifndef OMOBIDISPLAYTEXTMODEL_H -#define OMOBIDISPLAYTEXTMODEL_H +#ifndef LEDDISPLAYTEXTMODEL_H +#define LEDDISPLAYTEXTMODEL_H #include #include #include #include -class OmobiDisplayTextModel : public QAbstractListModel +class LedDisplayTextModel : public QAbstractListModel { Q_OBJECT Q_PROPERTY(int rowCount READ rowCount NOTIFY rowCountChanged) Q_PROPERTY(int maximumTextSets READ getMaximumTextSets NOTIFY maximumTextSetsChanged) public: - friend class OmobiDisplayBackend; + friend class LedDisplayBackend; - enum OmobiDisplayTextModelRole { + enum LedDisplayTextModelRole { TextRole = Qt::DisplayRole, ActiveRole, RuntimeRole, @@ -25,9 +25,9 @@ public: ScrollSpeedRole, ScrollCountRole, IndexRole, - OmobiDisplayTextModelRoleCount + LedDisplayTextModelRoleCount }; - Q_ENUM(OmobiDisplayTextModelRole) + Q_ENUM(LedDisplayTextModelRole) enum OmobiDisplayTextAlignment { @@ -60,7 +60,7 @@ public: Q_INVOKABLE int getMaximumTextSets(); protected: - OmobiDisplayTextModel(QObject* parent = nullptr); + LedDisplayTextModel(QObject* parent = nullptr); bool setTexts(QList> json); QList> getTexts(); @@ -74,7 +74,7 @@ private: int maximumTextSets; int maximumTextLength; - const QMap roleDataTypes = { + const QMap roleDataTypes = { {TextRole, QVariant::String}, {ActiveRole, QVariant::Bool}, {RuntimeRole, QVariant::Int}, @@ -91,4 +91,4 @@ signals: void maximumTextSetsChanged(); }; -#endif // OMOBIDISPLAYTEXTMODEL_H +#endif // LEDDISPLAYTEXTMODEL_H diff --git a/OmobiDisplayApp/main.cpp b/LedDisplayController/main.cpp similarity index 80% rename from OmobiDisplayApp/main.cpp rename to LedDisplayController/main.cpp index bdef8bc..a253153 100644 --- a/OmobiDisplayApp/main.cpp +++ b/LedDisplayController/main.cpp @@ -9,8 +9,8 @@ #include #endif -#include "omobidisplaybackend.h" -#include "omobidisplaytextmodel.h" +#include "leddisplaybackend.h" +#include "leddisplaytextmodel.h" /*void permissionCallback(const QtAndroid::PermissionResultMap& results) { for(QtAndroid::PermissionResult result : results) { @@ -32,8 +32,7 @@ int main(int argc, char *argv[]) translator.load(":/" + QLocale::system().name() + ".qm"); app.installTranslator(&translator); - qmlRegisterType("de.itsblue.omobidisplayapp", 1, 0, "OmobiDisplayBackend"); - qmlRegisterUncreatableType("de.itsblue.omobidisplayapp", 1, 0, "OmobiDisplayTextModel", "OmobiDisplayTextModel cannot be created"); + LedDisplayBackend::init(); QBluetoothLeUartClient::init(); QQuickStyle::setStyle("Material"); diff --git a/OmobiDisplayApp/ressources/qml/Chip.qml b/LedDisplayController/ressources/qml/Chip.qml similarity index 93% rename from OmobiDisplayApp/ressources/qml/Chip.qml rename to LedDisplayController/ressources/qml/Chip.qml index 351bc8a..c585674 100644 --- a/OmobiDisplayApp/ressources/qml/Chip.qml +++ b/LedDisplayController/ressources/qml/Chip.qml @@ -20,10 +20,13 @@ Item { property double glowScale: 1 property double glowOpacity: Math.pow( control.opacity, 100 ) * 0.5 property bool interactive: true + property int horizontalPadding: width * 0.15 + property int verticalPadding: height * 0.15 signal clicked function checkIsDarkColor(color) { + var c = color.substring(1); // strip # var rgb = parseInt(c, 16); // convert rrggbb to decimal var r = (rgb >> 16) & 0xff; // extract red @@ -96,8 +99,8 @@ Item { id: contentText anchors.centerIn: background - width: background.width * 0.7 - height: background.height * 0.7 + width: background.width - 2 * control.horizontalPadding + height: background.height - 2 * control.verticalPadding font.pixelSize: height fontSizeMode: Text.Fit diff --git a/OmobiDisplayApp/ressources/qml/ColorPicker.qml b/LedDisplayController/ressources/qml/ColorPicker.qml similarity index 100% rename from OmobiDisplayApp/ressources/qml/ColorPicker.qml rename to LedDisplayController/ressources/qml/ColorPicker.qml diff --git a/OmobiDisplayApp/ressources/qml/ColorPickerDelegate.qml b/LedDisplayController/ressources/qml/ColorPickerDelegate.qml similarity index 100% rename from OmobiDisplayApp/ressources/qml/ColorPickerDelegate.qml rename to LedDisplayController/ressources/qml/ColorPickerDelegate.qml diff --git a/OmobiDisplayApp/ressources/qml/ComboBoxDelegate.qml b/LedDisplayController/ressources/qml/ComboBoxDelegate.qml similarity index 100% rename from OmobiDisplayApp/ressources/qml/ComboBoxDelegate.qml rename to LedDisplayController/ressources/qml/ComboBoxDelegate.qml diff --git a/OmobiDisplayApp/ressources/qml/ConnectPage.qml b/LedDisplayController/ressources/qml/ConnectPage.qml similarity index 88% rename from OmobiDisplayApp/ressources/qml/ConnectPage.qml rename to LedDisplayController/ressources/qml/ConnectPage.qml index 7a8b9f7..9bdd1d1 100644 --- a/OmobiDisplayApp/ressources/qml/ConnectPage.qml +++ b/LedDisplayController/ressources/qml/ConnectPage.qml @@ -1,7 +1,7 @@ import QtQuick 2.0 import QtQuick.Controls 2.9 import QtQuick.Layouts 1.0 -import de.itsblue.omobidisplayapp 1.0 +import de.itsblue.LedDisplayController 1.0 import de.itsblue.bluetoothleuart 1.0 import QtQuick.Controls.Material 2.0 import QtGraphicalEffects 1.0 @@ -30,41 +30,35 @@ Page { Chip { Layout.fillWidth: true - Layout.preferredHeight: mainLayout.height * 0.05 + Layout.preferredHeight: 35 Layout.alignment: Layout.Center - color: "white" + verticalPadding: height * 0.25 + horizontalPadding: width * 0.05 + + color: "#ffffff" + text: root.statusText onClicked: { - backend.bleClient.startScanningForDevices() + if(parseInt(root.state) === LedDisplayBackend.LocationPermissionDenied && !backend.bleClient.isLocationPermissionGranted()) + backend.bleClient.requestLocationPermission() + else + backend.bleClient.startScanningForDevices() } - RowLayout { - spacing: mainLayout.anchors.margins + BusyIndicator { + id: busyIndicator - 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 + anchors { + right: parent.right } + height: parent.height + width: height + + scale: 0.8 + + opacity: root.working ? 1:0 } } @@ -154,7 +148,7 @@ Page { color: "lightgrey" font.pixelSize: parent.height * 0.6 font.bold: true - text: parseInt(root.state) === OmobiDisplayBackend.Scanning ? "...":"?" + text: parseInt(root.state) === LedDisplayBackend.Scanning ? "...":"?" } } @@ -170,7 +164,7 @@ Page { 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") + text: parseInt(root.state) === LedDisplayBackend.Scanning ? qsTr("Still scanning"):qsTr("No displays found") } } @@ -334,7 +328,7 @@ Page { states: [ State { - name: OmobiDisplayBackend.Idle + name: LedDisplayBackend.Idle PropertyChanges { target: root @@ -348,7 +342,7 @@ Page { } }, State { - name: OmobiDisplayBackend.BluetoothOff + name: LedDisplayBackend.BluetoothOff PropertyChanges { target: bluetoothOffItem opacity: 1 @@ -364,7 +358,7 @@ Page { } }, State { - name: OmobiDisplayBackend.LocationPermissionDenied + name: LedDisplayBackend.LocationPermissionDenied PropertyChanges { target: noPermissionItem @@ -381,7 +375,7 @@ Page { } }, State { - name: OmobiDisplayBackend.Scanning + name: LedDisplayBackend.Scanning PropertyChanges { target: root @@ -398,7 +392,7 @@ Page { } }, State { - name: OmobiDisplayBackend.ReadyToConnect + name: LedDisplayBackend.ReadyToConnect PropertyChanges { target: root @@ -408,7 +402,7 @@ Page { }, State { - name: OmobiDisplayBackend.AuthenticationRequired + name: LedDisplayBackend.AuthenticationRequired PropertyChanges { target: authenticationDialog @@ -427,7 +421,7 @@ Page { } }, State { - name: OmobiDisplayBackend.Authenticating + name: LedDisplayBackend.Authenticating PropertyChanges { target: availableDisplaysListView @@ -442,7 +436,7 @@ Page { }, State { - name: OmobiDisplayBackend.Connecting + name: LedDisplayBackend.Connecting PropertyChanges { target: availableDisplaysListView @@ -456,7 +450,7 @@ Page { } }, State { - name: OmobiDisplayBackend.Initing + name: LedDisplayBackend.Initing PropertyChanges { target: availableDisplaysListView diff --git a/OmobiDisplayApp/ressources/qml/ConnectedPage.qml b/LedDisplayController/ressources/qml/ConnectedPage.qml similarity index 94% rename from OmobiDisplayApp/ressources/qml/ConnectedPage.qml rename to LedDisplayController/ressources/qml/ConnectedPage.qml index ebd217d..6f1a2f7 100644 --- a/OmobiDisplayApp/ressources/qml/ConnectedPage.qml +++ b/LedDisplayController/ressources/qml/ConnectedPage.qml @@ -4,7 +4,7 @@ import QtQuick.Layouts 1.0 import QtQuick.Controls.Material 2.0 import QtGraphicalEffects 1.0 -import de.itsblue.omobidisplayapp 1.0 +import de.itsblue.LedDisplayController 1.0 import de.itsblue.bluetoothleuart 1.0 Page { @@ -34,7 +34,7 @@ Page { Chip { Layout.fillWidth: true - Layout.preferredHeight: mainLayout.height * 0.05 + Layout.preferredHeight: 35 Layout.alignment: Layout.Center interactive: false @@ -141,10 +141,10 @@ Page { states: [ State { - name: OmobiDisplayBackend.Connected + name: LedDisplayBackend.Connected }, State { - name: OmobiDisplayBackend.Loading + name: LedDisplayBackend.Loading PropertyChanges { target: loadingDialog diff --git a/OmobiDisplayApp/ressources/qml/DisplayEditDialog.qml b/LedDisplayController/ressources/qml/DisplayEditDialog.qml similarity index 97% rename from OmobiDisplayApp/ressources/qml/DisplayEditDialog.qml rename to LedDisplayController/ressources/qml/DisplayEditDialog.qml index 1dd331b..c772dcf 100644 --- a/OmobiDisplayApp/ressources/qml/DisplayEditDialog.qml +++ b/LedDisplayController/ressources/qml/DisplayEditDialog.qml @@ -3,7 +3,7 @@ import QtQuick.Controls 2.12 import QtQuick.Layouts 1.9 import QtQuick.Controls.Material 2.0 -import de.itsblue.omobidisplayapp 1.0 +import de.itsblue.LedDisplayController 1.0 Dialog { id: control diff --git a/OmobiDisplayApp/ressources/qml/DisplayTextDelegate.qml b/LedDisplayController/ressources/qml/DisplayTextDelegate.qml similarity index 100% rename from OmobiDisplayApp/ressources/qml/DisplayTextDelegate.qml rename to LedDisplayController/ressources/qml/DisplayTextDelegate.qml diff --git a/OmobiDisplayApp/ressources/qml/DisplayTextModelListView.qml b/LedDisplayController/ressources/qml/DisplayTextModelListView.qml similarity index 97% rename from OmobiDisplayApp/ressources/qml/DisplayTextModelListView.qml rename to LedDisplayController/ressources/qml/DisplayTextModelListView.qml index 2bb882d..210a06d 100644 --- a/OmobiDisplayApp/ressources/qml/DisplayTextModelListView.qml +++ b/LedDisplayController/ressources/qml/DisplayTextModelListView.qml @@ -3,7 +3,7 @@ import QtQuick.Controls 2.9 import QtQuick.Layouts 1.9 import QtQuick.Controls.Material 2.0 -import de.itsblue.omobidisplayapp 1.0 +import de.itsblue.LedDisplayController 1.0 ListView { id: control diff --git a/OmobiDisplayApp/ressources/qml/PasswordInputDelegate.qml b/LedDisplayController/ressources/qml/PasswordInputDelegate.qml similarity index 100% rename from OmobiDisplayApp/ressources/qml/PasswordInputDelegate.qml rename to LedDisplayController/ressources/qml/PasswordInputDelegate.qml diff --git a/OmobiDisplayApp/ressources/qml/SpinBoxDelegate.qml b/LedDisplayController/ressources/qml/SpinBoxDelegate.qml similarity index 100% rename from OmobiDisplayApp/ressources/qml/SpinBoxDelegate.qml rename to LedDisplayController/ressources/qml/SpinBoxDelegate.qml diff --git a/OmobiDisplayApp/ressources/qml/TextEditDialog.qml b/LedDisplayController/ressources/qml/TextEditDialog.qml similarity index 96% rename from OmobiDisplayApp/ressources/qml/TextEditDialog.qml rename to LedDisplayController/ressources/qml/TextEditDialog.qml index 66b6a9f..11c9a4e 100644 --- a/OmobiDisplayApp/ressources/qml/TextEditDialog.qml +++ b/LedDisplayController/ressources/qml/TextEditDialog.qml @@ -3,7 +3,7 @@ import QtQuick.Controls 2.12 import QtQuick.Layouts 1.9 import QtQuick.Controls.Material 2.0 -import de.itsblue.omobidisplayapp 1.0 +import de.itsblue.LedDisplayController 1.0 Dialog { id: control @@ -83,6 +83,7 @@ Dialog { id: runtimeSpinBox Layout.fillWidth: true editable: true + from: 1 to: 3600 text: qsTr("Runtime (in s)") } @@ -117,7 +118,7 @@ Dialog { SpinBoxDelegate { id: scrollCountSpinBox Layout.fillWidth: true - from: 0 + from: 1 editable: true text: qsTr("Scroll count") } @@ -181,11 +182,11 @@ Dialog { function reset() { activeSwitch.checked = true textTextField.value = "" - runtimeSpinBox.value = 0 - colorColorPicker.value = "" + runtimeSpinBox.value = 1 + colorColorPicker.value = "#ffffff" alignmentComboBox.currentIndex = 0 scrollSwitch.checked = false scrollSpeedSpinBox.value = 5 - scrollCountSpinBox.value = 0 + scrollCountSpinBox.value = 1 } } diff --git a/OmobiDisplayApp/ressources/qml/TextInputDelegate.qml b/LedDisplayController/ressources/qml/TextInputDelegate.qml similarity index 100% rename from OmobiDisplayApp/ressources/qml/TextInputDelegate.qml rename to LedDisplayController/ressources/qml/TextInputDelegate.qml diff --git a/OmobiDisplayApp/ressources/qml/main.qml b/LedDisplayController/ressources/qml/main.qml similarity index 90% rename from OmobiDisplayApp/ressources/qml/main.qml rename to LedDisplayController/ressources/qml/main.qml index a9d6b27..c2c1cb3 100644 --- a/OmobiDisplayApp/ressources/qml/main.qml +++ b/LedDisplayController/ressources/qml/main.qml @@ -1,7 +1,7 @@ import QtQuick 2.12 import QtQuick.Controls 2.0 import QtQuick.Window 2.12 -import de.itsblue.omobidisplayapp 1.0 +import de.itsblue.LedDisplayController 1.0 import de.itsblue.bluetoothleuart 1.0 import QtQuick.Controls.Material 2.0 import QtQuick.Layouts 1.0 @@ -24,7 +24,7 @@ ApplicationWindow { anchors.fill: parent Material.accent: "#0094ff" - Material.theme: Material.System + Material.theme: Material.Dark header: ToolBar { id: headerToolBar @@ -97,7 +97,7 @@ ApplicationWindow { } } - OmobiDisplayBackend { + LedDisplayBackend { id: backend } @@ -171,7 +171,7 @@ ApplicationWindow { states: [ State { - name: OmobiDisplayBackend.Idle + name: LedDisplayBackend.Idle PropertyChanges { target: mainStack currentComponent: connectPageComp @@ -179,7 +179,7 @@ ApplicationWindow { }, State { - name: OmobiDisplayBackend.BluetoothOff + name: LedDisplayBackend.BluetoothOff PropertyChanges { target: mainStack currentComponent: connectPageComp @@ -187,7 +187,7 @@ ApplicationWindow { }, State { - name: OmobiDisplayBackend.LocationPermissionDenied + name: LedDisplayBackend.LocationPermissionDenied PropertyChanges { target: mainStack currentComponent: connectPageComp @@ -195,7 +195,7 @@ ApplicationWindow { }, State { - name: OmobiDisplayBackend.Scanning + name: LedDisplayBackend.Scanning PropertyChanges { target: mainStack currentComponent: connectPageComp @@ -203,7 +203,7 @@ ApplicationWindow { }, State { - name: OmobiDisplayBackend.ReadyToConnect + name: LedDisplayBackend.ReadyToConnect PropertyChanges { target: mainStack currentComponent: connectPageComp @@ -211,7 +211,7 @@ ApplicationWindow { }, State { - name: OmobiDisplayBackend.Connecting + name: LedDisplayBackend.Connecting PropertyChanges { target: mainStack currentComponent: connectPageComp @@ -219,7 +219,7 @@ ApplicationWindow { }, State { - name: OmobiDisplayBackend.AuthenticationRequired + name: LedDisplayBackend.AuthenticationRequired PropertyChanges { target: mainStack currentComponent: connectPageComp @@ -227,7 +227,7 @@ ApplicationWindow { }, State { - name: OmobiDisplayBackend.Authenticating + name: LedDisplayBackend.Authenticating PropertyChanges { target: mainStack currentComponent: connectPageComp @@ -235,7 +235,7 @@ ApplicationWindow { }, State { - name: OmobiDisplayBackend.Initing + name: LedDisplayBackend.Initing PropertyChanges { target: mainStack currentComponent: connectPageComp @@ -243,7 +243,7 @@ ApplicationWindow { }, State { - name: OmobiDisplayBackend.Connected + name: LedDisplayBackend.Connected PropertyChanges { target: mainStack currentComponent: connectedPageComp @@ -259,7 +259,7 @@ ApplicationWindow { }, State { - name: OmobiDisplayBackend.Loading + name: LedDisplayBackend.Loading PropertyChanges { target: mainStack currentComponent: connectedPageComp diff --git a/OmobiDisplayApp/ressources/qml/qml.qrc b/LedDisplayController/ressources/qml/qml.qrc similarity index 100% rename from OmobiDisplayApp/ressources/qml/qml.qrc rename to LedDisplayController/ressources/qml/qml.qrc diff --git a/OmobiDisplayApp/ressources/shared/fa5brands.woff b/LedDisplayController/ressources/shared/fa5brands.woff similarity index 100% rename from OmobiDisplayApp/ressources/shared/fa5brands.woff rename to LedDisplayController/ressources/shared/fa5brands.woff diff --git a/OmobiDisplayApp/ressources/shared/fa5solid.woff b/LedDisplayController/ressources/shared/fa5solid.woff similarity index 100% rename from OmobiDisplayApp/ressources/shared/fa5solid.woff rename to LedDisplayController/ressources/shared/fa5solid.woff diff --git a/OmobiDisplayApp/ressources/shared/itsblue.png b/LedDisplayController/ressources/shared/itsblue.png similarity index 100% rename from OmobiDisplayApp/ressources/shared/itsblue.png rename to LedDisplayController/ressources/shared/itsblue.png diff --git a/OmobiDisplayApp/ressources/shared/omobi.png b/LedDisplayController/ressources/shared/omobi.png similarity index 100% rename from OmobiDisplayApp/ressources/shared/omobi.png rename to LedDisplayController/ressources/shared/omobi.png diff --git a/OmobiDisplayApp/ressources/shared/shared.qrc b/LedDisplayController/ressources/shared/shared.qrc similarity index 100% rename from OmobiDisplayApp/ressources/shared/shared.qrc rename to LedDisplayController/ressources/shared/shared.qrc diff --git a/OmobiDisplayApp/ressources/translations/de.qm b/LedDisplayController/ressources/translations/de.qm similarity index 55% rename from OmobiDisplayApp/ressources/translations/de.qm rename to LedDisplayController/ressources/translations/de.qm index 981f93a6d706e10dd19266053a7dd49cc0f05fab..85034a0afbe926799916ad83656d4b2ce6356995 100644 GIT binary patch delta 1018 zcmb7CO-NKx6h8Am&iF%O`P1JWgD9|BghfdRi3Wv)q@_Vv&-d;)FUR-B``&ZVMYF0F zEvJIaVuYj!v(mI&h_nzQ$X$yT_5($`+E`Ga_1$q$iZ=0h@1A?lcfRl3@4R2-*=^}V z&$Nn{Ux%-~ifoxXH!{0;mxz2CKik;UK;)_*-`EmS(JAtejuQC~&@r`(D16@CG&Mz3 zu*u!>rjjTy;l4bcBJyNCGw(8BAn)L#d7{ua@8DCp_Iqb5JCRqtbD41>cd;*GEnuBa z`>MN+gJ{Ti<0OP!4}C+|YlsRR-`K6&ATIR>%Z?HSxBIK2wGbW-jy--3{`ms6{WFN4 zgbpUYK<<8M;zJAed&8dT3#jW42dW$hehj}~z6!qO@X`wvJU7EjD>nAyg=+RS^y*I+ zj_lZt8(u7`+gy(uYDFv4Q4ls4Pq}6Q+*#7s{ubvCN)|dULAayjlMRCKE*(XSnNru8 zj{Vd?337;&O(q_j;>1WN3lSp)8H>7+wMa!q0oIn-p!CU)x4a?YaN9KPIMXd=JHp@^ zGh?w#*0V8vf{p+jM-eAMbrhmjlq+PA1}TAf59DQz=jd$+cSF*^mr;K%lfqY?N|a5J zHR0+eAxu#hYBp8H)=h&Yx#-m`ONJUZbgo5Y50i%LirZD2`RUoZFP0Y_ghUK&#B;*N z8f96Vl4Nl%II~Trnue_#4wodEAD+(i3N@k;=>$h}hbf7NQ5SXweMf7uN$HuEL$Uw3 zYE7<6pfM$)40oIN_MlBjfa&8K8r9J5xENhWxoqYG}a#6PB>8_X0M7c6E9w*H&I+mtDK sYM5@bl%7a1!?c;A+K!S)3?NXsWw8O%5o@H;0DiR09nXfzcJIBwZ;dGbk^lez delta 299 zcmZ1=_g}o;W=D#|srPfHo>i3DpRjQ6T_*+xh93;9YrZfraK$sQEnUjM!0gE2m7K)D zz){TPx^*i91DiZkz)eX82A17S?d!@J7?|cW@4P=5sE>iAYQs?m2KIj}Rog*yJqw`b^81wh2i&r65IHn gmH;(!7-j-hKbvgB7_)gMQ#aG(9@eNo displays found. Tap to scan again Keine Displays gefunden. Tippe um erneut zu suchen + + Bluetooth is turned off + Bluetooth ist ausgeschaltet + + + Error: +Location permission denied! + Fehler: +Standort-Berechtigung verweigert! + + + This app requires location permission in order for Bluetooth to work, it will not actually access your location. + Diese App benötigt die Standort-Berechtigung, damit sie Bluetooth verwenden kann. Sie wird nicht auf deinen Standort zugreifen. + + + Tap here to continue + Tippe hier um fortzufahren + ConnectedPage diff --git a/OmobiDisplayApp/ressources/translations/translations.qrc b/LedDisplayController/ressources/translations/translations.qrc similarity index 100% rename from OmobiDisplayApp/ressources/translations/translations.qrc rename to LedDisplayController/ressources/translations/translations.qrc diff --git a/OmobiDisplayApp/QBluetoothLeUart b/OmobiDisplayApp/QBluetoothLeUart deleted file mode 160000 index fba59b3..0000000 --- a/OmobiDisplayApp/QBluetoothLeUart +++ /dev/null @@ -1 +0,0 @@ -Subproject commit fba59b37770ab1ede351ec70119d2da328be6a06 From ab9c782df70160a23d3407bb7ea3dfa0fdfee2b1 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sun, 18 Oct 2020 15:09:16 +0200 Subject: [PATCH 3/8] renaming --- .gitmodules | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 9ad5376..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "OmobiDisplayApp/QBluetoothLeUart"] - path = OmobiDisplayApp/QBluetoothLeUart - url = https://itsblue.dev/itsblue-development/QBluetoothLeUart.git From 0c7a0c03bd8b84907c741953fab57a5c1f5a06e9 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sun, 18 Oct 2020 15:09:37 +0200 Subject: [PATCH 4/8] renamings --- .gitmodules | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index e69de29..0000000 From a987963fe685d4c8599c9eabde31540745457174 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sun, 18 Oct 2020 15:10:42 +0200 Subject: [PATCH 5/8] re-added submodule --- .gitmodules | 3 +++ LedDisplayController/QBluetoothLeUart | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 LedDisplayController/QBluetoothLeUart diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..d5816ac --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "LedDisplayController/QBluetoothLeUart"] + path = LedDisplayController/QBluetoothLeUart + url = https://itsblue.dev/itsblue-development/QBluetoothLeUart.git diff --git a/LedDisplayController/QBluetoothLeUart b/LedDisplayController/QBluetoothLeUart new file mode 160000 index 0000000..fba59b3 --- /dev/null +++ b/LedDisplayController/QBluetoothLeUart @@ -0,0 +1 @@ +Subproject commit fba59b37770ab1ede351ec70119d2da328be6a06 From 49860404a85eb0452d6d1bdeb0b5f55d6509f3c7 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sun, 18 Oct 2020 15:13:35 +0200 Subject: [PATCH 6/8] lib --- LedDisplayController/QBluetoothLeUart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LedDisplayController/QBluetoothLeUart b/LedDisplayController/QBluetoothLeUart index fba59b3..d75f55a 160000 --- a/LedDisplayController/QBluetoothLeUart +++ b/LedDisplayController/QBluetoothLeUart @@ -1 +1 @@ -Subproject commit fba59b37770ab1ede351ec70119d2da328be6a06 +Subproject commit d75f55a3a16a833599cd93e1fb22f2500a94dcf5 From 1b28fe84b8c7029ed9e1b17c9600dab394fde8d0 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sun, 18 Oct 2020 15:20:55 +0200 Subject: [PATCH 7/8] fix some colors --- LedDisplayController/ressources/qml/ConnectedPage.qml | 7 ++++++- LedDisplayController/ressources/qml/main.qml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/LedDisplayController/ressources/qml/ConnectedPage.qml b/LedDisplayController/ressources/qml/ConnectedPage.qml index 6f1a2f7..c7fef62 100644 --- a/LedDisplayController/ressources/qml/ConnectedPage.qml +++ b/LedDisplayController/ressources/qml/ConnectedPage.qml @@ -105,6 +105,9 @@ Page { DisplayEditDialog { id: displayEditDialog + + Material.theme: root.Material.theme + Material.accent: root.Material.accent } Dialog { @@ -127,9 +130,11 @@ Page { closePolicy: Popup.NoAutoClose modal: true + Material.theme: root.Material.theme + Material.accent: root.Material.accent + contentItem: ColumnLayout { BusyIndicator { - } Text { diff --git a/LedDisplayController/ressources/qml/main.qml b/LedDisplayController/ressources/qml/main.qml index c2c1cb3..458dc91 100644 --- a/LedDisplayController/ressources/qml/main.qml +++ b/LedDisplayController/ressources/qml/main.qml @@ -24,7 +24,7 @@ ApplicationWindow { anchors.fill: parent Material.accent: "#0094ff" - Material.theme: Material.Dark + Material.theme: Material.Light header: ToolBar { id: headerToolBar From bd3deb2b7fa413abc485b33bcfb1b79f2591c8d9 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sun, 18 Oct 2020 15:44:18 +0200 Subject: [PATCH 8/8] implemented scroll direction --- LedDisplayController/leddisplaybackend.cpp | 4 +++- LedDisplayController/leddisplaytextmodel.cpp | 5 ++++- LedDisplayController/leddisplaytextmodel.h | 5 ++++- .../ressources/qml/TextEditDialog.qml | 15 +++++++++++++-- .../include/LedDisplayController.h | 4 +++- .../src/LedDisplayController.cpp | 6 ++++++ .../src/OmobiLedDisplay.cpp | 4 ++++ 7 files changed, 37 insertions(+), 6 deletions(-) diff --git a/LedDisplayController/leddisplaybackend.cpp b/LedDisplayController/leddisplaybackend.cpp index 6386573..f00085c 100644 --- a/LedDisplayController/leddisplaybackend.cpp +++ b/LedDisplayController/leddisplaybackend.cpp @@ -157,7 +157,7 @@ void LedDisplayBackend::sendBluetoothKeepAlive() { } void LedDisplayBackend::handleBluetoothDataReceived(QString s){ - //qDebug() << "New data: \n" << qPrintable(s); + qDebug() << "New data: \n" << qPrintable(s); QJsonParseError parseError; QJsonDocument doc = QJsonDocument::fromJson(s.toUtf8(), &parseError); @@ -199,6 +199,8 @@ void LedDisplayBackend::handleBluetoothDataReceived(QString s){ this->displayTextModel->maximumTextLength = data["maximumTextLength"].toInt(); this->displayTextModel->maximumTextSets = data["maximumTextSets"].toInt(); + qDebug() << "text sets are: " << this->textSetsBuffer; + this->displayTextModel->setTexts(this->textSetsBuffer); this->textSetsBuffer.clear(); diff --git a/LedDisplayController/leddisplaytextmodel.cpp b/LedDisplayController/leddisplaytextmodel.cpp index 7a7d138..a5a13f9 100644 --- a/LedDisplayController/leddisplaytextmodel.cpp +++ b/LedDisplayController/leddisplaytextmodel.cpp @@ -42,6 +42,7 @@ QHash LedDisplayTextModel::roleNames() const { ColorRole, "color" }, { AlignmentRole, "alignment" }, { ScrollRole, "scroll" }, + { ScrollDirectionRole, "scrollDirection" }, { ScrollSpeedRole, "scrollSpeed" }, { ScrollCountRole, "scrollCount" }, { IndexRole, "index" } @@ -54,8 +55,9 @@ void LedDisplayTextModel::append( bool active, unsigned int runtime, QString color, - QString alignment, + unsigned int alignment, bool scroll, + unsigned int scrollDirection, unsigned int scrollSpeed, unsigned int scrollCount ) { @@ -74,6 +76,7 @@ void LedDisplayTextModel::append( { ColorRole, color }, { AlignmentRole, alignment }, { ScrollRole, scroll }, + { ScrollDirectionRole, scrollDirection}, { ScrollSpeedRole, scrollSpeed }, { ScrollCountRole, scrollCount } }; diff --git a/LedDisplayController/leddisplaytextmodel.h b/LedDisplayController/leddisplaytextmodel.h index c13e905..97db764 100644 --- a/LedDisplayController/leddisplaytextmodel.h +++ b/LedDisplayController/leddisplaytextmodel.h @@ -22,6 +22,7 @@ public: ColorRole, AlignmentRole, ScrollRole, + ScrollDirectionRole, ScrollSpeedRole, ScrollCountRole, IndexRole, @@ -46,8 +47,9 @@ public: bool active, unsigned int runtime, QString color, - QString alignment, + unsigned int alignment, bool scroll, + unsigned int scrollDirection, unsigned int scrollSpeed, unsigned int scrollCount ); @@ -81,6 +83,7 @@ private: {ColorRole, QVariant::String}, {AlignmentRole, QVariant::Int}, {ScrollRole, QVariant::Bool}, + {ScrollDirectionRole, QVariant::Int}, {ScrollSpeedRole, QVariant::Int}, {ScrollCountRole, QVariant::Int}, {IndexRole, QVariant::Int} diff --git a/LedDisplayController/ressources/qml/TextEditDialog.qml b/LedDisplayController/ressources/qml/TextEditDialog.qml index 11c9a4e..54dc6bb 100644 --- a/LedDisplayController/ressources/qml/TextEditDialog.qml +++ b/LedDisplayController/ressources/qml/TextEditDialog.qml @@ -31,6 +31,7 @@ Dialog { editingModel.color = colorColorPicker.value editingModel.alignment = alignmentComboBox.currentIndex editingModel.scroll = scrollSwitch.checked + editingModel.scrollDirection = scrollDirectionComboBox.currentIndex editingModel.scrollSpeed = scrollSpeedSpinBox.value editingModel.scrollCount = scrollCountSpinBox.value } @@ -39,8 +40,9 @@ Dialog { activeSwitch.checked, runtimeSpinBox.value, colorColorPicker.value, - alignmentComboBox.currentText, + alignmentComboBox.currentIndex, scrollSwitch.checked, + scrollDirectionComboBox.currentIndex, scrollSpeedSpinBox.value, scrollCountSpinBox.value ) @@ -97,7 +99,7 @@ Dialog { ComboBoxDelegate { id: alignmentComboBox Layout.fillWidth: true - model: ["left", "center", "right"] + model: [qsTr("left"), qsTr("center"), qsTr("right")] text: qsTr("Alignment") } @@ -107,6 +109,13 @@ Dialog { text: qsTr("Scroll") } + ComboBoxDelegate { + id: scrollDirectionComboBox + Layout.fillWidth: true + model: [qsTr("right to left"), qsTr("left to right")] + text: qsTr("Scroll direction") + } + SpinBoxDelegate { id: scrollSpeedSpinBox Layout.fillWidth: true @@ -166,6 +175,7 @@ Dialog { colorColorPicker.value = editingModel.color alignmentComboBox.currentIndex = editingModel.alignment scrollSwitch.checked = editingModel.scroll + scrollDirectionComboBox.currentIndex = editingModel.scrollDirection scrollSpeedSpinBox.value = editingModel.scrollSpeed scrollCountSpinBox.value = editingModel.scrollCount @@ -186,6 +196,7 @@ Dialog { colorColorPicker.value = "#ffffff" alignmentComboBox.currentIndex = 0 scrollSwitch.checked = false + scrollDirectionComboBox.currentIndex = 0 scrollSpeedSpinBox.value = 5 scrollCountSpinBox.value = 1 } diff --git a/vscode/OmobiLEDdisplayBluetooth/include/LedDisplayController.h b/vscode/OmobiLEDdisplayBluetooth/include/LedDisplayController.h index 899932c..fb595e8 100644 --- a/vscode/OmobiLEDdisplayBluetooth/include/LedDisplayController.h +++ b/vscode/OmobiLEDdisplayBluetooth/include/LedDisplayController.h @@ -59,6 +59,7 @@ public: ColorParameter, AlignmentParameter, ScrollParameter, + ScrollDirectionParameter, ScrollSpeedParameter, ScrollCountParameter, IndexParameter, @@ -125,6 +126,7 @@ private: char color[7]; text_align_t alignment; bool scroll; + int scrollDirection; int scrollSpeed; /*!< Between 0 and 10 */ uint16_t scrollCount; } text_set_t; @@ -137,7 +139,7 @@ private: } sets_t; // storage variables - const text_set_t defaultTextSet {"", false, 0, "", AlignCenter, false, 0, 0}; + const text_set_t defaultTextSet {"", false, 0, "", AlignCenter, false, 0, 0, 0}; sets_t text_sets; // storage control diff --git a/vscode/OmobiLEDdisplayBluetooth/src/LedDisplayController.cpp b/vscode/OmobiLEDdisplayBluetooth/src/LedDisplayController.cpp index ec13925..3272902 100644 --- a/vscode/OmobiLEDdisplayBluetooth/src/LedDisplayController.cpp +++ b/vscode/OmobiLEDdisplayBluetooth/src/LedDisplayController.cpp @@ -291,6 +291,12 @@ LedDisplayController::GetSetTextSetParameterExitCode LedDisplayController::getSe returnValue = currentTextSet->scroll ? "true" : "false"; break; + case ScrollDirectionParameter: + if(set) + currentTextSet->scrollDirection = value->toInt(); + else + returnValue = currentTextSet->scrollDirection; + break; case ScrollSpeedParameter: if (set) { diff --git a/vscode/OmobiLEDdisplayBluetooth/src/OmobiLedDisplay.cpp b/vscode/OmobiLEDdisplayBluetooth/src/OmobiLedDisplay.cpp index b479497..1017ec8 100644 --- a/vscode/OmobiLEDdisplayBluetooth/src/OmobiLedDisplay.cpp +++ b/vscode/OmobiLEDdisplayBluetooth/src/OmobiLedDisplay.cpp @@ -110,6 +110,10 @@ void OmobiLedDisplay::onDataReceived(String dataString) textSetIndex, LedDisplayController::DisplayTextSetParameter(textSetParameter)); + Serial.println("sending parameter: " + String(textSetParameter) + " with value: " + this->ledDisplayController->getTextSetParameter( + textSetIndex, + LedDisplayController::DisplayTextSetParameter(textSetParameter))); + String json; serializeJson(doc, json); this->bleServer->sendData(json);