qt/LedOK/base/softconfigdialog.cpp
2022-10-27 15:07:45 +08:00

59 lines
2.1 KiB
C++

#include "softconfigdialog.h"
#include "cfg.h"
#include "globaldefine.h"
#include <QVBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <QSettings>
SoftConfigDialog::SoftConfigDialog(QWidget *parent) : BaseDlg(parent) {
resize(400, 300);
setWindowTitle(tr("Software Configuration"));
auto vbox = new QVBoxLayout(this);
auto pushButton = new QPushButton("X");
pushButton->setMinimumSize(30, 24);
connect(pushButton, &QPushButton::clicked, this, &QWidget::close);
vbox->addWidget(pushButton, 0, Qt::AlignRight);
press_fd = new QCheckBox(tr("Video compress to")+" 720p");
press_fd->setChecked(gVideoCompress);
vbox->addWidget(press_fd);
trans_fd = new QCheckBox(tr("Video transcoding to")+" h264");
trans_fd->setChecked(gVideoTranscoding);
vbox->addWidget(trans_fd);
auto hbox = new QHBoxLayout();
hbox->setContentsMargins(-1, 0, -1, -1);
anti_fd = new QCheckBox(tr("Text antialiasing"));
anti_fd->setChecked(gTextAntialiasing);
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")));
guangying_fd->setChecked(gShowLoraScreen);
vbox->addWidget(fdWidthSplit = new QCheckBox(tr("Width Split")));
fdWidthSplit->setChecked(gWidthSplit);
auto ok_btn = new QPushButton(tr("OK"));
vbox->addWidget(ok_btn, 0, Qt::AlignCenter);
connect(ok_btn, &QPushButton::clicked, this, [this]() {
QSettings settings;
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());
accept();
});
}