b
This commit is contained in:
+14
-2
@@ -51,7 +51,8 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
CONFIG += c++11
|
||||
CONFIG += c++11 \
|
||||
warn_off
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
@@ -66,6 +67,17 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||
!isEmpty(target.path): INSTALLS += target
|
||||
|
||||
|
||||
# Additional import path used to resolve QML modules in Qt Creator's code model
|
||||
QML_IMPORT_PATH += $$PWD
|
||||
|
||||
# Additional import path used to resolve QML modules just for Qt Quick Designer
|
||||
QML_DESIGNER_IMPORT_PATH += $$PWD
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#添加程序运行的第三方库
|
||||
|
||||
INCLUDEPATH += $$PWD/../thirdpart/include
|
||||
@@ -106,7 +118,7 @@ win32|win64 {
|
||||
dst_dir ~= s,/,\\,g
|
||||
|
||||
#要发布时要打开,复制必要的库文件
|
||||
#system(xcopy $$src_dir $$dst_dir /y /e)
|
||||
system(xcopy $$src_dir $$dst_dir /y /e)
|
||||
}
|
||||
|
||||
|
||||
|
||||
+10
-2
@@ -2,8 +2,7 @@ import QtQuick 2.6
|
||||
import QtQuick.Controls 2.5
|
||||
|
||||
//导入指令模块,这样就能发指令了
|
||||
//import Protocol.MavLinkNode 1.0
|
||||
|
||||
import Drivers.LinkUI 1.0
|
||||
|
||||
Rectangle {
|
||||
|
||||
@@ -19,6 +18,15 @@ Rectangle {
|
||||
signal btnclicked_int(real param1, real param2, real param3, real param4, int x, int y, real z)
|
||||
signal btnclicked_long(real param1, real param2, real param3, real param4, real param5, real param6, real param7)
|
||||
|
||||
/*
|
||||
LinkUI {
|
||||
id:linkui
|
||||
|
||||
setWindowTitle: "nini"
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
Rectangle {
|
||||
id:armbtn
|
||||
|
||||
+40
-23
@@ -20,6 +20,20 @@
|
||||
//#pragma comment(lib, "Version")
|
||||
|
||||
|
||||
|
||||
//include
|
||||
#include "dlink.h"
|
||||
|
||||
|
||||
|
||||
//#pragma comment(lib, "../../thirdpart/lib/Dlink")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QSize GetDesktopSize() {
|
||||
#ifdef __arm__
|
||||
int fb_fd = open("/dev/fb0", O_RDWR);
|
||||
@@ -48,7 +62,6 @@ QSize GetDesktopSize() {
|
||||
|
||||
return QSize(lcd_width, lcd_height);
|
||||
#endif
|
||||
//return QSize(800, 480);
|
||||
return QSize(800, 480);
|
||||
}
|
||||
|
||||
@@ -66,21 +79,12 @@ void CheckDirs(const QString &path, const QStringList &dirs) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define SoftWareVersion "V1.0.0"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
void LoadLang(QApplication *a)
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
|
||||
MainWindow w;
|
||||
|
||||
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF8"));
|
||||
|
||||
QTranslator * qtTranslator = new QTranslator{};
|
||||
QString lang = "qt_" + QLocale::system().name();
|
||||
if (qtTranslator->load(lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath))
|
||||
&& a.installTranslator(qtTranslator))
|
||||
&& a->installTranslator(qtTranslator))
|
||||
{
|
||||
qDebug() << "Success to load translator " <<lang << " from " << QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
||||
}
|
||||
@@ -92,7 +96,7 @@ int main(int argc, char *argv[])
|
||||
QTranslator * myappTranslator = new QTranslator{};
|
||||
lang = "SimpleGroundStation_" + QLocale::system().name();
|
||||
if (myappTranslator->load(lang, QCoreApplication::applicationDirPath())
|
||||
&& a.installTranslator(myappTranslator))
|
||||
&& a->installTranslator(myappTranslator))
|
||||
{
|
||||
qDebug() << "Success to load translator " <<lang << " from " << QCoreApplication::applicationDirPath();
|
||||
}
|
||||
@@ -100,23 +104,36 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
qWarning() << "Fail to load translator " <<lang << " from " << QCoreApplication::applicationDirPath();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RegisterType(void)
|
||||
{
|
||||
|
||||
qmlRegisterModule("Drivers.LinkUI",1,0);
|
||||
|
||||
qmlRegisterType<LinkUI>("Drivers.LinkUI",1,0,"LinkUI");
|
||||
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
|
||||
a.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
|
||||
|
||||
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF8"));
|
||||
|
||||
LoadLang(&a);
|
||||
|
||||
RegisterType();
|
||||
|
||||
w.setWindowTitle(QStringLiteral("GCS New Frame @ %1"));//with version
|
||||
// 主要是控制HDMI输出,如果是LCD显示,此行无关紧要
|
||||
w.resize(GetDesktopSize());
|
||||
|
||||
|
||||
a.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
|
||||
+20
-25
@@ -9,8 +9,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
|
||||
//qmlRegisterType<DLink>("Protocol.DLink", 1, 0, "DLink");
|
||||
|
||||
//ui initial
|
||||
linkui = new LinkUI(this);
|
||||
linkui->hide();
|
||||
@@ -55,8 +53,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
nav = new QNavigationWidget(this);
|
||||
|
||||
nav->setAttribute(Qt::WA_AlwaysStackOnTop);
|
||||
|
||||
nav->setGeometry(0,0,50,this->height());
|
||||
nav->setRowHeight(50);
|
||||
nav->addItem(tr("Flight"),icon);
|
||||
@@ -67,30 +63,21 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
nav->addItem(tr("Data"),icon);//all data
|
||||
nav->addItem(tr("Tools"),icon);//soft setting help about
|
||||
|
||||
|
||||
|
||||
connect(nav,SIGNAL(ItemChanged(int)),
|
||||
this,SLOT(onTabIndexChanged(int)));
|
||||
|
||||
|
||||
|
||||
|
||||
quick = new QQuickWidget(this);
|
||||
|
||||
quick->setFocus();
|
||||
quick->setResizeMode(QQuickWidget::SizeRootObjectToView);
|
||||
quick->setAttribute(Qt::WA_AlwaysStackOnTop);
|
||||
|
||||
QUrl source("qrc:/App/qml/base.qml");
|
||||
quick->setSource(source);
|
||||
|
||||
quick->setGeometry(this->width() - copk->width(),copk->height(),300,this->height() - copk->height());
|
||||
quick->show();
|
||||
|
||||
|
||||
copk = new Cockpit(this);
|
||||
copk->setGeometry(this->width() - copk->width(),0,300,340);
|
||||
|
||||
quick = new QQuickWidget(this);
|
||||
quick->setFocus();
|
||||
quick->setResizeMode(QQuickWidget::SizeRootObjectToView);
|
||||
quick->setAttribute(Qt::WA_AlwaysStackOnTop);
|
||||
QUrl source(QUrl(QStringLiteral("qrc:/App/qml/base.qml")));
|
||||
quick->setSource(source);
|
||||
quick->setGeometry(this->width() - copk->width(),copk->height(),300,this->height() - copk->height());
|
||||
quick->show();
|
||||
|
||||
|
||||
updateTimer = new QTimer();
|
||||
@@ -110,6 +97,9 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
connect(toolsui,&ToolsUI::clicked,
|
||||
this,&MainWindow::subui);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@@ -123,24 +113,29 @@ MainWindow::~MainWindow()
|
||||
QCoreApplication::quit();//退出所有窗口
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
event->accept();
|
||||
QCoreApplication::quit();//退出所有
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MainWindow::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
Q_UNUSED(event)
|
||||
|
||||
map->setGeometry(nav->width(),
|
||||
0,
|
||||
this->width()- copk->width() - nav->width(),
|
||||
this->height());
|
||||
|
||||
/*
|
||||
map->setGeometry(0,
|
||||
0,
|
||||
this->width()- copk->width(),
|
||||
this->height());
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
map->setGeometry(0,
|
||||
0,
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@
|
||||
#include "QQuickView"
|
||||
|
||||
|
||||
|
||||
QT_BEGIN_MOC_NAMESPACE
|
||||
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
|
||||
@@ -12,6 +12,10 @@ MAVLinkInspector::MAVLinkInspector(const QString& title, QAction* action,QWidget
|
||||
selectedComponentID(0),
|
||||
ui(new Ui::MAVLinkInspector)
|
||||
{
|
||||
Q_UNUSED(action)
|
||||
Q_UNUSED(parent)
|
||||
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
setWindowTitle(title);
|
||||
|
||||
@@ -30,6 +30,8 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
|
||||
|
||||
# include sub project
|
||||
include (./ParameterInspector/ParameterInspector.pri)
|
||||
include (./MAVLinkInspector/MAVLinkInspector.pri)
|
||||
|
||||
@@ -43,12 +45,15 @@ DEFINES += QtMavlinkNode
|
||||
HEADERS += \
|
||||
commandprocess.h \
|
||||
mavlinknode.h \
|
||||
parameterprocess.h
|
||||
parameterprocess.h \
|
||||
missionprocess.h \
|
||||
mavlinknodeglobal.h
|
||||
|
||||
SOURCES += \
|
||||
commandprocess.cpp \
|
||||
mavlinknode.cpp \
|
||||
parameterprocess.cpp
|
||||
parameterprocess.cpp \
|
||||
missionprocess.cpp
|
||||
|
||||
#添加mavlink目录
|
||||
INCLUDEPATH += $$PWD/../mavlink \
|
||||
@@ -60,16 +65,6 @@ INCLUDEPATH += $$PWD/../mavlink \
|
||||
$$PWD/../mavlink/message_definitions
|
||||
|
||||
|
||||
HEADERS += \
|
||||
mavlinknode.h \
|
||||
mavlinknodeglobal.h \
|
||||
missionprocess.h
|
||||
|
||||
SOURCES += \
|
||||
mavlinknode.cpp \
|
||||
missionprocess.cpp
|
||||
|
||||
|
||||
|
||||
win32|win64 {
|
||||
src_dir = $$PWD\\*.h
|
||||
|
||||
@@ -119,7 +119,7 @@ void MavLinkNode::stop()
|
||||
void MavLinkNode::process()//线程函数
|
||||
{
|
||||
uint8_t count = 0;
|
||||
QByteArray datagram = NULL;
|
||||
QByteArray datagram = nullptr;
|
||||
while (running_flag)
|
||||
{
|
||||
count ++;
|
||||
@@ -197,7 +197,7 @@ QByteArray MavLinkNode::readbuff(quint32 src)
|
||||
case SourceType::c_sock:
|
||||
if(client_buff.select == 0)
|
||||
{
|
||||
datagram.setRawData(client_buff.buff[1],client_buff.buff[1].size());
|
||||
datagram.setRawData(client_buff.buff[1],(uint)client_buff.buff[1].size());
|
||||
//清除这个未选择的buff
|
||||
client_buff.buff[1].clear();
|
||||
//读取完成,可以往这个内存里面写数了
|
||||
@@ -205,7 +205,7 @@ QByteArray MavLinkNode::readbuff(quint32 src)
|
||||
}
|
||||
else if(client_buff.select == 1)
|
||||
{
|
||||
datagram.setRawData(client_buff.buff[0],client_buff.buff[0].size());
|
||||
datagram.setRawData(client_buff.buff[0],(uint)client_buff.buff[0].size());
|
||||
//清除这个未选择的buff
|
||||
client_buff.buff[0].clear();
|
||||
|
||||
@@ -216,14 +216,14 @@ QByteArray MavLinkNode::readbuff(quint32 src)
|
||||
case SourceType::s_port:
|
||||
if(serial_buff.select == 0)
|
||||
{
|
||||
datagram.setRawData(serial_buff.buff[1],serial_buff.buff[1].size());
|
||||
datagram.setRawData(serial_buff.buff[1],(uint)serial_buff.buff[1].size());
|
||||
//读取完成,可以往这个内存里面写数了
|
||||
serial_buff.buff[1].clear();
|
||||
serial_buff.select = 1;
|
||||
}
|
||||
else if(serial_buff.select == 1)
|
||||
{
|
||||
datagram.setRawData(serial_buff.buff[0],serial_buff.buff[0].size());
|
||||
datagram.setRawData(serial_buff.buff[0],(uint)serial_buff.buff[0].size());
|
||||
//读取完成,可以往这个内存里面写数了
|
||||
serial_buff.buff[0].clear();
|
||||
serial_buff.select = 0;
|
||||
|
||||
@@ -31,8 +31,8 @@ class MavLinkNode : public QObject
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t sysid; /*< ID of message sender system/aircraft */
|
||||
uint8_t compid; /*< ID of the message sender component */
|
||||
uint8_t sysid; /* ID of message sender system/aircraft */
|
||||
uint8_t compid; /* ID of the message sender component */
|
||||
|
||||
mavlink_autopilot_version_t autopilot_version;
|
||||
mavlink_sys_status_t sys_status;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#else
|
||||
# define SKINSHARED_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
class SKINSHARED_EXPORT Skin {
|
||||
#else
|
||||
class Skin {
|
||||
|
||||
+6
-1
@@ -4,11 +4,16 @@
|
||||
#include "QDateTime"
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
DLink::DLink(QObject *parent) : QObject(parent)
|
||||
{
|
||||
qDebug() << "Dlink " << QThread::currentThreadId();
|
||||
|
||||
|
||||
|
||||
|
||||
//采用插件导入的方式(plugin)
|
||||
|
||||
//mavlink协议节点
|
||||
@@ -155,6 +160,6 @@ void DLink::readPendingDatagramsClient(void)
|
||||
|
||||
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
|
||||
+9
-8
@@ -8,6 +8,11 @@
|
||||
#include "QDebug"
|
||||
#include "mavlinknode.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
//class DLinkPrivate;
|
||||
|
||||
#ifdef QtDlink
|
||||
#include <dlinkglobal.h>
|
||||
class DLINKSHARED_EXPORT DLink : public QObject {
|
||||
@@ -16,6 +21,7 @@ class DLink : public QObject
|
||||
{
|
||||
#endif
|
||||
Q_OBJECT
|
||||
//Q_DECLARE_PRIVATE(DLink)
|
||||
|
||||
struct Node{
|
||||
QUdpSocket * sock;
|
||||
@@ -34,18 +40,13 @@ public:
|
||||
|
||||
void setupClient(const QHostAddress &remote_addr, int remote_port, int local_port);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
MavLinkNode *mavlinknode = nullptr;
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
|
||||
|
||||
|
||||
public slots:
|
||||
public Q_SLOTS:
|
||||
|
||||
void readPendingDatagramsSerialPort(void);
|
||||
|
||||
@@ -68,6 +69,6 @@ protected:
|
||||
|
||||
};
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // DLINK_H
|
||||
|
||||
+5
-6
@@ -2,21 +2,20 @@
|
||||
QT += serialport
|
||||
QT += network
|
||||
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
CONFIG += c++11
|
||||
|
||||
TARGET = Dlink
|
||||
TEMPLATE = lib
|
||||
|
||||
|
||||
#DEFINES += DEBUG
|
||||
|
||||
|
||||
DEFINES += DLINK_LIBRARY
|
||||
|
||||
|
||||
CONFIG += plugin \
|
||||
resources_big
|
||||
CONFIG += c++11 \
|
||||
dll \
|
||||
resources_big \
|
||||
warn_off
|
||||
|
||||
|
||||
|
||||
|
||||
+9
-5
@@ -3,16 +3,20 @@
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifdef QtDlink
|
||||
#if defined(DLINK_LIBRARY)
|
||||
# define DLINKSHARED_EXPORT Q_DECL_EXPORT
|
||||
#if defined(DLINK_LIBRARY)
|
||||
# define DLINKSHARED_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
# define DLINKSHARED_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
#else
|
||||
# define DLINKSHARED_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
define DLINKSHARED_EXPORT
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
#endif // DLINKGLOBAL_H
|
||||
|
||||
@@ -18,7 +18,8 @@ QNavigationWidget::QNavigationWidget(QWidget *parent) : QWidget(parent)
|
||||
|
||||
controlBarWidth = 10;
|
||||
|
||||
|
||||
setAttribute(Qt::WA_AlwaysStackOnTop);
|
||||
setWindowFlags(Qt::WindowStaysOnTopHint);
|
||||
setMouseTracking(true);
|
||||
setFixedWidth(150);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user