qt/LedOK/base/softconfigdialog.cpp

59 lines
2.1 KiB
C++
Raw Normal View History

2022-01-04 18:11:48 +08:00
#include "softconfigdialog.h"
2022-08-25 18:37:24 +08:00
#include "cfg.h"
#include "globaldefine.h"
#include <QVBoxLayout>
#include <QLabel>
#include <QPushButton>
2022-01-04 18:11:48 +08:00
#include <QSettings>
2022-08-25 18:37:24 +08:00
SoftConfigDialog::SoftConfigDialog(QWidget *parent) : BaseDlg(parent) {
resize(400, 300);
setWindowTitle(tr("Software Configuration"));
auto vbox = new QVBoxLayout(this);
auto pushButton = new QPushButton("X");
2022-10-27 15:07:45 +08:00
pushButton->setMinimumSize(30, 24);
2022-08-25 18:37:24 +08:00
connect(pushButton, &QPushButton::clicked, this, &QWidget::close);
vbox->addWidget(pushButton, 0, Qt::AlignRight);
press_fd = new QCheckBox(tr("Video compress to")+" 720p");
2022-10-27 15:07:45 +08:00
press_fd->setChecked(gVideoCompress);
2022-08-25 18:37:24 +08:00
vbox->addWidget(press_fd);
trans_fd = new QCheckBox(tr("Video transcoding to")+" h264");
2022-10-27 15:07:45 +08:00
trans_fd->setChecked(gVideoTranscoding);
2022-08-25 18:37:24 +08:00
vbox->addWidget(trans_fd);
auto hbox = new QHBoxLayout();
hbox->setContentsMargins(-1, 0, -1, -1);
anti_fd = new QCheckBox(tr("Text antialiasing"));
2022-10-27 15:07:45 +08:00
anti_fd->setChecked(gTextAntialiasing);
2022-08-25 18:37:24 +08:00
hbox->addWidget(anti_fd, 0, Qt::AlignTop);
auto anti_tip = new QLabel(tr("TextAntilaTip"));
anti_tip->setStyleSheet("color:#FF0000;");
anti_tip->setWordWrap(true);
hbox->addWidget(anti_tip);
vbox->addLayout(hbox);
vbox->addWidget(guangying_fd = new QCheckBox(tr("GuangYinPin")));
2022-10-27 15:07:45 +08:00
guangying_fd->setChecked(gShowLoraScreen);
vbox->addWidget(fdWidthSplit = new QCheckBox(tr("Width Split")));
fdWidthSplit->setChecked(gWidthSplit);
2022-08-25 18:37:24 +08:00
auto ok_btn = new QPushButton(tr("OK"));
vbox->addWidget(ok_btn, 0, Qt::AlignCenter);
connect(ok_btn, &QPushButton::clicked, this, [this]() {
QSettings settings;
2022-10-27 15:07:45 +08:00
settings.setValue("VideoCompress", gVideoCompress = press_fd->isChecked());
settings.setValue("VideoTranscoding", gVideoTranscoding = trans_fd->isChecked());
settings.setValue("TextAntialiasing", gTextAntialiasing = anti_fd->isChecked());
settings.setValue("GuangYingPin",gShowLoraScreen = guangying_fd->isChecked());
settings.setValue("WidthSplit", gWidthSplit = fdWidthSplit->isChecked());
2022-08-25 18:37:24 +08:00
accept();
});
2022-01-04 18:11:48 +08:00
}