2021-11-02 13:12:36 +08:00
|
|
|
#include "executorproblemsetwidget.h"
|
|
|
|
#include "ui_executorproblemsetwidget.h"
|
|
|
|
#include "../settings.h"
|
|
|
|
#include "../mainwindow.h"
|
|
|
|
|
|
|
|
ExecutorProblemSetWidget::ExecutorProblemSetWidget(const QString& name, const QString& group, QWidget *parent):
|
|
|
|
SettingsWidget(name,group,parent),
|
|
|
|
ui(new Ui::ExecutorProblemSetWidget)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
ExecutorProblemSetWidget::~ExecutorProblemSetWidget()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ExecutorProblemSetWidget::doLoad()
|
|
|
|
{
|
|
|
|
ui->grpProblemSet->setChecked(pSettings->executor().enableProblemSet());
|
|
|
|
ui->grpCompetitiveCompanion->setChecked(pSettings->executor().enableCompetitiveCompanion());
|
|
|
|
ui->spinPortNumber->setValue(pSettings->executor().competivieCompanionPort());
|
2021-11-27 15:43:47 +08:00
|
|
|
ui->chkIgnoreSpacesWhenValidatingCases->setChecked(pSettings->executor().ignoreSpacesWhenValidatingCases());
|
2021-12-15 19:12:16 +08:00
|
|
|
|
|
|
|
ui->cbFont->setCurrentFont(QFont(pSettings->executor().caseEditorFontName()));
|
|
|
|
ui->spinFontSize->setValue(pSettings->executor().caseEditorFontSize());
|
|
|
|
ui->chkOnlyMonospaced->setChecked(pSettings->executor().caseEditorFontOnlyMonospaced());
|
2021-11-02 13:12:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void ExecutorProblemSetWidget::doSave()
|
|
|
|
{
|
|
|
|
pSettings->executor().setEnableProblemSet(ui->grpProblemSet->isChecked());
|
|
|
|
pSettings->executor().setEnableCompetitiveCompanion(ui->grpCompetitiveCompanion->isChecked());
|
|
|
|
pSettings->executor().setCompetivieCompanionPort(ui->spinPortNumber->value());
|
2021-11-27 15:43:47 +08:00
|
|
|
pSettings->executor().setIgnoreSpacesWhenValidatingCases(ui->chkIgnoreSpacesWhenValidatingCases->isChecked());
|
2021-12-15 19:12:16 +08:00
|
|
|
pSettings->executor().setCaseEditorFontName(ui->cbFont->currentFont().family());
|
|
|
|
pSettings->executor().setCaseEditorFontOnlyMonospaced(ui->chkOnlyMonospaced->isChecked());
|
|
|
|
pSettings->executor().setCaseEditorFontSize(ui->spinFontSize->value());
|
2021-11-02 13:12:36 +08:00
|
|
|
pSettings->executor().save();
|
|
|
|
pMainWindow->applySettings();
|
|
|
|
}
|
2021-12-15 19:12:16 +08:00
|
|
|
|
|
|
|
void ExecutorProblemSetWidget::on_chkOnlyMonospaced_stateChanged(int )
|
|
|
|
{
|
|
|
|
if (ui->chkOnlyMonospaced->isChecked()) {
|
|
|
|
ui->cbFont->setFontFilters(QFontComboBox::FontFilter::MonospacedFonts);
|
|
|
|
} else {
|
|
|
|
ui->cbFont->setFontFilters(QFontComboBox::FontFilter::AllFonts);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|