Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
7284f18c43 | |||
fb27b0fa57 | |||
77dd027ff7 | |||
8e0018480b | |||
16757c5f78 | |||
ef7aa73c8d | |||
95b68bc67d |
@ -127,7 +127,24 @@ void Application::setCurrentAntiClipAreaEnabled(bool enabled) {
|
||||
emit currentAntiClipAreaEnabledChanged();
|
||||
if (!m_device.expired()) {
|
||||
auto device = m_device.lock();
|
||||
device->updateAntiClipAreaPoints(m_currentAntiClipAreaEnabled, m_currentAntiClipAreaPoints);
|
||||
device->updateAntiClipAreaPoints(m_currentAntiClipAreaEnabled, m_currentAntiClipAreaPoints,
|
||||
m_currentAntiClipSensitivity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Application::currentAntiClipSensitivity() const {
|
||||
return m_currentAntiClipSensitivity;
|
||||
}
|
||||
|
||||
void Application::setCurrentAntiClipSensitivity(int sensitivity) {
|
||||
if (m_currentAntiClipSensitivity != sensitivity) {
|
||||
m_currentAntiClipSensitivity = sensitivity;
|
||||
emit currentAntiClipSensitivityChanged();
|
||||
if (!m_device.expired()) {
|
||||
auto device = m_device.lock();
|
||||
device->updateAntiClipAreaPoints(m_currentAntiClipAreaEnabled, m_currentAntiClipAreaPoints,
|
||||
m_currentAntiClipSensitivity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -153,7 +170,7 @@ void Application::updateOpenDoorAreaPoints(const QList<QPointF> &points) {
|
||||
void Application::updateAntiClipAreaPoints(const QList<QPointF> &points) {
|
||||
if (!m_device.expired()) {
|
||||
auto device = m_device.lock();
|
||||
device->updateAntiClipAreaPoints(m_currentAntiClipAreaEnabled, points);
|
||||
device->updateAntiClipAreaPoints(m_currentAntiClipAreaEnabled, points, m_currentAntiClipSensitivity);
|
||||
}
|
||||
}
|
||||
|
||||
@ -260,6 +277,7 @@ void Application::connectToDevice(int index) {
|
||||
m_currentShieldedAreaPoints = info.shieldedArea;
|
||||
m_currentAntiClipAreaEnabled = info.antiClipAreaEnabled;
|
||||
m_currentAntiClipAreaPoints = info.antiClipArea;
|
||||
m_currentAntiClipSensitivity = info.antiClipSensitivity;
|
||||
m_currentNetworkInfomation = device->networkInfomation();
|
||||
m_currentFirmware = device->infomation().firmwareVersion;
|
||||
m_currentDeviceConnected = device->isConnected();
|
||||
@ -273,6 +291,7 @@ void Application::connectToDevice(int index) {
|
||||
emit currentOpenDoorAreaWayChanged();
|
||||
emit currentShieldedAreaEnabledChanged();
|
||||
emit currentAntiClipAreaEnabledChanged();
|
||||
emit currentAntiClipSensitivityChanged();
|
||||
emit currentNetworkInfomationChanged();
|
||||
}
|
||||
emit currentFirmwareChanged();
|
||||
@ -306,6 +325,16 @@ void Application::upgradeDevice(const QString &file) {
|
||||
}
|
||||
}
|
||||
|
||||
void Application::resetDevice() {
|
||||
if (m_device.expired()) return;
|
||||
auto device = m_device.lock();
|
||||
if (device->isConnected()) {
|
||||
device->requestReset();
|
||||
} else {
|
||||
emit newMessage(2, "恢复出厂设置", "设备已离线,请重新连接设备!");
|
||||
}
|
||||
}
|
||||
|
||||
void Application::onDeviceOpenDoorArea(DeviceConnection::AreaWay way, const QList<QPointF> &points) {
|
||||
setCurrentOpenDoorAreaWay(way);
|
||||
setCurrentOpenDoorAreaPoints(points);
|
||||
@ -323,9 +352,10 @@ void Application::onDeviceShieldedArea(bool enabled, const QList<QPointF> &point
|
||||
setCurrentShieldedAreaPoints(points);
|
||||
}
|
||||
|
||||
void Application::onDeviceAntiClipArea(bool enabled, const QList<QPointF> &points) {
|
||||
void Application::onDeviceAntiClipArea(bool enabled, const QList<QPointF> &points, int sensitivity) {
|
||||
setCurrentAntiClipAreaEnabled(enabled);
|
||||
setCurrentAntiClipAreaPoints(points);
|
||||
setCurrentAntiClipSensitivity(sensitivity);
|
||||
}
|
||||
|
||||
void Application::onDeviceNetworkInfomation(const NetworkInfomation &info) {
|
||||
|
@ -34,6 +34,7 @@ class Application : public QObject {
|
||||
setCurrentShieldedAreaPoints NOTIFY currentShieldedAreaPointsChanged)
|
||||
Q_PROPERTY(bool currentAntiClipAreaEnabled READ currentAntiClipAreaEnabled WRITE setCurrentAntiClipAreaEnabled
|
||||
NOTIFY currentAntiClipAreaEnabledChanged)
|
||||
Q_PROPERTY(int currentAntiClipSensitivity READ currentAntiClipSensitivity WRITE setCurrentAntiClipSensitivity NOTIFY currentAntiClipSensitivityChanged)
|
||||
Q_PROPERTY(QList<QPointF> currentAntiClipAreaPoints READ currentAntiClipAreaPoints WRITE
|
||||
setCurrentAntiClipAreaPoints NOTIFY currentAntiClipAreaPointsChanged)
|
||||
Q_PROPERTY(
|
||||
@ -65,6 +66,8 @@ public:
|
||||
|
||||
bool currentAntiClipAreaEnabled() const;
|
||||
void setCurrentAntiClipAreaEnabled(bool enabled);
|
||||
int currentAntiClipSensitivity() const;
|
||||
void setCurrentAntiClipSensitivity(int sensitivity);
|
||||
QList<QPointF> currentAntiClipAreaPoints() const;
|
||||
void setCurrentAntiClipAreaPoints(const QList<QPointF> &points);
|
||||
|
||||
@ -81,6 +84,7 @@ public:
|
||||
const QString &gateway, const QString &dns);
|
||||
Q_INVOKABLE void connectToDevice(int index);
|
||||
Q_INVOKABLE void upgradeDevice(const QString &file);
|
||||
Q_INVOKABLE void resetDevice();
|
||||
Q_INVOKABLE void startSearchDevice();
|
||||
|
||||
int exec();
|
||||
@ -94,6 +98,7 @@ signals:
|
||||
void currentOpenDoorAreaWayChanged();
|
||||
void currentShieldedAreaEnabledChanged();
|
||||
void currentAntiClipAreaEnabledChanged();
|
||||
void currentAntiClipSensitivityChanged();
|
||||
void currentNetworkInfomationChanged();
|
||||
void currentFirmwareChanged();
|
||||
void currentDeviceConnectedChanged();
|
||||
@ -108,7 +113,7 @@ protected:
|
||||
void onDeviceFlipChanged(bool flip);
|
||||
void onDeviceOpenDoorArea(DeviceConnection::AreaWay way, const QList<QPointF> &points);
|
||||
void onDeviceShieldedArea(bool enabled, const QList<QPointF> &points);
|
||||
void onDeviceAntiClipArea(bool enabled, const QList<QPointF> &points);
|
||||
void onDeviceAntiClipArea(bool enabled, const QList<QPointF> &points, int sensitivity);
|
||||
void onDeviceNetworkInfomation(const NetworkInfomation &info);
|
||||
void onDeviceFirmware(const QString &firmware);
|
||||
void onDeviceConnected();
|
||||
@ -128,6 +133,7 @@ private:
|
||||
bool m_currentShieldedAreaEnabled = false;
|
||||
QList<QPointF> m_currentShieldedAreaPoints;
|
||||
bool m_currentAntiClipAreaEnabled = false;
|
||||
int m_currentAntiClipSensitivity = 1;
|
||||
QList<QPointF> m_currentAntiClipAreaPoints;
|
||||
NetworkInfomation m_currentNetworkInfomation;
|
||||
QString m_currentFirmware;
|
||||
|
@ -1,6 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(AntiClipSettings VERSION 1.5 LANGUAGES C CXX)
|
||||
project(AntiClipSettings VERSION 1.7 LANGUAGES C CXX)
|
||||
set(APPLICATION_NAME "视觉防夹设备上位机工具")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
@ -46,8 +46,7 @@ else()
|
||||
set(MBEDTLS_ROOT ${Libraries_ROOT}/mbedtls-3.6.2_msvc2022_64bit_release)
|
||||
endif()
|
||||
|
||||
set(MBEDTLS_INCLUDE_DIR ${MBEDTLS_ROOT}/include)
|
||||
set(MBEDTLS_LIBRARY_DIRS ${MBEDTLS_ROOT}/lib)
|
||||
set(MbedTLS_DIR ${MBEDTLS_ROOT}/lib/cmake/MbedTLS)
|
||||
|
||||
set(JPEGTURBO_INCLUDE_DIR ${JPEGTURBO_ROOT}/include)
|
||||
set(JPEGTURBO_LIB_DIR ${JPEGTURBO_ROOT}/lib)
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <QFileInfo>
|
||||
#include <QPointF>
|
||||
#include <QTimer>
|
||||
#include <QTimerEvent>
|
||||
#include <WinSock2.h>
|
||||
#include <boost/json/object.hpp>
|
||||
#include <boost/json/parse.hpp>
|
||||
@ -24,9 +25,9 @@ void DeviceConnection::close() {
|
||||
m_otaTimer->deleteLater();
|
||||
m_otaTimer = nullptr;
|
||||
}
|
||||
if (m_timerId > 0) {
|
||||
killTimer(m_timerId);
|
||||
m_timerId = -1;
|
||||
if (m_heartbeatTimerId > 0) {
|
||||
killTimer(m_heartbeatTimerId);
|
||||
m_heartbeatTimerId = -1;
|
||||
}
|
||||
if (m_commandSocket != nullptr) {
|
||||
m_commandSocket->deleteLater();
|
||||
@ -209,15 +210,16 @@ void DeviceConnection::requestAntiClipArea() {
|
||||
m_requests.push(task);
|
||||
}
|
||||
|
||||
void DeviceConnection::updateAntiClipAreaPoints(bool enabled, const QList<QPointF> &points) {
|
||||
void DeviceConnection::updateAntiClipAreaPoints(bool enabled, const QList<QPointF> &points, int sensitivity) {
|
||||
Task task;
|
||||
task.command = "a03opendoor5_setdata";
|
||||
task.task = [this, enabled, points]() {
|
||||
task.task = [this, enabled, points, sensitivity]() {
|
||||
boost::json::object request;
|
||||
request["func"] = "a03opendoor5_setdata";
|
||||
request["deviceid"] = "0";
|
||||
boost::json::object data;
|
||||
data["value"] = enabled ? "1" : "0";
|
||||
data["sensitivity"] = std::to_string(sensitivity);
|
||||
boost::json::array pointArray;
|
||||
for (auto &p : points) {
|
||||
boost::json::object point;
|
||||
@ -387,11 +389,11 @@ QFuture<bool> DeviceConnection::updateNetworkInfomation(bool dhcp, const QString
|
||||
void DeviceConnection::requestOta(const QString &firmware, const QString &file) {
|
||||
m_otaProgress = 0;
|
||||
emit otaProgressChanged(true, m_otaProgress, "正在向设备发起OTA请求......");
|
||||
if (m_timerId > 0) {
|
||||
killTimer(m_timerId);
|
||||
m_timerId = -1;
|
||||
if (m_heartbeatTimerId > 0) {
|
||||
killTimer(m_heartbeatTimerId);
|
||||
m_heartbeatTimerId = -1;
|
||||
}
|
||||
if (!m_requests.empty()) {
|
||||
while (!m_requests.empty()) { // 清除之前的命令
|
||||
m_requests.pop();
|
||||
}
|
||||
Task task;
|
||||
@ -432,6 +434,28 @@ void DeviceConnection::requestOta(const QString &firmware, const QString &file)
|
||||
m_requests.push(task);
|
||||
}
|
||||
|
||||
void DeviceConnection::requestReset() {
|
||||
Task task;
|
||||
task.command = "a12factory_setdata";
|
||||
task.task = [this]() {
|
||||
boost::json::object request;
|
||||
request["func"] = "a12factory_setdata";
|
||||
request["deviceid"] = "0";
|
||||
boost::json::object data;
|
||||
data["value"] = "1";
|
||||
|
||||
request["data"] = std::move(data);
|
||||
auto text = boost::json::serialize(request);
|
||||
m_commandSocket->write(text.data(), text.size());
|
||||
};
|
||||
task.future = std::make_shared<QFutureInterface<bool>>();
|
||||
if (m_requests.empty()) {
|
||||
task.task();
|
||||
}
|
||||
auto ret = task.future->future();
|
||||
m_requests.push(task);
|
||||
}
|
||||
|
||||
void DeviceConnection::transferBinContent() {
|
||||
constexpr int SliceSize = 1024;
|
||||
constexpr int WaitMd5CheckTime = 3000; // ms
|
||||
@ -480,7 +504,7 @@ void DeviceConnection::transferBinContent() {
|
||||
m_h264Socket->close();
|
||||
},
|
||||
type);
|
||||
m_otaTimer->start(60 * 1000);
|
||||
m_otaTimer->start(5 * 60 * 1000); // 固件升级五分钟,正常升级2.5分钟左右(包含算法模型)
|
||||
}
|
||||
}
|
||||
|
||||
@ -544,7 +568,10 @@ QString DeviceConnection::handleCommand(const std::string_view &replyText, const
|
||||
}
|
||||
m_infomation.antiClipAreaEnabled = value == "1";
|
||||
m_infomation.antiClipArea = points;
|
||||
emit antiClipAreaChanged(value == "1", points);
|
||||
if (data.contains("sensitivity")) {
|
||||
m_infomation.antiClipSensitivity = std::stoi(static_cast<std::string>(data.at("sensitivity").as_string()));
|
||||
}
|
||||
emit antiClipAreaChanged(value == "1", points, m_infomation.antiClipSensitivity);
|
||||
} else if (function == "netconfig_getdata") {
|
||||
auto &data = reply.at("data").as_object();
|
||||
m_networkInfomation.dhcp = data.at("type").as_string() == "dhcp";
|
||||
@ -613,7 +640,7 @@ QString DeviceConnection::handleCommand(const std::string_view &replyText, const
|
||||
emit otaProgressChanged(true, m_otaProgress, "设备正在升级中,请稍后......");
|
||||
} else {
|
||||
m_otaTimer->stop(); // 这里不需要再超时了
|
||||
emit otaProgressChanged(true, 100, "设备正在升级中,请于一分钟后重新连接wifi搜索设备");
|
||||
emit otaProgressChanged(true, 100, "设备正在升级中,请于五分钟后重新连接wifi搜索设备");
|
||||
}
|
||||
} else {
|
||||
const char *message = nullptr;
|
||||
@ -668,10 +695,12 @@ QString DeviceConnection::handleCommand(const std::string_view &replyText, const
|
||||
}
|
||||
}
|
||||
requestVideoInformation();
|
||||
} else if (function == "a12factory_setdata") {
|
||||
LOG(info) << "device factory reset";
|
||||
} else {
|
||||
LOG(warning) << "unknown reply: " << replyText;
|
||||
}
|
||||
return QString::fromStdString(std::string(std::move(function)));
|
||||
return QString::fromStdString(std::string(function));
|
||||
}
|
||||
|
||||
void DeviceConnection::onConnected() {
|
||||
@ -684,7 +713,7 @@ void DeviceConnection::onConnected() {
|
||||
requestNetworkInfomation();
|
||||
requestVideoInformation();
|
||||
emit connected();
|
||||
m_timerId = startTimer(2500);
|
||||
m_heartbeatTimerId = startTimer(2500);
|
||||
if (m_otaProgress == 99) {
|
||||
m_otaProgress = -1;
|
||||
emit otaProgressChanged(true, 100, "设备升级成功!");
|
||||
@ -692,6 +721,9 @@ void DeviceConnection::onConnected() {
|
||||
if (m_otaTimer != nullptr) {
|
||||
m_otaTimer->stop();
|
||||
}
|
||||
if (m_requestTimerId < 0) {
|
||||
m_requestTimerId = startTimer(HeartbeatInterval);
|
||||
}
|
||||
} else if (socket == m_h264Socket) {
|
||||
if (m_videoEnabled) {
|
||||
setLiveStreamEnabled(true);
|
||||
@ -702,9 +734,13 @@ void DeviceConnection::onConnected() {
|
||||
void DeviceConnection::onDisconnected() {
|
||||
auto socket = dynamic_cast<QTcpSocket *>(sender());
|
||||
if (socket == m_commandSocket) {
|
||||
if (m_timerId > 0) {
|
||||
killTimer(m_timerId);
|
||||
m_timerId = -1;
|
||||
if (m_requestTimerId > 0) {
|
||||
killTimer(m_requestTimerId);
|
||||
m_requestTimerId = -1;
|
||||
}
|
||||
if (m_heartbeatTimerId > 0) {
|
||||
killTimer(m_heartbeatTimerId);
|
||||
m_heartbeatTimerId = -1;
|
||||
}
|
||||
emit disconnected();
|
||||
if ((m_otaProgress >= 0) && (m_otaProgress <= 98)) {
|
||||
@ -743,7 +779,6 @@ void DeviceConnection::onH264ReadyRead() {
|
||||
void DeviceConnection::onCommandReadyRead() {
|
||||
auto data = m_commandSocket->readAll();
|
||||
m_commandBuffer.push_back(data);
|
||||
|
||||
while (!m_commandBuffer.isEmpty()) {
|
||||
auto packageSize = ntohl(*reinterpret_cast<uint32_t *>(m_commandBuffer.data()));
|
||||
if (m_commandBuffer.size() < (packageSize + sizeof(uint32_t))) break;
|
||||
@ -755,9 +790,13 @@ void DeviceConnection::onCommandReadyRead() {
|
||||
auto &task = m_requests.front();
|
||||
if (task.command == command) {
|
||||
m_requests.pop();
|
||||
} else {
|
||||
LOG(warning) << "current command[" << command.toStdString() << "] is no the task queue's head["
|
||||
<< task.command.toStdString() << "]";
|
||||
}
|
||||
if (!m_requests.empty()) {
|
||||
m_requests.front().task();
|
||||
auto &command = m_requests.front();
|
||||
command.task();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -769,15 +808,35 @@ void DeviceConnection::onErrorOccurred(QAbstractSocket::SocketError socketError)
|
||||
}
|
||||
|
||||
void DeviceConnection::timerEvent(QTimerEvent *event) {
|
||||
if (isConnected()) {
|
||||
int index = heartbeats % 3;
|
||||
if (index == 0) {
|
||||
requestOpenDoorArea();
|
||||
} else if (index == 1) {
|
||||
requestShieldedArea();
|
||||
} else if (index == 2) {
|
||||
requestAntiClipArea();
|
||||
using namespace std::chrono;
|
||||
if (event->timerId() == m_heartbeatTimerId) {
|
||||
if (isConnected()) {
|
||||
int index = heartbeats % 3;
|
||||
if (index == 0) {
|
||||
requestOpenDoorArea();
|
||||
} else if (index == 1) {
|
||||
requestShieldedArea();
|
||||
} else if (index == 2) {
|
||||
requestAntiClipArea();
|
||||
}
|
||||
heartbeats++;
|
||||
}
|
||||
} else if (event->timerId() == m_requestTimerId) {
|
||||
if (!m_requests.empty()) {
|
||||
auto &command = m_requests.front();
|
||||
auto elapsed = duration_cast<milliseconds>(system_clock::now() - command.time);
|
||||
if (elapsed > (HeartbeatInterval * 2)) {
|
||||
LOG(info) << "not received command[" << command.command.toStdString() << "] more than "
|
||||
<< (HeartbeatInterval * 2).count() << " ms, consider it failed, send next command.";
|
||||
m_requests.pop();
|
||||
if (!m_requests.empty()) {
|
||||
m_requests.front().task();
|
||||
}
|
||||
} else if (elapsed > HeartbeatInterval) {
|
||||
LOG(info) << "not received command[" << command.command.toStdString() << "] more than "
|
||||
<< HeartbeatInterval.count() << " ms, resend it.";
|
||||
command.task();
|
||||
}
|
||||
}
|
||||
heartbeats++;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ class DeviceConnection : public QObject {
|
||||
|
||||
public:
|
||||
constexpr static auto WirelessAddress = "192.168.10.2";
|
||||
constexpr static auto HeartbeatInterval = std::chrono::milliseconds(2500);
|
||||
enum Resolution {
|
||||
Video_360P = 0,
|
||||
Video_720P,
|
||||
@ -46,6 +47,7 @@ public:
|
||||
|
||||
QList<QPointF> antiClipArea;
|
||||
bool antiClipAreaEnabled;
|
||||
int antiClipSensitivity = 1;
|
||||
};
|
||||
Q_ENUM(AreaWay)
|
||||
|
||||
@ -66,7 +68,7 @@ public:
|
||||
void requestShieldedArea();
|
||||
void updateShieldedAreaPoints(bool enabled, const QList<QPointF> &points);
|
||||
void requestAntiClipArea();
|
||||
void updateAntiClipAreaPoints(bool enabled, const QList<QPointF> &points);
|
||||
void updateAntiClipAreaPoints(bool enabled, const QList<QPointF> &points, int sensitivity);
|
||||
void requestResolution(Resolution resolution);
|
||||
void requestNetworkInfomation();
|
||||
QFuture<bool> updateNetworkInfomation(bool dhcp, const QString &ip, const QString &netmask, const QString &gateway,
|
||||
@ -86,13 +88,14 @@ public:
|
||||
* @param file
|
||||
*/
|
||||
void requestOta(const QString &firmware, const QString &file);
|
||||
void requestReset();
|
||||
|
||||
signals:
|
||||
void connected();
|
||||
void disconnected();
|
||||
void openDoorAreaChanged(AreaWay way, const QList<QPointF> &points);
|
||||
void shieldedAreaChanged(bool enabled, const QList<QPointF> &points);
|
||||
void antiClipAreaChanged(bool enabled, const QList<QPointF> &points);
|
||||
void antiClipAreaChanged(bool enabled, const QList<QPointF> &points, int sensitivity);
|
||||
void rotationChanged(int rotation);
|
||||
void flipChanged(bool flip);
|
||||
void networkInfomationChanged(const NetworkInfomation &info);
|
||||
@ -103,6 +106,7 @@ protected:
|
||||
class Task {
|
||||
public:
|
||||
QString command;
|
||||
std::chrono::system_clock::time_point time = std::chrono::system_clock::now();
|
||||
std::function<void()> task;
|
||||
std::shared_ptr<QTimer> timeoutTimer = nullptr;
|
||||
std::shared_ptr<QFutureInterface<bool>> future;
|
||||
@ -135,7 +139,8 @@ private:
|
||||
|
||||
H264FrameCallback m_frameCallback;
|
||||
std::queue<Task> m_requests;
|
||||
int m_timerId = -1;
|
||||
int m_requestTimerId = -1;
|
||||
int m_heartbeatTimerId = -1;
|
||||
int heartbeats = 0;
|
||||
NetworkInfomation m_networkInfomation;
|
||||
QString m_firmware;
|
||||
|
@ -16,6 +16,7 @@ Item {
|
||||
property color antiClipAreaColor: "blue"
|
||||
property var antiClipAreaPoints: []
|
||||
property bool antiClipAreaEnabled: false
|
||||
property int antiClipSensitivity: 1
|
||||
property alias flip: flipSwitch.checked
|
||||
property alias videoRotation: rotateComboBox.currentIndex
|
||||
|
||||
@ -241,19 +242,18 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
Grid {
|
||||
GridLayout {
|
||||
id: controlBar
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
columns: 2
|
||||
spacing: 10
|
||||
verticalItemAlignment: Qt.AlignVCenter
|
||||
columns: 4
|
||||
|
||||
Label { text: qsTr("图像: ") }
|
||||
|
||||
Row {
|
||||
enabled: root.enabled
|
||||
Layout.columnSpan: 3
|
||||
Label {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: qsTr("旋转")
|
||||
@ -283,6 +283,7 @@ Item {
|
||||
}
|
||||
Row {
|
||||
enabled: root.enabled
|
||||
Layout.columnSpan: 3
|
||||
RadioButton {
|
||||
text: "关闭"
|
||||
checked: App.currentOpenDoorAreaWay ==DeviceConnection.Diabled
|
||||
@ -310,6 +311,7 @@ Item {
|
||||
Label {text: qsTr("防夹区域: ")}
|
||||
Row {
|
||||
enabled: root.enabled
|
||||
Layout.columnSpan: 1
|
||||
RadioButton {
|
||||
text: "关闭"
|
||||
checked: !App.currentAntiClipAreaEnabled
|
||||
@ -327,6 +329,19 @@ Item {
|
||||
}
|
||||
|
||||
}
|
||||
Label { text: qsTr("灵敏度: ")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
ComboBox {
|
||||
id: antiClipSensitivityComboBox
|
||||
enabled: root.enabled
|
||||
Layout.alignment: Qt.AlignLeft
|
||||
model: [1,2,3,4,5]
|
||||
currentIndex: root.antiClipSensitivity-1
|
||||
onCurrentIndexChanged: {
|
||||
App.currentAntiClipSensitivity = antiClipSensitivityComboBox.currentIndex+1
|
||||
}
|
||||
}
|
||||
|
||||
Label {text: qsTr("屏蔽区域: ")}
|
||||
Row {
|
||||
|
23
qml/Main.qml
23
qml/Main.qml
@ -118,6 +118,7 @@ ApplicationWindow {
|
||||
shieldedAreaEnabled: App.currentShieldedAreaEnabled
|
||||
shieldedAreaPoints: App.currentShieldedAreaPoints
|
||||
antiClipAreaEnabled: App.currentAntiClipAreaEnabled
|
||||
antiClipSensitivity: App.currentAntiClipSensitivity
|
||||
antiClipAreaPoints: App.currentAntiClipAreaPoints
|
||||
flip: App.currentDeviceFlip
|
||||
videoRotation: App.currentDeviceRotation
|
||||
@ -163,6 +164,7 @@ ApplicationWindow {
|
||||
}
|
||||
Item {}
|
||||
Button {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
text: "升级"
|
||||
onClicked: {
|
||||
if (deviceList.currentIndex < 0) {
|
||||
@ -175,17 +177,32 @@ ApplicationWindow {
|
||||
otaPopup.open()
|
||||
}
|
||||
}
|
||||
Item {}
|
||||
Button {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
Layout.rightMargin: 5
|
||||
text: "重置"
|
||||
onClicked: {
|
||||
if (deviceList.currentIndex < 0) {
|
||||
showMessageDialog(2, "恢复出厂设置", "请先选择设备")
|
||||
return
|
||||
} else {
|
||||
showMessageDialog(2, "恢复出厂设置", "设备将会重启,重启后配置恢复默认",()=>{
|
||||
App.resetDevice();
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
spacing: (parent.width - (2 * 100)) / 3
|
||||
}
|
||||
|
||||
function showMessageDialog(type, title, message) {
|
||||
function showMessageDialog(type, title, message, callback) {
|
||||
let component = Qt.createComponent("MessageDialog.qml")
|
||||
if (component.status === Component.Ready) {
|
||||
let dialog = component.createObject(window, {
|
||||
"type": type,
|
||||
"titleText": title,
|
||||
"text": message
|
||||
"text": message,
|
||||
"callback": callback
|
||||
})
|
||||
dialog.open()
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ Dialog {
|
||||
property alias text: textLabel.text
|
||||
property alias textFontSize: textLabel.font.pixelSize
|
||||
property int type: MessageDialog.Type.Successful
|
||||
property var callback
|
||||
closePolicy: Popup.CloseOnEscap | Popup.NoAutoClose
|
||||
background: Rectangle {
|
||||
radius: 8
|
||||
@ -62,30 +63,60 @@ Dialog {
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
|
||||
Button {
|
||||
id: cancelButton
|
||||
Row {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
Layout.rightMargin: 6
|
||||
Layout.preferredWidth: 72
|
||||
Layout.preferredHeight: 40
|
||||
font.family: control.font.family
|
||||
text: "关闭"
|
||||
font.pixelSize: 14
|
||||
contentItem: Text {
|
||||
text: parent.text
|
||||
font: parent.font
|
||||
color: parent.down ? "#FFFFFF" : "#53627C"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
spacing: 10
|
||||
Button {
|
||||
id: okButton
|
||||
width: 72
|
||||
height: 40
|
||||
font.family: control.font.family
|
||||
text: "好的"
|
||||
font.pixelSize: 14
|
||||
contentItem: Text {
|
||||
text: parent.text
|
||||
font: parent.font
|
||||
color: parent.down ? "#FFFFFF" : "#53627C"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
background: Rectangle {
|
||||
border.color: "#E1E4E8"
|
||||
border.width: 1
|
||||
color: parent.down ? "#F25959" : "#FFFFFF"
|
||||
radius: 2
|
||||
}
|
||||
onClicked: {
|
||||
if(callback !== undefined){
|
||||
callback()
|
||||
}
|
||||
control.accept()
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
border.color: "#E1E4E8"
|
||||
border.width: 1
|
||||
color: parent.down ? "#F25959" : "#FFFFFF"
|
||||
radius: 2
|
||||
Button {
|
||||
id: cancelButton
|
||||
visible: callback !== undefined
|
||||
width: 72
|
||||
height: 40
|
||||
font.family: control.font.family
|
||||
text: "取消"
|
||||
font.pixelSize: 14
|
||||
contentItem: Text {
|
||||
text: parent.text
|
||||
font: parent.font
|
||||
color: parent.down ? "#FFFFFF" : "#53627C"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
background: Rectangle {
|
||||
border.color: "#E1E4E8"
|
||||
border.width: 1
|
||||
color: parent.down ? "#F25959" : "#FFFFFF"
|
||||
radius: 2
|
||||
}
|
||||
onClicked: control.reject()
|
||||
}
|
||||
onClicked: control.reject()
|
||||
}
|
||||
}
|
||||
onTypeChanged: {
|
||||
|
@ -49,9 +49,13 @@ function Deploy() {
|
||||
New-Item $deployPath -ItemType Directory
|
||||
Copy-Item $buildPath\AntiClipSettings.exe $deployPath\视觉防夹设备上位机工具v$version.exe
|
||||
& $qtHome\bin\windeployqt.exe $deployPath\视觉防夹设备上位机工具v$version.exe --qmldir=$qtHome\qml
|
||||
Remove-Item -Path $deployPath\d3dcompiler_47.dll -Force
|
||||
# Remove-Item -Path $deployPath\d3dcompiler_47.dll -Force # 删了这个会导致Windows 7 无法正常显示
|
||||
Remove-Item -Path $deployPath\Qt5Multimedia.dll -Force
|
||||
Remove-Item -Path $deployPath\Qt5MultimediaQuick.dll -Force
|
||||
Remove-Item -Path $deployPath\Qt5RemoteObjects.dll -Force
|
||||
Remove-Item -Path $deployPath\Qt5Test.dll -Force
|
||||
Remove-Item -Path $deployPath\Qt5QuickTest.dll -Force
|
||||
Remove-Item -Path $deployPath\Qt5WinExtras.dll -Force
|
||||
Remove-Item -Path $deployPath\translations -Recurse -Force # 暂时不需要翻译文件
|
||||
Remove-Item -Path $deployPath\qmltooling -Recurse -Force
|
||||
Remove-Item -Path $deployPath\QtTest -Recurse -Force
|
||||
@ -79,8 +83,8 @@ function Deploy() {
|
||||
Copy-Item -Path $boostRoot\lib\boost_$boost-vc143-mt-x64-1_83.dll -Destination $deployPath
|
||||
}
|
||||
|
||||
# 暂时不需要 avfilter-9、avformat-60
|
||||
$ffmpegs = "avcodec-60", "avdevice-60", "avutil-58", "postproc-57", "swresample-4", "swscale-7"
|
||||
# 暂时不需要 avfilter-9、avformat-60、postproc-57、avdevice-60
|
||||
$ffmpegs = "avcodec-60", "avutil-58", "swresample-4", "swscale-7"
|
||||
foreach ($ffmpeg in $ffmpegs) {
|
||||
Copy-Item -Path $ffmpegRoot\bin\$ffmpeg.dll -Destination $deployPath
|
||||
}
|
||||
|
Reference in New Issue
Block a user