251 lines
7.2 KiB
C++
251 lines
7.2 KiB
C++
#include "expertwin.h"
|
|
#include "table.h"
|
|
#include "screenunit.h"
|
|
#include "expertsmartpointsetwin.h"
|
|
#include <QTabWidget>
|
|
#include <QLabel>
|
|
#include <QLineEdit>
|
|
#include <QPushButton>
|
|
#include <QGroupBox>
|
|
|
|
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 Canvas;
|
|
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, &Canvas::resized, this, [this, canvas, screen] {
|
|
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, "接收卡");
|
|
{
|
|
auto vBox = new QVBoxLayout(receivePanel);
|
|
auto gBox = new QGroupBox("模组信息", receivePanel);
|
|
gBox->setForegroundRole(QPalette::Text);
|
|
vBox->addWidget(gBox);
|
|
|
|
auto hhh = new QHBoxLayout(gBox);
|
|
|
|
auto vvv = new QVBoxLayout();
|
|
hhh->addLayout(vvv);
|
|
|
|
auto lb = new QLabel("驱动芯片: ");
|
|
vvv->addWidget(lb);
|
|
|
|
lb = new QLabel("译码方式: ");
|
|
vvv->addWidget(lb);
|
|
|
|
vvv = new QVBoxLayout();
|
|
hhh->addLayout(vvv);
|
|
|
|
lb = new QLabel("驱动芯片");
|
|
vvv->addWidget(lb);
|
|
|
|
lb = new QLabel("译码方式");
|
|
vvv->addWidget(lb);
|
|
|
|
hhh->addSpacing(20);
|
|
vvv = new QVBoxLayout();
|
|
hhh->addLayout(vvv);
|
|
|
|
lb = new QLabel("模组宽度: ");
|
|
vvv->addWidget(lb);
|
|
|
|
lb = new QLabel("模组高度: ");
|
|
vvv->addWidget(lb);
|
|
|
|
vvv = new QVBoxLayout();
|
|
hhh->addLayout(vvv);
|
|
|
|
lb = new QLabel("模组宽度");
|
|
vvv->addWidget(lb);
|
|
|
|
lb = new QLabel("模组高度");
|
|
vvv->addWidget(lb);
|
|
|
|
hhh->addSpacing(20);
|
|
vvv = new QVBoxLayout();
|
|
hhh->addLayout(vvv);
|
|
|
|
lb = new QLabel("扫描数: ");
|
|
vvv->addWidget(lb);
|
|
|
|
lb = new QLabel("数据数组: ");
|
|
vvv->addWidget(lb);
|
|
|
|
vvv = new QVBoxLayout();
|
|
hhh->addLayout(vvv);
|
|
|
|
lb = new QLabel("扫描数");
|
|
vvv->addWidget(lb);
|
|
|
|
lb = new QLabel("数据数组");
|
|
vvv->addWidget(lb);
|
|
|
|
hhh->addSpacing(20);
|
|
vvv = new QVBoxLayout();
|
|
hhh->addLayout(vvv);
|
|
|
|
lb = new QLabel("数据线颜色: ");
|
|
vvv->addWidget(lb);
|
|
|
|
lb = new QLabel("模组抽行设置");
|
|
vvv->addWidget(lb);
|
|
|
|
vvv = new QVBoxLayout();
|
|
hhh->addLayout(vvv);
|
|
|
|
lb = new QLabel("数据线颜色");
|
|
vvv->addWidget(lb);
|
|
|
|
hhh->addStretch();
|
|
vvv = new QVBoxLayout();
|
|
hhh->addLayout(vvv);
|
|
|
|
auto btn = new QPushButton("模组选择");
|
|
vvv->addWidget(btn);
|
|
|
|
btn = new QPushButton("智能设置");
|
|
connect(btn, &QPushButton::clicked, this, [this] {
|
|
(new ExpertSmartPointSetWin(this))->show();
|
|
});
|
|
vvv->addWidget(btn);
|
|
|
|
vBox->addStretch();
|
|
}
|
|
|
|
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);
|
|
|
|
vBox->addStretch();
|
|
}
|
|
}
|