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);
|
mOJProblemModel.setProblem(problem);
|
||||||
ui->lblProblem->setText(mOJProblemModel.getTitle());
|
ui->lblProblem->setText(mOJProblemModel.getTitle());
|
||||||
ui->lblProblem->setToolTip(mOJProblemModel.getTooltip());
|
ui->lblProblem->setToolTip(mOJProblemModel.getTooltip());
|
||||||
|
if (mOJProblemModel.count()>0) {
|
||||||
ui->lstProblemCases->setCurrentIndex(mOJProblemModel.index(0,0));
|
ui->lstProblemCases->setCurrentIndex(mOJProblemModel.index(0,0));
|
||||||
|
} else {
|
||||||
|
onProblemCaseIndexChanged(QModelIndex(),QModelIndex());
|
||||||
|
}
|
||||||
openCloseBottomPanel(true);
|
openCloseBottomPanel(true);
|
||||||
ui->tabMessages->setCurrentWidget(ui->tabProblem);
|
ui->tabMessages->setCurrentWidget(ui->tabProblem);
|
||||||
ui->tabProblem->setEnabled(true);
|
ui->tabProblem->setEnabled(true);
|
||||||
|
@ -3696,7 +3700,7 @@ void MainWindow::onOJProblemCaseFinished(const QString& id, int current, int tot
|
||||||
if (row>=0) {
|
if (row>=0) {
|
||||||
POJProblemCase problemCase = mOJProblemModel.getCase(row);
|
POJProblemCase problemCase = mOJProblemModel.getCase(row);
|
||||||
ProblemCaseValidator validator;
|
ProblemCaseValidator validator;
|
||||||
problemCase->testState = validator.validate(problemCase)?
|
problemCase->testState = validator.validate(problemCase,pSettings->executor().ignoreSpacesWhenValidatingCases())?
|
||||||
ProblemCaseTestState::Passed:
|
ProblemCaseTestState::Passed:
|
||||||
ProblemCaseTestState::Failed;
|
ProblemCaseTestState::Failed;
|
||||||
mOJProblemModel.update(row);
|
mOJProblemModel.update(row);
|
||||||
|
@ -5749,3 +5753,13 @@ void MainWindow::on_actionDelete_to_BOL_triggered()
|
||||||
e->deleteToBOL();
|
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_actionDelete_to_BOL_triggered();
|
||||||
|
|
||||||
|
void on_btnCaseValidateOptions_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
EditorList *mEditorList;
|
EditorList *mEditorList;
|
||||||
|
|
|
@ -506,7 +506,7 @@
|
||||||
<enum>QTabWidget::South</enum>
|
<enum>QTabWidget::South</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
|
@ -1258,6 +1258,17 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
<item>
|
||||||
<spacer name="horizontalSpacer_4">
|
<spacer name="horizontalSpacer_4">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -1381,7 +1392,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1114</width>
|
<width>1114</width>
|
||||||
<height>30</height>
|
<height>25</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuFile">
|
<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)
|
if (!problemCase)
|
||||||
return false;
|
return false;
|
||||||
|
@ -15,8 +15,42 @@ bool ProblemCaseValidator::validate(POJProblemCase problemCase)
|
||||||
if (output.count()!=expected.count())
|
if (output.count()!=expected.count())
|
||||||
return false;
|
return false;
|
||||||
for (int i=0;i<output.count();i++) {
|
for (int i=0;i<output.count();i++) {
|
||||||
|
if (ignoreSpaces) {
|
||||||
|
if (!equalIgnoringSpaces(output[i],expected[i]))
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
if (output[i]!=expected[i])
|
if (output[i]!=expected[i])
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
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:
|
public:
|
||||||
ProblemCaseValidator();
|
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
|
#endif // PROBLEMCASEVALIDATOR_H
|
||||||
|
|
|
@ -2859,6 +2859,16 @@ void Settings::Executor::setCompetivieCompanionPort(int newCompetivieCompanionPo
|
||||||
mCompetivieCompanionPort = newCompetivieCompanionPort;
|
mCompetivieCompanionPort = newCompetivieCompanionPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Settings::Executor::ignoreSpacesWhenValidatingCases() const
|
||||||
|
{
|
||||||
|
return mIgnoreSpacesWhenValidatingCases;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::Executor::setIgnoreSpacesWhenValidatingCases(bool newIgnoreSpacesWhenValidatingCases)
|
||||||
|
{
|
||||||
|
mIgnoreSpacesWhenValidatingCases = newIgnoreSpacesWhenValidatingCases;
|
||||||
|
}
|
||||||
|
|
||||||
bool Settings::Executor::enableCompetitiveCompanion() const
|
bool Settings::Executor::enableCompetitiveCompanion() const
|
||||||
{
|
{
|
||||||
return mEnableCompetitiveCompanion;
|
return mEnableCompetitiveCompanion;
|
||||||
|
@ -2891,7 +2901,7 @@ void Settings::Executor::doSave()
|
||||||
saveValue("enable_proble_set", mEnableProblemSet);
|
saveValue("enable_proble_set", mEnableProblemSet);
|
||||||
saveValue("enable_competivie_companion", mEnableCompetitiveCompanion);
|
saveValue("enable_competivie_companion", mEnableCompetitiveCompanion);
|
||||||
saveValue("competitive_companion_port", mCompetivieCompanionPort);
|
saveValue("competitive_companion_port", mCompetivieCompanionPort);
|
||||||
|
saveValue("ignore_spaces_when_validating_cases", mIgnoreSpacesWhenValidatingCases);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Settings::Executor::pauseConsole() const
|
bool Settings::Executor::pauseConsole() const
|
||||||
|
@ -2916,6 +2926,7 @@ void Settings::Executor::doLoad()
|
||||||
mEnableProblemSet = boolValue("enable_proble_set",true);
|
mEnableProblemSet = boolValue("enable_proble_set",true);
|
||||||
mEnableCompetitiveCompanion = boolValue("enable_competivie_companion",true);
|
mEnableCompetitiveCompanion = boolValue("enable_competivie_companion",true);
|
||||||
mCompetivieCompanionPort = intValue("competitive_companion_port",10045);
|
mCompetivieCompanionPort = intValue("competitive_companion_port",10045);
|
||||||
|
mIgnoreSpacesWhenValidatingCases = boolValue("ignore_spaces_when_validating_cases",false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -794,6 +794,9 @@ public:
|
||||||
int competivieCompanionPort() const;
|
int competivieCompanionPort() const;
|
||||||
void setCompetivieCompanionPort(int newCompetivieCompanionPort);
|
void setCompetivieCompanionPort(int newCompetivieCompanionPort);
|
||||||
|
|
||||||
|
bool ignoreSpacesWhenValidatingCases() const;
|
||||||
|
void setIgnoreSpacesWhenValidatingCases(bool newIgnoreSpacesWhenValidatingCases);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// general
|
// general
|
||||||
bool mPauseConsole;
|
bool mPauseConsole;
|
||||||
|
@ -807,6 +810,7 @@ public:
|
||||||
bool mEnableProblemSet;
|
bool mEnableProblemSet;
|
||||||
bool mEnableCompetitiveCompanion;
|
bool mEnableCompetitiveCompanion;
|
||||||
int mCompetivieCompanionPort;
|
int mCompetivieCompanionPort;
|
||||||
|
bool mIgnoreSpacesWhenValidatingCases;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void doSave() override;
|
void doSave() override;
|
||||||
|
|
|
@ -20,6 +20,7 @@ void ExecutorProblemSetWidget::doLoad()
|
||||||
ui->grpProblemSet->setChecked(pSettings->executor().enableProblemSet());
|
ui->grpProblemSet->setChecked(pSettings->executor().enableProblemSet());
|
||||||
ui->grpCompetitiveCompanion->setChecked(pSettings->executor().enableCompetitiveCompanion());
|
ui->grpCompetitiveCompanion->setChecked(pSettings->executor().enableCompetitiveCompanion());
|
||||||
ui->spinPortNumber->setValue(pSettings->executor().competivieCompanionPort());
|
ui->spinPortNumber->setValue(pSettings->executor().competivieCompanionPort());
|
||||||
|
ui->chkIgnoreSpacesWhenValidatingCases->setChecked(pSettings->executor().ignoreSpacesWhenValidatingCases());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExecutorProblemSetWidget::doSave()
|
void ExecutorProblemSetWidget::doSave()
|
||||||
|
@ -27,6 +28,7 @@ void ExecutorProblemSetWidget::doSave()
|
||||||
pSettings->executor().setEnableProblemSet(ui->grpProblemSet->isChecked());
|
pSettings->executor().setEnableProblemSet(ui->grpProblemSet->isChecked());
|
||||||
pSettings->executor().setEnableCompetitiveCompanion(ui->grpCompetitiveCompanion->isChecked());
|
pSettings->executor().setEnableCompetitiveCompanion(ui->grpCompetitiveCompanion->isChecked());
|
||||||
pSettings->executor().setCompetivieCompanionPort(ui->spinPortNumber->value());
|
pSettings->executor().setCompetivieCompanionPort(ui->spinPortNumber->value());
|
||||||
|
pSettings->executor().setIgnoreSpacesWhenValidatingCases(ui->chkIgnoreSpacesWhenValidatingCases->isChecked());
|
||||||
pSettings->executor().save();
|
pSettings->executor().save();
|
||||||
pMainWindow->applySettings();
|
pMainWindow->applySettings();
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,13 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="chkIgnoreSpacesWhenValidatingCases">
|
||||||
|
<property name="text">
|
||||||
|
<string>Ignore spaces when validating problem cases</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
|
@ -317,7 +317,7 @@ void FormatterGeneralWidget::updateCodeFormatter(Settings::CodeFormatter &format
|
||||||
PFormatterStyleItem item = mStylesModel.getStyle(ui->cbBraceStyle->currentIndex());
|
PFormatterStyleItem item = mStylesModel.getStyle(ui->cbBraceStyle->currentIndex());
|
||||||
if (item)
|
if (item)
|
||||||
format.setBraceStyle(item->style);
|
format.setBraceStyle(item->style);
|
||||||
if (ui->rbIndentSpaces) {
|
if (ui->rbIndentSpaces->isChecked()) {
|
||||||
format.setIndentStyle(FormatterIndentType::fitSpace);
|
format.setIndentStyle(FormatterIndentType::fitSpace);
|
||||||
} else {
|
} else {
|
||||||
format.setIndentStyle(FormatterIndentType::fitTab);
|
format.setIndentStyle(FormatterIndentType::fitTab);
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
#define VERSION_H
|
#define VERSION_H
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
#define DEVCPP_VERSION "beta.0.10.2"
|
#define DEVCPP_VERSION "beta.0.10.3"
|
||||||
|
|
||||||
#endif // VERSION_H
|
#endif // VERSION_H
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
!define COMPILERNAME "MinGW-w64 X86_64 GCC 11.2"
|
!define COMPILERNAME "MinGW-w64 X86_64 GCC 11.2"
|
||||||
!define COMPILERFOLDER "MinGW64"
|
!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 FINALNAME "RedPanda-Cpp.7.${DEVCPP_VERSION}.${COMPILERNAME}.Setup.exe"
|
||||||
!define DISPLAY_NAME "Red Panda Dev-C++ 7 ${DEVCPP_VERSION}"
|
!define DISPLAY_NAME "Red Panda Dev-C++ 7 ${DEVCPP_VERSION}"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue