mirror of
https://github.com/Serial-Studio/Serial-Studio.git
synced 2025-01-31 17:42:55 +08:00
Fixes to be able to compile on Raspberry Pi
This commit is contained in:
parent
840ab906e7
commit
ed806c3563
@ -217,7 +217,7 @@ Widgets.Window {
|
||||
icon: "qrc:/icons/group.svg"
|
||||
count: Cpp_UI_Dashboard.groupCount
|
||||
titles: Cpp_UI_Dashboard.groupTitles
|
||||
onCheckedChanged: (index, checked) => Cpp_UI_Dashboard.setGroupVisible(index, checked)
|
||||
onCheckedChanged: Cpp_UI_Dashboard.setGroupVisible(index, checked)
|
||||
}
|
||||
|
||||
//
|
||||
@ -228,7 +228,7 @@ Widgets.Window {
|
||||
icon: "qrc:/icons/multiplot.svg"
|
||||
count: Cpp_UI_Dashboard.multiPlotCount
|
||||
titles: Cpp_UI_Dashboard.multiPlotTitles
|
||||
onCheckedChanged: (index, checked) => Cpp_UI_Dashboard.setMultiplotVisible(index, checked)
|
||||
onCheckedChanged: Cpp_UI_Dashboard.setMultiplotVisible(index, checked)
|
||||
}
|
||||
|
||||
//
|
||||
@ -239,7 +239,7 @@ Widgets.Window {
|
||||
icon: "qrc:/icons/led.svg"
|
||||
count: Cpp_UI_Dashboard.ledCount
|
||||
titles: Cpp_UI_Dashboard.ledTitles
|
||||
onCheckedChanged: (index, checked) => Cpp_UI_Dashboard.setLedVisible(index, checked)
|
||||
onCheckedChanged: Cpp_UI_Dashboard.setLedVisible(index, checked)
|
||||
}
|
||||
|
||||
//
|
||||
@ -250,7 +250,7 @@ Widgets.Window {
|
||||
icon: "qrc:/icons/fft.svg"
|
||||
count: Cpp_UI_Dashboard.fftCount
|
||||
titles: Cpp_UI_Dashboard.fftTitles
|
||||
onCheckedChanged: (index, checked) => Cpp_UI_Dashboard.setFFTVisible(index, checked)
|
||||
onCheckedChanged: Cpp_UI_Dashboard.setFFTVisible(index, checked)
|
||||
}
|
||||
|
||||
//
|
||||
@ -261,7 +261,7 @@ Widgets.Window {
|
||||
icon: "qrc:/icons/plot.svg"
|
||||
count: Cpp_UI_Dashboard.plotCount
|
||||
titles: Cpp_UI_Dashboard.plotTitles
|
||||
onCheckedChanged: (index, checked) => Cpp_UI_Dashboard.setPlotVisible(index, checked)
|
||||
onCheckedChanged: Cpp_UI_Dashboard.setPlotVisible(index, checked)
|
||||
}
|
||||
|
||||
//
|
||||
@ -272,7 +272,7 @@ Widgets.Window {
|
||||
icon: "qrc:/icons/bar.svg"
|
||||
count: Cpp_UI_Dashboard.barCount
|
||||
titles: Cpp_UI_Dashboard.barTitles
|
||||
onCheckedChanged: (index, checked) => Cpp_UI_Dashboard.setBarVisible(index, checked)
|
||||
onCheckedChanged: Cpp_UI_Dashboard.setBarVisible(index, checked)
|
||||
}
|
||||
|
||||
//
|
||||
@ -283,7 +283,7 @@ Widgets.Window {
|
||||
icon: "qrc:/icons/gauge.svg"
|
||||
count: Cpp_UI_Dashboard.gaugeCount
|
||||
titles: Cpp_UI_Dashboard.gaugeTitles
|
||||
onCheckedChanged: (index, checked) => Cpp_UI_Dashboard.setGaugeVisible(index, checked)
|
||||
onCheckedChanged: Cpp_UI_Dashboard.setGaugeVisible(index, checked)
|
||||
}
|
||||
|
||||
//
|
||||
@ -294,7 +294,7 @@ Widgets.Window {
|
||||
icon: "qrc:/icons/compass.svg"
|
||||
count: Cpp_UI_Dashboard.compassCount
|
||||
titles: Cpp_UI_Dashboard.compassTitles
|
||||
onCheckedChanged: (index, checked) => Cpp_UI_Dashboard.setCompassVisible(index, checked)
|
||||
onCheckedChanged: Cpp_UI_Dashboard.setCompassVisible(index, checked)
|
||||
}
|
||||
|
||||
//
|
||||
@ -305,7 +305,7 @@ Widgets.Window {
|
||||
icon: "qrc:/icons/gyro.svg"
|
||||
count: Cpp_UI_Dashboard.gyroscopeCount
|
||||
titles: Cpp_UI_Dashboard.gyroscopeTitles
|
||||
onCheckedChanged: (index, checked) => Cpp_UI_Dashboard.setGyroscopeVisible(index, checked)
|
||||
onCheckedChanged: Cpp_UI_Dashboard.setGyroscopeVisible(index, checked)
|
||||
}
|
||||
|
||||
//
|
||||
@ -316,7 +316,7 @@ Widgets.Window {
|
||||
icon: "qrc:/icons/accelerometer.svg"
|
||||
count: Cpp_UI_Dashboard.accelerometerCount
|
||||
titles: Cpp_UI_Dashboard.accelerometerTitles
|
||||
onCheckedChanged: (index, checked) => Cpp_UI_Dashboard.setAccelerometerVisible(index, checked)
|
||||
onCheckedChanged: Cpp_UI_Dashboard.setAccelerometerVisible(index, checked)
|
||||
}
|
||||
|
||||
//
|
||||
@ -327,7 +327,7 @@ Widgets.Window {
|
||||
icon: "qrc:/icons/gps.svg"
|
||||
count: Cpp_UI_Dashboard.gpsCount
|
||||
titles: Cpp_UI_Dashboard.gpsTitles
|
||||
onCheckedChanged: (index, checked) => Cpp_UI_Dashboard.setGpsVisible(index, checked)
|
||||
onCheckedChanged: Cpp_UI_Dashboard.setGpsVisible(index, checked)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ QtWindow.Window {
|
||||
//
|
||||
// Maximize window fixes
|
||||
//
|
||||
onVisibilityChanged: (visibility) => {
|
||||
onVisibilityChanged: {
|
||||
// Ensure that correct window flags are still used
|
||||
if (Cpp_ThemeManager.customWindowDecorations) {
|
||||
// Hard-reset window flags on macOS to fix most glitches
|
||||
|
@ -52,7 +52,7 @@ Item {
|
||||
DashboardItems.ViewOptions {
|
||||
Layout.fillHeight: true
|
||||
Layout.minimumWidth: 280
|
||||
onWidgetSizeChanged: (maxSize) => widgetGrid.maxSize = maxSize
|
||||
onWidgetSizeChanged: widgetGrid.maxSize = maxSize
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -28,7 +28,7 @@ DropArea {
|
||||
//
|
||||
// Show rectangle and set color based on file extension on drag enter
|
||||
//
|
||||
onEntered: (drag) => {
|
||||
onEntered: {
|
||||
// Get file name & set color of rectangle accordingly
|
||||
if (drag.urls.length > 0) {
|
||||
var path = drag.urls[0].toString()
|
||||
@ -49,7 +49,7 @@ DropArea {
|
||||
//
|
||||
// Open *.json & *.csv files on drag drop
|
||||
//
|
||||
onDropped: (drop) => {
|
||||
onDropped: {
|
||||
// Hide rectangle
|
||||
dropRectangle.hide()
|
||||
|
||||
|
@ -157,7 +157,7 @@ Item {
|
||||
acceptedButtons: Qt.RightButton
|
||||
anchors.rightMargin: textEdit.scrollbarWidth
|
||||
|
||||
onClicked: (mouse) => {
|
||||
onClicked: {
|
||||
if (mouse.button === Qt.RightButton) {
|
||||
contextMenu.popup()
|
||||
mouse.accepted = true
|
||||
|
@ -126,7 +126,7 @@ Page {
|
||||
anchors.fill: parent
|
||||
onDoubleClicked: root.headerDoubleClicked()
|
||||
|
||||
onClicked: (mouse) => {
|
||||
onClicked: {
|
||||
if (mouse.x >= headerBt.x && mouse.x <= headerBt.x + headerBt.width)
|
||||
root.headerDoubleClicked()
|
||||
}
|
||||
|
@ -23,8 +23,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <QFile>
|
||||
#include <QVector>
|
||||
#include <QObject>
|
||||
#include <QVariant>
|
||||
#include <QDateTime>
|
||||
#include <QTextStream>
|
||||
#include <QJsonObject>
|
||||
|
||||
|
@ -37,10 +37,20 @@ IO::DataSources::Network::Network()
|
||||
setUdpLocalPort(defaultUdpLocalPort());
|
||||
setUdpRemotePort(defaultUdpRemotePort());
|
||||
setSocketType(QAbstractSocket::TcpSocket);
|
||||
connect(&m_tcpSocket, &QTcpSocket::errorOccurred, this,
|
||||
&IO::DataSources::Network::onErrorOccurred);
|
||||
connect(&m_udpSocket, &QUdpSocket::errorOccurred, this,
|
||||
&IO::DataSources::Network::onErrorOccurred);
|
||||
|
||||
// clang-format off
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
||||
connect(&m_tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)),
|
||||
this, SLOT(onErrorOccurred(QAbstractSocket::SocketError)));
|
||||
connect(&m_udpSocket, SIGNAL(error(QAbstractSocket::SocketError)),
|
||||
this, SLOT(onErrorOccurred(QAbstractSocket::SocketError)));
|
||||
#else
|
||||
connect(&m_tcpSocket, &QTcpSocket::errorOccurred,
|
||||
this, &IO::DataSources::Network::onErrorOccurred);
|
||||
connect(&m_udpSocket, &QUdpSocket::errorOccurred,
|
||||
this, &IO::DataSources::Network::onErrorOccurred);
|
||||
#endif
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -626,6 +626,7 @@ void IO::DataSources::Serial::readSettings()
|
||||
m_baudRateList.append(list.at(i));
|
||||
|
||||
// Sort baud rate list
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
|
||||
for (auto i = 0; i < m_baudRateList.count() - 1; ++i)
|
||||
{
|
||||
for (auto j = 0; j < m_baudRateList.count() - i - 1; ++j)
|
||||
@ -636,6 +637,7 @@ void IO::DataSources::Serial::readSettings()
|
||||
m_baudRateList.swapItemsAt(j, j + 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Notify UI
|
||||
Q_EMIT baudRateListChanged();
|
||||
@ -647,6 +649,7 @@ void IO::DataSources::Serial::readSettings()
|
||||
void IO::DataSources::Serial::writeSettings()
|
||||
{
|
||||
// Sort baud rate list
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
|
||||
for (auto i = 0; i < m_baudRateList.count() - 1; ++i)
|
||||
{
|
||||
for (auto j = 0; j < m_baudRateList.count() - i - 1; ++j)
|
||||
@ -660,6 +663,7 @@ void IO::DataSources::Serial::writeSettings()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Convert QVector to QStringList
|
||||
QStringList list;
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QVector>
|
||||
#include <JSON/Dataset.h>
|
||||
|
||||
namespace UI
|
||||
|
@ -250,10 +250,16 @@ StringList MQTT::Client::mqttVersions() const
|
||||
*/
|
||||
StringList MQTT::Client::sslProtocols() const
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
||||
return StringList {
|
||||
tr("System default"), "TLS v1.0", "TLS v1.1", "TLS v1.2"
|
||||
};
|
||||
#else
|
||||
return StringList {
|
||||
tr("System default"), "TLS v1.0", "TLS v1.1", "TLS v1.2",
|
||||
"TLS v1.3 (or later)", "DTLS v1.0", "DTLS v1.2", "DTLS v1.2 (or later)"
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -271,8 +277,11 @@ QString MQTT::Client::caFilePath() const
|
||||
void MQTT::Client::loadCaFile()
|
||||
{
|
||||
// Prompt user to select a CA file
|
||||
auto path
|
||||
= QFileDialog::getOpenFileName(Q_NULLPTR, tr("Select CA file"), QDir::homePath());
|
||||
// clang-format off
|
||||
auto path = QFileDialog::getOpenFileName(Q_NULLPTR,
|
||||
tr("Select CA file"),
|
||||
QDir::homePath());
|
||||
// clang-format on
|
||||
|
||||
// Try to load the *.ca file
|
||||
loadCaFile(path);
|
||||
@ -420,6 +429,25 @@ void MQTT::Client::loadCaFile(const QString &path)
|
||||
*/
|
||||
void MQTT::Client::setSslProtocol(const int index)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
m_sslConfiguration.setProtocol(QSsl::SecureProtocols);
|
||||
break;
|
||||
case 1:
|
||||
m_sslConfiguration.setProtocol(QSsl::TlsV1_0);
|
||||
break;
|
||||
case 2:
|
||||
m_sslConfiguration.setProtocol(QSsl::TlsV1_1);
|
||||
break;
|
||||
case 3:
|
||||
m_sslConfiguration.setProtocol(QSsl::TlsV1_2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#else
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
@ -449,6 +477,7 @@ void MQTT::Client::setSslProtocol(const int index)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
regenerateClient();
|
||||
Q_EMIT sslProtocolChanged();
|
||||
|
@ -181,8 +181,18 @@ void Plugins::Server::acceptConnection()
|
||||
|
||||
// Connect socket signals/slots
|
||||
connect(socket, &QTcpSocket::readyRead, this, &Plugins::Server::onDataReceived);
|
||||
connect(socket, &QTcpSocket::errorOccurred, this, &Plugins::Server::onErrorOccurred);
|
||||
connect(socket, &QTcpSocket::disconnected, this, &Plugins::Server::removeConnection);
|
||||
|
||||
// React to socket errors
|
||||
// clang-format off
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
||||
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)),
|
||||
this, SLOT(onErrorOccurred(QAbstractSocket::SocketError)));
|
||||
#else
|
||||
connect(socket, &QTcpSocket::errorOccurred,
|
||||
this, &Plugins::Server::onErrorOccurred);
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
// Add socket to sockets list
|
||||
m_sockets.append(socket);
|
||||
|
@ -98,7 +98,6 @@ class DashboardWidget : public DeclarativeWidget
|
||||
{
|
||||
// clang-format off
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
Q_PROPERTY(int widgetIndex
|
||||
READ widgetIndex
|
||||
WRITE setWidgetIndex
|
||||
|
@ -64,7 +64,6 @@ class Terminal : public UI::DeclarativeWidget
|
||||
{
|
||||
// clang-format off
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
Q_PROPERTY(QFont font
|
||||
READ font
|
||||
WRITE setFont
|
||||
|
Loading…
x
Reference in New Issue
Block a user