Merge branch 'master' of github.com:royqh1979/RedPanda-CPP
# Conflicts: # NEWS.md
This commit is contained in:
commit
4a89e97844
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -2760,7 +2760,11 @@ void MainWindow::onProblemSetIndexChanged(const QModelIndex ¤t, const QMod
|
|||
mOJProblemModel.setProblem(problem);
|
||||
ui->lblProblem->setText(mOJProblemModel.getTitle());
|
||||
ui->lblProblem->setToolTip(mOJProblemModel.getTooltip());
|
||||
if (mOJProblemModel.count()>0) {
|
||||
ui->lstProblemCases->setCurrentIndex(mOJProblemModel.index(0,0));
|
||||
} else {
|
||||
onProblemCaseIndexChanged(QModelIndex(),QModelIndex());
|
||||
}
|
||||
openCloseBottomPanel(true);
|
||||
ui->tabMessages->setCurrentWidget(ui->tabProblem);
|
||||
ui->tabProblem->setEnabled(true);
|
||||
|
@ -3696,7 +3700,7 @@ void MainWindow::onOJProblemCaseFinished(const QString& id, int current, int tot
|
|||
if (row>=0) {
|
||||
POJProblemCase problemCase = mOJProblemModel.getCase(row);
|
||||
ProblemCaseValidator validator;
|
||||
problemCase->testState = validator.validate(problemCase)?
|
||||
problemCase->testState = validator.validate(problemCase,pSettings->executor().ignoreSpacesWhenValidatingCases())?
|
||||
ProblemCaseTestState::Passed:
|
||||
ProblemCaseTestState::Failed;
|
||||
mOJProblemModel.update(row);
|
||||
|
@ -5749,3 +5753,13 @@ void MainWindow::on_actionDelete_to_BOL_triggered()
|
|||
e->deleteToBOL();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_btnCaseValidateOptions_clicked()
|
||||
{
|
||||
changeOptions(
|
||||
SettingsDialog::tr("Problem Set"),
|
||||
SettingsDialog::tr("Program Runner")
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -529,6 +529,8 @@ private slots:
|
|||
|
||||
void on_actionDelete_to_BOL_triggered();
|
||||
|
||||
void on_btnCaseValidateOptions_clicked();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
EditorList *mEditorList;
|
||||
|
|
|
@ -506,7 +506,7 @@
|
|||
<enum>QTabWidget::South</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
|
@ -1258,6 +1258,17 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnCaseValidateOptions">
|
||||
<property name="text">
|
||||
<string>Problem Cases Validation Options</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<normaloff>:/icons/images/newlook24/083-toolbar.png</normaloff>:/icons/images/newlook24/083-toolbar.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
|
@ -1381,7 +1392,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1114</width>
|
||||
<height>30</height>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
|
|
@ -6,7 +6,7 @@ ProblemCaseValidator::ProblemCaseValidator()
|
|||
|
||||
}
|
||||
|
||||
bool ProblemCaseValidator::validate(POJProblemCase problemCase)
|
||||
bool ProblemCaseValidator::validate(POJProblemCase problemCase, bool ignoreSpaces)
|
||||
{
|
||||
if (!problemCase)
|
||||
return false;
|
||||
|
@ -15,8 +15,42 @@ bool ProblemCaseValidator::validate(POJProblemCase problemCase)
|
|||
if (output.count()!=expected.count())
|
||||
return false;
|
||||
for (int i=0;i<output.count();i++) {
|
||||
if (ignoreSpaces) {
|
||||
if (!equalIgnoringSpaces(output[i],expected[i]))
|
||||
return false;
|
||||
} else {
|
||||
if (output[i]!=expected[i])
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ProblemCaseValidator::equalIgnoringSpaces(const QString &s1, const QString &s2)
|
||||
{
|
||||
QStringList strList1=split(s1);
|
||||
QStringList strList2=split(s2);
|
||||
return (strList1==strList2);
|
||||
}
|
||||
|
||||
QStringList ProblemCaseValidator::split(const QString &s)
|
||||
{
|
||||
QStringList result;
|
||||
const QChar* p = s.data();
|
||||
const QChar* start = p;
|
||||
while (p->unicode()!=0) {
|
||||
if (p->isSpace()) {
|
||||
if (!start->isSpace()) {
|
||||
result.append(QString(start,p-start));
|
||||
}
|
||||
start = p;
|
||||
} else if (start->isSpace()) {
|
||||
start = p;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
if (!start->isSpace()) {
|
||||
result.append(QString(start,p-start));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,10 @@ class ProblemCaseValidator
|
|||
{
|
||||
public:
|
||||
ProblemCaseValidator();
|
||||
bool validate(POJProblemCase problemCase);
|
||||
bool validate(POJProblemCase problemCase,bool ignoreSpaces);
|
||||
private:
|
||||
bool equalIgnoringSpaces(const QString& s1, const QString& s2);
|
||||
QStringList split(const QString& s);
|
||||
};
|
||||
|
||||
#endif // PROBLEMCASEVALIDATOR_H
|
||||
|
|
|
@ -2859,6 +2859,16 @@ void Settings::Executor::setCompetivieCompanionPort(int newCompetivieCompanionPo
|
|||
mCompetivieCompanionPort = newCompetivieCompanionPort;
|
||||
}
|
||||
|
||||
bool Settings::Executor::ignoreSpacesWhenValidatingCases() const
|
||||
{
|
||||
return mIgnoreSpacesWhenValidatingCases;
|
||||
}
|
||||
|
||||
void Settings::Executor::setIgnoreSpacesWhenValidatingCases(bool newIgnoreSpacesWhenValidatingCases)
|
||||
{
|
||||
mIgnoreSpacesWhenValidatingCases = newIgnoreSpacesWhenValidatingCases;
|
||||
}
|
||||
|
||||
bool Settings::Executor::enableCompetitiveCompanion() const
|
||||
{
|
||||
return mEnableCompetitiveCompanion;
|
||||
|
@ -2891,7 +2901,7 @@ void Settings::Executor::doSave()
|
|||
saveValue("enable_proble_set", mEnableProblemSet);
|
||||
saveValue("enable_competivie_companion", mEnableCompetitiveCompanion);
|
||||
saveValue("competitive_companion_port", mCompetivieCompanionPort);
|
||||
|
||||
saveValue("ignore_spaces_when_validating_cases", mIgnoreSpacesWhenValidatingCases);
|
||||
}
|
||||
|
||||
bool Settings::Executor::pauseConsole() const
|
||||
|
@ -2916,6 +2926,7 @@ void Settings::Executor::doLoad()
|
|||
mEnableProblemSet = boolValue("enable_proble_set",true);
|
||||
mEnableCompetitiveCompanion = boolValue("enable_competivie_companion",true);
|
||||
mCompetivieCompanionPort = intValue("competitive_companion_port",10045);
|
||||
mIgnoreSpacesWhenValidatingCases = boolValue("ignore_spaces_when_validating_cases",false);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -794,6 +794,9 @@ public:
|
|||
int competivieCompanionPort() const;
|
||||
void setCompetivieCompanionPort(int newCompetivieCompanionPort);
|
||||
|
||||
bool ignoreSpacesWhenValidatingCases() const;
|
||||
void setIgnoreSpacesWhenValidatingCases(bool newIgnoreSpacesWhenValidatingCases);
|
||||
|
||||
private:
|
||||
// general
|
||||
bool mPauseConsole;
|
||||
|
@ -807,6 +810,7 @@ public:
|
|||
bool mEnableProblemSet;
|
||||
bool mEnableCompetitiveCompanion;
|
||||
int mCompetivieCompanionPort;
|
||||
bool mIgnoreSpacesWhenValidatingCases;
|
||||
|
||||
protected:
|
||||
void doSave() override;
|
||||
|
|
|
@ -20,6 +20,7 @@ void ExecutorProblemSetWidget::doLoad()
|
|||
ui->grpProblemSet->setChecked(pSettings->executor().enableProblemSet());
|
||||
ui->grpCompetitiveCompanion->setChecked(pSettings->executor().enableCompetitiveCompanion());
|
||||
ui->spinPortNumber->setValue(pSettings->executor().competivieCompanionPort());
|
||||
ui->chkIgnoreSpacesWhenValidatingCases->setChecked(pSettings->executor().ignoreSpacesWhenValidatingCases());
|
||||
}
|
||||
|
||||
void ExecutorProblemSetWidget::doSave()
|
||||
|
@ -27,6 +28,7 @@ void ExecutorProblemSetWidget::doSave()
|
|||
pSettings->executor().setEnableProblemSet(ui->grpProblemSet->isChecked());
|
||||
pSettings->executor().setEnableCompetitiveCompanion(ui->grpCompetitiveCompanion->isChecked());
|
||||
pSettings->executor().setCompetivieCompanionPort(ui->spinPortNumber->value());
|
||||
pSettings->executor().setIgnoreSpacesWhenValidatingCases(ui->chkIgnoreSpacesWhenValidatingCases->isChecked());
|
||||
pSettings->executor().save();
|
||||
pMainWindow->applySettings();
|
||||
}
|
||||
|
|
|
@ -65,6 +65,13 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkIgnoreSpacesWhenValidatingCases">
|
||||
<property name="text">
|
||||
<string>Ignore spaces when validating problem cases</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
|
|
@ -317,7 +317,7 @@ void FormatterGeneralWidget::updateCodeFormatter(Settings::CodeFormatter &format
|
|||
PFormatterStyleItem item = mStylesModel.getStyle(ui->cbBraceStyle->currentIndex());
|
||||
if (item)
|
||||
format.setBraceStyle(item->style);
|
||||
if (ui->rbIndentSpaces) {
|
||||
if (ui->rbIndentSpaces->isChecked()) {
|
||||
format.setIndentStyle(FormatterIndentType::fitSpace);
|
||||
} else {
|
||||
format.setIndentStyle(FormatterIndentType::fitTab);
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
#define VERSION_H
|
||||
#include <QObject>
|
||||
|
||||
#define DEVCPP_VERSION "beta.0.10.2"
|
||||
#define DEVCPP_VERSION "beta.0.10.3"
|
||||
|
||||
#endif // VERSION_H
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
!define COMPILERNAME "MinGW-w64 X86_64 GCC 11.2"
|
||||
!define COMPILERFOLDER "MinGW64"
|
||||
!define DEVCPP_VERSION "beta.0.8.1"
|
||||
!define DEVCPP_VERSION "beta.0.10.3"
|
||||
!define FINALNAME "RedPanda-Cpp.7.${DEVCPP_VERSION}.${COMPILERNAME}.Setup.exe"
|
||||
!define DISPLAY_NAME "Red Panda Dev-C++ 7 ${DEVCPP_VERSION}"
|
||||
|
||||
|
|
Loading…
Reference in New Issue