2021-12-26 23:18:28 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
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());
|
2022-07-22 11:34:45 +08:00
|
|
|
ui->grpEnableTimeout->setChecked(pSettings->executor().enableCaseTimeout());
|
|
|
|
|
2022-03-27 11:44:52 +08:00
|
|
|
ui->spinCaseTimeout->setValue(pSettings->executor().caseTimeout());
|
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());
|
2022-03-30 19:28:46 +08:00
|
|
|
pSettings->executor().setEnableCaseTimeout(ui->grpEnableTimeout->isChecked());
|
2022-03-27 11:44:52 +08:00
|
|
|
pSettings->executor().setCaseTimeout(ui->spinCaseTimeout->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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|