add,计划采集8:
实现部分计划采集功能:电源通断控制
This commit is contained in:
14
HPPA/CommunicationInterfaceBase.cpp
Normal file
14
HPPA/CommunicationInterfaceBase.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include "CommunicationInterfaceBase.h"
|
||||||
|
|
||||||
|
using namespace MotorParams;
|
||||||
|
|
||||||
|
CommunicationInterfaceBase::CommunicationInterfaceBase(QObject* parent)
|
||||||
|
:QObject(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CommunicationInterfaceBase::~CommunicationInterfaceBase()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
36
HPPA/CommunicationInterfaceBase.h
Normal file
36
HPPA/CommunicationInterfaceBase.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <QObject>
|
||||||
|
#include <QString>
|
||||||
|
#include "motorParams.h"
|
||||||
|
|
||||||
|
namespace MotorParams {
|
||||||
|
|
||||||
|
struct TCPConnectionParams
|
||||||
|
{
|
||||||
|
QString serverIP;
|
||||||
|
int port;
|
||||||
|
};
|
||||||
|
class CommunicationInterfaceBase :public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
CommunicationInterfaceBase(QObject* parent = nullptr);
|
||||||
|
~CommunicationInterfaceBase();
|
||||||
|
|
||||||
|
virtual bool connect2Motor() = 0;
|
||||||
|
//virtual void disconnect() = 0;
|
||||||
|
//virtual bool isConnected() const = 0;
|
||||||
|
|
||||||
|
virtual int sendCommand(const QString command) = 0;
|
||||||
|
//virtual void sendCommandAsync(const QString& command) = 0;
|
||||||
|
virtual int recvData(QByteArray& dataRecv) = 0;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void dataReceived(const QByteArray& data);
|
||||||
|
|
||||||
|
void connected(); // <20><><EFBFBD>ܴ<EFBFBD><DCB4>ڻ<EFBFBD><DABB><EFBFBD>TCP<43><50><EFBFBD><EFBFBD><EFBFBD>ᷢ<EFBFBD><E1B7A2><EFBFBD><EFBFBD><EFBFBD>ź<EFBFBD>
|
||||||
|
void disconnected();
|
||||||
|
void errorOccurred(QString msg);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace MotorParams
|
||||||
95
HPPA/CommunicationViaTCP.cpp
Normal file
95
HPPA/CommunicationViaTCP.cpp
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
#include "CommunicationViaTCP.h"
|
||||||
|
|
||||||
|
using namespace MotorParams;
|
||||||
|
|
||||||
|
CommunicationViaTCP::CommunicationViaTCP(MotorParams::TCPConnectionParams connectionParams, QObject* parent)
|
||||||
|
:MotorParams::CommunicationInterfaceBase(parent)
|
||||||
|
{
|
||||||
|
m_bConnected = false;
|
||||||
|
m_tcpServer = new QTcpServer(this);
|
||||||
|
connect(m_tcpServer, SIGNAL(newConnection()), this, SLOT(onNewConnection()));
|
||||||
|
|
||||||
|
m_tcpServer->listen(QHostAddress::Any, connectionParams.port);
|
||||||
|
}
|
||||||
|
|
||||||
|
CommunicationViaTCP::~CommunicationViaTCP()
|
||||||
|
{
|
||||||
|
m_tcpServer->close();
|
||||||
|
delete m_tcpServer;
|
||||||
|
|
||||||
|
//这两行代码要报错,为啥呢?????????????????
|
||||||
|
//m_tcpSocket->disconnectFromHost();
|
||||||
|
//delete m_tcpSocket;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CommunicationViaTCP::connect2Motor()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CommunicationViaTCP::onNewConnection()
|
||||||
|
{
|
||||||
|
m_bConnected = true;
|
||||||
|
m_tcpSocket = m_tcpServer->nextPendingConnection();
|
||||||
|
connect(m_tcpSocket, SIGNAL(disconnected()), this, SLOT(onTcpSocketDisconnected()));
|
||||||
|
|
||||||
|
emit connected();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CommunicationViaTCP::isConnected() const
|
||||||
|
{
|
||||||
|
return m_bConnected;
|
||||||
|
}
|
||||||
|
|
||||||
|
//从拔掉客户端的电源(客户端m_tcpSocket断开连接)到这个函数被调用有延迟,所以这个函数调用也有延迟,导致拔掉电源后的一小段时间函数isConnected()还是返回true
|
||||||
|
void CommunicationViaTCP::onTcpSocketDisconnected()
|
||||||
|
{
|
||||||
|
int a = 1;
|
||||||
|
m_bConnected = false;
|
||||||
|
m_tcpSocket->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
|
int CommunicationViaTCP::sendCommand(const QString cmd)
|
||||||
|
{
|
||||||
|
if (!isConnected()) {
|
||||||
|
QString error = "No client connected";
|
||||||
|
emit commandSendResult(-1, error);
|
||||||
|
qWarning() << error << "command:" << cmd;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
qint64 bytesWritten = m_tcpSocket->write(cmd.toUtf8().data());
|
||||||
|
m_tcpSocket->waitForBytesWritten(50);
|
||||||
|
|
||||||
|
return bytesWritten;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CommunicationViaTCP::recvData(QByteArray& dataRecv)
|
||||||
|
{
|
||||||
|
if (!isConnected()) {
|
||||||
|
QString error = "No client connected";
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
dataRecv.clear();
|
||||||
|
|
||||||
|
QByteArray temp;
|
||||||
|
|
||||||
|
temp = m_tcpSocket->readAll();
|
||||||
|
dataRecv.append(temp);
|
||||||
|
|
||||||
|
int counter = 0;
|
||||||
|
while (dataRecv.size() < 21)
|
||||||
|
{
|
||||||
|
counter++;
|
||||||
|
m_tcpSocket->waitForReadyRead(100);
|
||||||
|
temp = m_tcpSocket->readAll();
|
||||||
|
dataRecv.append(temp);
|
||||||
|
|
||||||
|
if (counter >= 5)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//qDebug() << "Hex:" << dataRecv.toHex();
|
||||||
|
|
||||||
|
return dataRecv.size();
|
||||||
|
}
|
||||||
45
HPPA/CommunicationViaTCP.h
Normal file
45
HPPA/CommunicationViaTCP.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <QObject>
|
||||||
|
#include <QThread>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QTcpServer>
|
||||||
|
#include <QTcpSocket>
|
||||||
|
|
||||||
|
#include "CommunicationInterfaceBase.h"
|
||||||
|
|
||||||
|
namespace MotorParams {
|
||||||
|
|
||||||
|
class CommunicationViaTCP :
|
||||||
|
public CommunicationInterfaceBase
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
CommunicationViaTCP(TCPConnectionParams connectionParams, QObject* parent = nullptr);
|
||||||
|
~CommunicationViaTCP();
|
||||||
|
|
||||||
|
//继承基类
|
||||||
|
bool connect2Motor();
|
||||||
|
//void disconnect();
|
||||||
|
//bool isConnected() const;
|
||||||
|
|
||||||
|
int sendCommand(const QString cmd);
|
||||||
|
//void sendCommandAsync(const QString& command);
|
||||||
|
int recvData(QByteArray& dataRecv);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QTcpServer* m_tcpServer;
|
||||||
|
QTcpSocket* m_tcpSocket;
|
||||||
|
int m_iCommunicationProtocol;
|
||||||
|
|
||||||
|
bool m_bConnected;
|
||||||
|
bool isConnected() const;
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void onNewConnection();
|
||||||
|
void onTcpSocketDisconnected();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void commandSendResult(int bytesWritten, const QString& error = QString());
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -965,6 +965,11 @@ void HPPA::initControlTabwidget()
|
|||||||
m_pc->setWindowFlags(Qt::Widget);
|
m_pc->setWindowFlags(Qt::Widget);
|
||||||
ui.controlTabWidget->addTab(m_pc, QString::fromLocal8Bit("电源控制"));
|
ui.controlTabWidget->addTab(m_pc, QString::fromLocal8Bit("电源控制"));
|
||||||
|
|
||||||
|
//电源控制3D
|
||||||
|
m_pc3D = new PowerControl3D();
|
||||||
|
m_pc3D->setWindowFlags(Qt::Widget);
|
||||||
|
ui.controlTabWidget->addTab(m_pc3D, QString::fromLocal8Bit("电源控制3D"));
|
||||||
|
|
||||||
//机械臂控制
|
//机械臂控制
|
||||||
m_rac = new RobotArmControl();
|
m_rac = new RobotArmControl();
|
||||||
connect(m_rac->robotController, SIGNAL(hsiRecordSignal(int)), this, SLOT(recordFromRobotArm(int)));
|
connect(m_rac->robotController, SIGNAL(hsiRecordSignal(int)), this, SLOT(recordFromRobotArm(int)));
|
||||||
@ -1514,7 +1519,8 @@ void HPPA::create3DPlantPhenotypeScenario()
|
|||||||
m_tabManager->showTab(m_singleLensReflexCameraWindow);
|
m_tabManager->showTab(m_singleLensReflexCameraWindow);
|
||||||
//m_tabManager->showTab(m_rgbCameraControlWindow);
|
//m_tabManager->showTab(m_rgbCameraControlWindow);
|
||||||
m_tabManager->showTab(m_adt);
|
m_tabManager->showTab(m_adt);
|
||||||
m_tabManager->showTab(m_pc);
|
//m_tabManager->showTab(m_pc);
|
||||||
|
m_tabManager->showTab(m_pc3D);
|
||||||
m_tabManager->showTab(m_tmc);
|
m_tabManager->showTab(m_tmc);
|
||||||
|
|
||||||
m_view3DModelManager->switchScenario(View3DModelManager::ScenarioType::PlantPhenotype);
|
m_view3DModelManager->switchScenario(View3DModelManager::ScenarioType::PlantPhenotype);
|
||||||
|
|||||||
@ -85,6 +85,8 @@
|
|||||||
|
|
||||||
#include "TimedDataCollection.h"
|
#include "TimedDataCollection.h"
|
||||||
|
|
||||||
|
#include "PowerControl3D.h"
|
||||||
|
|
||||||
#define PI 3.1415926
|
#define PI 3.1415926
|
||||||
|
|
||||||
QT_CHARTS_USE_NAMESPACE//QChartView 使用 需要加宏, 否则无法使用
|
QT_CHARTS_USE_NAMESPACE//QChartView 使用 需要加宏, 否则无法使用
|
||||||
@ -290,6 +292,7 @@ private:
|
|||||||
SingleLensReflexCameraWindow* m_singleLensReflexCameraWindow;
|
SingleLensReflexCameraWindow* m_singleLensReflexCameraWindow;
|
||||||
adjustTable* m_adt;
|
adjustTable* m_adt;
|
||||||
PowerControl* m_pc;
|
PowerControl* m_pc;
|
||||||
|
PowerControl3D* m_pc3D;
|
||||||
RobotArmControl* m_rac;
|
RobotArmControl* m_rac;
|
||||||
OneMotorControl* m_omc;
|
OneMotorControl* m_omc;
|
||||||
TwoMotorControl* m_tmc;
|
TwoMotorControl* m_tmc;
|
||||||
|
|||||||
@ -112,6 +112,8 @@
|
|||||||
<ClCompile Include="AspectRatioLabel.cpp" />
|
<ClCompile Include="AspectRatioLabel.cpp" />
|
||||||
<ClCompile Include="CaptureCoordinator.cpp" />
|
<ClCompile Include="CaptureCoordinator.cpp" />
|
||||||
<ClCompile Include="Carousel.cpp" />
|
<ClCompile Include="Carousel.cpp" />
|
||||||
|
<ClCompile Include="CommunicationInterfaceBase.cpp" />
|
||||||
|
<ClCompile Include="CommunicationViaTCP.cpp" />
|
||||||
<ClCompile Include="Corning410Imager.cpp" />
|
<ClCompile Include="Corning410Imager.cpp" />
|
||||||
<ClCompile Include="CustomDockWidgetBase.cpp" />
|
<ClCompile Include="CustomDockWidgetBase.cpp" />
|
||||||
<ClCompile Include="DepthCameraWindow.cpp" />
|
<ClCompile Include="DepthCameraWindow.cpp" />
|
||||||
@ -140,6 +142,7 @@
|
|||||||
<ClCompile Include="OneMotorControl.cpp" />
|
<ClCompile Include="OneMotorControl.cpp" />
|
||||||
<ClCompile Include="path_tc.cpp" />
|
<ClCompile Include="path_tc.cpp" />
|
||||||
<ClCompile Include="PowerControl.cpp" />
|
<ClCompile Include="PowerControl.cpp" />
|
||||||
|
<ClCompile Include="PowerControl3D.cpp" />
|
||||||
<ClCompile Include="QDoubleSlider.cpp" />
|
<ClCompile Include="QDoubleSlider.cpp" />
|
||||||
<ClCompile Include="QMotorDoubleSlider.cpp" />
|
<ClCompile Include="QMotorDoubleSlider.cpp" />
|
||||||
<ClCompile Include="RasterDataProvider.cpp" />
|
<ClCompile Include="RasterDataProvider.cpp" />
|
||||||
@ -189,6 +192,7 @@
|
|||||||
<QtUic Include="oneMotorControl.ui" />
|
<QtUic Include="oneMotorControl.ui" />
|
||||||
<QtUic Include="PathPlan.ui" />
|
<QtUic Include="PathPlan.ui" />
|
||||||
<QtUic Include="PowerControl.ui" />
|
<QtUic Include="PowerControl.ui" />
|
||||||
|
<QtUic Include="PowerControl3D.ui" />
|
||||||
<QtUic Include="RadianceConversion.ui" />
|
<QtUic Include="RadianceConversion.ui" />
|
||||||
<QtUic Include="ReflectanceConversion.ui" />
|
<QtUic Include="ReflectanceConversion.ui" />
|
||||||
<QtUic Include="rgbCamera.ui" />
|
<QtUic Include="rgbCamera.ui" />
|
||||||
@ -223,6 +227,8 @@
|
|||||||
<ClInclude Include="AppSettings.h" />
|
<ClInclude Include="AppSettings.h" />
|
||||||
<QtMoc Include="FileNameLineEdit.h" />
|
<QtMoc Include="FileNameLineEdit.h" />
|
||||||
<QtMoc Include="DepthCameraWindow.h" />
|
<QtMoc Include="DepthCameraWindow.h" />
|
||||||
|
<QtMoc Include="CommunicationViaTCP.h" />
|
||||||
|
<QtMoc Include="CommunicationInterfaceBase.h" />
|
||||||
<ClInclude Include="imager_base.h" />
|
<ClInclude Include="imager_base.h" />
|
||||||
<ClInclude Include="irisximeaimager.h" />
|
<ClInclude Include="irisximeaimager.h" />
|
||||||
<QtMoc Include="OneMotorControl.h" />
|
<QtMoc Include="OneMotorControl.h" />
|
||||||
@ -244,6 +250,7 @@
|
|||||||
<QtMoc Include="MapToolSpectral.h" />
|
<QtMoc Include="MapToolSpectral.h" />
|
||||||
<QtMoc Include="MapTools.h" />
|
<QtMoc Include="MapTools.h" />
|
||||||
<ClInclude Include="MotorWindowBase.h" />
|
<ClInclude Include="MotorWindowBase.h" />
|
||||||
|
<QtMoc Include="PowerControl3D.h" />
|
||||||
<ClInclude Include="RasterDataProvider.h" />
|
<ClInclude Include="RasterDataProvider.h" />
|
||||||
<ClInclude Include="MultibandRasterRenderer.h" />
|
<ClInclude Include="MultibandRasterRenderer.h" />
|
||||||
<ClInclude Include="RasterImageLayer.h" />
|
<ClInclude Include="RasterImageLayer.h" />
|
||||||
|
|||||||
@ -238,6 +238,15 @@
|
|||||||
<ClCompile Include="TimedDataCollectionDataStructures.cpp">
|
<ClCompile Include="TimedDataCollectionDataStructures.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="CommunicationViaTCP.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="CommunicationInterfaceBase.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="PowerControl3D.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtMoc Include="fileOperation.h">
|
<QtMoc Include="fileOperation.h">
|
||||||
@ -387,6 +396,15 @@
|
|||||||
<QtMoc Include="TimedDataCollectionDataStructures.h">
|
<QtMoc Include="TimedDataCollectionDataStructures.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
|
<QtMoc Include="CommunicationViaTCP.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="CommunicationInterfaceBase.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="PowerControl3D.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="imageProcessor.h">
|
<ClInclude Include="imageProcessor.h">
|
||||||
@ -496,6 +514,9 @@
|
|||||||
<QtUic Include="TimedDataCollection_ui.ui">
|
<QtUic Include="TimedDataCollection_ui.ui">
|
||||||
<Filter>Form Files</Filter>
|
<Filter>Form Files</Filter>
|
||||||
</QtUic>
|
</QtUic>
|
||||||
|
<QtUic Include="PowerControl3D.ui">
|
||||||
|
<Filter>Form Files</Filter>
|
||||||
|
</QtUic>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="cpp.hint" />
|
<None Include="cpp.hint" />
|
||||||
|
|||||||
64
HPPA/PowerControl3D.cpp
Normal file
64
HPPA/PowerControl3D.cpp
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#include "PowerControl3D.h"
|
||||||
|
|
||||||
|
using namespace MotorParams;
|
||||||
|
|
||||||
|
PowerControl3D::PowerControl3D(QWidget* parent)
|
||||||
|
: QDialog(parent)
|
||||||
|
{
|
||||||
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
connect(ui.halogenLampPowerOn_btn, &QPushButton::clicked, this, &PowerControl3D::halogenLampPowerOn);
|
||||||
|
connect(ui.halogenLampPowerDown_btn, &QPushButton::clicked, this, &PowerControl3D::halogenLampPowerDown);
|
||||||
|
|
||||||
|
connect(ui.d65LampPowerOn_btn, &QPushButton::clicked, this, &PowerControl3D::d65LampPowerOn);
|
||||||
|
connect(ui.d65LampPowerDown_btn, &QPushButton::clicked, this, &PowerControl3D::d65LampPowerDown);
|
||||||
|
|
||||||
|
connect(ui.slrPowerOn_btn, &QPushButton::clicked, this, &PowerControl3D::slrPowerOn);
|
||||||
|
connect(ui.slrPowerDown_btn, &QPushButton::clicked, this, &PowerControl3D::slrPowerDown);
|
||||||
|
|
||||||
|
MotorParams::TCPConnectionParams tcpConnectionParams6003;
|
||||||
|
tcpConnectionParams6003.port = 6003;
|
||||||
|
tcpConnectionParams6003.serverIP = "192.168.1.2";
|
||||||
|
tcpServer6003 = new CommunicationViaTCP(tcpConnectionParams6003, this);
|
||||||
|
|
||||||
|
MotorParams::TCPConnectionParams tcpConnectionParams6004;
|
||||||
|
tcpConnectionParams6004.port = 6004;
|
||||||
|
tcpConnectionParams6004.serverIP = "192.168.1.2";
|
||||||
|
tcpServer6004 = new CommunicationViaTCP(tcpConnectionParams6004, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
PowerControl3D::~PowerControl3D()
|
||||||
|
{
|
||||||
|
delete tcpServer6003;
|
||||||
|
delete tcpServer6004;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PowerControl3D::halogenLampPowerOn()
|
||||||
|
{
|
||||||
|
tcpServer6003->sendCommand(R"({"key1":1,"type":"event"})");
|
||||||
|
}
|
||||||
|
|
||||||
|
void PowerControl3D::halogenLampPowerDown()
|
||||||
|
{
|
||||||
|
tcpServer6003->sendCommand(R"({"key1":0,"type":"event"})");
|
||||||
|
}
|
||||||
|
|
||||||
|
void PowerControl3D::d65LampPowerOn()
|
||||||
|
{
|
||||||
|
tcpServer6004->sendCommand(R"({"key1":1,"type":"event"})");
|
||||||
|
}
|
||||||
|
|
||||||
|
void PowerControl3D::d65LampPowerDown()
|
||||||
|
{
|
||||||
|
tcpServer6004->sendCommand(R"({"key1":0,"type":"event"})");
|
||||||
|
}
|
||||||
|
|
||||||
|
void PowerControl3D::slrPowerOn()
|
||||||
|
{
|
||||||
|
tcpServer6003->sendCommand(R"({"key2":1,"type":"event"})");
|
||||||
|
}
|
||||||
|
|
||||||
|
void PowerControl3D::slrPowerDown()
|
||||||
|
{
|
||||||
|
tcpServer6003->sendCommand(R"({"key2":0,"type":"event"})");
|
||||||
|
}
|
||||||
39
HPPA/PowerControl3D.h
Normal file
39
HPPA/PowerControl3D.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
|
||||||
|
#include "ui_PowerControl3D.h"
|
||||||
|
|
||||||
|
#include "CommunicationViaTCP.h"
|
||||||
|
|
||||||
|
//using namespace MotorParams;
|
||||||
|
|
||||||
|
class PowerControl3D : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
PowerControl3D(QWidget* parent = nullptr);
|
||||||
|
~PowerControl3D();
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void halogenLampPowerOn();
|
||||||
|
void halogenLampPowerDown();
|
||||||
|
|
||||||
|
void d65LampPowerOn();
|
||||||
|
void d65LampPowerDown();
|
||||||
|
|
||||||
|
void slrPowerOn();
|
||||||
|
void slrPowerDown();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
//void powerOpened();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::PowerControl3D_UI ui;
|
||||||
|
|
||||||
|
MotorParams::CommunicationViaTCP* tcpServer6003;
|
||||||
|
MotorParams::CommunicationViaTCP* tcpServer6004;
|
||||||
|
};
|
||||||
350
HPPA/PowerControl3D.ui
Normal file
350
HPPA/PowerControl3D.ui
Normal file
@ -0,0 +1,350 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>PowerControl3D_UI</class>
|
||||||
|
<widget class="QDialog" name="PowerControl3D_UI">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>493</width>
|
||||||
|
<height>369</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>PowerControl3D</string>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QGroupBox
|
||||||
|
{
|
||||||
|
border: 12px solid transparent;
|
||||||
|
/*border-top: 12px solid transparent;
|
||||||
|
border-right: 0px solid transparent;
|
||||||
|
border-bottom: 0px solid transparent;
|
||||||
|
border-left: 0px solid transparent;*/
|
||||||
|
color: #ACCDFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton
|
||||||
|
{
|
||||||
|
/*width: 172px;
|
||||||
|
height: 56px;*/
|
||||||
|
font: 19pt "新宋体";
|
||||||
|
background-color: qlineargradient(
|
||||||
|
spread:pad,
|
||||||
|
x1:0.5, y1:0, x2:0.5, y2:1,
|
||||||
|
stop:0 #283D86,
|
||||||
|
stop:1 #0F1A40
|
||||||
|
);
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
padding: 8px 16px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
QPushButton:hover
|
||||||
|
{
|
||||||
|
background-color: qlineargradient(
|
||||||
|
spread:pad,
|
||||||
|
x1:0, y1:0, x2:1, y2:0,
|
||||||
|
stop:0 #3A4875,
|
||||||
|
stop:1 #5F6B91
|
||||||
|
);
|
||||||
|
}
|
||||||
|
/* 按下时的效果 */
|
||||||
|
QPushButton:pressed
|
||||||
|
{
|
||||||
|
background-color: qlineargradient(
|
||||||
|
spread:pad,
|
||||||
|
x1:0, y1:0, x2:1, y2:0,
|
||||||
|
stop:0 #1A254F,
|
||||||
|
stop:1 #3A466B
|
||||||
|
);
|
||||||
|
/* 可选:添加下压效果 */
|
||||||
|
padding-top: 9px;
|
||||||
|
padding-bottom: 7px;
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_4" rowstretch="1,2,2,2,1" columnstretch="1,10,1">
|
||||||
|
<item row="0" column="1">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>66</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>63</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QGroupBox" name="groupBox_8">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>卤素灯</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalSpacing">
|
||||||
|
<number>18</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="halogenLampPowerOn_btn">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>打 开</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QPushButton" name="halogenLampPowerDown_btn">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>关 闭</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<spacer name="horizontalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>63</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>63</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QGroupBox" name="groupBox_7">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>D65灯</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalSpacing">
|
||||||
|
<number>18</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="d65LampPowerOn_btn">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>打 开</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QPushButton" name="d65LampPowerDown_btn">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>关 闭</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<spacer name="horizontalSpacer_6">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>63</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>63</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QGroupBox" name="groupBox_6">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>单反</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalSpacing">
|
||||||
|
<number>18</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QPushButton" name="slrPowerDown_btn">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>下 电</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="slrPowerOn_btn">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>上 电</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="2">
|
||||||
|
<spacer name="horizontalSpacer_5">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>63</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>65</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
Reference in New Issue
Block a user