YoudaoTrans/settingdialog.cpp

30 lines
901 B
C++

#include "settingdialog.h"
#include <DLabel>
#include <QFormLayout>
SettingDialog::SettingDialog(bool sel, bool cp, DDialog *parent)
: DDialog(parent) {
setWindowTitle(tr("Setting"));
auto w = new QWidget(this);
auto flayout = new QFormLayout(w);
addContent(w, Qt::AlignCenter);
swsel = new DSwitchButton(this);
swsel->setChecked(sel);
connect(swsel, &DSwitchButton::checkedChanged, this,
[=](bool v) { emit this->sigSelEnabled(v); });
flayout->addRow(tr("EnableSel"), swsel);
swcp = new DSwitchButton(this);
swcp->setChecked(cp);
connect(swcp, &DSwitchButton::checkedChanged, this,
[=](bool v) { emit this->sigCpEnabled(v); });
flayout->addRow(tr("EnableCp"), swcp);
addSpacing(10);
addContent(new DLabel(tr("SetEffect"), this), Qt::AlignCenter);
}
void SettingDialog::setYoudaoEnabled(bool v) {
swsel->setEnabled(v);
swcp->setEnabled(v);
}