加入 dockWidget
This commit is contained in:
55
HPPA/PowerControl.cpp
Normal file
55
HPPA/PowerControl.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
#include "PowerControl.h"
|
||||
|
||||
PowerControl::PowerControl(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
connect(ui.lamp_power_open_btn, SIGNAL(clicked()), this, SLOT(onLampPowerOpen_btn()));
|
||||
connect(ui.lamp_power_close_btn, SIGNAL(clicked()), this, SLOT(onLampPowerClose_btn()));
|
||||
|
||||
connect(ui.motor_power_open_btn, SIGNAL(clicked()), this, SLOT(onMotorPowerOpen_btn()));
|
||||
connect(ui.motor_power_close_btn, SIGNAL(clicked()), this, SLOT(onMotorPowerClose_btn()));
|
||||
}
|
||||
|
||||
PowerControl::~PowerControl()
|
||||
{}
|
||||
|
||||
void PowerControl::getRequest(QString str)
|
||||
{
|
||||
QNetworkRequest request;
|
||||
QNetworkAccessManager* naManager = new QNetworkAccessManager(this);
|
||||
QMetaObject::Connection connRet = QObject::connect(naManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requestFinished(QNetworkReply*)));
|
||||
Q_ASSERT(connRet);
|
||||
|
||||
request.setUrl(QUrl(str));
|
||||
QNetworkReply* reply = naManager->get(request);
|
||||
}
|
||||
|
||||
void PowerControl::onLampPowerOpen_btn()//onLampPowerOpen_btn
|
||||
{
|
||||
QString xx = "http://192.168.1.3/setshutter?Portname=3&Value=1";
|
||||
getRequest(xx);
|
||||
}
|
||||
|
||||
void PowerControl::onLampPowerClose_btn()//onLampPowerClose_btn
|
||||
{
|
||||
QString xx = "http://192.168.1.3/setshutter?Portname=3&Value=0";
|
||||
getRequest(xx);
|
||||
}
|
||||
|
||||
void PowerControl::onMotorPowerOpen_btn()
|
||||
{
|
||||
QString xx = "http://192.168.1.3/setshutter?Portname=1&Value=1";
|
||||
getRequest(xx);
|
||||
|
||||
emit powerOpened();
|
||||
}
|
||||
|
||||
void PowerControl::onMotorPowerClose_btn()
|
||||
{
|
||||
QString xx = "http://192.168.1.3/setshutter?Portname=1&Value=0";
|
||||
getRequest(xx);
|
||||
|
||||
emit powerClosed();
|
||||
}
|
||||
Reference in New Issue
Block a user