feat: 新增PDT外部程序调用

pull/13/head
cbwu 6 months ago committed by WuChengbo
parent 6115e86104
commit eacfb0348f

@ -10,8 +10,8 @@ QMAKE_PROJECT_DEPTH = 0
# In order to do so, uncomment the following line. # In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
#给exe默认管理员权限否则无法调起管理员权限的第三方程序
#QMAKE_LFLAGS += /MANIFESTUAC:\"level=\'requireAdministrator\' uiAccess=\'false\'\"
SOURCES += \ SOURCES += \
global.cpp \ global.cpp \
@ -53,6 +53,10 @@ LIBS += -L$$PWD/ffmpeg/lib \
-lavcodec -lavdevice -lavfilter -lavformat -lavutil -lpostproc \ -lavcodec -lavdevice -lavfilter -lavformat -lavutil -lpostproc \
-lswresample -lswscale -lswresample -lswscale
# win32 {
# LIBS += -luser32
# }
include($$PWD/Src/HomePage/HomePage.pri) include($$PWD/Src/HomePage/HomePage.pri)
include($$PWD/Src/WebPage/WebPage.pri) include($$PWD/Src/WebPage/WebPage.pri)
include($$PWD/Src/ModelCamera/ModelCamera.pri) include($$PWD/Src/ModelCamera/ModelCamera.pri)

@ -11,17 +11,14 @@
#include <qpushbutton.h> #include <qpushbutton.h>
MainWindow::MainWindow(QWidget *parent) MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow), mWeb(nullptr) { : QMainWindow(parent), ui(new Ui::MainWindow) {
ui->setupUi(this); ui->setupUi(this);
initFile(); initFile();
initWindow(); initWindow();
initButton(); initButton();
// initMenuBar();
initToolBar();
initSignalSlot(); initSignalSlot();
process = new QProcess(this); processPDT = new QProcess(this);
// apply the qss // apply the qss
QFile file(":/res/Qss/qss.qss"); QFile file(":/res/Qss/qss.qss");
if (file.open(QFile::ReadOnly)) { if (file.open(QFile::ReadOnly)) {
@ -43,13 +40,18 @@ MainWindow::~MainWindow() {
delete m_SDFPDlg; delete m_SDFPDlg;
delete m_GDDCdlg; delete m_GDDCdlg;
delete m_HomePagedlg; delete m_HomePagedlg;
delete process; delete processPDT;
delete mWeb; // delete mWeb;
delete lLinkWeb; delete lLinkWeb;
delete adHocNetworkWeb; delete adHocNetworkWeb;
delete satelliteCommWeb; delete satelliteCommWeb;
if (m_ModelCameraDlg != nullptr) if (m_ModelCameraDlg != nullptr)
delete m_ModelCameraDlg; delete m_ModelCameraDlg;
if (processPDT != nullptr) {
if (processPDT->state() == QProcess::NotRunning)
processPDT->kill();
processPDT->deleteLater();
}
delete ui; delete ui;
} }
/** /**
@ -95,9 +97,9 @@ void MainWindow::initWindow() {
qDebug() << "本地ip:" << m_allSetMap["三维建模"].net.localIp; qDebug() << "本地ip:" << m_allSetMap["三维建模"].net.localIp;
qDebug() << "本地端口:" << m_allSetMap["三维建模"].net.localPort; qDebug() << "本地端口:" << m_allSetMap["三维建模"].net.localPort;
mWeb = new CWebEngineView(); // mWeb = new CWebEngineView();
mWeb->setPage(new CustomWebEnginePage()); // mWeb->setPage(new CustomWebEnginePage());
mWeb->load(QUrl("http://192.168.150.1")); // mWeb->load(QUrl("http://192.168.150.1"));
lLinkWeb = new CWebEngineView(); lLinkWeb = new CWebEngineView();
lLinkWeb->setPage(new CustomWebEnginePage()); lLinkWeb->setPage(new CustomWebEnginePage());
@ -141,7 +143,7 @@ void MainWindow::initWindow() {
ui->stackedWidget->addWidget(m_SDFPDlg); ui->stackedWidget->addWidget(m_SDFPDlg);
ui->stackedWidget->addWidget(m_HomePagedlg); ui->stackedWidget->addWidget(m_HomePagedlg);
ui->stackedWidget->addWidget(m_GDDCdlg); ui->stackedWidget->addWidget(m_GDDCdlg);
ui->stackedWidget->addWidget(mWeb); // ui->stackedWidget->addWidget(mWeb);
ui->stackedWidget->addWidget(lLinkWeb); ui->stackedWidget->addWidget(lLinkWeb);
ui->stackedWidget->addWidget(adHocNetworkWeb); ui->stackedWidget->addWidget(adHocNetworkWeb);
ui->stackedWidget->addWidget(satelliteCommWeb); ui->stackedWidget->addWidget(satelliteCommWeb);
@ -150,6 +152,7 @@ void MainWindow::initWindow() {
// 初始栈窗口显示主页 // 初始栈窗口显示主页
ui->stackedWidget->setCurrentWidget(m_SDFPDlg); ui->stackedWidget->setCurrentWidget(m_SDFPDlg);
} }
void MainWindow::initButton() { void MainWindow::initButton() {
int sizeX = 30; int sizeX = 30;
int sizeY = 30; int sizeY = 30;
@ -210,83 +213,7 @@ void MainWindow::initButton() {
ui->toolButton_9->setStyleSheet(g_ToolBtnStyle); ui->toolButton_9->setStyleSheet(g_ToolBtnStyle);
// ui->pushButton->setStyleSheet(g_PushBtnStyle); // ui->pushButton->setStyleSheet(g_PushBtnStyle);
} }
void MainWindow::initMenuBar() {
// QMenuBar *menuBar = new QMenuBar(this);
// this->setMenuBar(menuBar);
// QMenu *menu1 = new QMenu("菜单1",this);
// QMenu *menu2 = new QMenu("菜单2",this);
// QMenu *menu3 = new QMenu("菜单3",this);
// QMenu *menu4 = new QMenu("菜单4",this);
// QMenu *menu5 = new QMenu("菜单5",this);
// QMenu *menu6 = new QMenu("菜单6",this);
// QMenu *menu7 = new QMenu("菜单7",this);
// menuBar->addMenu(menu1);
// menuBar->addMenu(menu2);
// menuBar->addMenu(menu3);
// menuBar->addMenu(menu4);
// menuBar->addMenu(menu5);
// menuBar->addMenu(menu6);
// menuBar->addMenu(menu7);
// menuBar->setStyleSheet("QMenuBar{color:rgb(255,255,255);background:rgb(0,0,0);}");//设置颜色
}
void MainWindow::initToolBar() {
// QToolBar *toolBar = new QToolBar("toolBar",this);
// this->addToolBar(Qt::LeftToolBarArea,toolBar);
// toolBar->setFloatable(false);//设置可浮动
// toolBar->setMovable(true);//可移动
// //QAction *actionToolBar = new
// QAction(/*QIcon("res/主页.png"),*/"主页",this); QAction *actionToolBar =
// new QAction(QIcon(":/res/SDFP.png"),"主 页",this); QAction *actionToolBar2
// = new QAction(QIcon(":/res/GDDC.png"),"光电吊舱",this); QAction
// *actionToolBar3 = new QAction(QIcon(":/res/LChain.png"),"L 链",this);
// QAction *actionToolBar4 = new QAction(QIcon(":/res/adHoc.png"),"自组网
// ",this); QAction *actionToolBar5 = new
// QAction(QIcon(":/res/PDTColony.png"),"PDT集群",this); QAction
// *actionToolBar6 = new
// QAction(QIcon(":/res/Kusatellite.png"),"Ku卫通",this); QAction
// *actionToolBar7 = new
// QAction(QIcon(":/res/SearchPayload.png"),"搜集载荷",this); QAction
// *actionToolBar8 = new
// QAction(QIcon(":/res/3DModeling.png"),"三维建模",this);
// toolBar->addAction(actionToolBar);
// toolBar->addAction(actionToolBar2);
// toolBar->addAction(actionToolBar3);
// toolBar->addAction(actionToolBar4);
// toolBar->addAction(actionToolBar5);
// toolBar->addAction(actionToolBar6);
// toolBar->addAction(actionToolBar7);
// toolBar->addAction(actionToolBar8);
// toolBar->setAllowedAreas(Qt::LeftToolBarArea|Qt::RightToolBarArea|Qt::TopToolBarArea);
// toolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
// toolBar->setStyleSheet("color:white;slection-background-color:green");//设置颜色
// ui->toolBar->addAction(ui->toolbar_action1);
// //ui->toolBar->addSeparator();
// ui->toolBar->addAction(ui->toolbar_action2);
// //ui->toolBar->addSeparator();
// ui->toolBar->addAction(ui->toolbar_action3);
// //ui->toolBar->addSeparator();
// ui->toolBar->addAction(ui->toolbar_action4);
// //ui->toolBar->addSeparator();
// ui->toolBar->addAction(ui->toolbar_action5);
// // ui->toolBar->addSeparator();
// ui->toolBar->addAction(ui->toolbar_action6);
// //ui->toolBar->addSeparator();
// ui->toolBar->addAction(ui->toolbar_action7);
// //ui->toolBar->addSeparator();
// ui->toolBar->addAction(ui->toolbar_action8);
// //ui->toolBar->addSeparator();
// ui->toolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
// ui->toolBar->setStyleSheet("QToolBar:{color:white;}"
// "QToolBar:hover{background-color:rgb(100,100,100);color:rgb(200,200,200);}"
// "QToolBar:pressed{background-color:blue;}");
/*"QAction:hover{background-color:white; color: green;}"*/
/*"QAction:pressed{background-color:rgb(100, 100, 100);}");*/
}
// 初始化信号与槽 // 初始化信号与槽
void MainWindow::initSignalSlot() { void MainWindow::initSignalSlot() {
connect(ui->toolButton, SIGNAL(clicked()), this, SLOT(toolButton_clicked())); connect(ui->toolButton, SIGNAL(clicked()), this, SLOT(toolButton_clicked()));
@ -339,17 +266,12 @@ void MainWindow::initSignalSlot() {
// 主页 // 主页
void MainWindow::toolButton_clicked() { void MainWindow::toolButton_clicked() {
changeBtnColor(1); changeBtnColor(1);
// m_HomePagedlg->move(130,80);
ui->stackedWidget->setCurrentWidget(m_HomePagedlg); ui->stackedWidget->setCurrentWidget(m_HomePagedlg);
process->kill();
} }
// 光电吊舱 // 光电吊舱
void MainWindow::toolButton_2_clicked() { void MainWindow::toolButton_2_clicked() {
changeBtnColor(2); changeBtnColor(2);
// m_GDDCdlg->move(130,80);
// m_GDDCdlg->show(); //显示窗口
ui->stackedWidget->setCurrentWidget(m_GDDCdlg); ui->stackedWidget->setCurrentWidget(m_GDDCdlg);
} }
@ -363,33 +285,31 @@ void MainWindow::toolButton_3_clicked() {
// 自组网 // 自组网
void MainWindow::toolButton_4_clicked() { void MainWindow::toolButton_4_clicked() {
changeBtnColor(4); changeBtnColor(4);
// mWeb->load(QUrl("http://192.168.1.10")); // mWeb->load(QUrl("http://192.168.1.10"));
// mWeb->show(); // mWeb->show();
ui->stackedWidget->setCurrentWidget(adHocNetworkWeb); ui->stackedWidget->setCurrentWidget(adHocNetworkWeb);
// process->kill();
} }
// PDT集群 // PDT集群
void MainWindow::toolButton_5_clicked() { void MainWindow::toolButton_5_clicked() {
changeBtnColor(5); changeBtnColor(5);
// mWeb->load(QUrl("http://192.168.150.1"));
// mWeb->show(); QString pdtDirPath = QCoreApplication::applicationDirPath() + "/NMC7.0";
ui->stackedWidget->setCurrentWidget(mWeb); QString exePath = pdtDirPath + "/NMC.exe";
// qDebug() << "*********PDT Path:" << pdtDirPath;
processPDT->setWorkingDirectory(pdtDirPath); // 设置工作目录
processPDT->start(exePath); //
} }
// Ku卫通 // Ku卫通
void MainWindow::toolButton_6_clicked() { void MainWindow::toolButton_6_clicked() {
changeBtnColor(6); changeBtnColor(6);
// mWeb->load(QUrl("http://192.168.0.2"));
// mWeb->show();
ui->stackedWidget->setCurrentWidget(satelliteCommWeb); ui->stackedWidget->setCurrentWidget(satelliteCommWeb);
} }
// 搜救载荷 // 搜救载荷
void MainWindow::toolButton_7_clicked() { void MainWindow::toolButton_7_clicked() {
changeBtnColor(7); changeBtnColor(7);
ui->stackedWidget->setCurrentWidget(m_rescueLoadWidget); ui->stackedWidget->setCurrentWidget(m_rescueLoadWidget);
} }
@ -397,14 +317,6 @@ void MainWindow::toolButton_7_clicked() {
void MainWindow::toolButton_8_clicked() { void MainWindow::toolButton_8_clicked() {
changeBtnColor(8); changeBtnColor(8);
ui->stackedWidget->setCurrentWidget(m_ModelCameraDlg); ui->stackedWidget->setCurrentWidget(m_ModelCameraDlg);
// ui->stackedWidget->setCurrentWidget(mWeb);
// process->setWorkingDirectory("D:/QTdemo/playerApp/app"); // 设置工作目录
// process->start("D:/QTdemo/playerApp/app/XCOM V2.0.exe"); //
// 启动exe并传递参数
// process->setWorkingDirectory("D:/Software/TCPUDPDbg"); // 设置工作目录
// process->start("D:/Software/TCPUDPDbg/TCPUDPDbg.exe"); // 启动exe并传递参数
} }
// 时代飞鹏 // 时代飞鹏
void MainWindow::toolButton_9_clicked() { void MainWindow::toolButton_9_clicked() {
@ -414,7 +326,6 @@ void MainWindow::toolButton_9_clicked() {
// 更新主界面按钮颜色 // 更新主界面按钮颜色
void MainWindow::changeBtnColor(int num) { void MainWindow::changeBtnColor(int num) {
initButton(); initButton();
switch (num) { switch (num) {
case 1: case 1:

@ -17,6 +17,12 @@
#include <QPushButton> #include <QPushButton>
#include <QTextEdit> #include <QTextEdit>
#include <QWebEngineView> #include <QWebEngineView>
#ifdef Q_OS_WIN
// #include <QWindow>
// #include <WinUser.h>
// #include <windows.h>
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
namespace Ui { namespace Ui {
class MainWindow; class MainWindow;
@ -38,8 +44,6 @@ private:
public: public:
void initWindow(); void initWindow();
void initButton(); void initButton();
void initMenuBar();
void initToolBar();
void initSignalSlot(); void initSignalSlot();
private slots: private slots:
void toolButton_clicked(); void toolButton_clicked();
@ -58,13 +62,13 @@ public:
RescueLoadWidget *m_rescueLoadWidget; RescueLoadWidget *m_rescueLoadWidget;
SDFPDlg *m_SDFPDlg; SDFPDlg *m_SDFPDlg;
// QWeb *m_qWeb; // QWeb *m_qWeb;
QWebEngineView *mWeb; // QWebEngineView *mWeb;
ModelCameraDlg *m_ModelCameraDlg; ModelCameraDlg *m_ModelCameraDlg;
QWebEngineView *lLinkWeb; // L链 QWebEngineView *lLinkWeb; // L链
QWebEngineView *adHocNetworkWeb; // 自组网 QWebEngineView *adHocNetworkWeb; // 自组网
QWebEngineView *satelliteCommWeb; // 卫通 QWebEngineView *satelliteCommWeb; // 卫通
private: private:
QProcess *process; QProcess *processPDT;
QString exeDirPathName = ""; QString exeDirPathName = "";
std::unordered_map<QString, settingStruct> m_allSetMap; std::unordered_map<QString, settingStruct> m_allSetMap;

Loading…
Cancel
Save