qt/ledset/expertwin.cpp

338 lines
9.5 KiB
C++
Raw Normal View History

2022-08-25 18:43:03 +08:00
#include "expertwin.h"
#include "gqt.h"
2022-08-25 18:43:03 +08:00
#include "table.h"
#include "screenunit.h"
#include "expertsmartpointsetwin.h"
2022-08-26 23:15:25 +08:00
#include "expertscreenconnwin.h"
2022-08-25 18:43:03 +08:00
#include <QTabWidget>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QGroupBox>
2022-09-13 23:16:36 +08:00
#include <QStackedWidget>
2022-08-26 23:15:25 +08:00
#include <QStackedLayout>
2022-09-13 23:16:36 +08:00
#include <QRadioButton>
2022-08-25 18:43:03 +08:00
QColor colors[] {QColor(0xdd0000), QColor(0xdd6600), QColor(0x008800), QColor(0x008888), QColor(0x0000ff), QColor(0x777777), QColor(0xaaaaaa)};
ExpertWin::ExpertWin(QWidget *parent) : BaseWin{parent} {
//setWindowModality(Qt::WindowModal);
setAttribute(Qt::WA_DeleteOnClose);
setWindowTitle("专家调屏");
resize(1024, 720);
auto vBox = new QVBoxLayout(center);
vBox->setContentsMargins(0,0,0,0);
vBox->setSpacing(3);
vBox->addLayout(addBtns(new QHBoxLayout()));
auto tab = new QTabWidget;
tab->setStyleSheet(R"rrr(
QTabWidget::pane {border: 1px solid #888; margin-top:-1px;}
QTabBar::tab {margin-top: 4px; padding: 6px 20px; border: 1px solid #888; border-radius: 0 0 3px 3px;}
QTabBar::tab:selected {margin-top: 0; border-bottom: none; color: #acf; background-color: #000;}
)rrr");
vBox->addWidget(tab);
auto sendPanel = new QWidget;
tab->addTab(sendPanel, "发送设备");
{
auto hhh = new QHBoxLayout(sendPanel);
hhh->setContentsMargins(6,6,6,6);
auto wgtLeft = new QWidget;
wgtLeft->setMaximumWidth(400);
hhh->addWidget(wgtLeft);
auto vLeft = new QVBoxLayout(wgtLeft);
vLeft->setContentsMargins(0,0,0,0);
auto hBox = new QHBoxLayout;
hBox->addWidget(new QLabel("分辨率: "));
auto fdW = new QLineEdit(QString::number(screenWidth));
hBox->addWidget(fdW);
hBox->addWidget(new QLabel("X"));
auto fdH = new QLineEdit(QString::number(screenHeight));
hBox->addWidget(fdH);
vLeft->addLayout(hBox);
hBox = new QHBoxLayout;
hBox->addStretch();
auto btnGet = new QPushButton("刷新");
btnGet->setMinimumWidth(80);
hBox->addWidget(btnGet);
hBox->addSpacing(40);
auto btnSet = new QPushButton("设置");
btnSet->setMinimumWidth(80);
hBox->addWidget(btnSet);
hBox->addStretch();
vLeft->addLayout(hBox);
auto table = new Table{
{"face", "网口", 40},
{"x", "X", Table::Stretch},
{"y", "Y", Table::Stretch},
{"w", "宽度", Table::Stretch},
{"h", "高度", Table::Stretch},
{"audio", "音频开关", Table::Stretch},
{"backup", "备份开关", Table::Stretch}
};
table->setDefs();
vLeft->addWidget(table);
table->setRowCount(4);
auto canvas = new ResizeEmitedWgt;
2022-08-25 18:43:03 +08:00
auto screen = new QWidget(canvas);
screen->setGeometry(0, 0, screenWidth, screenHeight);
screen->setAutoFillBackground(true);
auto pal = palette();
pal.setColor(QPalette::Window, QColor(0, 0, 0));
screen->setPalette(pal);
connect(canvas, &ResizeEmitedWgt::resized, this, [this, canvas, screen] {
2022-08-25 18:43:03 +08:00
rate = qMin(canvas->width()/(double)screenWidth, canvas->height()/(double)screenHeight);
if(rate==0) return;
screen->resize(qRound(screenWidth*rate), qRound(screenHeight*rate));
auto children = screen->children();
foreach(auto childObj, children) {
auto unit = static_cast<ScreenUnit*>(childObj);
unit->setGeometry(qRound(unit->mX*rate), qRound(unit->mY*rate), qRound(unit->mW*rate), qRound(unit->mH*rate));
}
});
hhh->addWidget(canvas);
int idx = 0;
for(int rr=0; rr<4; rr++) {
QString name = "P"+QString::number(rr+1);
table->setValue(rr, "name", name);
table->setValue(rr, "x", QString::number(idx));
table->setValue(rr, "y", "0");
table->setValue(rr, "w", "128");
table->setValue(rr, "h", "128");
table->setValue(rr, "audio", "0");
table->setValue(rr, "backup", "0");
auto unit = new ScreenUnit(this, name, idx, 0, 128, 128, screen);
unit->setAutoFillBackground(true);
pal.setColor(QPalette::Window, colors[rr]);
unit->setPalette(pal);
idx += 128;
}
}
auto receivePanel = new QWidget;
tab->addTab(receivePanel, "接收卡");
{
2022-09-13 23:16:36 +08:00
auto vBox = new VBox(receivePanel);
2022-08-26 23:15:25 +08:00
auto gBox = new QGroupBox("模组信息");
2022-08-25 18:43:03 +08:00
vBox->addWidget(gBox);
2022-09-13 23:16:36 +08:00
auto hh = new HBox(gBox);
auto vvv = new VBox(hh);
2022-08-25 18:43:03 +08:00
auto lb = new QLabel("驱动芯片: ");
vvv->addWidget(lb);
lb = new QLabel("译码方式: ");
vvv->addWidget(lb);
2022-09-13 23:16:36 +08:00
vvv = new VBox(hh);
2022-08-25 18:43:03 +08:00
lb = new QLabel("驱动芯片");
vvv->addWidget(lb);
lb = new QLabel("译码方式");
vvv->addWidget(lb);
2022-09-13 23:16:36 +08:00
hh->addSpacing(20);
vvv = new VBox(hh);
2022-08-25 18:43:03 +08:00
lb = new QLabel("模组宽度: ");
vvv->addWidget(lb);
lb = new QLabel("模组高度: ");
vvv->addWidget(lb);
2022-09-13 23:16:36 +08:00
vvv = new VBox(hh);
2022-08-25 18:43:03 +08:00
lb = new QLabel("模组宽度");
vvv->addWidget(lb);
lb = new QLabel("模组高度");
vvv->addWidget(lb);
2022-09-13 23:16:36 +08:00
hh->addSpacing(20);
vvv = new VBox(hh);
2022-08-25 18:43:03 +08:00
lb = new QLabel("扫描数: ");
vvv->addWidget(lb);
lb = new QLabel("数据数组: ");
vvv->addWidget(lb);
2022-09-13 23:16:36 +08:00
vvv = new VBox(hh);
2022-08-25 18:43:03 +08:00
lb = new QLabel("扫描数");
vvv->addWidget(lb);
lb = new QLabel("数据数组");
vvv->addWidget(lb);
2022-09-13 23:16:36 +08:00
hh->addSpacing(20);
vvv = new VBox(hh);
2022-08-25 18:43:03 +08:00
lb = new QLabel("数据线颜色: ");
vvv->addWidget(lb);
lb = new QLabel("模组抽行设置");
vvv->addWidget(lb);
2022-09-13 23:16:36 +08:00
vvv = new VBox(hh);
2022-08-25 18:43:03 +08:00
lb = new QLabel("数据线颜色");
vvv->addWidget(lb);
2022-09-13 23:16:36 +08:00
hh->addStretch();
vvv = new VBox(hh);
2022-08-25 18:43:03 +08:00
auto btn = new QPushButton("模组选择");
vvv->addWidget(btn);
btn = new QPushButton("智能设置");
connect(btn, &QPushButton::clicked, this, [this] {
(new ExpertSmartPointSetWin(this))->show();
});
vvv->addWidget(btn);
2022-09-09 23:25:49 +08:00
gBox = new QGroupBox("单卡带载");
vBox->addWidget(gBox);
2022-09-13 23:16:36 +08:00
hh = new HBox(gBox);
vvv = new VBox(hh);
vvv->addWidget(new QRadioButton("常规设计"));
vvv->addWidget(new QRadioButton("高级设计"));
hh->addSpacing(20);
auto line = new QFrame;
line->setFrameShadow(QFrame::Sunken);
line->setFrameShape(QFrame::VLine);
hh->addWidget(line);
auto stack = new QStackedWidget;
auto poli = stack->sizePolicy();
poli.setVerticalPolicy(QSizePolicy::Maximum);
stack->setSizePolicy(poli);
hh->addWidget(stack);
2022-09-09 23:25:49 +08:00
auto normalPanel = new QWidget;
2022-09-13 23:16:36 +08:00
stack->addWidget(normalPanel);
{
auto hh = new HBox(normalPanel);
auto vvv = new VBox(hh);
lb = new QLabel("宽度");
vvv->addWidget(lb);
lb = new QLabel("高度");
vvv->addWidget(lb);
vvv = new VBox(hh);
auto fdCardWidth = new QSpinBox;
fdCardWidth->setRange(0, 99999);
vvv->addWidget(fdCardWidth);
auto fdCardHeight = new QSpinBox;
fdCardHeight->setRange(0, 99999);
vvv->addWidget(fdCardHeight);
vvv = new VBox(hh);
2022-09-09 23:25:49 +08:00
2022-09-13 23:16:36 +08:00
lb = new QLabel("多开宽度");
vvv->addWidget(lb);
lb = new QLabel("级联方向");
vvv->addWidget(lb);
vvv = new VBox(hh);
auto fdMulti = new QComboBox();
fdMulti->addItem("");
fdMulti->addItem("双开");
fdMulti->addItem("三开");
fdMulti->addItem("四开");
vvv->addWidget(fdMulti);
auto fdDirection = new QComboBox();
fdDirection->addItem("从左到右");
fdDirection->addItem("从右到左");
fdDirection->addItem("从上到下");
fdDirection->addItem("从下到上");
vvv->addWidget(fdDirection);
vvv = new VBox(hh);
lb = new QLabel("插头顺序");
vvv->addWidget(lb);
vvv->addStretch();
vvv = new VBox(hh);
auto fdSord = new QComboBox();
fdSord->addItem("正序");
fdSord->addItem("逆序");
vvv->addWidget(fdSord);
vvv->addStretch();
hh->addStretch();
}
auto advacnedPanel = new QWidget;
stack->addWidget(advacnedPanel);
2022-09-09 23:25:49 +08:00
2022-08-25 18:43:03 +08:00
vBox->addStretch();
}
2022-08-25 22:52:52 +08:00
auto connPanel = new QWidget;
tab->addTab(connPanel, "显示屏连接(正面看屏)");
{
auto vBox = new QVBoxLayout(connPanel);
vBox->setContentsMargins(4, 4, 4, 4);
auto hhh = new QHBoxLayout;
vBox->addLayout(hhh);
auto bnScreen = new QPushButton("屏1");
hhh->addWidget(bnScreen);
hhh->addStretch();
auto lb = new QLabel("显示屏数目:");
hhh->addWidget(lb);
auto fdScreenCnt = new QSpinBox;
fdScreenCnt->setRange(1, 99);
fdScreenCnt->setValue(1);
hhh->addWidget(fdScreenCnt);
2022-08-26 23:15:25 +08:00
auto stack = new QStackedLayout;
vBox->addLayout(stack);
stack->addWidget(new ExpertScreenConnWin());
2022-08-25 22:52:52 +08:00
}
2022-08-25 18:43:03 +08:00
}