qt/LedOK/base/softconfigdialog.cpp

55 lines
2.0 KiB
C++
Raw Normal View History

2023-04-18 14:14:46 +08:00
#include "softconfigdialog.h"
#include "cfg.h"
#include "globaldefine.h"
#include <QVBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <QSettings>
2023-04-25 16:30:58 +08:00
SoftConfigDialog::SoftConfigDialog(QWidget *parent) : QDialog(parent) {
setWindowFlag(Qt::WindowContextHelpButtonHint, 0);
2023-04-18 14:14:46 +08:00
resize(400, 300);
setWindowTitle(tr("Software Config"));
auto vbox = new QVBoxLayout(this);
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"));
2023-04-25 16:30:58 +08:00
anti_tip->setStyleSheet("QLabel{color: #f00;}");
2023-04-18 14:14:46 +08:00
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();
});
}