mirror of
https://github.com/Serial-Studio/Serial-Studio.git
synced 2025-01-15 05:22:53 +08:00
Save SSL settings in MQTT dialog
This commit is contained in:
parent
615115fa41
commit
e15f423e6b
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@ -54,7 +54,7 @@ jobs:
|
|||||||
|
|
||||||
- name: '🚧 Compile application'
|
- name: '🚧 Compile application'
|
||||||
run: |
|
run: |
|
||||||
qmake ${{env.QMAKE_PROJECT}} CONFIG+=release PREFIX=/usr
|
qmake ${{env.QMAKE_PROJECT}} CONFIG+=release CONFIG+=unity_build PREFIX=/usr
|
||||||
make -j16
|
make -j16
|
||||||
|
|
||||||
- name: '💭 Perform CodeQL Analysis'
|
- name: '💭 Perform CodeQL Analysis'
|
||||||
|
6
.github/workflows/deploy.yml
vendored
6
.github/workflows/deploy.yml
vendored
@ -69,7 +69,7 @@ jobs:
|
|||||||
|
|
||||||
- name: '🚧 Compile application'
|
- name: '🚧 Compile application'
|
||||||
run: |
|
run: |
|
||||||
${{env.QMAKE}} ${{env.QMAKE_PROJECT}} CONFIG+=release PREFIX=/usr
|
${{env.QMAKE}} ${{env.QMAKE_PROJECT}} CONFIG+=release CONFIG+=unity_build PREFIX=/usr
|
||||||
make -j${{env.CORES}}
|
make -j${{env.CORES}}
|
||||||
|
|
||||||
- name: '⚙️ Install linuxdeployqt'
|
- name: '⚙️ Install linuxdeployqt'
|
||||||
@ -118,7 +118,7 @@ jobs:
|
|||||||
|
|
||||||
- name: '🚧 Compile application'
|
- name: '🚧 Compile application'
|
||||||
run: |
|
run: |
|
||||||
${{env.QMAKE}} ${{env.QMAKE_PROJECT}} CONFIG+=release PREFIX=/usr
|
${{env.QMAKE}} ${{env.QMAKE_PROJECT}} CONFIG+=release CONFIG+=unity_build PREFIX=/usr
|
||||||
make -j${{env.CORES}}
|
make -j${{env.CORES}}
|
||||||
|
|
||||||
- name: '📦 Package application (macdeployqt and zipfile)'
|
- name: '📦 Package application (macdeployqt and zipfile)'
|
||||||
@ -176,7 +176,7 @@ jobs:
|
|||||||
|
|
||||||
- name: '🚧 Compile application'
|
- name: '🚧 Compile application'
|
||||||
run: |
|
run: |
|
||||||
${{env.QMAKE}} ${{env.QMAKE_PROJECT}} CONFIG+=release PREFIX=/usr
|
${{env.QMAKE}} ${{env.QMAKE_PROJECT}} CONFIG+=release CONFIG+=unity_build PREFIX=/usr
|
||||||
nmake
|
nmake
|
||||||
|
|
||||||
# Copy Qt DLLs, compiler runtime & application icon
|
# Copy Qt DLLs, compiler runtime & application icon
|
||||||
|
@ -96,14 +96,10 @@ CONFIG += c++11
|
|||||||
CONFIG += silent
|
CONFIG += silent
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------------------
|
||||||
# Enable/Disable single unit build depending on build configuration
|
# Unity build
|
||||||
#-----------------------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
CONFIG(debug, debug|release) {
|
CONFIG(unity_build) {
|
||||||
CONFIG -= ltcg # Disable linker optimization
|
|
||||||
DEFINES += UNITY_BUILD=0 # Disable unity build
|
|
||||||
DEFINES += UNITY_BUILD_INCLUDE_QML=0 # Do not optimize QtQuick compiler cache
|
|
||||||
} else {
|
|
||||||
CONFIG += ltcg # Enable linker optimization
|
CONFIG += ltcg # Enable linker optimization
|
||||||
DEFINES += UNITY_BUILD=1 # Enable unity build
|
DEFINES += UNITY_BUILD=1 # Enable unity build
|
||||||
DEFINES += UNITY_BUILD_INCLUDE_QML=0 # Do not optimize QtQuick compiler cache
|
DEFINES += UNITY_BUILD_INCLUDE_QML=0 # Do not optimize QtQuick compiler cache
|
||||||
|
@ -51,7 +51,7 @@ Window {
|
|||||||
property bool firstChange: true
|
property bool firstChange: true
|
||||||
property bool isMaximized: false
|
property bool isMaximized: false
|
||||||
property bool isMinimized: false
|
property bool isMinimized: false
|
||||||
property alias isFullscreen: border.isFullscreen
|
property alias isFullscreen: _title.isFullscreen
|
||||||
readonly property int customFlags: Qt.Window |
|
readonly property int customFlags: Qt.Window |
|
||||||
Qt.CustomizeWindowHint |
|
Qt.CustomizeWindowHint |
|
||||||
Qt.FramelessWindowHint |
|
Qt.FramelessWindowHint |
|
||||||
@ -73,7 +73,7 @@ Window {
|
|||||||
//
|
//
|
||||||
// Alias to the titlebar
|
// Alias to the titlebar
|
||||||
//
|
//
|
||||||
property alias titlebar: border
|
property alias titlebar: _title
|
||||||
|
|
||||||
//
|
//
|
||||||
// Size of the shadow object
|
// Size of the shadow object
|
||||||
@ -83,9 +83,9 @@ Window {
|
|||||||
//
|
//
|
||||||
// Titlebar left/right margins for custom controls
|
// Titlebar left/right margins for custom controls
|
||||||
//
|
//
|
||||||
property alias leftTitlebarMargin: border.leftMargin
|
property alias leftTitlebarMargin: _title.leftMargin
|
||||||
property alias rightTitlebarMargin: border.rightMargin
|
property alias rightTitlebarMargin: _title.rightMargin
|
||||||
property alias showMacControls: border.showMacControls
|
property alias showMacControls: _title.showMacControls
|
||||||
|
|
||||||
//
|
//
|
||||||
// Background color of the window & the titlebar
|
// Background color of the window & the titlebar
|
||||||
@ -98,10 +98,10 @@ Window {
|
|||||||
//
|
//
|
||||||
// Window controls
|
// Window controls
|
||||||
//
|
//
|
||||||
property alias closeEnabled: border.closeEnabled
|
property alias closeEnabled: _title.closeEnabled
|
||||||
property alias minimizeEnabled: border.minimizeEnabled
|
property alias minimizeEnabled: _title.minimizeEnabled
|
||||||
property alias maximizeEnabled: border.maximizeEnabled
|
property alias maximizeEnabled: _title.maximizeEnabled
|
||||||
property alias fullscreenEnabled: border.fullscreenEnabled
|
property alias fullscreenEnabled: _title.fullscreenEnabled
|
||||||
|
|
||||||
//
|
//
|
||||||
// Shadow implementation
|
// Shadow implementation
|
||||||
@ -147,7 +147,7 @@ Window {
|
|||||||
// Titlebar control
|
// Titlebar control
|
||||||
//
|
//
|
||||||
Titlebar {
|
Titlebar {
|
||||||
id: border
|
id: _title
|
||||||
window: root
|
window: root
|
||||||
radius: root.radius
|
radius: root.radius
|
||||||
color: root.titlebarColor
|
color: root.titlebarColor
|
||||||
|
@ -46,10 +46,10 @@ FramelessWindow.CustomWindow {
|
|||||||
extraFlags: Qt.WindowStaysOnTopHint
|
extraFlags: Qt.WindowStaysOnTopHint
|
||||||
x: (Screen.desktopAvailableWidth - width) / 2
|
x: (Screen.desktopAvailableWidth - width) / 2
|
||||||
y: (Screen.desktopAvailableHeight - height) / 2
|
y: (Screen.desktopAvailableHeight - height) / 2
|
||||||
|
minimumHeight: 440 + titlebar.height + 2 * root.shadowMargin
|
||||||
|
maximumHeight: 440 + titlebar.height + 2 * root.shadowMargin
|
||||||
minimumWidth: column.implicitWidth + 4 * app.spacing + 2 * root.shadowMargin
|
minimumWidth: column.implicitWidth + 4 * app.spacing + 2 * root.shadowMargin
|
||||||
maximumWidth: column.implicitWidth + 4 * app.spacing + 2 * root.shadowMargin
|
maximumWidth: column.implicitWidth + 4 * app.spacing + 2 * root.shadowMargin
|
||||||
minimumHeight: column.implicitHeight + 4 * app.spacing + titlebar.height + 2 * root.shadowMargin
|
|
||||||
maximumHeight: column.implicitHeight + 4 * app.spacing + titlebar.height + 2 * root.shadowMargin
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Titlebar options
|
// Titlebar options
|
||||||
@ -74,6 +74,9 @@ FramelessWindow.CustomWindow {
|
|||||||
property alias retain: _retain.checked
|
property alias retain: _retain.checked
|
||||||
property alias user: _user.text
|
property alias user: _user.text
|
||||||
property alias password: _password.text
|
property alias password: _password.text
|
||||||
|
property alias ssl: _ssl.checked
|
||||||
|
property alias certificate: _certificateMode.currentIndex
|
||||||
|
property alias protocol: _protocols.currentIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -374,6 +377,7 @@ FramelessWindow.CustomWindow {
|
|||||||
Behavior on opacity {NumberAnimation{}}
|
Behavior on opacity {NumberAnimation{}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
// Spacers
|
// Spacers
|
||||||
//
|
//
|
||||||
Item {
|
Item {
|
||||||
@ -472,7 +476,7 @@ FramelessWindow.CustomWindow {
|
|||||||
visible: _ssl.checked
|
visible: _ssl.checked
|
||||||
text: qsTr("Certificate:")
|
text: qsTr("Certificate:")
|
||||||
opacity: enabled ? 1 : 0.5
|
opacity: enabled ? 1 : 0.5
|
||||||
enabled: !Cpp_MQTT_Client.isConnectedToHost && visible
|
enabled: !Cpp_MQTT_Client.isConnectedToHosT
|
||||||
Behavior on opacity {NumberAnimation{}}
|
Behavior on opacity {NumberAnimation{}}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,8 +485,8 @@ FramelessWindow.CustomWindow {
|
|||||||
//
|
//
|
||||||
Switch {
|
Switch {
|
||||||
id: _ssl
|
id: _ssl
|
||||||
Layout.leftMargin: -app.spacing
|
|
||||||
opacity: enabled ? 1 : 0.5
|
opacity: enabled ? 1 : 0.5
|
||||||
|
Layout.leftMargin: -app.spacing
|
||||||
enabled: !Cpp_MQTT_Client.isConnectedToHost
|
enabled: !Cpp_MQTT_Client.isConnectedToHost
|
||||||
Behavior on opacity {NumberAnimation{}}
|
Behavior on opacity {NumberAnimation{}}
|
||||||
}
|
}
|
||||||
@ -520,6 +524,47 @@ FramelessWindow.CustomWindow {
|
|||||||
Behavior on opacity {NumberAnimation{}}
|
Behavior on opacity {NumberAnimation{}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Spacers
|
||||||
|
//
|
||||||
|
Item {
|
||||||
|
height: app.spacing
|
||||||
|
visible: _ssl.checked
|
||||||
|
} Item {
|
||||||
|
height: app.spacing
|
||||||
|
visible: _ssl.checked
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// SSL/TLS protocol selection title
|
||||||
|
//
|
||||||
|
Item {
|
||||||
|
visible: _ssl.checked
|
||||||
|
Layout.fillWidth: true
|
||||||
|
} Label {
|
||||||
|
visible: _ssl.checked
|
||||||
|
text: qsTr("Protocol:")
|
||||||
|
opacity: enabled ? 1 : 0.5
|
||||||
|
enabled: !Cpp_MQTT_Client.isConnectedToHost
|
||||||
|
Behavior on opacity {NumberAnimation{}}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// SSL/TLS protocol selection
|
||||||
|
//
|
||||||
|
Item {
|
||||||
|
visible: _ssl.checked
|
||||||
|
Layout.fillWidth: true
|
||||||
|
} ComboBox {
|
||||||
|
id: _protocols
|
||||||
|
visible: _ssl.checked
|
||||||
|
Layout.fillWidth: true
|
||||||
|
opacity: enabled ? 1 : 0.5
|
||||||
|
model: Cpp_MQTT_Client.sslProtocols
|
||||||
|
enabled: !Cpp_MQTT_Client.isConnectedToHost
|
||||||
|
Behavior on opacity {NumberAnimation{}}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -228,6 +228,22 @@ StringList Client::mqttVersions() const
|
|||||||
return StringList { "MQTT 3.1.0", "MQTT 3.1.1" };
|
return StringList { "MQTT 3.1.0", "MQTT 3.1.1" };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list with the supported SSL/TLS protocols
|
||||||
|
*/
|
||||||
|
StringList Client::sslProtocols() const
|
||||||
|
{
|
||||||
|
return StringList {
|
||||||
|
tr("System default"),
|
||||||
|
"TLS v1.0",
|
||||||
|
"TLS v1.1",
|
||||||
|
"TLS v1.2",
|
||||||
|
"DTLS v1.0",
|
||||||
|
"DTLS v1.2",
|
||||||
|
"DTLS v1.3"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tries to establish a TCP connection with the MQTT broker/server.
|
* Tries to establish a TCP connection with the MQTT broker/server.
|
||||||
*/
|
*/
|
||||||
|
@ -116,6 +116,9 @@ class Client : public QObject
|
|||||||
Q_PROPERTY(StringList qosLevels
|
Q_PROPERTY(StringList qosLevels
|
||||||
READ qosLevels
|
READ qosLevels
|
||||||
CONSTANT)
|
CONSTANT)
|
||||||
|
Q_PROPERTY(StringList sslProtocols
|
||||||
|
READ sslProtocols
|
||||||
|
CONSTANT)
|
||||||
Q_PROPERTY(quint16 defaultPort
|
Q_PROPERTY(quint16 defaultPort
|
||||||
READ defaultPort
|
READ defaultPort
|
||||||
CONSTANT)
|
CONSTANT)
|
||||||
@ -158,6 +161,7 @@ public:
|
|||||||
StringList qosLevels() const;
|
StringList qosLevels() const;
|
||||||
StringList clientModes() const;
|
StringList clientModes() const;
|
||||||
StringList mqttVersions() const;
|
StringList mqttVersions() const;
|
||||||
|
StringList sslProtocols() const;
|
||||||
|
|
||||||
quint16 defaultPort() const { return 1883; }
|
quint16 defaultPort() const { return 1883; }
|
||||||
QString defaultHost() const { return "127.0.0.1"; }
|
QString defaultHost() const { return "127.0.0.1"; }
|
||||||
@ -198,5 +202,6 @@ private:
|
|||||||
quint16 m_sentMessages;
|
quint16 m_sentMessages;
|
||||||
QVector<QByteArray> m_frames;
|
QVector<QByteArray> m_frames;
|
||||||
MQTTClientMode m_clientMode;
|
MQTTClientMode m_clientMode;
|
||||||
|
QSslConfiguration m_sslConfiguration;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user