V20251119-2.2.4
增加参数预览按钮。
This commit is contained in:
+1
-1
@@ -11,7 +11,7 @@
|
||||
#include <QDir>
|
||||
|
||||
#pragma execution_character_set("utf-8")
|
||||
const std::string softwareVersion = "20251119-2.2.3";
|
||||
const std::string softwareVersion = "20251119-2.2.4";
|
||||
const std::string euiJsonVersion = "1.0.6";
|
||||
#define globalDatabasePth "./sqlDatabase/eui_db.db" //全局数据库路径
|
||||
#define saveImgEnable 1
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
@@ -48,6 +48,7 @@
|
||||
<file>icon/runningTime.png</file>
|
||||
<file>icon/biaoDingBanBiaoDing.png</file>
|
||||
<file>icon/jiuDianBiaoDingBiaoDing.png</file>
|
||||
<file>icon/viewOnly.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/TongYongUiIcon">
|
||||
<file>TongYongUiIcon/0.cameraModule.png</file>
|
||||
|
||||
@@ -295,7 +295,7 @@ public:
|
||||
#pragma region 修改检测参数按钮
|
||||
{
|
||||
_toolBarWidget->createToolButton(QIcon(":/TongYongUiIcon/TongYongUiIcon/search_1.png"),
|
||||
QString::fromStdString(trans.translate("Param")),
|
||||
QString::fromStdString(trans.translate("Param Edit")),
|
||||
[this]() {
|
||||
paramTableEditor* dlg = new paramTableEditor(this);
|
||||
std::vector<std::pair<QString, QVariant>> params;
|
||||
@@ -306,6 +306,20 @@ public:
|
||||
}, Auth::UserLevel::ADMIN);
|
||||
}
|
||||
#pragma endregion
|
||||
#pragma region 预览检测参数按钮
|
||||
{
|
||||
_toolBarWidget->createToolButton(QIcon(":/icon/icon/viewOnly.png"),
|
||||
QString::fromStdString(trans.translate("View Param")),
|
||||
[this]() {
|
||||
paramTableEditor* dlg = new paramTableEditor(this,true);
|
||||
std::vector<std::pair<QString, QVariant>> params;
|
||||
auto b = fSignalHub::getInstance();
|
||||
emit fSignalHub::getInstance()->getAllParams(¶ms);
|
||||
dlg->setParams(params);
|
||||
dlg->show();
|
||||
}, Auth::UserLevel::GUEST);
|
||||
}
|
||||
#pragma endregion
|
||||
#pragma region 故障排查按钮
|
||||
{
|
||||
_runCommandWidget = new runCommandWidget();
|
||||
|
||||
@@ -43,8 +43,8 @@ class paramTableEditor : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit paramTableEditor(QWidget* parent = nullptr)
|
||||
: QDialog(parent) {
|
||||
explicit paramTableEditor(QWidget* parent = nullptr,bool viewOnlyModeIN = false)
|
||||
: QDialog(parent), viewOnlyMode(viewOnlyModeIN){
|
||||
this->setWindowTitle("参数编辑器");
|
||||
this->resize(900, 500);
|
||||
setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint);
|
||||
@@ -80,10 +80,7 @@ public:
|
||||
for(auto& data : params) {
|
||||
m_allParams.insert(data.first, data.second);
|
||||
}
|
||||
//生成参数修改控件的缓存
|
||||
//for (auto& it = params.begin(); it != params.end(); it++) {
|
||||
// m_paramsEditItemsCache.insert(it->first, createEditorWidget(it->second, it->second.type()));
|
||||
//}
|
||||
|
||||
//清空现有数据
|
||||
m_tableModel->setRowCount(0);
|
||||
m_editorWidgets.clear();
|
||||
@@ -207,6 +204,7 @@ private slots:
|
||||
}
|
||||
|
||||
private:
|
||||
bool viewOnlyMode = false;
|
||||
WheelBlocker blocker;
|
||||
QTableView* m_tableView;
|
||||
QStandardItemModel* m_tableModel;
|
||||
@@ -223,8 +221,6 @@ private:
|
||||
// 参数数据
|
||||
QMap<QString, QVariant> m_allParams;
|
||||
QMap<QString, std::vector<QString>> m_groupedParamsNames;//分组 名字
|
||||
//QMap<QString, QWidget*> m_paramsEditItemsCache;
|
||||
|
||||
|
||||
void createSidebar() {
|
||||
m_sidebarWidget = new QWidget(this);
|
||||
@@ -288,7 +284,7 @@ private:
|
||||
contentLayout->setSpacing(10);
|
||||
|
||||
// 当前分组标签
|
||||
m_currentGroupLabel = new QLabel("所有参数");
|
||||
m_currentGroupLabel = new QLabel("所有参数" + viewOnlyMode == false ? "":"当前无法修改(权限不足,请登录后重新打开此界面)");
|
||||
m_currentGroupLabel->setStyleSheet("color: white; font-weight: bold; font-size: 16px; padding: 5px;");
|
||||
contentLayout->addWidget(m_currentGroupLabel);
|
||||
|
||||
@@ -330,6 +326,9 @@ private:
|
||||
m_tableView->setColumnWidth(1, 250);
|
||||
|
||||
fancyButtonText* okBtn = new fancyButtonText("保存", 70, 22, "");
|
||||
okBtn->setDisabled(viewOnlyMode);
|
||||
okBtn->setVisible(!viewOnlyMode);
|
||||
|
||||
fancyButtonText* cancelBtn = new fancyButtonText("取消", 70, 22, "");
|
||||
|
||||
connect(okBtn, &QPushButton::clicked, this, ¶mTableEditor::onAccept);
|
||||
@@ -474,12 +473,15 @@ private:
|
||||
switch (type) {
|
||||
case QVariant::Type::Bool: {
|
||||
CircularSwitch* switchBtn = new CircularSwitch();
|
||||
switchBtn->setDisabled(viewOnlyMode);
|
||||
|
||||
switchBtn->setChecked(value.toBool());
|
||||
switchBtn->setToolTip(generateTypeHint(type));
|
||||
return switchBtn;
|
||||
}
|
||||
case QVariant::Type::Int: {
|
||||
QSpinBox* spinBox = new QSpinBox();
|
||||
spinBox->setDisabled(viewOnlyMode);
|
||||
spinBox->installEventFilter(&blocker); //安装滚轮事件过滤器
|
||||
spinBox->setStyleSheet(R"(
|
||||
QSpinBox {
|
||||
@@ -501,6 +503,7 @@ private:
|
||||
}
|
||||
case QVariant::Type::Double: {
|
||||
QDoubleSpinBox* spinBox = new QDoubleSpinBox();
|
||||
spinBox->setDisabled(viewOnlyMode);
|
||||
spinBox->installEventFilter(&blocker); //安装滚轮事件过滤器
|
||||
spinBox->setStyleSheet(R"(
|
||||
QDoubleSpinBox {
|
||||
@@ -523,6 +526,7 @@ private:
|
||||
}
|
||||
case QVariant::Type::String: {
|
||||
QLineEdit* lineEdit = new QLineEdit();
|
||||
lineEdit->setDisabled(viewOnlyMode);
|
||||
lineEdit->setText(value.toString());
|
||||
lineEdit->setToolTip(generateTypeHint(type));
|
||||
return lineEdit;
|
||||
|
||||
@@ -307,9 +307,10 @@ namespace Auth {
|
||||
return static_cast<int>(currentUserLevel) >= static_cast<int>(requiredLevel);
|
||||
}
|
||||
|
||||
void executeWithPermission(UserLevel requiredLevel, AuthCallback callback) {
|
||||
bool executeWithPermission(UserLevel requiredLevel, AuthCallback callback) {
|
||||
if (hasPermission(requiredLevel)) {
|
||||
callback();
|
||||
return true;
|
||||
} else {
|
||||
std::string errorMessage = "Access denied. Required level: " + userLevelToString(requiredLevel) +
|
||||
", Current level: " + userLevelToString(currentUserLevel);
|
||||
@@ -321,6 +322,7 @@ namespace Auth {
|
||||
QString(TR("You do not have sufficient permissions to perform this action.\n\nRequired level: %1\nCurrent level: %2"))
|
||||
.arg(QString::fromStdString(userLevelToString(requiredLevel)))
|
||||
.arg(QString::fromStdString(userLevelToString(currentUserLevel))));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -511,6 +511,16 @@
|
||||
"us-EN": "Param",
|
||||
"zh-CN": "参数设置"
|
||||
},
|
||||
"Param Edit": {
|
||||
"ms-MY": "Sunting Parameter",
|
||||
"us-EN": "Param Edit",
|
||||
"zh-CN": "参数编辑"
|
||||
},
|
||||
"View Param": {
|
||||
"ms-MY": "Lihat Parameter",
|
||||
"us-EN": "View Param",
|
||||
"zh-CN": "预览参数"
|
||||
},
|
||||
"Parse Error": {
|
||||
"ms-MY": "Ralat Parse",
|
||||
"us-EN": "Parse Error",
|
||||
|
||||
Reference in New Issue
Block a user