qt/ledset/expertsmartpointsetwin.cpp

902 lines
36 KiB
C++
Raw Normal View History

2022-08-25 18:43:03 +08:00
#include "expertsmartpointsetwin.h"
2023-05-27 17:43:57 +08:00
#include "gutil/qgui.h"
#include "globalfunc.h"
2023-06-06 12:13:33 +08:00
#include "crc.h"
#include "waitingdlg.h"
2022-08-25 18:43:03 +08:00
#include <QStackedLayout>
#include <QLabel>
#include <QRadioButton>
#include <QPushButton>
#include <QButtonGroup>
2022-08-25 22:52:52 +08:00
#include <QHeaderView>
2022-09-08 23:22:59 +08:00
#include <QMessageBox>
#include <QLineEdit>
#include <QApplication>
#include <QFileDialog>
2022-09-09 23:25:49 +08:00
#include <QJsonArray>
#include <QJsonDocument>
2023-05-27 17:43:57 +08:00
#include <QDialogButtonBox>
struct ModUnitMap {
byte UUID{ie(16)};
byte type{ipp(4)};
byte len{ipp(4)};
byte w{ipp(2)};
byte h{ipp(2)};
byte ex1{ipp(4)};
2023-06-06 12:13:33 +08:00
byte chipType{ipp(2)};
2023-05-27 17:43:57 +08:00
byte decodeMode{ipp(2)};
byte ex3{ipp(4)};
byte smartset{ipp(4)};
byte smartset2{ipp(4)};
byte len{ipp(4)};
byte endFlag{ipp(4)};
byte end{fi};
} modUnitMap;
struct ModMap {
byte start{ie(4)};
byte {ipp(2)};
byte len{ipp(2)};
byte {ipp(2)};
byte {ipp(2)};
byte OE宽度{ipp(2)};
byte {ipp(2)};
byte GLK占空比{fi++};
byte {fi++};
byte {fi++};
byte {fi++};
byte {fi++};
byte {fi++};
byte {fi++};
byte {fi++};
byte {ipp(3)};
byte {ipp()};
byte Unit{ipp(modUnitMap.end)};
2023-06-06 12:13:33 +08:00
byte 2{ipp(4)};
byte check{ipp(4)};
2023-05-27 17:43:57 +08:00
byte end{fi};
} modMap;
2022-09-08 23:22:59 +08:00
2022-12-16 15:08:53 +08:00
ExpertSmartPointSetWin::ExpertSmartPointSetWin(ExpertWin *expertWin) : BaseWin{expertWin}, expertWin(expertWin) {
2022-08-25 18:43:03 +08:00
setWindowModality(Qt::WindowModal);
setAttribute(Qt::WA_DeleteOnClose);
2022-12-16 15:08:53 +08:00
setWindowTitle(tr("智能走点参数配置"));
2022-08-25 18:43:03 +08:00
resize(900, 600);
2022-12-16 15:08:53 +08:00
ModuleWidth = expertWin->mModule["ModuleWidth"].toInt();
ModuleHeight = expertWin->mModule["ModuleHeight"].toInt();
GroupNum = expertWin->mModule["GroupNum"].toInt();
ScanNum = expertWin->mModule["ScanNum"].toInt();
ChipType = expertWin->mModule["ChipType"].toString();
DecodeMode = expertWin->mModule["DecodeMode"].toString();
GroupMode = expertWin->mModule["GroupMode"].toString();
2023-05-27 17:43:57 +08:00
auto vBox = new VBox(center);
2022-08-25 18:43:03 +08:00
vBox->setContentsMargins(0,0,0,0);
vBox->setSpacing(3);
vBox->addLayout(addBtns(new QHBoxLayout()));
2023-05-27 17:43:57 +08:00
auto stack = new QStackedLayout(vBox);
auto vv = new VBox(stack);
vv->setContentsMargins(50, 50, 6, 6);
2022-08-25 18:43:03 +08:00
2023-05-27 17:43:57 +08:00
auto lb = new QLabel(tr("基本参数"));
2023-06-06 12:13:33 +08:00
gFont(lb, 16);
2023-05-27 17:43:57 +08:00
auto bkBlue = lb->palette();
bkBlue.setColor(QPalette::WindowText, QColor(0x5599ff));
lb->setPalette(bkBlue);
vv->addWidget(lb);
vv->addSpacing(50);
2022-08-25 22:52:52 +08:00
2023-05-27 17:43:57 +08:00
auto grid = new Grid(vv);
grid->setVerticalSpacing(30);
grid->setColumnStretch(0, 1);
grid->setColumnStretch(3, 1);
grid->setColumnStretch(6, 1);
2022-08-25 22:52:52 +08:00
2023-05-27 17:43:57 +08:00
lb = new QLabel(tr("模组宽度: "));
grid->addWidget(lb, 0, 1);
2022-08-25 22:52:52 +08:00
2023-05-27 17:43:57 +08:00
fdModuleWidth = new QSpinBox;
fdModuleWidth->setRange(0, 9999);
fdModuleWidth->setValue(ModuleWidth);
grid->addWidget(fdModuleWidth, 0, 2);
2022-08-25 22:52:52 +08:00
2023-05-27 17:43:57 +08:00
lb = new QLabel(tr("模组高度: "));
grid->addWidget(lb, 1, 1);
2022-08-25 22:52:52 +08:00
2023-05-27 17:43:57 +08:00
fdModuleHeight = new QSpinBox;
fdModuleHeight->setRange(0, 9999);
fdModuleHeight->setValue(ModuleHeight);
grid->addWidget(fdModuleHeight, 1, 2);
2022-08-25 22:52:52 +08:00
2023-05-27 17:43:57 +08:00
lb = new QLabel(tr("数据组数: "));
grid->addWidget(lb, 2, 1);
2022-08-25 22:52:52 +08:00
2023-05-27 17:43:57 +08:00
fdGroupNum = new QSpinBox;
fdGroupNum->setRange(0, 9999);
fdGroupNum->setValue(GroupNum);
grid->addWidget(fdGroupNum, 2, 2);
2022-08-25 22:52:52 +08:00
2023-06-06 12:13:33 +08:00
{
dlgChipType = new QDialog(this);
dlgChipType->setWindowFlag(Qt::WindowMaximizeButtonHint);
dlgChipType->setWindowTitle("选择芯片类型");
dlgChipType->resize(800, 600);
2022-08-25 22:52:52 +08:00
2023-06-06 12:13:33 +08:00
auto vBox = new VBox(dlgChipType);
2023-05-27 17:43:57 +08:00
vBox->setContentsMargins(0,0,0,0);
2022-08-25 22:52:52 +08:00
2023-06-06 12:13:33 +08:00
tableChipType = new Table(24, 10);
tableChipType->setColFit();
tableChipType->setRowFit();
tableChipType->setEditTriggers(QAbstractItemView::NoEditTriggers);
tableChipType->setAlternatingRowColors(true);
tableChipType->setSelectionMode(QAbstractItemView::SingleSelection);
2023-05-27 17:43:57 +08:00
int rr = 0, cc = 0;
2023-06-06 12:13:33 +08:00
tableChipType->setHeaderText(cc, "ICN系列");
tableChipType->setText(rr++, cc, "ICN2026");
tableChipType->setText(rr++, cc, "ICN2027");
tableChipType->setText(rr++, cc, "ICN2028");
tableChipType->setText(rr++, cc, "ICN2037");
tableChipType->setText(rr++, cc, "ICN2038");
tableChipType->setText(rr++, cc, "ICN2038S");
tableChipType->setText(rr++, cc, "ICN2053");
tableChipType->setText(rr++, cc, "ICN2058");
tableChipType->setText(rr++, cc, "ICN2088");
tableChipType->setText(rr++, cc, "ICND2045");
tableChipType->setText(rr++, cc, "ICND2046");
tableChipType->setText(rr++, cc, "ICND2047");
tableChipType->setText(rr++, cc, "ICND2049");
tableChipType->setText(rr++, cc, "ICND2055");
tableChipType->setText(rr++, cc, "ICND2059");
tableChipType->setText(rr++, cc, "ICND2065");
tableChipType->setText(rr++, cc, "ICND2069");
tableChipType->setText(rr++, cc, "ICND2076");
tableChipType->setText(rr++, cc, "ICND2110");
tableChipType->setText(rr++, cc, "ICND2112");
tableChipType->setText(rr++, cc, "ICND2153");
tableChipType->setText(rr++, cc, "ICND2153_three");
tableChipType->setText(rr++, cc, "ICND2163");
tableChipType->setText(rr++, cc, "ICND2200");
2023-05-27 17:43:57 +08:00
rr = 0; cc++;
2023-06-06 12:13:33 +08:00
tableChipType->setHeaderText(cc, "SM系列");
tableChipType->setText(rr++, cc, "SM16017_NEW");
tableChipType->setText(rr++, cc, "SM16017S");
tableChipType->setText(rr++, cc, "SM16159S");
tableChipType->setText(rr++, cc, "SM16169S");
tableChipType->setText(rr++, cc, "SM16207S");
tableChipType->setText(rr++, cc, "SM16218");
tableChipType->setText(rr++, cc, "SM16227S");
tableChipType->setText(rr++, cc, "SM16237DS");
tableChipType->setText(rr++, cc, "SM16237S");
tableChipType->setText(rr++, cc, "SM16259S");
tableChipType->setText(rr++, cc, "SM16259S");
tableChipType->setText(rr++, cc, "SM16369");
tableChipType->setText(rr++, cc, "SM16380");
tableChipType->setText(rr++, cc, "SM16388");
tableChipType->setText(rr++, cc, "SM16389");
tableChipType->setText(rr++, cc, "SM16509/16399");
2023-05-27 17:43:57 +08:00
rr = 0; cc++;
2023-06-06 12:13:33 +08:00
tableChipType->setHeaderText(cc, "LS系列");
tableChipType->setText(rr++, cc, "LS9918S");
tableChipType->setText(rr++, cc, "LS9919S");
tableChipType->setText(rr++, cc, "LS9926S");
tableChipType->setText(rr++, cc, "LS9929C");
tableChipType->setText(rr++, cc, "LS9929S");
tableChipType->setText(rr++, cc, "LS9930S");
tableChipType->setText(rr++, cc, "LS9931S");
tableChipType->setText(rr++, cc, "LS9935B");
tableChipType->setText(rr++, cc, "LS9935S");
tableChipType->setText(rr++, cc, "LS9936S");
tableChipType->setText(rr++, cc, "LS9961S");
2023-05-27 17:43:57 +08:00
rr = 0; cc++;
2023-06-06 12:13:33 +08:00
tableChipType->setHeaderText(cc, "MBI系列");
tableChipType->setText(rr++, cc, "MBI5041/5042");
tableChipType->setText(rr++, cc, "MBI5051");
tableChipType->setText(rr++, cc, "MBI5124");
tableChipType->setText(rr++, cc, "MBI5151");
tableChipType->setText(rr++, cc, "MBI5153");
tableChipType->setText(rr++, cc, "MBI5155");
tableChipType->setText(rr++, cc, "MBI5158");
tableChipType->setText(rr++, cc, "MBI5252");
tableChipType->setText(rr++, cc, "MBI5253");
tableChipType->setText(rr++, cc, "MBI5253B");
tableChipType->setText(rr++, cc, "MBI5254");
tableChipType->setText(rr++, cc, "MBI5264");
tableChipType->setText(rr++, cc, "MBI5268");
tableChipType->setText(rr++, cc, "MBI5353");
tableChipType->setText(rr++, cc, "MBI5353B");
tableChipType->setText(rr++, cc, "MBI6322");
tableChipType->setText(rr++, cc, "MBI6328");
tableChipType->setText(rr++, cc, "MBI6334");
2023-05-27 17:43:57 +08:00
rr = 0; cc++;
2023-06-06 12:13:33 +08:00
tableChipType->setHeaderText(cc, "SUM系列");
tableChipType->setText(rr++, cc, "SUM2017");
tableChipType->setText(rr++, cc, "SUM2017T");
tableChipType->setText(rr++, cc, "SUM2017TD");
tableChipType->setText(rr++, cc, "SUM2028");
tableChipType->setText(rr++, cc, "SUM2030");
tableChipType->setText(rr++, cc, "SUM2030T");
tableChipType->setText(rr++, cc, "SUM2032");
tableChipType->setText(rr++, cc, "SUM2033");
tableChipType->setText(rr++, cc, "SUM2035");
tableChipType->setText(rr++, cc, "SUM2036");
tableChipType->setText(rr++, cc, "SUM2037");
tableChipType->setText(rr++, cc, "SUM2117");
tableChipType->setText(rr++, cc, "SUM2130");
tableChipType->setText(rr++, cc, "SUM2131");
tableChipType->setText(rr++, cc, "SUM2135");
tableChipType->setText(rr++, cc, "SUM6086");
2023-05-27 17:43:57 +08:00
rr = 0; cc++;
2023-06-06 12:13:33 +08:00
tableChipType->setHeaderText(cc, "FM系列");
tableChipType->setText(rr++, cc, "FM6128");
tableChipType->setText(rr++, cc, "FM6129");
tableChipType->setText(rr++, cc, "FM6153");
tableChipType->setText(rr++, cc, "FM6182");
tableChipType->setText(rr++, cc, "FM6253");
tableChipType->setText(rr++, cc, "FM6353");
tableChipType->setText(rr++, cc, "FM6356");
tableChipType->setText(rr++, cc, "FM6363");
tableChipType->setText(rr++, cc, "FM6555");
tableChipType->setText(rr++, cc, "FM6565/6569");
tableChipType->setText(rr++, cc, "FM6565CE");
2023-05-27 17:43:57 +08:00
rr = 0; cc++;
2023-06-06 12:13:33 +08:00
tableChipType->setHeaderText(cc, "DP系列");
tableChipType->setText(rr++, cc, "DP5135");
tableChipType->setText(rr++, cc, "DP5220X");
tableChipType->setText(rr++, cc, "DP5525");
2023-05-27 17:43:57 +08:00
rr = 0; cc++;
2023-06-06 12:13:33 +08:00
tableChipType->setHeaderText(cc, "MY系列");
tableChipType->setText(rr++, cc, "MY9758");
tableChipType->setText(rr++, cc, "MY9862");
tableChipType->setText(rr++, cc, "MY9866");
2023-05-27 17:43:57 +08:00
rr = 0; cc++;
2023-06-06 12:13:33 +08:00
tableChipType->setHeaderText(cc, "LYD系列");
tableChipType->setText(rr++, cc, "LYD6168B");
tableChipType->setText(rr++, cc, "LYD6168C");
tableChipType->setText(rr++, cc, "LYD6168D");
tableChipType->setText(rr++, cc, "LYD6168E");
tableChipType->setText(rr++, cc, "LYD6188");
tableChipType->setText(rr++, cc, "LYD6188PC");
2023-05-27 17:43:57 +08:00
rr = 0; cc++;
2023-06-06 12:13:33 +08:00
tableChipType->setHeaderText(cc, "其他系列");
tableChipType->setText(rr++, cc, "通用");
tableChipType->setText(rr++, cc, "A5065");
tableChipType->setText(rr++, cc, "AXS6018");
tableChipType->setText(rr++, cc, "CFD135A");
tableChipType->setText(rr++, cc, "CFD455A");
tableChipType->setText(rr++, cc, "CNS7153");
tableChipType->setText(rr++, cc, "CNS7253");
tableChipType->setText(rr++, cc, "CNS7263");
tableChipType->setText(rr++, cc, "CS2017");
tableChipType->setText(rr++, cc, "CS2033");
tableChipType->setText(rr++, cc, "D26188");
tableChipType->setText(rr++, cc, "HX8055");
tableChipType->setText(rr++, cc, "HX8864");
tableChipType->setText(rr++, cc, "HX8896");
tableChipType->setText(rr++, cc, "RT5965");
tableChipType->setText(rr++, cc, "RT5967");
tableChipType->setText(rr++, cc, "SCL8081A");
tableChipType->setText(rr++, cc, "XM11202G");
connect(tableChipType, &Table::cellDoubleClicked, dlgChipType, [=](int row, int column) {
auto text = tableChipType->text(row, column);
2023-05-27 17:43:57 +08:00
if(text.isEmpty()) return;
fdChipType->setText(text);
2023-06-06 12:13:33 +08:00
ChipTypeCode = (column<<8) | row;
dlgChipType->accept();
2023-05-27 17:43:57 +08:00
});
2023-06-06 12:13:33 +08:00
vBox->addWidget(tableChipType);
2022-08-25 22:52:52 +08:00
2023-05-27 17:43:57 +08:00
auto btnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Close);
2023-06-06 12:13:33 +08:00
connect(btnBox, &QDialogButtonBox::rejected, dlgChipType, &QDialog::reject);
connect(btnBox, &QDialogButtonBox::accepted, dlgChipType, [=] {
auto items = tableChipType->selectedItems();
2023-05-27 17:43:57 +08:00
if(items.isEmpty()) {
2023-06-06 12:13:33 +08:00
QMessageBox::warning(dlgChipType, "Warning", "请选择芯片类型");
2023-05-27 17:43:57 +08:00
return;
}
fdChipType->setText(items[0]->text());
2023-06-06 12:13:33 +08:00
auto ranges = tableChipType->selectedRanges();
ChipTypeCode = (ranges[0].leftColumn()<<8) | ranges[0].topRow();
dlgChipType->accept();
2023-05-27 17:43:57 +08:00
});
vBox->addWidget(btnBox);
2023-06-06 12:13:33 +08:00
}
{
dlgDecodeMode = new QDialog(this);
dlgDecodeMode->setWindowFlag(Qt::WindowMaximizeButtonHint);
dlgDecodeMode->setWindowTitle("选择译码方式");
dlgDecodeMode->resize(600, 400);
2022-08-25 22:52:52 +08:00
2023-06-06 12:13:33 +08:00
auto vBox = new VBox(dlgDecodeMode);
2023-05-27 17:43:57 +08:00
vBox->setContentsMargins(0,0,0,0);
2022-08-25 22:52:52 +08:00
2023-06-06 12:13:33 +08:00
tableDecodeMode = new Table(9, 7);
tableDecodeMode->setColFit();
tableDecodeMode->setRowFit();
tableDecodeMode->setEditTriggers(QAbstractItemView::NoEditTriggers);
tableDecodeMode->setAlternatingRowColors(true);
tableDecodeMode->setSelectionMode(QAbstractItemView::SingleSelection);
2023-05-27 17:43:57 +08:00
int rr = 0, cc = 0;
2023-06-06 12:13:33 +08:00
tableDecodeMode->setHeaderText(cc, "系列"+QString::number(cc+1));
tableDecodeMode->setText(rr++, cc, "138译码");
tableDecodeMode->setText(rr++, cc, "ICN2012");
tableDecodeMode->setText(rr++, cc, "MW4958");
tableDecodeMode->setText(rr++, cc, "SM5166P");
tableDecodeMode->setText(rr++, cc, "TC7260");
tableDecodeMode->setText(rr++, cc, "TC7258E");
tableDecodeMode->setText(rr++, cc, "TC7258EN");
tableDecodeMode->setText(rr++, cc, "HX6012");
tableDecodeMode->setText(rr++, cc, "ICN2016");
2023-05-27 17:43:57 +08:00
rr = 0; cc++;
2023-06-06 12:13:33 +08:00
tableDecodeMode->setHeaderText(cc, "系列"+QString::number(cc+1));
tableDecodeMode->setText(rr++, cc, "595译码");
2023-05-27 17:43:57 +08:00
rr = 0; cc++;
2023-06-06 12:13:33 +08:00
tableDecodeMode->setHeaderText(cc, "系列"+QString::number(cc+1));
tableDecodeMode->setText(rr++, cc, "5958译码");
tableDecodeMode->setText(rr++, cc, "5960译码");
tableDecodeMode->setText(rr++, cc, "TC7558");
tableDecodeMode->setText(rr++, cc, "RT5957");
tableDecodeMode->setText(rr++, cc, "HX6058");
tableDecodeMode->setText(rr++, cc, "HX6158H");
tableDecodeMode->setText(rr++, cc, "MBI5988");
2023-05-27 17:43:57 +08:00
rr = 0; cc++;
2023-06-06 12:13:33 +08:00
tableDecodeMode->setHeaderText(cc, "系列"+QString::number(cc+1));
tableDecodeMode->setText(rr++, cc, "直接输出 (低)");
tableDecodeMode->setText(rr++, cc, "直接输出 (高)");
tableDecodeMode->setText(rr++, cc, "静态无译码");
2023-05-27 17:43:57 +08:00
rr = 0; cc++;
2023-06-06 12:13:33 +08:00
tableDecodeMode->setHeaderText(cc, "系列"+QString::number(cc+1));
tableDecodeMode->setText(rr++, cc, "ICND2018");
tableDecodeMode->setText(rr++, cc, "ICND3018");
tableDecodeMode->setText(rr++, cc, "ICND2019");
tableDecodeMode->setText(rr++, cc, "TC7559");
tableDecodeMode->setText(rr++, cc, "TC7519");
tableDecodeMode->setText(rr++, cc, "SM5366");
tableDecodeMode->setText(rr++, cc, "DP32020");
tableDecodeMode->setText(rr++, cc, "DP7298A");
tableDecodeMode->setText(rr++, cc, "SM5368");
2023-05-27 17:43:57 +08:00
rr = 0; cc++;
2023-06-06 12:13:33 +08:00
tableDecodeMode->setHeaderText(cc, "系列"+QString::number(cc+1));
tableDecodeMode->setText(rr++, cc, "ICND2013");
tableDecodeMode->setText(rr++, cc, "TC7262");
tableDecodeMode->setText(rr++, cc, "ICND2017");
tableDecodeMode->setText(rr++, cc, "DP7268E");
tableDecodeMode->setText(rr++, cc, "DP32019");
tableDecodeMode->setText(rr++, cc, "HX6013");
2023-05-27 17:43:57 +08:00
rr = 0; cc++;
2023-06-06 12:13:33 +08:00
tableDecodeMode->setHeaderText(cc, "系列"+QString::number(cc+1));
tableDecodeMode->setText(rr++, cc, "SM5266P");
tableDecodeMode->setText(rr++, cc, "FM7239");
tableDecodeMode->setText(rr++, cc, "LS9736");
tableDecodeMode->setText(rr++, cc, "D7266");
tableDecodeMode->setText(rr++, cc, "CFD21338SPC");
tableDecodeMode->setText(rr++, cc, "LS9737_1");
connect(tableDecodeMode, &Table::cellDoubleClicked, dlgDecodeMode, [=](int row, int column) {
auto text = tableDecodeMode->text(row, column);
2023-05-27 17:43:57 +08:00
if(text.isEmpty()) return;
fdDecodeMode->setText(text);
2023-06-06 12:13:33 +08:00
DecodeModeCode = (column<<8) | row;
dlgDecodeMode->accept();
2023-05-27 17:43:57 +08:00
});
2023-06-06 12:13:33 +08:00
vBox->addWidget(tableDecodeMode);
2023-05-27 17:43:57 +08:00
auto btnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Close);
2023-06-06 12:13:33 +08:00
connect(btnBox, &QDialogButtonBox::rejected, dlgDecodeMode, &QDialog::reject);
connect(btnBox, &QDialogButtonBox::accepted, dlgDecodeMode, [=] {
auto items = tableDecodeMode->selectedItems();
2023-05-27 17:43:57 +08:00
if(items.isEmpty()) {
2023-06-06 12:13:33 +08:00
QMessageBox::warning(dlgDecodeMode, "Warning", "请选择译码方式");
2023-05-27 17:43:57 +08:00
return;
}
fdDecodeMode->setText(items[0]->text());
2023-06-06 12:13:33 +08:00
auto ranges = tableDecodeMode->selectedRanges();
DecodeModeCode = (ranges[0].leftColumn()<<8) | ranges[0].topRow();
dlgDecodeMode->accept();
2023-05-27 17:43:57 +08:00
});
vBox->addWidget(btnBox);
2023-06-06 12:13:33 +08:00
}
2023-05-27 17:43:57 +08:00
2023-06-06 12:13:33 +08:00
lb = new QLabel(tr("驱动芯片: "));
grid->addWidget(lb, 0, 4);
auto hhhh = new HBox;
hhhh->setSpacing(0);
fdChipType = new QLineEdit("ICND2153");
fdChipType->setMinimumWidth(150);
fdChipType->setReadOnly(true);
hhhh->addWidget(fdChipType);
auto def = fdChipType->text();
QTableWidgetItem *item;
if(! def.isEmpty()) for(int r=0; r<tableChipType->rowCount(); r++) for(int c=0; c<tableChipType->columnCount(); c++) if((item = tableChipType->item(r, c)) && item->text()==def) item->setSelected(true);
auto btn = new QPushButton("...");
btn->setMaximumWidth(30);
connect(btn, &QPushButton::clicked, dlgChipType, &QDialog::exec);
hhhh->addWidget(btn);
grid->addLayout(hhhh, 0, 5);
lb = new QLabel(tr("译码方式: "));
grid->addWidget(lb, 1, 4);
hhhh = new HBox;
hhhh->setSpacing(0);
fdDecodeMode = new QLineEdit(tr("138译码"));
fdDecodeMode->setReadOnly(true);
hhhh->addWidget(fdDecodeMode);
def = fdDecodeMode->text();
if(! def.isEmpty()) for(int r=0; r<tableDecodeMode->rowCount(); r++) for(int c=0; c<tableDecodeMode->columnCount(); c++) if((item = tableDecodeMode->item(r, c)) && item->text()==def) item->setSelected(true);
btn = new QPushButton("...");
btn->setMaximumWidth(30);
connect(btn, &QPushButton::clicked, dlgDecodeMode, &QDialog::exec);
2023-05-27 17:43:57 +08:00
hhhh->addWidget(btn);
grid->addLayout(hhhh, 1, 5);
lb = new QLabel(tr("分组方式: "));
grid->addWidget(lb, 2, 4);
fdGroupMode = new QComboBox;
fdGroupMode->addItem(tr("三线并行"));
fdGroupMode->addItem(tr("三色1点串"));
fdGroupMode->addItem(tr("三色8点串"));
fdGroupMode->addItem(tr("三色16点串"));
grid->addWidget(fdGroupMode, 2, 5);
vv->addStretch();
2022-08-25 22:52:52 +08:00
2022-08-25 18:43:03 +08:00
{
2023-05-27 17:43:57 +08:00
auto vBox = new VBox(stack);
2022-08-25 22:52:52 +08:00
vBox->setContentsMargins(50, 50, 6, 6);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
auto lb = new QLabel(tr("扫描行数"));
2023-06-06 12:13:33 +08:00
gFont(lb, 16);
2022-08-25 22:52:52 +08:00
lb->setPalette(bkBlue);
2022-08-25 18:43:03 +08:00
vBox->addWidget(lb);
vBox->addSpacing(50);
auto hBox = new QHBoxLayout;
vBox->addLayout(hBox);
hBox->addStretch();
auto vvv = new QVBoxLayout;
hBox->addLayout(vvv);
2022-12-16 15:08:53 +08:00
lb = new QLabel(tr("根据亮线的行/列数确定扫描行/列数: "));
2022-08-25 18:43:03 +08:00
vvv->addWidget(lb);
vvv->addSpacing(30);
auto hhhh = new QHBoxLayout;
hhhh->addStretch();
2022-12-16 15:08:53 +08:00
auto fdRow = new QRadioButton(tr(""));
2022-08-25 18:43:03 +08:00
hhhh->addWidget(fdRow);
hhhh->addStretch();
2022-12-16 15:08:53 +08:00
auto fdCol = new QRadioButton(tr(""));
2022-08-25 18:43:03 +08:00
hhhh->addWidget(fdCol);
hhhh->addStretch();
vvv->addLayout(hhhh);
vvv->addSpacing(20);
hhhh = new QHBoxLayout;
hhhh->addStretch();
2022-12-16 15:08:53 +08:00
lb = new QLabel(tr("亮线的行/列数: "));
2022-08-25 18:43:03 +08:00
hhhh->addWidget(lb);
auto fdNum = new QSpinBox;
fdNum->setRange(0, 9999);
fdNum->setValue(1);
hhhh->addWidget(fdNum);
hhhh->addStretch();
vvv->addLayout(hhhh);
vvv->addStretch();
hBox->addStretch();
vvv = new QVBoxLayout;
hBox->addLayout(vvv);
2022-12-16 15:08:53 +08:00
lb = new QLabel(tr("芯片245版本: "));
2022-08-25 18:43:03 +08:00
vvv->addWidget(lb);
vvv->addSpacing(30);
hhhh = new QHBoxLayout;
hhhh->addStretch();
auto fdA = new QRadioButton("A");
hhhh->addWidget(fdA);
hhhh->addStretch();
auto fdD = new QRadioButton("D");
hhhh->addWidget(fdD);
hhhh->addStretch();
vvv->addLayout(hhhh);
vvv->addStretch();
hBox->addStretch();
}
{
2023-05-27 17:43:57 +08:00
auto vBox = new VBox(stack);
2022-08-25 22:52:52 +08:00
vBox->setContentsMargins(50, 50, 6, 6);
2022-08-25 18:43:03 +08:00
2022-12-16 15:08:53 +08:00
auto lb = new QLabel(tr("数据线颜色"));
2023-06-06 12:13:33 +08:00
gFont(lb, 16);
2022-08-25 22:52:52 +08:00
lb->setPalette(bkBlue);
2022-08-25 18:43:03 +08:00
vBox->addWidget(lb);
vBox->addSpacing(50);
2022-12-16 15:08:53 +08:00
lb = new QLabel(tr("依次点击以下状态, 根据模组颜色选择对应颜色"));
2022-08-25 18:43:03 +08:00
vBox->addWidget(lb, 0, Qt::AlignCenter);
vBox->addSpacing(30);
auto hhhh = new QHBoxLayout;
hhhh->addStretch();
2022-12-16 15:08:53 +08:00
auto fdSta1 = new QRadioButton(tr("状态1"));
2022-09-07 23:10:35 +08:00
fdSta1->setChecked(true);
2022-08-25 18:43:03 +08:00
hhhh->addWidget(fdSta1);
hhhh->addStretch();
2022-12-16 15:08:53 +08:00
auto fdR1 = new QRadioButton(tr(""));
2022-09-07 23:10:35 +08:00
fdR1->setChecked(true);
2022-08-25 18:43:03 +08:00
hhhh->addWidget(fdR1);
hhhh->addSpacing(20);
2022-12-16 15:08:53 +08:00
auto fdG1 = new QRadioButton(tr("绿"));
2022-08-25 18:43:03 +08:00
hhhh->addWidget(fdG1);
hhhh->addSpacing(20);
2022-12-16 15:08:53 +08:00
auto fdB1 = new QRadioButton(tr(""));
2022-08-25 18:43:03 +08:00
hhhh->addWidget(fdB1);
hhhh->addSpacing(20);
2022-12-16 15:08:53 +08:00
auto fdNo1 = new QRadioButton(tr(""));
2022-08-25 18:43:03 +08:00
hhhh->addWidget(fdNo1);
hhhh->addStretch();
vBox->addLayout(hhhh);
vBox->addSpacing(20);
hhhh = new QHBoxLayout;
hhhh->addStretch();
2022-12-16 15:08:53 +08:00
auto fdSta2 = new QRadioButton(tr("状态2"));
2022-08-25 18:43:03 +08:00
hhhh->addWidget(fdSta2);
hhhh->addStretch();
2022-12-16 15:08:53 +08:00
auto fdR2 = new QRadioButton(tr(""));
2022-08-25 18:43:03 +08:00
hhhh->addWidget(fdR2);
hhhh->addSpacing(20);
2022-12-16 15:08:53 +08:00
auto fdG2 = new QRadioButton(tr("绿"));
2022-09-07 23:10:35 +08:00
fdG2->setChecked(true);
2022-08-25 18:43:03 +08:00
hhhh->addWidget(fdG2);
hhhh->addSpacing(20);
2022-12-16 15:08:53 +08:00
auto fdB2 = new QRadioButton(tr(""));
2022-08-25 18:43:03 +08:00
hhhh->addWidget(fdB2);
hhhh->addSpacing(20);
2022-12-16 15:08:53 +08:00
auto fdNo2 = new QRadioButton(tr(""));
2022-08-25 18:43:03 +08:00
hhhh->addWidget(fdNo2);
hhhh->addStretch();
vBox->addLayout(hhhh);
vBox->addSpacing(20);
hhhh = new QHBoxLayout;
hhhh->addStretch();
2022-12-16 15:08:53 +08:00
auto fdSta3 = new QRadioButton(tr("状态3"));
2022-08-25 18:43:03 +08:00
hhhh->addWidget(fdSta3);
hhhh->addStretch();
2022-12-16 15:08:53 +08:00
auto fdR3 = new QRadioButton(tr(""));
2022-08-25 18:43:03 +08:00
hhhh->addWidget(fdR3);
hhhh->addSpacing(20);
2022-12-16 15:08:53 +08:00
auto fdG3 = new QRadioButton(tr("绿"));
2022-08-25 18:43:03 +08:00
hhhh->addWidget(fdG3);
hhhh->addSpacing(20);
2022-12-16 15:08:53 +08:00
auto fdB3 = new QRadioButton(tr(""));
2022-09-07 23:10:35 +08:00
fdB3->setChecked(true);
2022-08-25 18:43:03 +08:00
hhhh->addWidget(fdB3);
hhhh->addSpacing(20);
2022-12-16 15:08:53 +08:00
auto fdNo3 = new QRadioButton(tr(""));
2022-08-25 18:43:03 +08:00
hhhh->addWidget(fdNo3);
hhhh->addStretch();
vBox->addLayout(hhhh);
vBox->addStretch();
2023-05-27 17:43:57 +08:00
auto btnGrp = new QButtonGroup(fdNo1);
2022-08-25 18:43:03 +08:00
btnGrp->addButton(fdR1);
btnGrp->addButton(fdG1);
btnGrp->addButton(fdB1);
btnGrp->addButton(fdNo1);
2023-05-27 17:43:57 +08:00
btnGrp = new QButtonGroup(fdNo2);
2022-08-25 18:43:03 +08:00
btnGrp->addButton(fdR2);
btnGrp->addButton(fdG2);
btnGrp->addButton(fdB2);
btnGrp->addButton(fdNo2);
2023-05-27 17:43:57 +08:00
btnGrp = new QButtonGroup(fdNo3);
2022-08-25 18:43:03 +08:00
btnGrp->addButton(fdR3);
btnGrp->addButton(fdG3);
btnGrp->addButton(fdB3);
btnGrp->addButton(fdNo3);
}
2022-08-25 22:52:52 +08:00
{
2023-05-27 17:43:57 +08:00
auto vBox = new VBox(stack);
2022-08-25 22:52:52 +08:00
vBox->setContentsMargins(0,0,0,0);
auto hhh = new QHBoxLayout;
2022-09-06 23:40:02 +08:00
auto btnUndo = new QPushButton("回撤");
btnUndo->setMinimumSize(90, 30);
connect(btnUndo, &QPushButton::clicked, this, [this] {
2022-09-07 23:10:35 +08:00
auto lastIdx = tableRow->columnCount()-1;
if(lastIdx==-1) return;
auto last = tableRow->item(1, lastIdx);
2023-03-31 18:44:09 +08:00
if(last->text()=="×") virtualCnt--;
else {
2022-09-07 23:10:35 +08:00
auto point = last->data(Qt::UserRole).toPoint();
2023-03-31 18:44:09 +08:00
table->setText(point.y(), point.x(), "");
2022-09-07 23:10:35 +08:00
if(lastIdx==virtualCnt) table->selectionModel()->clearCurrentIndex();
else {
for(int i=lastIdx-1; i>-1; i--) {
2023-03-31 18:44:09 +08:00
if(tableRow->text(1, i)=="×") continue;
auto point = tableRow->data(1, i).toPoint();
2022-09-07 23:10:35 +08:00
table->setCurrentCell(point.y(), point.x());
break;
}
}
2022-09-06 23:40:02 +08:00
}
2022-09-07 23:10:35 +08:00
tableRow->setColumnCount(lastIdx);
2022-09-06 23:40:02 +08:00
});
hhh->addWidget(btnUndo);
2022-08-25 22:52:52 +08:00
2022-12-16 15:08:53 +08:00
auto btnAddVoid = new QPushButton(tr("插入虚点"));
2022-09-07 23:10:35 +08:00
btnAddVoid->setMinimumSize(90, 30);
connect(btnAddVoid, &QPushButton::clicked, this, [this] {
virtualCnt++;
auto cnt = tableRow->columnCount();
tableRow->setColumnCount(cnt+1);
2023-03-31 18:44:09 +08:00
tableRow->setText(0, cnt, QString::number(cnt+1))->setTextAlignment(Qt::AlignCenter);
tableRow->setText(1, cnt, "×")->setTextAlignment(Qt::AlignCenter);
2022-09-07 23:10:35 +08:00
});
hhh->addWidget(btnAddVoid);
2022-12-16 15:08:53 +08:00
auto btnReset = new QPushButton(tr("重新走点"));
2022-09-07 23:10:35 +08:00
btnReset->setMinimumSize(90, 30);
connect(btnReset, &QPushButton::clicked, this, [this] {
table->clearContents();
tableRow->setColumnCount(0);
virtualCnt = 0;
});
hhh->addWidget(btnReset);
2022-12-16 15:08:53 +08:00
auto btnOK = new QPushButton(tr("完成"));
2022-09-08 23:22:59 +08:00
btnOK->setMinimumSize(90, 30);
connect(btnOK, &QPushButton::clicked, this, &ExpertSmartPointSetWin::save);
hhh->addWidget(btnOK);
2022-08-25 22:52:52 +08:00
hhh->addStretch();
vBox->addLayout(hhh);
2023-05-27 17:43:57 +08:00
table = new Table;
2023-03-31 18:44:09 +08:00
table->setNoEdit();
2022-09-07 23:10:35 +08:00
table->setSelectionMode(QTableWidget::SingleSelection);
2023-03-31 18:44:09 +08:00
table->setColWidth(40);
2022-08-25 22:52:52 +08:00
table->horizontalHeader()->setDefaultAlignment(Qt::AlignCenter);
table->verticalHeader()->setMinimumWidth(40);
table->verticalHeader()->setDefaultAlignment(Qt::AlignCenter);
2022-12-16 15:08:53 +08:00
connect(table, &QTableWidget::currentCellChanged, this, [=](int row, int col) {
2022-09-06 23:40:02 +08:00
if(row < 0) return;
2023-03-31 18:44:09 +08:00
auto text = table->text(row, col);
if(! text.isEmpty()) return;
2022-09-09 23:25:49 +08:00
if(scans.isEmpty()) {
2022-09-08 23:22:59 +08:00
auto cnt = tableRow->columnCount() + 1;
tableRow->setColumnCount(cnt);
2023-03-31 18:44:09 +08:00
tableRow->setText(0, cnt-1, QString::number(cnt))->setTextAlignment(Qt::AlignCenter);
tableRow->setText(1, cnt-1, "")->setTextAlignment(Qt::AlignCenter);
tableRow->setData(1, cnt-1, QPoint{col, row});
2022-09-08 23:22:59 +08:00
auto realCnt = cnt - virtualCnt;
2023-03-31 18:44:09 +08:00
table->setText(row, col, QString::number(realCnt))->setTextAlignment(Qt::AlignCenter);
2022-09-09 23:25:49 +08:00
if(realCnt==ModuleWidth) {
scans.append({col, row});
2022-12-16 15:08:53 +08:00
QMessageBox::information(this, tr("提示"), tr("列走完"));
2022-09-08 23:22:59 +08:00
}
2022-09-09 23:25:49 +08:00
} else if(scans.size() < ScanNum) {
scans.append({col, row});
auto size = scans.size();
2023-03-31 18:44:09 +08:00
table->setText(row, col, "S"+QString::number(size))->setTextAlignment(Qt::AlignCenter);
2022-09-09 23:25:49 +08:00
if(size==ScanNum) {
2022-12-16 15:08:53 +08:00
QMessageBox::information(this, tr("提示"), tr("行走完"));
2022-09-08 23:22:59 +08:00
save();
}
}
2022-08-25 22:52:52 +08:00
});
2022-12-16 15:08:53 +08:00
2022-08-25 22:52:52 +08:00
vBox->addWidget(table);
2022-09-07 23:10:35 +08:00
2023-05-27 17:43:57 +08:00
tableRow = new Table(2, 0);
2023-03-31 18:44:09 +08:00
tableRow->setNoEdit();
2022-09-07 23:10:35 +08:00
tableRow->setSelectionMode(QTableWidget::NoSelection);
tableRow->horizontalHeader()->setDefaultSectionSize(40);
tableRow->horizontalHeader()->setVisible(false);
tableRow->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);
tableRow->verticalHeader()->setMinimumWidth(120);
tableRow->setMaximumHeight(80);
auto item = tableRow->verticalHeaderItem(0);
if(item==0) tableRow->setVerticalHeaderItem(0, item = new QTableWidgetItem());
2022-12-16 15:08:53 +08:00
item->setText(tr("第一扫灯数:"));
2022-09-07 23:10:35 +08:00
item = tableRow->verticalHeaderItem(1);
if(item==0) tableRow->setVerticalHeaderItem(1, item = new QTableWidgetItem());
2022-12-16 15:08:53 +08:00
item->setText(tr("实: 虚:"));
2022-09-07 23:10:35 +08:00
vBox->addWidget(tableRow);
2022-08-25 22:52:52 +08:00
}
2023-05-27 17:43:57 +08:00
auto hBox = new HBox(vBox);
2022-08-25 18:43:03 +08:00
hBox->addStretch();
2022-12-16 15:08:53 +08:00
auto btnPrev = new QPushButton(tr("上一步"));
2022-08-25 18:43:03 +08:00
btnPrev->setMinimumSize(90, 30);
hBox->addWidget(btnPrev);
2022-12-16 15:08:53 +08:00
auto btnNext = new QPushButton(tr("下一步"));
2022-08-25 18:43:03 +08:00
btnNext->setMinimumSize(90, 30);
hBox->addWidget(btnNext);
connect(btnPrev, &QPushButton::clicked, this, [stack, btnPrev, btnNext] {
2022-08-25 22:52:52 +08:00
auto idx = stack->currentIndex();
stack->setCurrentIndex(--idx);
2022-09-08 23:22:59 +08:00
btnPrev->setEnabled(idx > 0);
btnNext->setEnabled(idx < stack->count()-1);
2022-08-25 18:43:03 +08:00
});
2022-12-16 15:08:53 +08:00
connect(btnNext, &QPushButton::clicked, this, [=] {
2022-08-25 22:52:52 +08:00
auto idx = stack->currentIndex();
if(idx==0) {
2022-09-09 23:25:49 +08:00
ModuleWidth = fdModuleWidth->value();
ModuleHeight = fdModuleHeight->value();
GroupNum = fdGroupNum->value();
ScanNum = (ModuleHeight + 1) / GroupNum;
2023-05-27 17:43:57 +08:00
ChipType = fdChipType->text();
DecodeMode = fdDecodeMode->text();
2022-09-09 23:25:49 +08:00
GroupMode = fdGroupMode->currentText();
2023-06-06 12:13:33 +08:00
// 开始标识 保留 长度 换行间/刻 OE宽 放电间 芯片通道数 模组类型数
auto msg = QByteArray::fromHex("5555 01 AD 0062 FFFFFFFF 0000ABCD B1000000 0000 415F94A7 AD000000 005C AA55AA55 0000 0036 1770 0000 0280 0000 32 10 00 00 0A 01 00 00 001000 01 "
"BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB 00000000 00000008 00400020 00001400 FF00FF00 3C000000 00000000 1B022020 00000040 55AA55AA 00000000 39F424F6 351B0E53");
// UUID type len w h ex1 chip/decode ex3 smartset smartset2 走点len endFlag
2023-05-27 17:43:57 +08:00
auto unitptr = msg.data()+headMap.end+modMap.Unit;
auto w = (quint16_be*)(unitptr+modUnitMap.w);
qDebug()<<"w"<<QString::number(*w, 16);
*w = ModuleWidth;
auto h = (quint16_be*)(unitptr+modUnitMap.h);
qDebug()<<"h"<<QString::number(*h, 16);
*h = ModuleHeight;
auto groupNum = unitptr+modUnitMap.smartset2 + 1;
qDebug()<<"groupNum"<<QString::number(*groupNum, 16);
*groupNum = GroupNum;
2023-06-06 12:13:33 +08:00
auto chipType = (quint16_be*)(unitptr+modUnitMap.chipType);
qDebug()<<"chipType"<<QString::number(*chipType, 16);
*chipType = ChipTypeCode;
auto decodeMode = (quint16_be*)(unitptr+modUnitMap.decodeMode);
qDebug()<<"decodeMode"<<QString::number(*decodeMode, 16);
*decodeMode = DecodeModeCode;
auto check = (quint32_be*)(msg.data()+headMap.end+modMap.check);
*check = crc32_calc((byte*)msg.data()+headMap.end+modMap., modMap.check - modMap.);
qDebug()<<"check"<<QString::number(*check, 16);
check = (quint32_be*)(msg.data()+headMap.end+modMap.end);
*check = crc32_calc((byte*)msg.data()+headMap.body, modMap.end+6);
qDebug()<<"check"<<QString::number(*check, 16);
auto waitingDlg = new WaitingDlg(this, tr("Setting")+" ...");
auto res = sendMsg(msg, 0x1EA, 10000, [=](int code, const QByteArray data) {
if(code==5) {
waitingDlg->close();
QMessageBox::critical(this, "Error", tr("请求超时"));
return;
}
waitingDlg->close();
auto iii = idx+1;
stack->setCurrentIndex(iii);
btnPrev->setEnabled(iii > 0);
btnNext->setEnabled(iii < stack->count()-1);
}, waitingDlg);
if(res) QMessageBox::critical(this, "Error", QString(tr("发送失败: "))+QString::fromLocal8Bit(pcap_geterr(pcapSend)));
2022-08-25 22:52:52 +08:00
} else if(idx==2) {
2022-09-09 23:25:49 +08:00
table->setColumnCount(ModuleWidth);
table->setRowCount(ModuleHeight);
2023-03-31 18:44:09 +08:00
QColor altColor(0x445566);
for(int r=0; r<ModuleHeight; r++) {
if((r&7)!=7) for(int c=7; c<ModuleWidth; c+=8) table->itemValid(r, c)->setBackground(altColor);
else for(int c=0; c<ModuleWidth; c++) table->itemValid(r, c)->setBackground(altColor);
}
2023-06-06 12:13:33 +08:00
stack->setCurrentIndex(++idx);
btnPrev->setEnabled(idx > 0);
btnNext->setEnabled(idx < stack->count()-1);
2022-08-25 22:52:52 +08:00
}
2022-08-25 18:43:03 +08:00
});
auto btnCcl = new QPushButton("取消");
btnCcl->setMinimumSize(90, 30);
hBox->addWidget(btnCcl);
hBox->addSpacing(30);
}
2022-09-08 23:22:59 +08:00
void ExpertSmartPointSetWin::save() {
2022-12-16 15:08:53 +08:00
auto file = QApplication::applicationDirPath()+"/temp.module";
2022-09-09 23:25:49 +08:00
QFile qFile(file);
2022-12-16 15:08:53 +08:00
if(! qFile.open(QFile::WriteOnly)) {
QMessageBox::critical(this, tr("失败"), QString(tr("准备写入 %1 文件失败")).arg(file));
return;
}
2022-09-09 23:25:49 +08:00
QJsonObject obj;
obj.insert("ModuleWidth", ModuleWidth);
obj.insert("ModuleHeight", ModuleHeight);
obj.insert("GroupNum", GroupNum);
obj.insert("ScanNum", ScanNum);
obj.insert("ChipType", ChipType);
obj.insert("DecodeMode", DecodeMode);
obj.insert("GroupMode", GroupMode);
2022-12-16 15:08:53 +08:00
QJsonArray points;
auto cnt = tableRow->columnCount();
if(cnt > ModuleWidth) {
auto add = (cnt+ModuleWidth-1) / ModuleWidth * ModuleWidth - cnt;
for(int i=0; i<add; i++) points.append(-1);
}
for(int i=cnt-1; i>=0; i--) {
2023-03-31 18:44:09 +08:00
auto data = tableRow->data(1, i);
2022-12-16 15:08:53 +08:00
points.append(data.isValid() ? data.toPoint().x() : -1);
2022-09-09 23:25:49 +08:00
}
2022-12-16 15:08:53 +08:00
obj.insert("Points", points);
2022-09-09 23:25:49 +08:00
QJsonArray Scans;
foreach(QPoint scan, scans) Scans.append(scan.y());
obj.insert("Scans", Scans);
2022-12-16 15:08:53 +08:00
auto data = QJsonDocument(obj).toJson(QJsonDocument::Indented);
auto res = qFile.write(data);
2022-09-09 23:25:49 +08:00
qFile.close();
2022-12-16 15:08:53 +08:00
if(res < 0) {
QMessageBox::critical(this, tr("失败"), QString(tr("写入 %1 文件失败")).arg(file));
return;
}
expertWin->mModule = obj;
2022-09-08 23:22:59 +08:00
2022-12-16 15:08:53 +08:00
expertWin->fdModuleWidth->setText(QString::number(ModuleWidth));
expertWin->fdModuleHeight->setText(QString::number(ModuleHeight));
expertWin->fdGroupNum->setText(QString::number(GroupNum));
expertWin->fdScanNum->setText(QString::number(ScanNum));
expertWin->fdChipType->setText(ChipType);
expertWin->fdDecodeMode->setText(DecodeMode);
2022-09-08 23:22:59 +08:00
2022-12-16 15:08:53 +08:00
expertWin->fdCardWidth->setValue(ModuleWidth);
expertWin->fdCardHeight->setValue(ModuleHeight);
2022-09-08 23:22:59 +08:00
2022-12-16 15:08:53 +08:00
auto appDir = QApplication::applicationDirPath();
QDir(appDir).mkdir("ModuleFiles");
file = QFileDialog::getSaveFileName(this, tr("保存文件"), appDir+QString("/ModuleFiles/%1X%2_%3扫.module").arg(ModuleWidth).arg(ModuleHeight).arg(ScanNum), tr("Module file (*.module)"));
if(file.isEmpty()) return;
QFile qFile2(file);
if(! qFile2.open(QFile::WriteOnly)) {
QMessageBox::critical(this, tr("失败"), QString(tr("准备写入 %1 文件失败")).arg(file));
return;
}
res = qFile2.write(data);
qFile2.close();
if(res < 0) {
QMessageBox::critical(this, tr("失败"), QString(tr("写入 %1 文件失败")).arg(file));
return;
}
QMessageBox::information(this, tr("保存成功"), tr("保存成功"));
close();
2022-09-08 23:22:59 +08:00
}