qt/LedOK/LoUIClass/softconfigdialog.cpp

103 lines
2.4 KiB
C++
Raw Normal View History

2022-01-04 18:11:48 +08:00
#include "softconfigdialog.h"
#include "ui_softconfigdialog.h"
#include "loappconfig.h"
#include <QSettings>
SoftConfigDialog::SoftConfigDialog(QWidget *parent) :
LoQDialog(parent),
ui(new Ui::SoftConfigDialog)
{
ui->setupUi(this);
LoAppConfig *cfg = LoAppConfig::getInstance();
QSettings *settings = new QSettings(cfg->OrganizationName(), cfg->ApplicationName());
if(settings->value("videoconvert").isValid())
{
if(settings->value("videoconvert").toBool())
{
ui->checkBoxVideoConvert->setChecked(true);
}
else {
ui->checkBoxVideoConvert->setChecked(false);
}
}
else {
ui->checkBoxVideoConvert->setChecked(false);
}
if(settings->value("TextAntialiasing").isValid())
{
if(settings->value("TextAntialiasing").toBool())
{
ui->checkBoxFontGuanghua->setChecked(true);
}
else {
ui->checkBoxFontGuanghua->setChecked(false);
}
}
else {
ui->checkBoxFontGuanghua->setChecked(false);
}
//元亨
// ui->checkBoxGuangYingPin->setVisible(false);
if(settings->value("GuangYingPin").isValid())
{
if(settings->value("GuangYingPin").toBool())
{
ui->checkBoxGuangYingPin->setChecked(true);
}
else {
ui->checkBoxGuangYingPin->setChecked(false);
}
}
else {
ui->checkBoxGuangYingPin->setChecked(false);
}
connect(ui->pushButton_2, SIGNAL(clicked()), this, SLOT(OnOK()));
}
SoftConfigDialog::~SoftConfigDialog()
{
delete ui;
}
void SoftConfigDialog::OnOK()
{
LoAppConfig *cfg = LoAppConfig::getInstance();
QSettings *settings = new QSettings(cfg->OrganizationName(), cfg->ApplicationName());
if(ui->checkBoxVideoConvert->isChecked())
{
settings->setValue("videoconvert",true);
}
else {
settings->setValue("videoconvert",false);
}
m_globBoolFontantialiasing=ui->checkBoxFontGuanghua->isChecked();
if(m_globBoolFontantialiasing)
{
settings->setValue("TextAntialiasing",true);
}
else {
settings->setValue("TextAntialiasing",false);
}
m_globBoolGuangYingPin=ui->checkBoxGuangYingPin->isChecked();
if(m_globBoolGuangYingPin)
{
settings->setValue("GuangYingPin",true);
}
else {
settings->setValue("GuangYingPin",false);
}
QDialog::accept();
}