Remove TX/RX LEDs

This commit is contained in:
Alex Spataru 2021-11-18 23:39:38 -06:00
parent 3fa6cd5bfa
commit b08c6954e3
6 changed files with 1 additions and 157 deletions

View File

@ -293,7 +293,6 @@ DISTFILES += \
assets/qml/PlatformDependent/MenubarMacOS.qml \ assets/qml/PlatformDependent/MenubarMacOS.qml \
assets/qml/Widgets/Icon.qml \ assets/qml/Widgets/Icon.qml \
assets/qml/Widgets/JSONDropArea.qml \ assets/qml/Widgets/JSONDropArea.qml \
assets/qml/Widgets/LED.qml \
assets/qml/Widgets/Shadow.qml \ assets/qml/Widgets/Shadow.qml \
assets/qml/Widgets/Terminal.qml \ assets/qml/Widgets/Terminal.qml \
assets/qml/Widgets/Window.qml \ assets/qml/Widgets/Window.qml \

View File

@ -122,7 +122,6 @@
<file>qml/PlatformDependent/MenubarMacOS.qml</file> <file>qml/PlatformDependent/MenubarMacOS.qml</file>
<file>qml/Widgets/Icon.qml</file> <file>qml/Widgets/Icon.qml</file>
<file>qml/Widgets/JSONDropArea.qml</file> <file>qml/Widgets/JSONDropArea.qml</file>
<file>qml/Widgets/LED.qml</file>
<file>qml/Widgets/Shadow.qml</file> <file>qml/Widgets/Shadow.qml</file>
<file>qml/Widgets/Terminal.qml</file> <file>qml/Widgets/Terminal.qml</file>
<file>qml/Widgets/Window.qml</file> <file>qml/Widgets/Window.qml</file>

View File

@ -1,81 +0,0 @@
/*
* Copyright (c) 2020-2021 Alex Spataru <https://github.com/alex-spataru>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.12
RowLayout {
id: root
spacing: app.spacing
//
// Custom properties
//
property alias label: _label
property alias indicator: _dot
property alias text: _label.text
property alias font: _label.font
property alias flashDuration: _timer.interval
//
// Turns on the LED for a short period of time
//
function flash() {
root.enabled = true
if (_timer.running)
_timer.restart()
else
_timer.start()
}
//
// Used to allow the flash behavior
//
Timer {
id: _timer
interval: 50
onTriggered: root.enabled = false
}
//
// LED indicator
//
Rectangle {
id: _dot
width: 14
height: 14
radius: width / 2
Layout.alignment: Qt.AlignVCenter
color: root.enabled ? Cpp_ThemeManager.ledEnabled : Cpp_ThemeManager.ledDisabled
}
//
// LED text
//
Label {
id: _label
font.family: app.monoFont
Layout.alignment: Qt.AlignVCenter
color: root.enabled ? Cpp_ThemeManager.ledEnabled : Cpp_ThemeManager.ledDisabled
}
}

View File

@ -263,72 +263,6 @@ FramelessWindow.CustomWindow {
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
} }
//
// RX LED
//
LED {
id: _rx
enabled: false
Layout.alignment: Qt.AlignVCenter
Connections {
target: Cpp_IO_Manager
function onRx() {
_rx.flash()
}
}
}
//
// RX label
//
Label {
text: "RX"
font.bold: true
font.family: app.monoFont
Layout.alignment: Qt.AlignVCenter
color: _rx.enabled ? Cpp_ThemeManager.ledEnabled : Cpp_ThemeManager.ledDisabled
}
//
// RX/TX middleman icon
//
Icon {
width: 24
height: 24
source: "qrc:/icons/ethernet.svg"
Layout.alignment: Qt.AlignVCenter
color: Cpp_ThemeManager.ledDisabled
}
//
// TX Label
//
Label {
text: "TX"
font.bold: true
font.family: app.monoFont
Layout.alignment: Qt.AlignVCenter
color: _tx.enabled ? Cpp_ThemeManager.ledEnabled : Cpp_ThemeManager.ledDisabled
}
//
// TX LED
//
LED {
id: _tx
enabled: false
layoutDirection: Qt.RightToLeft
Layout.alignment: Qt.AlignVCenter
Connections {
target: Cpp_IO_Manager
function onTx() {
_tx.flash()
}
}
}
} }
// //

View File

@ -275,8 +275,7 @@ StringList Manager::dataSourcesList() const
} }
/** /**
* Tries to write the given @a data to the current device. Upon data write, the class * Tries to write the given @a data to the current device.
* emits the @a tx() signal for UI updating.
* *
* @returns the number of bytes written to the target device * @returns the number of bytes written to the target device
*/ */
@ -315,8 +314,6 @@ qint64 Manager::writeData(const QByteArray &data)
{ {
auto writtenData = data; auto writtenData = data;
writtenData.chop(data.length() - bytes); writtenData.chop(data.length() - bytes);
emit tx();
emit dataSent(writtenData); emit dataSent(writtenData);
} }
@ -434,7 +431,6 @@ void Manager::processPayload(const QByteArray &payload)
m_receivedBytes = 0; m_receivedBytes = 0;
// Notify user interface & application modules // Notify user interface & application modules
emit rx();
emit dataReceived(payload); emit dataReceived(payload);
emit frameReceived(payload); emit frameReceived(payload);
emit receivedBytesChanged(); emit receivedBytesChanged();
@ -644,7 +640,6 @@ void Manager::onDataReceived()
// Notify user interface // Notify user interface
emit receivedBytesChanged(); emit receivedBytesChanged();
emit dataReceived(data); emit dataReceived(data);
emit rx();
} }
/** /**

View File

@ -97,8 +97,6 @@ class Manager : public QObject
// clang-format on // clang-format on
signals: signals:
void tx();
void rx();
void deviceChanged(); void deviceChanged();
void connectedChanged(); void connectedChanged();
void watchdogTriggered(); void watchdogTriggered();