117 lines
3.3 KiB
C++
117 lines
3.3 KiB
C++
|
#include "progcreatedlg.h"
|
||
|
#include "gqt.h"
|
||
|
#include "ui_wnewprogram.h"
|
||
|
|
||
|
ProgCreateDlg::ProgCreateDlg(QString name, int width, int height, QString remarks, QWidget *parent, bool lockName) : BaseDlg(parent) {
|
||
|
auto vBox = new VBox(this);
|
||
|
|
||
|
auto hBox = new HBox(vBox);
|
||
|
hBox->setContentsMargins(0, 0, 0, 0);
|
||
|
hBox->addStretch();
|
||
|
|
||
|
auto label = new QLabel(tr("Solution Information"));
|
||
|
hBox->addWidget(label);
|
||
|
hBox->addStretch();
|
||
|
|
||
|
auto btnClose = new QPushButton("X");
|
||
|
btnClose->setProperty("ssType", "progManageTool");
|
||
|
connect(btnClose, &QPushButton::clicked, this, &QDialog::close);
|
||
|
hBox->addWidget(btnClose);
|
||
|
|
||
|
auto line = new QFrame;
|
||
|
line->setFrameShape(QFrame::HLine);
|
||
|
line->setFrameShadow(QFrame::Sunken);
|
||
|
vBox->addWidget(line);
|
||
|
|
||
|
hBox = new HBox(vBox);
|
||
|
|
||
|
label = new QLabel(tr("Solution Name"));
|
||
|
label->setMinimumWidth(90);
|
||
|
label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||
|
hBox->addWidget(label);
|
||
|
hBox->addSpacing(6);
|
||
|
|
||
|
fdName = new QLineEdit(name);
|
||
|
if(lockName) fdName->setDisabled(true);
|
||
|
hBox->addWidget(fdName);
|
||
|
|
||
|
hBox = new HBox(vBox);
|
||
|
hBox->setSpacing(12);
|
||
|
|
||
|
label = new QLabel(tr("Resolution"));
|
||
|
label->setMinimumWidth(90);
|
||
|
label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||
|
hBox->addWidget(label);
|
||
|
hBox->addSpacing(6);
|
||
|
|
||
|
auto label_4 = new QLabel(tr("Width"));
|
||
|
hBox->addWidget(label_4);
|
||
|
|
||
|
fdWidth = new QSpinBox;
|
||
|
fdWidth->setMaximum(99999);
|
||
|
fdWidth->setValue(width);
|
||
|
hBox->addWidget(fdWidth);
|
||
|
|
||
|
auto label_5 = new QLabel(tr("Height"));
|
||
|
hBox->addWidget(label_5);
|
||
|
|
||
|
fdHeight = new QSpinBox;
|
||
|
fdHeight->setMaximum(99999);
|
||
|
fdHeight->setValue(height);
|
||
|
hBox->addWidget(fdHeight);
|
||
|
hBox->addStretch();
|
||
|
|
||
|
hBox = new HBox(vBox);
|
||
|
|
||
|
label = new QLabel(tr("Remarks"));
|
||
|
label->setMinimumWidth(90);
|
||
|
label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||
|
hBox->addWidget(label);
|
||
|
hBox->addSpacing(6);
|
||
|
|
||
|
fdRemark = new QTextEdit(remarks);
|
||
|
fdRemark->setFixedSize(300, 80);
|
||
|
hBox->addWidget(fdRemark);
|
||
|
|
||
|
line = new QFrame;
|
||
|
line->setFrameShape(QFrame::HLine);
|
||
|
line->setFrameShadow(QFrame::Sunken);
|
||
|
vBox->addWidget(line);
|
||
|
|
||
|
hBox = new HBox(vBox);
|
||
|
|
||
|
auto lbSplitWidth = new QLabel(tr("节目超宽需要打折, 请输入打折宽度"));
|
||
|
lbSplitWidth->setVisible(false);
|
||
|
hBox->addWidget(lbSplitWidth);
|
||
|
|
||
|
fdSplitWidth = new QSpinBox;
|
||
|
fdSplitWidth->setVisible(false);
|
||
|
fdSplitWidth->setMaximum(1920);
|
||
|
hBox->addWidget(fdSplitWidth);
|
||
|
hBox->addStretch();
|
||
|
|
||
|
connect(fdWidth, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [this, lbSplitWidth](int value) {
|
||
|
if(value > 1920) {
|
||
|
fdSplitWidth->show();
|
||
|
lbSplitWidth->show();
|
||
|
int den = (value+1919) / 1920;
|
||
|
fdSplitWidth->setValue((value+den-1) / den);
|
||
|
} else {
|
||
|
fdSplitWidth->hide();
|
||
|
lbSplitWidth->hide();
|
||
|
fdSplitWidth->setValue(0);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
hBox = new HBox(vBox);
|
||
|
hBox->addStretch();
|
||
|
|
||
|
auto bnOK = new QPushButton(tr("OK"));
|
||
|
connect(bnOK, &QPushButton::clicked, this, &QDialog::accept);
|
||
|
hBox->addWidget(bnOK);
|
||
|
|
||
|
auto bnCancel = new QPushButton(tr("Cancel"));
|
||
|
connect(bnCancel, &QPushButton::clicked, this, &QDialog::reject);
|
||
|
hBox->addWidget(bnCancel);
|
||
|
}
|