1、 修复部分轮毂只抠一半的bug;2、调整不同权限显示的内容;3、添加界面修改多重曝光的功能
parent
d534ed13ee
commit
b4cb70a7cf
@ -0,0 +1,10 @@
|
||||
{
|
||||
"exposureTime": {
|
||||
"time1": 500,
|
||||
"time2": 600,
|
||||
"time3": 700,
|
||||
"time4": 800,
|
||||
"time5": 900
|
||||
},
|
||||
"switch": 0
|
||||
}
|
||||
@ -0,0 +1,111 @@
|
||||
#include "QExposureTimeDlg.h"
|
||||
#include <QFileDialog>
|
||||
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
QExposureTimeDlg::QExposureTimeDlg(QWidget* parent) : QWidget(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
ui.appliedLabel->setVisible(false);
|
||||
connect(ui.m_pbApply, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
|
||||
connect(ui.m_pbExit, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
|
||||
}
|
||||
QExposureTimeDlg::~QExposureTimeDlg()
|
||||
{
|
||||
}
|
||||
|
||||
Q_SLOT void QExposureTimeDlg::onButtonClicked()
|
||||
{
|
||||
QString strObj = sender()->objectName();
|
||||
if (strObj == "m_pbApply")
|
||||
{
|
||||
QString strPath = QApplication::applicationDirPath();
|
||||
savaParam(strPath);
|
||||
ui.appliedLabel->setVisible(true);
|
||||
m_timeID = startTimer(1000);
|
||||
emit sgExpsParamChange();
|
||||
}
|
||||
else if (strObj == "m_pbExit")
|
||||
{
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
void QExposureTimeDlg::showEvent(QShowEvent *event)
|
||||
{
|
||||
QString strPath = QApplication::applicationDirPath();
|
||||
if (!showParam(strPath))
|
||||
{
|
||||
}
|
||||
}
|
||||
void QExposureTimeDlg::timerEvent(QTimerEvent *event)
|
||||
{
|
||||
if (m_timeID == event->timerId())
|
||||
{
|
||||
killTimer(m_timeID);
|
||||
m_timeID = 0;
|
||||
ui.appliedLabel->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
bool QExposureTimeDlg::showParam(const QString& strPath)
|
||||
{
|
||||
QString filePath = strPath + "\\config\\exposure.json";
|
||||
QJsonObject jsonObj = QZkJsonParser::ReadJsonAuto(filePath);
|
||||
if (jsonObj.empty())
|
||||
{
|
||||
qDebug() << "Json file parsing failed!";
|
||||
return false;
|
||||
}
|
||||
|
||||
QJsonObject exposureObj = jsonObj.value("exposureTime").toObject();
|
||||
|
||||
QJsonObject::iterator objIterEnd = exposureObj.end();
|
||||
std::vector<int> exposureTimeVec;
|
||||
for (auto objIter = exposureObj.begin(); objIter != objIterEnd; objIter++)
|
||||
{
|
||||
int exposureTime = objIter.value().toInt();
|
||||
exposureTimeVec.emplace_back(exposureTime);
|
||||
}
|
||||
const unsigned int nSize = exposureTimeVec.size();
|
||||
if (nSize == 5)
|
||||
{
|
||||
ui.exposureTime1->setValue(exposureTimeVec[0]);
|
||||
ui.exposureTime2->setValue(exposureTimeVec[1]);
|
||||
ui.exposureTime3->setValue(exposureTimeVec[2]);
|
||||
ui.exposureTime4->setValue(exposureTimeVec[3]);
|
||||
ui.exposureTime5->setValue(exposureTimeVec[4]);
|
||||
}
|
||||
int switchFlag = jsonObj.value("switch").toInt();
|
||||
ui.multiExpSwitch->setChecked(switchFlag > 0 ? true : false);
|
||||
return true;
|
||||
}
|
||||
|
||||
void QExposureTimeDlg::savaParam(const QString& strPath)
|
||||
{
|
||||
QString filePath = strPath + "\\config\\exposure.json";
|
||||
QJsonObject jsonObj;
|
||||
|
||||
//QJsonArray jsonArr;
|
||||
QJsonObject expsObj;
|
||||
int exposureTime1 = ui.exposureTime1->value();
|
||||
int exposureTime2 = ui.exposureTime2->value();
|
||||
int exposureTime3 = ui.exposureTime3->value();
|
||||
int exposureTime4 = ui.exposureTime4->value();
|
||||
int exposureTime5 = ui.exposureTime5->value();
|
||||
expsObj.insert("time1", exposureTime1);
|
||||
expsObj.insert("time2", exposureTime2);
|
||||
expsObj.insert("time3", exposureTime3);
|
||||
expsObj.insert("time4", exposureTime4);
|
||||
expsObj.insert("time5", exposureTime5);
|
||||
|
||||
jsonObj.insert("exposureTime", expsObj);
|
||||
int switchFlag = ui.multiExpSwitch->isChecked();
|
||||
jsonObj.insert("switch", switchFlag);
|
||||
QJsonDocument jsonDoc(jsonObj);
|
||||
QByteArray data = jsonDoc.toJson();
|
||||
QFile jsonFile(filePath);
|
||||
jsonFile.open(QIODevice::WriteOnly);
|
||||
jsonFile.write(data);
|
||||
jsonFile.close();
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
#ifndef _H_QEXPOSURETIMEDLG_H_
|
||||
#define _H_QEXPOSURETIMEDLG_H_
|
||||
#include "ui_QExposureTimeDlg.h"
|
||||
#include "QZkJsonParser.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QDebug>
|
||||
class QExposureTimeDlg : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QExposureTimeDlg(QWidget *parent = Q_NULLPTR);
|
||||
~QExposureTimeDlg();
|
||||
|
||||
Q_SLOT void onButtonClicked();
|
||||
signals:
|
||||
void sgExpsParamChange();
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent *event);
|
||||
virtual void timerEvent(QTimerEvent *event);
|
||||
//virtual void changeEvent(QEvent *event);
|
||||
|
||||
private:
|
||||
Ui::QExposureTimeDlg ui;
|
||||
bool showParam(const QString& strPath);
|
||||
void savaParam(const QString& strPath);
|
||||
int m_timeID{ 0 };
|
||||
};
|
||||
#endif // !_H_QEXPOSURETIMEDLG_H_
|
||||
@ -0,0 +1,276 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QExposureTimeDlg</class>
|
||||
<widget class="QWidget" name="QExposureTimeDlg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>292</width>
|
||||
<height>419</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>曝光值设置</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>曝光值</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>二级曝光值:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="exposureTime2">
|
||||
<property name="maximum">
|
||||
<number>100000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>四级曝光值:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="exposureTime4">
|
||||
<property name="maximum">
|
||||
<number>100000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutButton">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pbApply">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>应用</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pbExit">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>退出</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout1">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>一级曝光值:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="exposureTime1">
|
||||
<property name="maximum">
|
||||
<number>100000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>三级曝光值:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="exposureTime3">
|
||||
<property name="maximum">
|
||||
<number>100000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout5">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>五级曝光值:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="exposureTime5">
|
||||
<property name="maximum">
|
||||
<number>100000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="appliedLabel">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>参数已修改</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QGroupBox" name="groupbox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>多重曝光开关:</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="multiExpSwitch">
|
||||
<property name="text">
|
||||
<string>是否打开多重曝光功能</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Loading…
Reference in New Issue