Skip to content

Commit 1c3c19b

Browse files
author
zhang zhongyuan
committed
build failed, will to home build env.
1 parent 450f8fc commit 1c3c19b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2709
-164
lines changed

MqttClient.pro

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ SOURCES += \
3434
tabledelegate.cpp \
3535
messageviewer.cpp \
3636
mqttexception.cpp \
37-
license.cpp
37+
license.cpp \
38+
qmqtt.cpp \
39+
qtmqtt.cpp
3840

3941
HEADERS += \
4042
mainwindow.h \
@@ -46,7 +48,10 @@ HEADERS += \
4648
tabledelegate.h \
4749
messageviewer.h \
4850
mqttexception.h \
49-
license.h
51+
license.h \
52+
abstractmqtt.h \
53+
qmqtt.h \
54+
qtmqtt.h
5055

5156
FORMS += \
5257
mainwindow.ui \
@@ -69,9 +74,16 @@ TRANSLATIONS += zh_cn.ts\
6974
#INCLUDEPATH += $$PWD/include
7075
#DEPENDPATH += $$PWD/include
7176

72-
win32:CONFIG(release, debug|release): LIBS += -lQt5Mqtt
73-
else:win32:CONFIG(debug, debug|release): LIBS += -lQt5Mqttd
74-
else:unix: LIBS += -lQt5Mqtt
77+
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/lib/ -lQt5Mqtt -lqmqtt
78+
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/lib/ -lQt5Mqttd -lqmqttd
79+
else:unix: LIBS += -L$$PWD/lib/ -lQt5Mqtt -lqmqtt
7580

7681
#INCLUDEPATH += E:/SoftWare/Qt/Qt5.12.2/5.12.2/mingw73_64/include
7782
#DEPENDPATH += E:/SoftWare/Qt/Qt5.12.2/5.12.2/mingw73_64/include
83+
84+
#win32:CONFIG(release, debug|release): LIBS += -L$$PWD/lib/ -lqmqtt
85+
#else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/lib/ -lqmqttd
86+
#else:unix: LIBS += -L$$PWD/lib/ -lqmqtt
87+
88+
#INCLUDEPATH += $$PWD/.
89+
#DEPENDPATH += $$PWD/.

MqttClient.pro.user

Lines changed: 37 additions & 35 deletions
Large diffs are not rendered by default.

about.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#include "about.h"
22
#include "ui_about.h"
33
#include "license.h"
4+
#include <QUrl>
5+
#include <QDesktopServices>
46

57
About::About(QWidget *parent) :
68
QDialog(parent),
@@ -13,6 +15,9 @@ About::About(QWidget *parent) :
1315
License l(this);
1416
l.exec();
1517
});
18+
connect(ui->github, &QLabel::linkActivated, [](const QString& link){
19+
QDesktopServices::openUrl(QUrl(link));
20+
});
1621
}
1722

1823
About::~About()

about.ui

Lines changed: 92 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<x>0</x>
88
<y>0</y>
99
<width>400</width>
10-
<height>219</height>
10+
<height>252</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -16,21 +16,8 @@
1616
<layout class="QVBoxLayout" name="verticalLayout">
1717
<item>
1818
<widget class="QWidget" name="widget_2" native="true">
19-
<layout class="QHBoxLayout" name="horizontalLayout">
20-
<item>
21-
<spacer name="horizontalSpacer_2">
22-
<property name="orientation">
23-
<enum>Qt::Horizontal</enum>
24-
</property>
25-
<property name="sizeHint" stdset="0">
26-
<size>
27-
<width>40</width>
28-
<height>20</height>
29-
</size>
30-
</property>
31-
</spacer>
32-
</item>
33-
<item>
19+
<layout class="QGridLayout" name="gridLayout_2">
20+
<item row="0" column="1" rowspan="3">
3421
<widget class="QLabel" name="label">
3522
<property name="maximumSize">
3623
<size>
@@ -55,7 +42,7 @@
5542
</property>
5643
</widget>
5744
</item>
58-
<item>
45+
<item row="0" column="2" rowspan="3" colspan="2">
5946
<spacer name="horizontalSpacer_4">
6047
<property name="orientation">
6148
<enum>Qt::Horizontal</enum>
@@ -68,7 +55,20 @@
6855
</property>
6956
</spacer>
7057
</item>
71-
<item>
58+
<item row="0" column="0" rowspan="3">
59+
<spacer name="horizontalSpacer_2">
60+
<property name="orientation">
61+
<enum>Qt::Horizontal</enum>
62+
</property>
63+
<property name="sizeHint" stdset="0">
64+
<size>
65+
<width>40</width>
66+
<height>20</height>
67+
</size>
68+
</property>
69+
</spacer>
70+
</item>
71+
<item row="1" column="5">
7272
<widget class="QLabel" name="label_3">
7373
<property name="styleSheet">
7474
<string notr="true">font-family:Microsoft YaHei;font-size:30px;</string>
@@ -81,7 +81,7 @@
8181
</property>
8282
</widget>
8383
</item>
84-
<item>
84+
<item row="1" column="6">
8585
<spacer name="horizontalSpacer_3">
8686
<property name="orientation">
8787
<enum>Qt::Horizontal</enum>
@@ -94,6 +94,16 @@
9494
</property>
9595
</spacer>
9696
</item>
97+
<item row="2" column="3" colspan="4">
98+
<widget class="QLabel" name="label_2">
99+
<property name="text">
100+
<string>Beta v1.0.1</string>
101+
</property>
102+
<property name="alignment">
103+
<set>Qt::AlignCenter</set>
104+
</property>
105+
</widget>
106+
</item>
97107
</layout>
98108
</widget>
99109
</item>
@@ -109,53 +119,97 @@
109119
<string notr="true">QWidget#widget{border-top:1px solid}</string>
110120
</property>
111121
<layout class="QGridLayout" name="gridLayout">
112-
<item row="1" column="1">
113-
<spacer name="verticalSpacer">
122+
<item row="3" column="1">
123+
<widget class="QPushButton" name="license">
124+
<property name="text">
125+
<string>License</string>
126+
</property>
127+
</widget>
128+
</item>
129+
<item row="3" column="2">
130+
<spacer name="horizontalSpacer">
114131
<property name="orientation">
115-
<enum>Qt::Vertical</enum>
132+
<enum>Qt::Horizontal</enum>
116133
</property>
117134
<property name="sizeHint" stdset="0">
118135
<size>
119-
<width>20</width>
120-
<height>50</height>
136+
<width>164</width>
137+
<height>20</height>
121138
</size>
122139
</property>
123140
</spacer>
124141
</item>
125-
<item row="2" column="1">
126-
<spacer name="horizontalSpacer">
142+
<item row="0" column="1" colspan="4">
143+
<widget class="QLabel" name="github">
144+
<property name="text">
145+
<string>&lt;a href = https://github.com/yuaners/mqtt-client &gt;https://github.com/yuaners/mqtt-client&lt;/a&gt;</string>
146+
</property>
147+
</widget>
148+
</item>
149+
<item row="3" column="3">
150+
<widget class="QPushButton" name="okButton">
151+
<property name="text">
152+
<string>OK</string>
153+
</property>
154+
</widget>
155+
</item>
156+
<item row="3" column="4">
157+
<spacer name="horizontalSpacer_6">
127158
<property name="orientation">
128159
<enum>Qt::Horizontal</enum>
129160
</property>
130161
<property name="sizeHint" stdset="0">
131162
<size>
132-
<width>164</width>
163+
<width>40</width>
133164
<height>20</height>
134165
</size>
135166
</property>
136167
</spacer>
137168
</item>
138169
<item row="2" column="2">
139-
<widget class="QPushButton" name="okButton">
170+
<spacer name="verticalSpacer">
171+
<property name="orientation">
172+
<enum>Qt::Vertical</enum>
173+
</property>
174+
<property name="sizeHint" stdset="0">
175+
<size>
176+
<width>20</width>
177+
<height>50</height>
178+
</size>
179+
</property>
180+
</spacer>
181+
</item>
182+
<item row="0" column="0">
183+
<widget class="QLabel" name="label_4">
140184
<property name="text">
141-
<string>OK</string>
185+
<string>github:</string>
142186
</property>
143187
</widget>
144188
</item>
145-
<item row="0" column="0" colspan="3">
146-
<widget class="QLabel" name="label_2">
147-
<property name="text">
148-
<string>Beta v1.0.1</string>
189+
<item row="3" column="0">
190+
<spacer name="horizontalSpacer_5">
191+
<property name="orientation">
192+
<enum>Qt::Horizontal</enum>
149193
</property>
150-
<property name="alignment">
151-
<set>Qt::AlignCenter</set>
194+
<property name="sizeHint" stdset="0">
195+
<size>
196+
<width>40</width>
197+
<height>20</height>
198+
</size>
199+
</property>
200+
</spacer>
201+
</item>
202+
<item row="1" column="0">
203+
<widget class="QLabel" name="label_6">
204+
<property name="text">
205+
<string>license:</string>
152206
</property>
153207
</widget>
154208
</item>
155-
<item row="2" column="0">
156-
<widget class="QPushButton" name="license">
209+
<item row="1" column="1" colspan="3">
210+
<widget class="QLabel" name="label_7">
157211
<property name="text">
158-
<string>License</string>
212+
<string>GNU General Public License v3.0</string>
159213
</property>
160214
</widget>
161215
</item>

abstractmqtt.h

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#ifndef ABSTRACTMQTT_H
2+
#define ABSTRACTMQTT_H
3+
4+
#include <QSslConfiguration>
5+
#include <QObject>
6+
7+
class AbstractMqtt : public QObject
8+
{
9+
public:
10+
enum MqttStatus
11+
{
12+
Disconnected = 0,
13+
Connecting,
14+
Connected
15+
};
16+
17+
Q_OBJECT
18+
public:
19+
explicit AbstractMqtt(QObject *parent = nullptr) : QObject(parent) {}
20+
virtual ~AbstractMqtt(){}
21+
22+
virtual void setBroker(const QString &broker) = 0;
23+
virtual void setSslConfiguration(const QSslConfiguration &ssl) = 0;
24+
virtual void setCleanSession(const bool clean) = 0;
25+
virtual void setClientId(const QString &id) = 0;
26+
virtual void setKeepAlive(const quint16 second) = 0;
27+
virtual void setUsername(const QString &username) = 0;
28+
virtual void setPassword(const QString &password) = 0;
29+
virtual void setWillTopic(const QString &topic) = 0;
30+
virtual void setWillQos(const quint8 qos) = 0;
31+
virtual void setWillRetain(const bool retain) = 0;
32+
virtual void setWillMessage(const QByteArray &msg) = 0;
33+
34+
virtual void connectToHost() = 0;
35+
virtual void disconnectFromHost() = 0;
36+
virtual void publish(const QString &topic, const quint8 qos, const QByteArray &payload, const bool retain) = 0;
37+
virtual void subscribe(const QString &topic, const quint8 qos) = 0;
38+
virtual void unsubscribe(const QString &topic) = 0;
39+
virtual MqttStatus status() = 0;
40+
41+
42+
signals:
43+
void connected();
44+
void disconnected();
45+
void errorChanged(const QString &error);
46+
void statusChanged(const MqttStatus &status);
47+
void subscribed(const QString &topic, const quint8 qos);
48+
void unsubscribed(const QString &topic);
49+
void received(const QString &topic, const quint8 qos, const QByteArray &payload, const bool retain);
50+
void published(const QString &topic, const quint8 qos, const QByteArray &payload, const bool retain);
51+
52+
public slots:
53+
};
54+
55+
#endif // ABSTRACTMQTT_H

connectionwidget.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,14 +591,16 @@ void ConnectionWidget::initTabOrder()
591591
setTabOrder(ui->subAdd, ui->subDelete);
592592
setTabOrder(ui->subDelete, ui->subClean);
593593
setTabOrder(ui->subClean, ui->topics);
594-
setTabOrder(ui->topics, ui->topic);
594+
setTabOrder(ui->topics, ui->subscribe);
595+
setTabOrder(ui->subscribe, ui->unsubscribe);
596+
setTabOrder(ui->unsubscribe, ui->topic);
595597
setTabOrder(ui->topic, ui->qos);
596598
setTabOrder(ui->qos, ui->retained);
597599
setTabOrder(ui->retained, ui->hex);
598600
setTabOrder(ui->hex, ui->message);
599601
setTabOrder(ui->message, ui->file);
600602
setTabOrder(ui->file, ui->publish);
601-
setTabOrder(ui->publish, ui->uri);
603+
setTabOrder(ui->publish, ui->tabWidget);
602604
}
603605

604606
void ConnectionWidget::setOnlineStatus(bool flag)

0 commit comments

Comments
 (0)