ledset
This commit is contained in:
parent
0ee263c870
commit
96ab0bc570
|
@ -20,18 +20,33 @@ BaseWinBase::BaseWinBase(QWidget *that) : that(that) {
|
||||||
|
|
||||||
QBoxLayout *BaseWinBase::addBtns(QBoxLayout *hBox) {
|
QBoxLayout *BaseWinBase::addBtns(QBoxLayout *hBox) {
|
||||||
if(hBox->count()==0) hBox->addStretch();
|
if(hBox->count()==0) hBox->addStretch();
|
||||||
auto btn = new QPushButton("");
|
//最小化按钮
|
||||||
|
auto btn = new QPushButton;
|
||||||
btn->setIcon(QIcon(":/imgs/macos-minimize.png"));
|
btn->setIcon(QIcon(":/imgs/macos-minimize.png"));
|
||||||
btn->setIconSize(QSize(20,20));
|
btn->setIconSize(QSize(20,20));
|
||||||
btn->setStyleSheet("padding: 1;border:none;");
|
btn->setStyleSheet("QPushButton{padding: 1; border:none; background-color:#222;} QPushButton:hover{background-color:#515151;}QPushButton:pressed{background-color:#515151;}");
|
||||||
//btn->setProperty("ss", "min");
|
|
||||||
that->connect(btn, &QPushButton::clicked, that, &BaseWin::showMinimized);
|
that->connect(btn, &QPushButton::clicked, that, &BaseWin::showMinimized);
|
||||||
hBox->addWidget(btn);
|
hBox->addWidget(btn);
|
||||||
btn = new QPushButton("");
|
//最大化按钮
|
||||||
|
btn = new QPushButton;
|
||||||
|
btn->setIcon(QIcon(":/imgs/macos-max.png"));
|
||||||
|
btn->setIconSize(QSize(20,20));
|
||||||
|
btn->setStyleSheet("QPushButton{padding: 1; border:none; background-color:#222;} QPushButton:hover{background-color:#515151;} QPushButton:pressed{background-color:#515151;}");
|
||||||
|
that->connect(btn, &QPushButton::clicked, that, [=] {
|
||||||
|
if(that->windowState() == Qt::WindowMaximized) {
|
||||||
|
that->setWindowState(Qt::WindowNoState); // 恢复正常状态
|
||||||
|
btn->setIcon(QIcon(":/imgs/macos-max.png"));
|
||||||
|
} else {
|
||||||
|
that->setWindowState(Qt::WindowMaximized); // 最大化
|
||||||
|
btn->setIcon(QIcon(":/imgs/macos-max1.png"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
hBox->addWidget(btn);
|
||||||
|
//关闭按钮
|
||||||
|
btn = new QPushButton;
|
||||||
btn->setIcon(QIcon(":/imgs/close.png"));
|
btn->setIcon(QIcon(":/imgs/close.png"));
|
||||||
btn->setIconSize(QSize(20,20));
|
btn->setIconSize(QSize(20,20));
|
||||||
btn->setStyleSheet("padding: 1;border:none;");
|
btn->setStyleSheet("QPushButton{padding: 1; border:none; background-color:#222;} QPushButton:hover{background-color:#515151;} QPushButton:pressed{background-color:#515151;}");
|
||||||
//btn->setProperty("ss", "close");
|
|
||||||
that->connect(btn, &QPushButton::clicked, that, &BaseWin::close);
|
that->connect(btn, &QPushButton::clicked, that, &BaseWin::close);
|
||||||
hBox->addWidget(btn);
|
hBox->addWidget(btn);
|
||||||
return hBox;
|
return hBox;
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QPainterPath>
|
#include <QPainterPath>
|
||||||
|
#include <QGroupBox>
|
||||||
|
|
||||||
ExpertBoxLayoutWin::ExpertBoxLayoutWin(ExpertWin *parent) : BaseWin{parent} {
|
ExpertBoxLayoutWin::ExpertBoxLayoutWin(ExpertWin *parent) : BaseWin{parent} {
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
@ -27,9 +28,10 @@ ExpertBoxLayoutWin::ExpertBoxLayoutWin(ExpertWin *parent) : BaseWin{parent} {
|
||||||
auto hBox = new HBox(vBox);
|
auto hBox = new HBox(vBox);
|
||||||
vBox = new VBox(hBox);
|
vBox = new VBox(hBox);
|
||||||
|
|
||||||
vBox->addWidget(new QLabel("模组编辑"));
|
auto gBox = new QGroupBox("模组编辑");
|
||||||
|
vBox->addWidget(gBox);
|
||||||
|
auto grid = new Grid(gBox);
|
||||||
|
|
||||||
auto grid = new Grid(vBox);
|
|
||||||
auto btnAdd = new QPushButton("添加");
|
auto btnAdd = new QPushButton("添加");
|
||||||
connect(btnAdd, &QPushButton::clicked, this, [=] {
|
connect(btnAdd, &QPushButton::clicked, this, [=] {
|
||||||
auto file = QFileDialog::getOpenFileName(this, tr("打开单元板文件"), gFileHome, tr("单元板文件 (*.module)"));
|
auto file = QFileDialog::getOpenFileName(this, tr("打开单元板文件"), gFileHome, tr("单元板文件 (*.module)"));
|
||||||
|
@ -117,8 +119,11 @@ ExpertBoxLayoutWin::ExpertBoxLayoutWin(ExpertWin *parent) : BaseWin{parent} {
|
||||||
});
|
});
|
||||||
grid->addWidget(btnClearLine, 3, 1);
|
grid->addWidget(btnClearLine, 3, 1);
|
||||||
|
|
||||||
vBox->addLabel("数据组数设置");
|
vBox->addSpacing(10);
|
||||||
auto hh = new HBox(vBox);
|
|
||||||
|
gBox = new QGroupBox("数据组数设置");
|
||||||
|
vBox->addWidget(gBox);
|
||||||
|
auto hh = new HBox(gBox);
|
||||||
|
|
||||||
hh->addLabel("组数:");
|
hh->addLabel("组数:");
|
||||||
auto fdGNum = new QSpinBox;
|
auto fdGNum = new QSpinBox;
|
||||||
|
@ -151,10 +156,12 @@ ExpertBoxLayoutWin::ExpertBoxLayoutWin(ExpertWin *parent) : BaseWin{parent} {
|
||||||
});
|
});
|
||||||
emit btnSet->clicked();
|
emit btnSet->clicked();
|
||||||
|
|
||||||
|
vBox->addSpacing(10);
|
||||||
|
|
||||||
vBox->addWidget(new QLabel("显示"));
|
gBox = new QGroupBox("显示");
|
||||||
|
vBox->addWidget(gBox);
|
||||||
|
grid = new Grid(gBox);
|
||||||
|
|
||||||
grid = new Grid(vBox);
|
|
||||||
fdHasPos = new QCheckBox("位置");
|
fdHasPos = new QCheckBox("位置");
|
||||||
fdHasPos->setChecked(true);
|
fdHasPos->setChecked(true);
|
||||||
grid->addWidget(fdHasPos, 0, 0);
|
grid->addWidget(fdHasPos, 0, 0);
|
||||||
|
@ -170,9 +177,15 @@ ExpertBoxLayoutWin::ExpertBoxLayoutWin(ExpertWin *parent) : BaseWin{parent} {
|
||||||
fdHasOutline = new QCheckBox("轮廓");
|
fdHasOutline = new QCheckBox("轮廓");
|
||||||
fdHasOutline->setChecked(true);
|
fdHasOutline->setChecked(true);
|
||||||
grid->addWidget(fdHasOutline, 2, 0);
|
grid->addWidget(fdHasOutline, 2, 0);
|
||||||
|
fdSnap = new QCheckBox("吸附");
|
||||||
|
fdSnap->setChecked(true);
|
||||||
|
grid->addWidget(fdSnap, 2, 1);
|
||||||
|
|
||||||
vBox->addWidget(new QLabel("对齐"));
|
vBox->addSpacing(10);
|
||||||
hh = new HBox(vBox);
|
|
||||||
|
gBox = new QGroupBox("对齐");
|
||||||
|
vBox->addWidget(gBox);
|
||||||
|
hh = new HBox(gBox);
|
||||||
|
|
||||||
QSize imgSize(32,32);
|
QSize imgSize(32,32);
|
||||||
|
|
||||||
|
@ -244,8 +257,9 @@ ExpertBoxLayoutWin::ExpertBoxLayoutWin(ExpertWin *parent) : BaseWin{parent} {
|
||||||
});
|
});
|
||||||
hh->addWidget(bnAlignBottom);
|
hh->addWidget(bnAlignBottom);
|
||||||
|
|
||||||
vBox->addWidget(new QLabel("排列"));
|
gBox = new QGroupBox("排列");
|
||||||
hh = new HBox(vBox);
|
vBox->addWidget(gBox);
|
||||||
|
hh = new HBox(gBox);
|
||||||
|
|
||||||
auto bnArrangeLeft = new QToolButton;
|
auto bnArrangeLeft = new QToolButton;
|
||||||
bnArrangeLeft->setIconSize(imgSize);
|
bnArrangeLeft->setIconSize(imgSize);
|
||||||
|
@ -387,8 +401,9 @@ ExpertBoxLayoutWin::ExpertBoxLayoutWin(ExpertWin *parent) : BaseWin{parent} {
|
||||||
auto pal = palette();
|
auto pal = palette();
|
||||||
pal.setColor(QPalette::Window, QColor(0x222222));
|
pal.setColor(QPalette::Window, QColor(0x222222));
|
||||||
box->setPalette(pal);
|
box->setPalette(pal);
|
||||||
SetCurText(fdRoom, "200%");
|
SetCurText(fdRoom, "400%");
|
||||||
|
|
||||||
|
connect(btnDel, &QPushButton::clicked, box, &BoxPanel::del);
|
||||||
connect(fdHasPos, &QCheckBox::stateChanged, box, (void(QWidget::*)())&QWidget::update);
|
connect(fdHasPos, &QCheckBox::stateChanged, box, (void(QWidget::*)())&QWidget::update);
|
||||||
connect(fdHasSize, &QCheckBox::stateChanged, box, (void(QWidget::*)())&QWidget::update);
|
connect(fdHasSize, &QCheckBox::stateChanged, box, (void(QWidget::*)())&QWidget::update);
|
||||||
connect(fdHasConn, &QCheckBox::stateChanged, box, (void(QWidget::*)())&QWidget::update);
|
connect(fdHasConn, &QCheckBox::stateChanged, box, (void(QWidget::*)())&QWidget::update);
|
||||||
|
@ -405,7 +420,47 @@ ExpertBoxLayoutWin::ExpertBoxLayoutWin(ExpertWin *parent) : BaseWin{parent} {
|
||||||
box->fitSize();
|
box->fitSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BoxPanel::del() {
|
||||||
|
for(auto child=children().begin(); child<children().end();) {
|
||||||
|
if(((ModuleUnit*) *child)->isSel) {
|
||||||
|
for(auto copied = copieds.begin(); copied < copieds.end(); copied++) if(*copied==*child) {
|
||||||
|
copieds.erase(copied);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(! ((ModuleUnit*) *child)->name.isEmpty()) for(auto btn : boxWin->grpGrp->buttons()) {
|
||||||
|
auto mods = btn->property("mods").toList();
|
||||||
|
for(auto mod=mods.begin(); mod<mods.end(); mod++) if(mod->value<void*>() == *child) {
|
||||||
|
mods.erase(mod);
|
||||||
|
btn->setProperty("mods", mods);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end:
|
||||||
|
delete *child;
|
||||||
|
} else child++;
|
||||||
|
}
|
||||||
|
boxWin->fdModNum->setNum(children().size());
|
||||||
|
fitSize();
|
||||||
|
}
|
||||||
|
void BoxPanel::keyPressEvent(QKeyEvent *event) {
|
||||||
|
if(event->modifiers() & Qt::ControlModifier) {
|
||||||
|
if(event->key()==Qt::Key_C) {
|
||||||
|
copieds.clear();
|
||||||
|
for(auto child : children()) if(((ModuleUnit*) child)->isSel) copieds.emplace_back((ModuleUnit*) child);
|
||||||
|
} else if(event->key()==Qt::Key_V) {
|
||||||
|
for(auto child : children()) if(((ModuleUnit*) child)->isSel) ((ModuleUnit*) child)->isSel = false;
|
||||||
|
auto off = 16 / rate;
|
||||||
|
for(auto copied = copieds.begin(); copied < copieds.end(); copied++) {
|
||||||
|
auto unit = new ModuleUnit((*copied)->mX+off, (*copied)->mY+off, (*copied)->mW, (*copied)->mH, (*copied)->mModule, "", this);
|
||||||
|
unit->isSel = true;
|
||||||
|
unit->show();
|
||||||
|
*copied = unit;
|
||||||
|
}
|
||||||
|
boxWin->fdModNum->setNum(children().size());
|
||||||
|
fitSize();
|
||||||
|
}
|
||||||
|
} else if(event->key()==Qt::Key_Delete) del();
|
||||||
|
}
|
||||||
void BoxPanel::mousePressEvent(QMouseEvent *event) {
|
void BoxPanel::mousePressEvent(QMouseEvent *event) {
|
||||||
if(event->button() != Qt::LeftButton) return;
|
if(event->button() != Qt::LeftButton) return;
|
||||||
if(isDrawing) return;
|
if(isDrawing) return;
|
||||||
|
@ -435,6 +490,11 @@ void BoxPanel::mouseMoveEvent(QMouseEvent *event) {
|
||||||
}
|
}
|
||||||
void BoxPanel::paintEvent(QPaintEvent *) {
|
void BoxPanel::paintEvent(QPaintEvent *) {
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
|
if(rate>=2) {
|
||||||
|
QBrush bra(0x666666);
|
||||||
|
for(int xx=rate; xx<width(); xx+=rate) painter.fillRect(QRectF(xx, 0, -0.5, height()), bra);
|
||||||
|
for(int yy=rate; yy<height(); yy+=rate) painter.fillRect(QRectF(0, yy, width(), -0.5), bra);
|
||||||
|
}
|
||||||
ModuleUnit *mod;
|
ModuleUnit *mod;
|
||||||
for(auto child : children()) {
|
for(auto child : children()) {
|
||||||
mod = (ModuleUnit*) child;
|
mod = (ModuleUnit*) child;
|
||||||
|
@ -500,6 +560,8 @@ void ModuleUnit::drawed() {
|
||||||
mods.append(QVariant::fromValue((void*)this));
|
mods.append(QVariant::fromValue((void*)this));
|
||||||
btn->setProperty("mods", mods);
|
btn->setProperty("mods", mods);
|
||||||
name = "G"+QString::number(box->boxWin->grpGrp->id(btn)+1)+"-"+QString::number(mods.size());
|
name = "G"+QString::number(box->boxWin->grpGrp->id(btn)+1)+"-"+QString::number(mods.size());
|
||||||
|
for(auto child : box->children()) ((ModuleUnit*)child)->isSel = false;
|
||||||
|
isSel = true;
|
||||||
box->update();
|
box->update();
|
||||||
}
|
}
|
||||||
void ModuleUnit::mousePressEvent(QMouseEvent *event) {
|
void ModuleUnit::mousePressEvent(QMouseEvent *event) {
|
||||||
|
@ -507,16 +569,17 @@ void ModuleUnit::mousePressEvent(QMouseEvent *event) {
|
||||||
if(event->button() != Qt::LeftButton) return;
|
if(event->button() != Qt::LeftButton) return;
|
||||||
event->accept();
|
event->accept();
|
||||||
if(box->isDrawing) return;
|
if(box->isDrawing) return;
|
||||||
|
if(event->modifiers() & Qt::ControlModifier) return;
|
||||||
setCursor(Qt::SizeAllCursor);
|
setCursor(Qt::SizeAllCursor);
|
||||||
auto glbPos = event->globalPos();
|
auto glbPos = event->globalPos();
|
||||||
box->grpRect = geometry();
|
box->grpRect = geometry();
|
||||||
if(isSel) {
|
if(isSel) {
|
||||||
mOtherSels.clear();
|
box->sels.clear();
|
||||||
ModuleUnit* mod;
|
ModuleUnit* mod;
|
||||||
for(auto child : box->children()) if(child!=this && (mod = (ModuleUnit*)child)->isSel) {
|
for(auto child : box->children()) if(child!=this && (mod = (ModuleUnit*)child)->isSel) {
|
||||||
mod->mPressRel = mod->pos() - pos();
|
mod->mPressRel = mod->pos() - pos();
|
||||||
box->grpRect |= mod->geometry();
|
box->grpRect |= mod->geometry();
|
||||||
mOtherSels.emplace_back(mod);
|
box->sels.emplace_back(mod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mPressRel = pos() - box->grpRect.topLeft();
|
mPressRel = pos() - box->grpRect.topLeft();
|
||||||
|
@ -531,6 +594,11 @@ void ModuleUnit::mouseReleaseEvent(QMouseEvent *event) {
|
||||||
if(name.isEmpty()) drawed();
|
if(name.isEmpty()) drawed();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(event->modifiers() & Qt::ControlModifier) {
|
||||||
|
isSel = true;
|
||||||
|
update();
|
||||||
|
return;
|
||||||
|
}
|
||||||
unsetCursor();
|
unsetCursor();
|
||||||
mPressRel.setX(INT_MIN);
|
mPressRel.setX(INT_MIN);
|
||||||
if(! isSel) {
|
if(! isSel) {
|
||||||
|
@ -541,10 +609,10 @@ void ModuleUnit::mouseReleaseEvent(QMouseEvent *event) {
|
||||||
((ModuleUnit*)item)->update();
|
((ModuleUnit*)item)->update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(auto sel : mOtherSels) sel->mPressRel.setX(INT_MIN);
|
for(auto sel : box->sels) sel->mPressRel.setX(INT_MIN);
|
||||||
mOtherSels.clear();
|
box->sels.clear();
|
||||||
}
|
}
|
||||||
#define SnapSpace 6
|
#define SnapSpace 12
|
||||||
void ModuleUnit::mouseMoveEvent(QMouseEvent *e) {
|
void ModuleUnit::mouseMoveEvent(QMouseEvent *e) {
|
||||||
if(! (e->buttons() & Qt::LeftButton)) return;
|
if(! (e->buttons() & Qt::LeftButton)) return;
|
||||||
if(box->isDrawing) {
|
if(box->isDrawing) {
|
||||||
|
@ -556,59 +624,76 @@ void ModuleUnit::mouseMoveEvent(QMouseEvent *e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(mPressRel.x()==INT_MIN) return;
|
if(mPressRel.x()==INT_MIN) return;
|
||||||
|
ModuleUnit* mod;
|
||||||
if(! isSel) {
|
if(! isSel) {
|
||||||
isSel = true;
|
isSel = true;
|
||||||
for(auto child : box->children()) if(child!=this && ((ModuleUnit*)child)->isSel) ((ModuleUnit*)child)->isSel = false;
|
for(auto child : box->children()) if(child!=this && (mod = (ModuleUnit*)child)->isSel) mod->isSel = false;
|
||||||
|
}
|
||||||
|
auto grpRect = box->grpRect;
|
||||||
|
grpRect.translate(e->globalPos());
|
||||||
|
auto dstHor = qMax(0, grpRect.x());
|
||||||
|
auto dstVer = qMax(0, grpRect.y());
|
||||||
|
if(box->boxWin->fdSnap->isChecked() && (dstHor || dstVer)) {
|
||||||
|
bool needH = dstHor, needV = dstVer;
|
||||||
|
auto nearRect = grpRect.marginsAdded({24,24,24,24});
|
||||||
|
for(auto child : box->children()) if(! (mod = (ModuleUnit*)child)->isSel && mod->geometry().intersects(nearRect)) {//左右
|
||||||
|
if(needH) {
|
||||||
|
if(abs(dstHor - mod->x()) < SnapSpace) {
|
||||||
|
dstHor = mod->x();
|
||||||
|
needH = false;
|
||||||
|
goto vvv;
|
||||||
|
}
|
||||||
|
auto eleRight = mod->x() + mod->width();
|
||||||
|
if(abs(dstHor - eleRight) < SnapSpace) {
|
||||||
|
dstHor = eleRight;
|
||||||
|
needH = false;
|
||||||
|
goto vvv;
|
||||||
|
}
|
||||||
|
auto right = dstHor + grpRect.width();
|
||||||
|
if(abs(right - mod->x()) < SnapSpace && mod->x() - grpRect.width() >= 0) {
|
||||||
|
dstHor = mod->x() - grpRect.width();
|
||||||
|
needH = false;
|
||||||
|
goto vvv;
|
||||||
|
}
|
||||||
|
if(abs(right - eleRight) < SnapSpace && eleRight - grpRect.width() >= 0) {
|
||||||
|
dstHor = eleRight - grpRect.width();
|
||||||
|
needH = false;
|
||||||
|
goto vvv;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vvv:
|
||||||
|
if(needV) {
|
||||||
|
if(abs(dstVer-mod->y()) < SnapSpace) {
|
||||||
|
dstVer = mod->y();
|
||||||
|
needV = false;
|
||||||
|
goto eee;
|
||||||
|
}
|
||||||
|
auto eleBtm = mod->y() + mod->height();
|
||||||
|
if(abs(dstVer - eleBtm) < SnapSpace) {
|
||||||
|
dstVer = eleBtm;
|
||||||
|
needV = false;
|
||||||
|
goto eee;
|
||||||
|
}
|
||||||
|
auto btm = dstVer + grpRect.height();
|
||||||
|
if(abs(btm - mod->y()) < SnapSpace && mod->y() - grpRect.height() >= 0) {
|
||||||
|
dstVer = mod->y() - grpRect.height();
|
||||||
|
needV = false;
|
||||||
|
goto eee;
|
||||||
|
}
|
||||||
|
if(abs(btm - eleBtm) < SnapSpace && eleBtm - grpRect.height() >= 0) {
|
||||||
|
dstVer = eleBtm - grpRect.height();
|
||||||
|
needV = false;
|
||||||
|
goto eee;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
eee:
|
||||||
|
if(! needH && ! needV) break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
auto mousePos = e->globalPos();
|
|
||||||
auto dstHor = box->grpRect.x() + mousePos.x();
|
|
||||||
auto dstVer = box->grpRect.y() + mousePos.y();
|
|
||||||
dstHor = qMax(0, dstHor);
|
|
||||||
dstVer = qMax(0, dstVer);
|
|
||||||
// if(dstHor) for(ModuleUnit *ele : mOtherEles) {//左右
|
|
||||||
// if(abs(dstHor - ele->x()) < SnapSpace) {
|
|
||||||
// dstHor = ele->x();
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// auto eleRight = ele->x() + ele->width();
|
|
||||||
// if(abs(dstHor - eleRight) < SnapSpace) {
|
|
||||||
// dstHor = eleRight;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// auto right = dstHor + width();
|
|
||||||
// if(abs(right - ele->x()) < SnapSpace && ele->x() - width() >= 0) {
|
|
||||||
// dstHor = ele->x() - width();
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// if(abs(right - eleRight) < SnapSpace && eleRight - width() >= 0) {
|
|
||||||
// dstHor = eleRight - width();
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if(dstVer) for(ModuleUnit *ele : mOtherEles) {//上下
|
|
||||||
// if(abs(dstVer-ele->y()) < SnapSpace) {
|
|
||||||
// dstVer = ele->y();
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// auto eleBtm = ele->y() + ele->height();
|
|
||||||
// if(abs(dstVer - eleBtm) < SnapSpace) {
|
|
||||||
// dstVer = eleBtm;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// auto btm = dstVer + height();
|
|
||||||
// if(abs(btm - ele->y()) < SnapSpace && ele->y() - height() >= 0) {
|
|
||||||
// dstVer = ele->y() - height();
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// if(abs(btm - eleBtm) < SnapSpace && eleBtm - height() >= 0) {
|
|
||||||
// dstVer = eleBtm - height();
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
move(mPressRel.x() + dstHor, mPressRel.y() + dstVer);
|
move(mPressRel.x() + dstHor, mPressRel.y() + dstVer);
|
||||||
mX = qRound(x() / box->rate);
|
mX = qRound(x() / box->rate);
|
||||||
mY = qRound(y() / box->rate);
|
mY = qRound(y() / box->rate);
|
||||||
for(auto sel : mOtherSels) {
|
for(auto sel : box->sels) {
|
||||||
if(sel->mPressRel.x()==INT_MIN) continue;
|
if(sel->mPressRel.x()==INT_MIN) continue;
|
||||||
sel->move(sel->mPressRel.x() + x(), sel->mPressRel.y() + y());
|
sel->move(sel->mPressRel.x() + x(), sel->mPressRel.y() + y());
|
||||||
sel->mX = qRound(sel->x() / box->rate);
|
sel->mX = qRound(sel->x() / box->rate);
|
||||||
|
|
|
@ -14,7 +14,7 @@ class ExpertBoxLayoutWin : public BaseWin {
|
||||||
public:
|
public:
|
||||||
explicit ExpertBoxLayoutWin(ExpertWin *parent = 0);
|
explicit ExpertBoxLayoutWin(ExpertWin *parent = 0);
|
||||||
|
|
||||||
QCheckBox *fdHasPos, *fdHasSize, *fdHasConn, *fdHasName, *fdHasOutline;
|
QCheckBox *fdHasPos, *fdHasSize, *fdHasConn, *fdHasName, *fdHasOutline, *fdSnap;
|
||||||
QButtonGroup *grpGrp;
|
QButtonGroup *grpGrp;
|
||||||
BoxPanel *box{0};
|
BoxPanel *box{0};
|
||||||
QLabel *fdModNum, *fdBoxSize;
|
QLabel *fdModNum, *fdBoxSize;
|
||||||
|
@ -24,7 +24,9 @@ class ModuleUnit;
|
||||||
class BoxPanel : public QWidget {
|
class BoxPanel : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit BoxPanel(ExpertBoxLayoutWin *boxWin) : boxWin(boxWin) {}
|
explicit BoxPanel(ExpertBoxLayoutWin *boxWin) : boxWin(boxWin) {
|
||||||
|
setFocusPolicy(Qt::ClickFocus);
|
||||||
|
}
|
||||||
|
|
||||||
void fitSize() {
|
void fitSize() {
|
||||||
boxRect = childrenRect();
|
boxRect = childrenRect();
|
||||||
|
@ -34,13 +36,17 @@ public:
|
||||||
else update();
|
else update();
|
||||||
boxWin->fdBoxSize->setText(QString("%1 x %2").arg(boxRect.width()).arg(boxRect.height()));
|
boxWin->fdBoxSize->setText(QString("%1 x %2").arg(boxRect.width()).arg(boxRect.height()));
|
||||||
}
|
}
|
||||||
|
void del();
|
||||||
|
|
||||||
QRect boxRect, grpRect;
|
QRect boxRect, grpRect;
|
||||||
ExpertBoxLayoutWin *boxWin;
|
|
||||||
double rate{1};
|
double rate{1};
|
||||||
QRectF rect;
|
QRectF rect;
|
||||||
|
std::vector<ModuleUnit *> sels;
|
||||||
|
std::vector<ModuleUnit *> copieds;
|
||||||
|
ExpertBoxLayoutWin *boxWin;
|
||||||
bool isDrawing{false};
|
bool isDrawing{false};
|
||||||
protected:
|
protected:
|
||||||
|
void keyPressEvent(QKeyEvent *event) override;
|
||||||
void mousePressEvent(QMouseEvent *event) override;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
void mouseReleaseEvent(QMouseEvent *) override;
|
void mouseReleaseEvent(QMouseEvent *) override;
|
||||||
void mouseMoveEvent(QMouseEvent *event) override;
|
void mouseMoveEvent(QMouseEvent *event) override;
|
||||||
|
@ -56,15 +62,13 @@ public:
|
||||||
int mX, mY, mW, mH;
|
int mX, mY, mW, mH;
|
||||||
JObj mModule;
|
JObj mModule;
|
||||||
QString name;
|
QString name;
|
||||||
BoxPanel *box;
|
|
||||||
QPoint mPressRel{INT_MIN, INT_MIN};
|
QPoint mPressRel{INT_MIN, INT_MIN};
|
||||||
|
BoxPanel *box;
|
||||||
bool isSel{false};
|
bool isSel{false};
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent *) override;
|
void mousePressEvent(QMouseEvent *) override;
|
||||||
void mouseReleaseEvent(QMouseEvent *) override;
|
void mouseReleaseEvent(QMouseEvent *) override;
|
||||||
void mouseMoveEvent(QMouseEvent *) override;
|
void mouseMoveEvent(QMouseEvent *) override;
|
||||||
|
|
||||||
std::vector<ModuleUnit *> mOtherSels;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // EXPERTBOXLAYOUTWIN_H
|
#endif // EXPERTBOXLAYOUTWIN_H
|
||||||
|
|
|
@ -130,6 +130,7 @@ ExpertSmartPointSetWin::ExpertSmartPointSetWin(ExpertWin *expertWin) : BaseWin{e
|
||||||
vBox->setContentsMargins(0,0,0,0);
|
vBox->setContentsMargins(0,0,0,0);
|
||||||
|
|
||||||
tableChipType = new Table(24, 10);
|
tableChipType = new Table(24, 10);
|
||||||
|
tableChipType->verticalHeader()->setMinimumWidth(30); //added by alahover 20230822
|
||||||
tableChipType->setColFit();
|
tableChipType->setColFit();
|
||||||
tableChipType->setRowFit();
|
tableChipType->setRowFit();
|
||||||
tableChipType->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
tableChipType->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||||
|
@ -315,6 +316,7 @@ ExpertSmartPointSetWin::ExpertSmartPointSetWin(ExpertWin *expertWin) : BaseWin{e
|
||||||
vBox->setContentsMargins(0,0,0,0);
|
vBox->setContentsMargins(0,0,0,0);
|
||||||
|
|
||||||
tableDecodeMode = new Table(9, 7);
|
tableDecodeMode = new Table(9, 7);
|
||||||
|
tableDecodeMode->verticalHeader()->setMinimumWidth(30); //added by alahover 20230822
|
||||||
tableDecodeMode->setColFit();
|
tableDecodeMode->setColFit();
|
||||||
tableDecodeMode->setRowFit();
|
tableDecodeMode->setRowFit();
|
||||||
tableDecodeMode->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
tableDecodeMode->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "expertboxlayoutwin.h"
|
#include "expertboxlayoutwin.h"
|
||||||
#include "expertsmartpointsetwin.h"
|
#include "expertsmartpointsetwin.h"
|
||||||
#include "expertscreenconnwin.h"
|
#include "expertscreenconnwin.h"
|
||||||
|
#include "globalfunc.h"
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
@ -19,9 +20,133 @@
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QSplitter>
|
#include <QSplitter>
|
||||||
|
|
||||||
|
//added by alahover -s 20230817
|
||||||
|
auto zrf_msg = QByteArray::fromHex("55 55 00 11 22 33 44 55 00 11 22 33 44 55 10 5a 13 00 00 00 00 aa ff ff 00 11 11 11 11 00 00 00 00 00 00 00 00 00 00 00 00"
|
||||||
|
"00 00 06 20 10 10 00 E4 06 FF FF FF FF 00 00 80 80 80 00 00 00 1F 00 00 00 3C 01 33 00 00 00 80 00 00 12 05 00 00 00 01 02 "
|
||||||
|
"03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 01 00 00 00 00 10 00 00 20 00 00 30 "
|
||||||
|
"00 00 40 00 00 50 00 00 60 00 00 70 00 00 80 00 00 90 00 00 A0 00 00 B0 00 00 C0 00 00 D0 00 00 F0 00 00 00 01 00 10 01 00 "
|
||||||
|
"20 01 00 30 01 00 40 01 00 50 01 00 60 01 00 70 01 00 80 01 00 90 01 00 A0 01 00 B0 01 00 C0 01 00 D0 01 00 F0 01 00 00 02 "
|
||||||
|
"00 10 02 05 00 1F F8 7F 01 40 07 1F F8 73 01 40 07 1F F8 5F 01 40 07 40 10 40 10 40 10 00 00 00 00 00 00 00 00 00 00 00 00 "
|
||||||
|
"00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "
|
||||||
|
"00 00 00 00 00 00 00 00 00 00 ");//297
|
||||||
|
void ExpertWin::claseToStruct() {
|
||||||
|
zrfBaseParam.b0 = (zrfBaseParam.b0_7 << 7 & 0b10000000)| (zrfBaseParam.b0_6 << 6 & 0b01000000)| (zrfBaseParam.b0_5 << 5 & 0b00100000)| (zrfBaseParam.b0_4 << 4 & 0b00010000)| (zrfBaseParam.b0_3_1 << 1 & 0b00001110) | (zrfBaseParam.b0_0 & 0b00000001);
|
||||||
|
auto unitptr = zrf_msg.data();
|
||||||
|
unsigned char * bytePrt = (unsigned char*)(unitptr);
|
||||||
|
*bytePrt=zrfBaseParam.b0;
|
||||||
|
bytePrt ++;
|
||||||
|
zrfBaseParam.b1 = (zrfBaseParam.b1_7_6<< 6 & 0b11000000) | (zrfBaseParam.b1_5<<5 & 0b00100000) | (zrfBaseParam.b1_4<<4 & 0b00010000) | (zrfBaseParam.b1_3_2<<2 & 0b00001100) | (zrfBaseParam.b1_1<<1 & 0b00000010) |(zrfBaseParam.b1_0&0b00000001);
|
||||||
|
*bytePrt=zrfBaseParam.b1;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b2;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b3;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b4;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b5;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b6;
|
||||||
|
bytePrt ++;
|
||||||
|
zrfBaseParam.b7 = (zrfBaseParam.b7_7_6 << 6 & 0b11000000) | (zrfBaseParam.b7_5_4<<4 & 0b00110000) | (zrfBaseParam.b7_3_2 << 2 & 0b00001100) | (zrfBaseParam.b7_1_0 & 0b00000011) ;
|
||||||
|
*bytePrt=zrfBaseParam.b7;
|
||||||
|
bytePrt ++;
|
||||||
|
zrfBaseParam.b8 = (zrfBaseParam.b8_7<<7 &0b10000000) | (zrfBaseParam.b8_6<<6 & 0b01000000) | (zrfBaseParam.b8_5_4<<4 & 0b00110000) | (zrfBaseParam.b8_3_0 & 0b00001111) ;
|
||||||
|
*bytePrt=zrfBaseParam.b8;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b9 ;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b10;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b11;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b12;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b13;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b14;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b15;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b16;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b17;
|
||||||
|
bytePrt ++;
|
||||||
|
zrfBaseParam.b18 = (zrfBaseParam.b18_7_4<<4 & 0b11110000) | (zrfBaseParam.b18_3_0 & 0b00001111);
|
||||||
|
*bytePrt=zrfBaseParam.b18;
|
||||||
|
bytePrt ++;
|
||||||
|
zrfBaseParam.b19 = (zrfBaseParam.b19_7_4<<4 & 0b11110000) | (zrfBaseParam.b19_3_0 & 0b00001111);
|
||||||
|
*bytePrt=zrfBaseParam.b19;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b20;
|
||||||
|
bytePrt ++;
|
||||||
|
zrfBaseParam.b21 = (zrfBaseParam.b21_7_5 << 5 & 0b11100000) | (zrfBaseParam.b21_4_0 & 0b00011111);
|
||||||
|
*bytePrt=zrfBaseParam.b21;
|
||||||
|
bytePrt ++;
|
||||||
|
zrfBaseParam.b22 = (zrfBaseParam.b22_7_6 << 6 & 0b11000000) | (zrfBaseParam.b22_5_2<<2 & 0b00111100) | (zrfBaseParam.b22_1_0 & 0b00000011);
|
||||||
|
*bytePrt=zrfBaseParam.b22;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b23;
|
||||||
|
bytePrt ++;
|
||||||
|
zrfBaseParam.b24 = (zrfBaseParam.b24_7_5<<5 & 0b11100000) | (zrfBaseParam.b24_4_0 & 0b00011111);
|
||||||
|
*bytePrt=zrfBaseParam.b24;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b25;
|
||||||
|
bytePrt ++;
|
||||||
|
zrfBaseParam.b26 = (zrfBaseParam.b26_7<<7 & 0b10000000) | (zrfBaseParam.b26_6<<6 & 0b01000000) | (zrfBaseParam.b26_5_0 & 0b00111111);
|
||||||
|
*bytePrt=zrfBaseParam.b26;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b27_28[0];
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b27_28[1];
|
||||||
|
bytePrt ++;
|
||||||
|
zrfBaseParam.b29 = (zrfBaseParam.b29_7_4<<4 & 0b11110000) | (zrfBaseParam.b29_3_2<<2 &0b00001100) | (zrfBaseParam.b29_1_0 & 0b00000011);
|
||||||
|
*bytePrt=zrfBaseParam.b29;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b30;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b31;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b32;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b33 = (zrfBaseParam.b33_7_4<<4 & 0b11110000) | (zrfBaseParam.b33_3_0 & 0b00001111);
|
||||||
|
*bytePrt=zrfBaseParam.b33;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b34 = (zrfBaseParam.b34_7_4<<5 & 0b11110000) | (zrfBaseParam.b34_3_0 & 0b00001111);
|
||||||
|
*bytePrt=zrfBaseParam.b34;
|
||||||
|
bytePrt ++;
|
||||||
|
*bytePrt=zrfBaseParam.b35;
|
||||||
|
bytePrt ++;
|
||||||
|
zrfBaseParam.b36 = (zrfBaseParam.b36_7_6<<6 & 0b11000000) | (zrfBaseParam.b36_5_0 & 0b00111111);
|
||||||
|
*bytePrt=zrfBaseParam.b36;
|
||||||
|
bytePrt ++;
|
||||||
|
zrfBaseParam. b37 = (zrfBaseParam.b37_7_5<<5 & 0b11100000) | (zrfBaseParam.b37_4_3<<3 & 0b00011000) | (zrfBaseParam.b37_2<<2 & 0b00000100) | (zrfBaseParam.b37_1 <<1 & 0b00000010) | (zrfBaseParam.b37_0 & 0b00000001);
|
||||||
|
*bytePrt=zrfBaseParam.b37;
|
||||||
|
bytePrt ++;
|
||||||
|
memcpy(bytePrt,&zrfBaseParam.b38_69[32],32);
|
||||||
|
bytePrt +=32;
|
||||||
|
zrfBaseParam.b70 = (zrfBaseParam.b70_7<<7 & 0b10000000) | (zrfBaseParam.b70_6<<6 & 0b01000000) | (zrfBaseParam.b70_5_2<<2 & 0b00111100) | (zrfBaseParam.b70_1<<1 & 0b00000010) | (zrfBaseParam.b70_0 & 0b00000001);
|
||||||
|
*bytePrt=zrfBaseParam.b70;
|
||||||
|
bytePrt ++;
|
||||||
|
for(int i=0;i<32;i++)
|
||||||
|
{
|
||||||
|
memcpy(bytePrt,&zrfBaseParam.b71_166[i][0],3);
|
||||||
|
bytePrt +=3;
|
||||||
|
}
|
||||||
|
*bytePrt=zrfBaseParam.b167;
|
||||||
|
bytePrt ++;
|
||||||
|
zrfBaseParam.b168 = (zrfBaseParam.b168_7_5<<5 & 0b11100000) | (zrfBaseParam.b168_4_0 & 0b00011111);
|
||||||
|
*bytePrt=zrfBaseParam.b168;
|
||||||
|
bytePrt ++;
|
||||||
|
memcpy(bytePrt,(unsigned char *)&zrfBaseParam.b169_192[0],24);
|
||||||
|
bytePrt +=12;
|
||||||
|
*bytePrt=zrfBaseParam.b193;
|
||||||
|
}
|
||||||
|
//added by alahover -o 20230817
|
||||||
|
|
||||||
QColor colors[] {QColor(0xdd0000), QColor(0xdd6600), QColor(0x008800), QColor(0x008888), QColor(0x0000ff), QColor(0x777777), QColor(0xaaaaaa)};
|
QColor colors[] {QColor(0xdd0000), QColor(0xdd6600), QColor(0x008800), QColor(0x008888), QColor(0x0000ff), QColor(0x777777), QColor(0xaaaaaa)};
|
||||||
|
|
||||||
ExpertWin::ExpertWin(QWidget *parent) : BaseWin{parent} {
|
ExpertWin::ExpertWin(QWidget *parent, int rcvCardType) : BaseWin{parent}, m_iRcvCardType{rcvCardType} {
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
setWindowTitle("专家调屏");
|
setWindowTitle("专家调屏");
|
||||||
resize(900, 720);
|
resize(900, 720);
|
||||||
|
@ -80,6 +205,7 @@ QTabBar::tab:selected {margin-top: 0; border-bottom: none; color: #acf; backgrou
|
||||||
{"audio", "音频开关", 0, QHeaderView::Stretch},
|
{"audio", "音频开关", 0, QHeaderView::Stretch},
|
||||||
{"backup", "备份开关", 0, QHeaderView::Stretch}
|
{"backup", "备份开关", 0, QHeaderView::Stretch}
|
||||||
};
|
};
|
||||||
|
table->verticalHeader()->setMinimumWidth(20);//added by alahover 20230822
|
||||||
table->setDefs();
|
table->setDefs();
|
||||||
vLeft->addWidget(table);
|
vLeft->addWidget(table);
|
||||||
table->setRowCount(4);
|
table->setRowCount(4);
|
||||||
|
@ -532,11 +658,24 @@ QTabBar::tab:selected {margin-top: 0; border-bottom: none; color: #acf; backgrou
|
||||||
btn = new QPushButton(tr("发送数据"));
|
btn = new QPushButton(tr("发送数据"));
|
||||||
btn->setProperty("ss","blue");
|
btn->setProperty("ss","blue");
|
||||||
connect(btn, &QPushButton::clicked, this, [=] {
|
connect(btn, &QPushButton::clicked, this, [=] {
|
||||||
QByteArray data;
|
//modified by alahover -s 20230817
|
||||||
addMapData(data);
|
if(m_iRcvCardType == enum_xixun_sync) {
|
||||||
|
QByteArray data;
|
||||||
|
addMapData(data);
|
||||||
QMessageBox::information(this, tr("发送成功"), tr("发送成功"));
|
QMessageBox::information(this, tr("提示"), tr("发送成功"));
|
||||||
|
} else if(m_iRcvCardType == enum_zrf) {
|
||||||
|
claseToStruct();
|
||||||
|
auto waitingDlg = new WaitingDlg(this, tr("Setting")+" ...");
|
||||||
|
auto res = sendMsgSync(zrf_msg, 0x1EA, 10000, waitingDlg);
|
||||||
|
if(res==5) QMessageBox::critical(this, "Error", tr("请求超时"));
|
||||||
|
else if(res) QMessageBox::critical(this, "Error", QString(tr("发送失败: "))+QString::fromLocal8Bit(pcap_geterr(pcapSend)));
|
||||||
|
else {
|
||||||
|
waitingDlg->close();
|
||||||
|
QMessageBox::information(this, tr("提示"), tr("发送成功"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(m_iRcvCardType == enum_xixun_async) QMessageBox::information(this, tr("提示"), tr("异步卡发送成功"));
|
||||||
|
else QMessageBox::information(this, tr("提示"), tr("未能识别的控制卡类型"));
|
||||||
});
|
});
|
||||||
hBox->addWidget(btn);
|
hBox->addWidget(btn);
|
||||||
hBox->addSpacing(20);
|
hBox->addSpacing(20);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
class ExpertWin : public BaseWin {
|
class ExpertWin : public BaseWin {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ExpertWin(QWidget *parent = nullptr);
|
explicit ExpertWin(QWidget *parent, int);
|
||||||
|
|
||||||
QByteArray savedData();
|
QByteArray savedData();
|
||||||
void addMapData(QByteArray &);
|
void addMapData(QByteArray &);
|
||||||
|
@ -41,6 +41,176 @@ public:
|
||||||
QSpinBox *fdCardWidth, *fdCardHeight;
|
QSpinBox *fdCardWidth, *fdCardHeight;
|
||||||
QComboBox *fdDirection, *fdSectorCount;
|
QComboBox *fdDirection, *fdSectorCount;
|
||||||
QRadioButton *fdAdvacned;
|
QRadioButton *fdAdvacned;
|
||||||
|
|
||||||
|
//added by alahover -s 20230817
|
||||||
|
int m_iRcvCardType;
|
||||||
|
class zrf_base_param{
|
||||||
|
public:
|
||||||
|
unsigned char b0_7 = 0b0; //DAT信号 方式 0:高有效(共阴) 1:低有效(共阳);
|
||||||
|
unsigned char b0_6 = 0b0; //STB信号有效方式 0:正向 1:反向;
|
||||||
|
unsigned char b0_5 = 0b0; //OE信号有效0 :低有 效1 :高有效;
|
||||||
|
unsigned char b0_4 = 0b0; //行有效方式:0 :低有效1 :高有效;
|
||||||
|
unsigned char b0_3_1 = 0b000; //行译码方式bit2~bit0与地址0x01 bit7~bit6 表示 bit4~bit3。0:普通,常规138译码;00001:SM5266;00010:SM5366;01000::ICN2013;00100:无译码;00101:595译码;0110::5958译码;01110:ICND2018;其他:保留;
|
||||||
|
unsigned char b0_0 = 0b0; //0 :全色;1 :单双色;
|
||||||
|
unsigned char b0 = (b0_7 << 7 & 0b10000000)| (b0_6 << 6 & 0b01000000)| (b0_5 << 5 & 0b00100000)| (b0_4 << 4 & 0b00010000)| (b0_3_1 << 1 & 0b00001110) | (b0_0 & 0b00000001);
|
||||||
|
|
||||||
|
unsigned char b1_7_6 = 0b00; //行译码方式 bit4~bit3
|
||||||
|
unsigned char b1_5 = 0b0; //消影控制电平0:高有效;1:低有效
|
||||||
|
unsigned char b1_4 = 0b0; //双卡备份0:关闭;1:启用
|
||||||
|
unsigned char b1_3_2 = 0b00; //颜色深度00:8bit;01:10bit;10:12bit
|
||||||
|
unsigned char b1_1 = 0b0; //D信号扩展为第二时钟0:关闭;1:启用
|
||||||
|
unsigned char b1_0 = 0b0; //上电渐亮0:启用;1:关闭
|
||||||
|
unsigned char b1 = (b1_7_6<< 6 & 0b11000000) | (b1_5<<5 & 0b00100000) | (b1_4<<4 & 0b00010000) | (b1_3_2<<2 & 0b00001100) | (b1_1<<1 & 0b00000010) |(b1_0&0b00000001);
|
||||||
|
|
||||||
|
unsigned char b2 = 0x5; //实际消影时间为:(输入值 * 2 + 1) * 48ns
|
||||||
|
unsigned char b3 = 0x8; //一组数据控制模组的行数:1~64;其他无效;
|
||||||
|
unsigned char b4 = 0x10; //一组数据控制的模组列数:1~128,其他无效;
|
||||||
|
unsigned char b5 = 0x08; //模组扫描方式:1~64,其他无效;
|
||||||
|
unsigned char b6 = 0x00; //模组每行空点数,详见说明2;
|
||||||
|
|
||||||
|
unsigned char b7_7_6 = 0b11; //输出数据线4,00:红;01:绿;10:蓝;11:黑;
|
||||||
|
unsigned char b7_5_4 = 0b10; //输出数据线3,00:红;01:绿;10:蓝;11:黑;
|
||||||
|
unsigned char b7_3_2 = 0b01; //输出数据线2,00:红;01:绿;10:蓝;11:黑;
|
||||||
|
unsigned char b7_1_0 = 0b00; //输出数据线1,00:红;01:绿;10:蓝;11:黑;
|
||||||
|
unsigned char b7 = (b7_7_6 << 6 & 0b11000000) | (b7_5_4<<4 & 0b00110000) | (b7_3_2 << 2 & 0b00001100) | (b7_1_0 & 0b00000011) ;
|
||||||
|
|
||||||
|
//数据传输方向及数据输出模式
|
||||||
|
unsigned char b8_7 = 0b0; //多种描点数据 :0,关闭;1,启用
|
||||||
|
unsigned char b8_6 = 0b0; //扫描复用模式:0,行扫;1,列扫;
|
||||||
|
unsigned char b8_5_4 = 0b00; //模组级联方向:00:从右往左;01:从上往下;10:从左往右;11:从下往上;
|
||||||
|
unsigned char b8_3_0 = 0b0000; //数据输出模式:0000:标准16组并行数据输出,0001:增强20组并行数据输出,0010:增强24组并行数据输出,0101:串行16组数据输出,0100:串行32组数据输出,0011:串行 64 组数据输出,0110:增强32组并行数据输出,0111:串行 128 组数据,1000:串行 96 组数据,1001~1111:保留
|
||||||
|
unsigned char b8 = (b8_7<<7 &0b10000000) | (b8_6<<6 & 0b01000000) | (b8_5_4<<4 & 0b00110000) | (b8_3_0 & 0b00001111) ;
|
||||||
|
|
||||||
|
unsigned char b9 = 0xFF; //静态亮度 0:最暗,ff:最亮;区别于帧同步包中的动态亮度;
|
||||||
|
unsigned char b10 = 0xFF; //红亮度0:最暗,ff:最亮
|
||||||
|
unsigned char b11 = 0xFF; //绿亮度0:最暗,ff:最亮
|
||||||
|
unsigned char b12 = 0xFF; //蓝亮度0:最暗,ff:最亮
|
||||||
|
unsigned char b13 = 0x00; //模组驱动芯片类型选择: //0x00:普通恒流芯片 0x0F:ICN2053; 0x01:MBI5042、MBI5041; 0x10:ICN2038S; 0x02:MY9268; 0x11:MBI5124; 0x03:MBI5050; 0x12:SM16017; 0x04:SD16749; 0x13:SM16207;
|
||||||
|
//0x05:SM16136; 0x14:SM16159; 0x06:APA101; 0x15:LS9929IP; 0x07:MY9266; 0x16:ICND2110 0x08:MY9868; 0x17:LS9918IP; 0x09:MBI5052; 0x18:SM16237;
|
||||||
|
//0x0A:SUM2017; 0x19:SUM2028; 0x0B:MY9862; 0x1A:SUM2017TD; 0x0C:SUM2032; 0x1B:SM16259; 0x0D:MBI5153; 0x1C:ICND2065/ICND2055; 0x1D:SM16359; 0x1E:RT5965/RT5966;
|
||||||
|
//0x1F:MBI5264; 其他未定义
|
||||||
|
|
||||||
|
unsigned char b14 = 0x00; //芯片辅助识别标志
|
||||||
|
unsigned char b15 = 0xAC; //红电流增益 0:最暗,ff:最亮
|
||||||
|
unsigned char b16 = 0xAC; //绿电流增益 0:最暗,ff:最亮
|
||||||
|
unsigned char b17 = 0xAC; //蓝电流增益 0:最暗,ff:最亮
|
||||||
|
//数据时钟频率
|
||||||
|
unsigned char b18_7_4 = 0x0; //保留
|
||||||
|
unsigned char b18_3_0 = 0x5; //输出数据时钟频率选择:0:31.25M; 1:25M; 2:20.83M; 3:17.8M 4:15.625M; 5:12.5M; 6:10.4M; 7:8.9M; 8:7.8M; 9:6.25M; 10:5.2M; 11:4.5M; 12:3.9M; 13:3.125M; 14:1.9M; 15:1M;
|
||||||
|
unsigned char b18 = (b18_7_4<<4 & 0b11110000) | (b18_3_0 & 0b00001111);
|
||||||
|
//数据时钟相位及占空比
|
||||||
|
unsigned char b19_7_4 = 0b0000; //输出数据时钟相位:0000:0 度; 0001:- 90 度; 0010:+90 度; 其他暂时保留;
|
||||||
|
unsigned char b19_3_0 = 0b0101; //输出数据时钟占空比:0000:50%; 0001:25%; 0010:75%; 其他暂时保留;
|
||||||
|
unsigned char b19 = (b19_7_4<<4 & 0b11110000) | (b19_3_0 & 0b00001111);
|
||||||
|
//PWM芯片灰度时钟周期
|
||||||
|
unsigned char b20 = 0x20; //PWM 类智能芯片的灰度时钟周期设定:MBI5042 芯片,软件计算; MY9268,MBI5050,用户设定;设定有效值范围 4~128, 其他不支持;
|
||||||
|
//灰度等级及倍频模式
|
||||||
|
unsigned char b21_7_5 = 0b000; //输出数据时钟相位:0000:0 度; 0001:- 90 度; 0010:+90 度; 其他暂时保留;
|
||||||
|
unsigned char b21_4_0 = 0b10111; //输出数据时钟占空比:0000:50%; 0001:25%; 0010:75%; 其他暂时保留;
|
||||||
|
unsigned char b21 = (b21_7_5 << 5 & 0b11100000) | (b21_4_0 & 0b00011111);
|
||||||
|
//倍频模式 、低灰优化
|
||||||
|
unsigned char b22_7_6 = 0b00; //倍频模式:00:无倍频;01:VPWM;10:VPWM2;11:VPWM3;
|
||||||
|
unsigned char b22_5_2 = 0b0000; //补偿等级:暂未定义:0000~1111
|
||||||
|
unsigned char b22_1_0 = 0b00; //低辉补偿:00:普通模式, 01:合并补偿, 10:累加补偿
|
||||||
|
unsigned char b22 = (b22_7_6 << 6 & 0b11000000) | (b22_5_2<<2 & 0b00111100) | (b22_1_0 & 0b00000011);
|
||||||
|
|
||||||
|
unsigned char b23 = 0x00; //保留
|
||||||
|
|
||||||
|
//画面刷新频率
|
||||||
|
unsigned char b24_7_5 = 0b000; //图像帧频率000:60Hz;001:50Hz;010:75Hz;011:30Hz;100:120Hz;其他保留
|
||||||
|
unsigned char b24_4_0 = 0b00000; //画面刷新频率 ,高 5bit
|
||||||
|
unsigned char b24 = (b24_7_5<<5 & 0b11100000) | (b24_4_0 & 0b00011111);
|
||||||
|
unsigned char b25 = 0xF0; //画面刷新频率 ,低 8bit
|
||||||
|
|
||||||
|
//与显卡同步
|
||||||
|
unsigned char b26_7 = 0b1; //0:与显卡同步;1:不同步
|
||||||
|
unsigned char b26_6 = 0b0; //低于 120hz时,该位置1,选择为行外扫描灰度
|
||||||
|
unsigned char b26_5_0 = 0b000000; //显卡同步时,帧频倍数
|
||||||
|
unsigned char b26 = (b26_7<<7 & 0b10000000) | (b26_6<<6 & 0b01000000) | (b26_5_0 & 0b00111111);
|
||||||
|
|
||||||
|
unsigned char b27_28[2] = { 0x01,0x33}; //非 5030/5042 时:ldq 值 = 166M/场频/扫描方式/遍数, 此数据必须小于 65535,当帧频不准时,利用微调选项调整
|
||||||
|
//5030/5042 时:ldq 值 = 166M/场频/扫描方式/19/遍数, 此数据必须小于 65535,此处遍数为:4096 级时:5, 8192 级时:9 , 16384级时:17 此值最小为 485.
|
||||||
|
//Ldq_vpwm,普通芯片的普通模式和 PWM 芯片与 ldq 一致,普通芯片的 VPWM 模式下,对遍数进行了修正(4096-38 遍;8192-39 遍;16384-134 遍);
|
||||||
|
//Ldq_vpwm2方式时,即普通芯片的VPWM灰度优先模式下,对遍数进行了修正(4096-58 遍;8192-59 遍;16384-116 遍;32768-117 遍;65536-118 遍);
|
||||||
|
//MY9268、MBI5050 时:画面刷新率/60Hz注意同步刷新时,数据源的帧频率需要考虑是 60Hz,还是50Hz,还是 75Hz;低字节在前
|
||||||
|
|
||||||
|
//与显卡同步
|
||||||
|
unsigned char b29_7_4 = 0b0000; //0:与显卡同步;1:不同步
|
||||||
|
unsigned char b29_3_2 = 0b00; //低于 120hz时,该位置1,选择为行外扫描灰度
|
||||||
|
unsigned char b29_1_0 = 0b00; //显卡同步时,帧频倍数
|
||||||
|
unsigned char b29 = (b29_7_4<<4 & 0b11110000) | (b29_3_2<<2 &0b00001100) | (b29_1_0 & 0b00000011);
|
||||||
|
|
||||||
|
unsigned char b30 = 0x00; //DPWM 芯片刷新倍频数 ICND2055/ICND2065 刷新倍频数 b7~b0
|
||||||
|
unsigned char b31 = 0x00; //接收卡带载列数低字节
|
||||||
|
unsigned char b32 = 0x80; //接收卡带载列数高字节
|
||||||
|
|
||||||
|
//空行模式
|
||||||
|
unsigned char b33_7_4 = 0b0000; //偶数图像区空行4bit
|
||||||
|
unsigned char b33_3_0 = 0b0000; //奇数图像区空行 4bit
|
||||||
|
unsigned char b33 = (b33_7_4<<4 & 0b11110000) | (b33_3_0 & 0b00001111);
|
||||||
|
|
||||||
|
//模组端口空行位置
|
||||||
|
unsigned char b34_7_4 = 0b0000; //1~14 表示第1到15组数据;0 保留;15 表示所有数据组都有空行
|
||||||
|
unsigned char b34_3_0 = 0b0000; //1~15,表示1到15组数据;0 保留
|
||||||
|
unsigned char b34 = (b34_7_4<<5 & 0b11110000) | (b34_3_0 & 0b00001111);
|
||||||
|
|
||||||
|
unsigned char b35 = 0x00; //消隐控制结束时刻
|
||||||
|
|
||||||
|
//行驱动芯片参数
|
||||||
|
unsigned char b36_7_6 = 0b00; //保留
|
||||||
|
unsigned char b36_5_0 = 0b000000; //详见说明3
|
||||||
|
unsigned char b36 = (b36_7_6<<6 & 0b11000000) | (b36_5_0 & 0b00111111);
|
||||||
|
|
||||||
|
//行驱动芯片参数
|
||||||
|
unsigned char b37_7_5 = 0b000; //保留
|
||||||
|
unsigned char b37_4_3 = 0b00; //端口内空数据通道数
|
||||||
|
unsigned char b37_2 = 0b0; //UD口交换
|
||||||
|
unsigned char b37_1 = 0b0; //逆序
|
||||||
|
unsigned char b37_0 = 0b0; //奇偶交换
|
||||||
|
unsigned char b37 = (b37_7_5<<5 & 0b11100000) | (b37_4_3<<3 & 0b00011000) | (b37_2<<2 & 0b00000100) | (b37_1 <<1 & 0b00000010) | (b37_0 & 0b00000001);
|
||||||
|
|
||||||
|
unsigned char b38_69[32] = {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f}; //端口1~31输出图像区
|
||||||
|
|
||||||
|
//行驱动芯片参数
|
||||||
|
unsigned char b70_7 = 0b000; //空行模式 0:关闭 1:打开
|
||||||
|
unsigned char b70_6 = 0b00; //对折偏移 0:关闭 1:打开
|
||||||
|
unsigned char b70_5_2 = 0b0; //对折模式: 0:正常模式; 1:两折; 2:镜像对折; 3:3折; 4:4折; 5:5折; 6:6折; 7:8折;其他:保留
|
||||||
|
unsigned char b70_1 = 0b0; //空列模式: 0:禁止; 1:允许
|
||||||
|
unsigned char b70_0 = 0b1; //bit0 图像区偏移: 0:菱形偏移模式; 1:梯形 偏移模式
|
||||||
|
unsigned char b70 = (b70_7<<7 & 0b10000000) | (b70_6<<6 & 0b01000000) | (b70_5_2<<2 & 0b00111100) | (b70_1<<1 & 0b00000010) | (b70_0 & 0b00000001);
|
||||||
|
|
||||||
|
//{0x00,0x00,0x00}图像区1列偏移低8bit,图像区1行偏移低8bit,图像区1列偏移低4bit+行偏移高4bit
|
||||||
|
unsigned char b71_166[32][3] = {{0x00,0x00,0x00},{0x00,0x01,0x00},{0x00,0x02,0x00},{0x00,0x03,0x00},{0x00,0x04,0x00},{0x00,0x05,0x00},{0x00,0x06,0x00},{0x00,0x07,0x00},
|
||||||
|
{0x00,0x08,0x00},{0x00,0x09,0x00},{0x00,0x0A,0x00},{0x00,0x0B,0x00},{0x00,0x0C,0x00},{0x00,0x0D,0x00},{0x00,0x0E,0x00},{0x00,0x0F,0x00},
|
||||||
|
{0x00,0x00,0x01},{0x00,0x10,0x01},{0x00,0x20,0x01},{0x00,0x30,0x01},{0x00,0x40,0x01},{0x00,0x50,0x01},{0x00,0x60,0x01},{0x00,0x70,0x01},
|
||||||
|
{0x00,0x80,0x01},{0x00,0x90,0x01},{0x00,0xA0,0x01},{0x00,0xB0,0x01},{0x00,0xC0,0x01},{0x00,0xD0,0x01},{0x00,0xE0,0x01},{0x00,0xF0,0x01}};
|
||||||
|
unsigned char b167 = 0x00; //同步预留时间
|
||||||
|
|
||||||
|
unsigned char b168_7_5 = 0b000; //保留
|
||||||
|
unsigned char b168_4_0 = 0b00000; //消隐延迟时间:(输入值+1)*48ns
|
||||||
|
unsigned char b168 = (b168_7_5<<5 & 0b11100000) | (b168_4_0 & 0b00011111);
|
||||||
|
|
||||||
|
unsigned short b169_192[12] = {0x0000,//红芯片参数 1 高字节,红芯片参数 1 低字节
|
||||||
|
0x0000,//红芯片参数 2 高字节,红芯片参数 2 低字节
|
||||||
|
0x0000,//红芯片参数 3 高字节,红芯片参数 3 低字节
|
||||||
|
0x0000,//绿芯片参数 1 高字节,绿芯片参数 1 低字节
|
||||||
|
0x0000,//绿芯片参数 2 高字节,绿芯片参数 2 低字节
|
||||||
|
0x0000,//绿芯片参数 3 高字节,绿芯片参数 3 低字节
|
||||||
|
0x0000,//蓝芯片参数 1 高字节,蓝芯片参数 1 低字节
|
||||||
|
0x0000,//蓝芯片参数 2 高字节,蓝芯片参数 2 低字节
|
||||||
|
0x0000,//蓝芯片参数 3 高字节,蓝芯片参数 3 低字节
|
||||||
|
0x0000,//红芯片参数 4 高字节,红芯片参数 4 低字节
|
||||||
|
0x0000,//绿芯片参数 4 高字节,绿芯片参数 4 低字节
|
||||||
|
0x0000 //蓝芯片参数 4 高字节,蓝芯片参数 4 低字节
|
||||||
|
};
|
||||||
|
|
||||||
|
unsigned char b193 = 0x00; //保留
|
||||||
|
};
|
||||||
|
zrf_base_param zrfBaseParam;
|
||||||
|
|
||||||
|
void claseToStruct();
|
||||||
|
//added by alahover -o 20230817
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *) override;
|
void closeEvent(QCloseEvent *) override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
QString gFileHome;
|
QString gFileHome;
|
||||||
|
|
||||||
HeadMap headMap;
|
HeadMap headMap;
|
||||||
|
HeadMap_ZRF headMap_zrf; //added by alahover 20230822
|
||||||
|
|
||||||
byte *getSepas() {
|
byte *getSepas() {
|
||||||
auto sepas = new byte[headMap.end+4]{0};
|
auto sepas = new byte[headMap.end+4]{0};
|
||||||
|
|
|
@ -30,6 +30,12 @@ inline byte ipp(byte size = 1) {
|
||||||
fi += size;
|
fi += size;
|
||||||
return rtn;
|
return rtn;
|
||||||
}
|
}
|
||||||
|
enum enum_rcvCardType{
|
||||||
|
enum_xixun_sync = 0,
|
||||||
|
enum_xixun_async = 1,
|
||||||
|
enum_zrf = 2,
|
||||||
|
enum_mxe
|
||||||
|
};
|
||||||
struct HeadMap {
|
struct HeadMap {
|
||||||
byte pre{ipp(2)};
|
byte pre{ipp(2)};
|
||||||
byte ver{fi++};
|
byte ver{fi++};
|
||||||
|
@ -44,8 +50,21 @@ struct HeadMap {
|
||||||
byte bodylen{ipp(2)};
|
byte bodylen{ipp(2)};
|
||||||
byte end{fi};
|
byte end{fi};
|
||||||
};
|
};
|
||||||
|
//added by alahover -s 20230822
|
||||||
|
struct HeadMap_ZRF {
|
||||||
|
byte pre{ie(2)};
|
||||||
|
byte tgtAddr{ipp(6)};
|
||||||
|
byte srcAddr{ipp(6)};
|
||||||
|
byte protcolFlag{ipp(2)};
|
||||||
|
byte pkgType{fi++};
|
||||||
|
byte reserve{fi++};
|
||||||
|
byte netPort{ipp(4)};
|
||||||
|
byte rcvIndex{ipp(2)};
|
||||||
|
byte end{fi};
|
||||||
|
};
|
||||||
|
|
||||||
extern HeadMap headMap;
|
extern HeadMap headMap;
|
||||||
|
extern HeadMap_ZRF headMap_zrf;
|
||||||
extern byte *sepas;
|
extern byte *sepas;
|
||||||
extern pcap *pcapSend;
|
extern pcap *pcapSend;
|
||||||
class PcapReThread;
|
class PcapReThread;
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 592 B |
Binary file not shown.
After Width: | Height: | Size: 493 B |
Binary file not shown.
After Width: | Height: | Size: 546 B |
Binary file not shown.
Before Width: | Height: | Size: 745 B After Width: | Height: | Size: 180 B |
|
@ -50,9 +50,6 @@ QCheckBox::indicator:checked {border-image: url(:/imgs/checkbox-check.png);}
|
||||||
QPushButton:checked {border: 2px solid #0a0; border-radius: 3px; padding-top: 2px; padding-bottom: 2px; }
|
QPushButton:checked {border: 2px solid #0a0; border-radius: 3px; padding-top: 2px; padding-bottom: 2px; }
|
||||||
QPushButton:disabled {color: #777;}
|
QPushButton:disabled {color: #777;}
|
||||||
|
|
||||||
QPushButton[ss="min"]{padding: 0; width: 30px; height: 25px; }
|
|
||||||
QPushButton[ss="close"]{padding: 0; width: 30px; height: 25px; }
|
|
||||||
|
|
||||||
QPushButton[ss="blue"] {background: #059;}
|
QPushButton[ss="blue"] {background: #059;}
|
||||||
|
|
||||||
QGroupBox {border: 1px solid #777; border-radius: 3px; margin-top: 0.5em; padding-top: 0.4em;}
|
QGroupBox {border: 1px solid #777; border-radius: 3px; margin-top: 0.5em; padding-top: 0.4em;}
|
||||||
|
|
|
@ -92,7 +92,7 @@ MainWin::MainWin() {
|
||||||
});
|
});
|
||||||
btnImg = addImg(imgsBar, QPixmap(":/imgs/expert.png").scaledToWidth(128, Qt::SmoothTransformation), tr("专家调屏"));
|
btnImg = addImg(imgsBar, QPixmap(":/imgs/expert.png").scaledToWidth(128, Qt::SmoothTransformation), tr("专家调屏"));
|
||||||
connect(btnImg, &ImgBtn::clicked, this, [=] {
|
connect(btnImg, &ImgBtn::clicked, this, [=] {
|
||||||
(new ExpertWin(this))->show();
|
(new ExpertWin(this, (enum_rcvCardType) table->data(table->currentRow(), "type").toInt()))->show();
|
||||||
});
|
});
|
||||||
btnImg = addImg(imgsBar, QPixmap(":/imgs/bright.png").scaledToWidth(128, Qt::SmoothTransformation), tr("亮度控制"));
|
btnImg = addImg(imgsBar, QPixmap(":/imgs/bright.png").scaledToWidth(128, Qt::SmoothTransformation), tr("亮度控制"));
|
||||||
connect(btnImg, &ImgBtn::clicked, this, [=] {
|
connect(btnImg, &ImgBtn::clicked, this, [=] {
|
||||||
|
@ -125,13 +125,14 @@ MainWin::MainWin() {
|
||||||
vBox->addWidget(new QLabel(" 硬件信息"));
|
vBox->addWidget(new QLabel(" 硬件信息"));
|
||||||
|
|
||||||
table = new Table{
|
table = new Table{
|
||||||
{"type", "发送卡型号"},
|
{"type", "控制系统类型"},
|
||||||
{"name", "名称"},
|
{"name", "名称"},
|
||||||
{"link", "连接方式"},
|
{"link", "连接方式"},
|
||||||
{"vcsNum", "接收卡数量"},
|
{"vcsNum", "接收卡数量"},
|
||||||
{"netPorts", "网口统计P1~Pn"},
|
{"netPorts", "网口统计P1~Pn"},
|
||||||
{"info", "其他信息", QHeaderView::Stretch},
|
{"info", "其他信息", QHeaderView::Stretch},
|
||||||
};
|
};
|
||||||
|
table->verticalHeader()->setMinimumWidth(20);//added by alahover 20230822
|
||||||
table->setDefs();
|
table->setDefs();
|
||||||
vBox->addWidget(table);
|
vBox->addWidget(table);
|
||||||
|
|
||||||
|
@ -213,12 +214,9 @@ MainWin::MainWin() {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
table->setRowCount(cnt+1);
|
table->setRowCount(cnt+1);
|
||||||
//table->setText(cnt, "type", tr("虚拟设备"));
|
table->setData(cnt, "type", enum_xixun_async)->setText(tr("异步卡"));//added by alahover 20230822
|
||||||
table->setText(cnt, "name", cardId);
|
table->setText(cnt, "name", cardId);
|
||||||
table->setText(cnt, "link", addr);
|
table->setText(cnt, "link", addr);
|
||||||
//table->setText(cnt, "vcsNum", QString::number(*(quint32_be*)(data.data()+headMap.body)));
|
|
||||||
//table->setText(cnt, "netPorts", "P:"+QString::number(virtualVCM));
|
|
||||||
//table->setText(cnt, "info", "备注:可直接配屏,无需发送卡");
|
|
||||||
} else {
|
} else {
|
||||||
auto bytes = gram.data();
|
auto bytes = gram.data();
|
||||||
auto packet = (UDPPacket *)bytes.data();
|
auto packet = (UDPPacket *)bytes.data();
|
||||||
|
@ -227,6 +225,7 @@ MainWin::MainWin() {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
table->setRowCount(cnt+1);
|
table->setRowCount(cnt+1);
|
||||||
|
table->setData(cnt, "type", enum_xixun_async)->setText(tr("异步卡"));
|
||||||
table->setText(cnt, "name", packet->serialCode);
|
table->setText(cnt, "name", packet->serialCode);
|
||||||
table->setText(cnt, "link", addr);
|
table->setText(cnt, "link", addr);
|
||||||
}
|
}
|
||||||
|
@ -246,10 +245,13 @@ void MainWin::getCard() {
|
||||||
auto msg = QByteArray::fromHex("5555 01 0D 0008 FFFFFFFF 0000ABCD A0000000 0000 38CB847E 00000000 0000ABCD CD040446");
|
auto msg = QByteArray::fromHex("5555 01 0D 0008 FFFFFFFF 0000ABCD A0000000 0000 38CB847E 00000000 0000ABCD CD040446");
|
||||||
auto res = sendMsg(msg, 0x1E0, 10000, [=](int, const QByteArray data) {
|
auto res = sendMsg(msg, 0x1E0, 10000, [=](int, const QByteArray data) {
|
||||||
if(*(quint32_be*)(data.data()+headMap.ptr) != 0xA0000000) return;
|
if(*(quint32_be*)(data.data()+headMap.ptr) != 0xA0000000) return;
|
||||||
auto rr = 0;
|
auto rr = table->rowCount();
|
||||||
table->setRowCount(rr+1);
|
table->setRowCount(rr+1);
|
||||||
int virtualVCM = *(quint16_be*)(data.data()+headMap.srcAddr);
|
int virtualVCM = *(quint16_be*)(data.data()+headMap.srcAddr);
|
||||||
table->setText(rr, "type", tr("虚拟设备"));
|
//modified by alahover -s 20230822
|
||||||
|
auto ver = *(byte*)(data.data()+headMap.ver);
|
||||||
|
if(ver==0x58) table->setData(rr, "type", enum_zrf)->setText(tr("PC虚拟卡V1.0"));
|
||||||
|
else if(ver==0x01) table->setData(rr, "type", enum_xixun_sync)->setText(tr("PC虚拟卡V0.0"));
|
||||||
table->setText(rr, "name", tr("网口:")+QString::number(virtualVCM));
|
table->setText(rr, "name", tr("网口:")+QString::number(virtualVCM));
|
||||||
table->setText(rr, "link", "千兆网直连");
|
table->setText(rr, "link", "千兆网直连");
|
||||||
table->setText(rr, "vcsNum", QString::number(*(quint32_be*)(data.data()+headMap.body)));
|
table->setText(rr, "vcsNum", QString::number(*(quint32_be*)(data.data()+headMap.body)));
|
||||||
|
@ -260,6 +262,26 @@ void MainWin::getCard() {
|
||||||
QString err = pcap_geterr(pcapSend);
|
QString err = pcap_geterr(pcapSend);
|
||||||
if(! err.endsWith("(2150891551)")) QMessageBox::critical(this, "Error", QString(tr("发送失败: "))+QString::fromLocal8Bit(pcap_geterr(pcapSend)));
|
if(! err.endsWith("(2150891551)")) QMessageBox::critical(this, "Error", QString(tr("发送失败: "))+QString::fromLocal8Bit(pcap_geterr(pcapSend)));
|
||||||
}
|
}
|
||||||
|
//modified by alahover -s 20230822
|
||||||
|
msg = QByteArray::fromHex("5555 001122334455 001122334455 105a 13 00 00 00 00 e0 ff ff 00 f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");
|
||||||
|
res = sendMsg(msg, 0x1E0, 10000, [=](int, const QByteArray data) {
|
||||||
|
auto rr = table->rowCount();
|
||||||
|
table->setRowCount(rr+1);
|
||||||
|
int virtualVCM = *(quint8*)(data.data()+headMap_zrf.netPort);
|
||||||
|
unsigned short ver = *(quint16_be *)(data.data()+headMap_zrf.protcolFlag);
|
||||||
|
if(ver==0x58 || ver==0x00 || ver==0x22) table->setData(rr, "type", enum_zrf)->setText(tr("PC虚拟卡V1.0"));
|
||||||
|
else if(ver==0x01) table->setData(rr, "type", enum_xixun_sync)->setText(tr("PC虚拟卡V0.0"));
|
||||||
|
table->setText(rr, "name", tr("网口:")+QString::number(virtualVCM));
|
||||||
|
table->setText(rr, "link", "千兆网直连");
|
||||||
|
table->setText(rr, "vcsNum", QString::number(*(quint32_be*)(data.data()+17)));
|
||||||
|
table->setText(rr, "netPorts", "P:"+QString::number(virtualVCM));
|
||||||
|
table->setText(rr, "info", "备注:可直接配屏,无需发送卡");
|
||||||
|
});
|
||||||
|
if(res) {
|
||||||
|
QString err = pcap_geterr(pcapSend);
|
||||||
|
if(! err.endsWith("(2150891551)")) QMessageBox::critical(this, "Error", QString(tr("发送失败: "))+QString::fromLocal8Bit(pcap_geterr(pcapSend)));
|
||||||
|
}
|
||||||
|
|
||||||
auto data = JToBytes(JObj{{"action", "getInfo"}});
|
auto data = JToBytes(JObj{{"action", "getInfo"}});
|
||||||
uchar ccc[]{0x7E, 0x7E, 0x7E, 0x90, 0x42, 0x72, 0x6F, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x21,
|
uchar ccc[]{0x7E, 0x7E, 0x7E, 0x90, 0x42, 0x72, 0x6F, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x21,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1C, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x9F};
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x1C, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x9F};
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
<qresource prefix="/">
|
<qresource prefix="/">
|
||||||
<file>128.ico</file>
|
<file>128.ico</file>
|
||||||
<file>imgs/align-left.png</file>
|
<file>imgs/align-left.png</file>
|
||||||
<file>imgs/align-right.png</file>
|
<file>imgs/align-right.png</file>
|
||||||
<file>imgs/align-top.png</file>
|
<file>imgs/align-top.png</file>
|
||||||
<file>imgs/align-bottom.png</file>
|
<file>imgs/align-bottom.png</file>
|
||||||
<file>imgs/arrange-left.png</file>
|
<file>imgs/arrange-left.png</file>
|
||||||
<file>imgs/arrange-right.png</file>
|
<file>imgs/arrange-right.png</file>
|
||||||
<file>imgs/arrange-top.png</file>
|
<file>imgs/arrange-top.png</file>
|
||||||
<file>imgs/arrange-bottom.png</file>
|
<file>imgs/arrange-bottom.png</file>
|
||||||
<file>imgs/checkbox-check.png</file>
|
<file>imgs/checkbox-check.png</file>
|
||||||
<file>imgs/checkbox-un.png</file>
|
<file>imgs/checkbox-un.png</file>
|
||||||
<file>imgs/radio-check.png</file>
|
<file>imgs/radio-check.png</file>
|
||||||
|
@ -31,5 +31,7 @@
|
||||||
<file>imgs/conn8.png</file>
|
<file>imgs/conn8.png</file>
|
||||||
<file>imgs/macos-minimize.png</file>
|
<file>imgs/macos-minimize.png</file>
|
||||||
<file>imgs/close.png</file>
|
<file>imgs/close.png</file>
|
||||||
|
<file>imgs/macos-max.png</file>
|
||||||
|
<file>imgs/macos-max1.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user