- enhancement: add ignore spaces checkbox in problem cases panel

This commit is contained in:
Roy Qu 2022-06-15 14:13:11 +08:00
parent f8cd0e63ad
commit 04311eb8e5
7 changed files with 596 additions and 544 deletions

View File

@ -2,6 +2,7 @@ Red Panda C++ Version 1.1.1
- enhancement: adjust the appearance of problem case's input/output/expected control
- change: swap position of problem case's output and expected input controls
- enhancement: when problem case panel is positioned at right, problem case's input, output and expected controls is layouted vertically
- enhancement: add ignore spaces checkbox in problem cases panel
Red Panda C++ Version 1.1.0
- enhancement: when ctrl+mouse cursor hovered an identifier or header name, use underline to highlight it

View File

@ -4424,10 +4424,6 @@
<source>Choose Expected Output Data File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Line %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Batch Set Cases</source>
<translation type="unfinished"></translation>
@ -4492,6 +4488,10 @@
<source>Rename</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Ignore Spaces</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NewClassDialog</name>

File diff suppressed because it is too large Load Diff

View File

@ -4440,10 +4440,6 @@
<source>Choose Expected Output Data File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Line %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Convert to UTF-8 BOM</source>
<translation type="unfinished"></translation>
@ -4492,6 +4488,10 @@
<source>Rename</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Ignore Spaces</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NewClassDialog</name>

View File

@ -719,6 +719,7 @@ void MainWindow::applySettings()
showHideMessagesTab(ui->tabProblem, pSettings->ui().showProblem()
&& pSettings->executor().enableProblemSet());
ui->chkIgnoreSpaces->setChecked(pSettings->executor().ignoreSpacesWhenValidatingCases());
ui->actionInterrupt->setVisible(pSettings->debugger().useGDBServer());
//icon sets for editors
updateEditorSettings();
@ -6246,7 +6247,7 @@ void MainWindow::setDockMessagesToArea(const Qt::DockWidgetArea &area)
& ~area);
QGridLayout* layout=(QGridLayout*)ui->panelProblemCase->layout();
layout->removeWidget(ui->widgetProblemCaseInputCaption);
layout->removeWidget(ui->lblProblemCaseOutputCaption);
layout->removeWidget(ui->widgetProblemCaseOutputCaption);
layout->removeWidget(ui->widgetProblemCaseExpectedCaption);
layout->removeWidget(ui->txtProblemCaseInput);
layout->removeWidget(ui->txtProblemCaseOutput);
@ -6259,28 +6260,30 @@ void MainWindow::setDockMessagesToArea(const Qt::DockWidgetArea &area)
case Qt::DockWidgetArea::TopDockWidgetArea:
layout->addWidget(ui->widgetProblemCaseInputCaption, 0, 0, 1, 1);
layout->addWidget(ui->txtProblemCaseInput, 1, 0, 1, 1);
layout->addWidget(ui->lblProblemCaseInput, 2, 0, 1, 1);
layout->addWidget(ui->lblProblemCaseOutputCaption, 0, 2, 1, 1);
layout->addWidget(ui->txtProblemCaseOutput, 1, 2, 1, 1);
layout->addWidget(ui->lblProblemCaseOutput, 2, 2, 1, 1);
// layout->addWidget(ui->lblProblemCaseInput, 2, 0, 1, 1);
layout->addWidget(ui->widgetProblemCaseExpectedCaption, 0, 1, 1, 1);
layout->addWidget(ui->txtProblemCaseExpected, 1, 1, 1, 1);
layout->addWidget(ui->lblProblemCaseExpected, 2, 1, 1, 1);
// layout->addWidget(ui->lblProblemCaseExpected, 2, 1, 1, 1);
layout->addWidget(ui->widgetProblemCaseOutputCaption, 0, 2, 1, 1);
layout->addWidget(ui->txtProblemCaseOutput, 1, 2, 1, 1);
// layout->addWidget(ui->lblProblemCaseOutput, 2, 2, 1, 1);
break;
default:
layout->addWidget(ui->widgetProblemCaseInputCaption, 0, 0, 1, 1);
layout->addWidget(ui->txtProblemCaseInput, 1, 0, 1, 1);
layout->addWidget(ui->lblProblemCaseInput, 2, 0, 1, 1);
//layout->addWidget(ui->lblProblemCaseInput, 2, 0, 1, 1);
layout->addWidget(ui->widgetProblemCaseExpectedCaption, 3, 0, 1, 1);
layout->addWidget(ui->txtProblemCaseExpected, 4, 0, 1, 1);
layout->addWidget(ui->lblProblemCaseExpected, 5, 0, 1, 1);
//layout->addWidget(ui->lblProblemCaseExpected, 5, 0, 1, 1);
layout->addWidget(ui->lblProblemCaseOutputCaption, 6, 0, 1, 1);
layout->addWidget(ui->widgetProblemCaseOutputCaption, 6, 0, 1, 1);
layout->addWidget(ui->txtProblemCaseOutput, 7, 0, 1, 1);
layout->addWidget(ui->lblProblemCaseOutput, 8, 0, 1, 1);
//layout->addWidget(ui->lblProblemCaseOutput, 8, 0, 1, 1);
}
}
@ -7774,7 +7777,7 @@ void MainWindow::on_txtProblemCaseOutput_cursorPositionChanged()
QTextCursor cursor = ui->txtProblemCaseOutput->textCursor();
int val = ui->txtProblemCaseOutput->verticalScrollBar()->value();
int line = cursor.block().firstLineNumber();
ui->lblProblemCaseOutput->setText(tr("Line %1").arg(cursor.block().firstLineNumber()+1));
//ui->lblProblemCaseOutput->setText(tr("Line %1").arg(cursor.block().firstLineNumber()+1));
QTextBlock block = ui->txtProblemCaseExpected->document()->findBlockByLineNumber(line);
if (!block.isValid())
@ -7788,14 +7791,14 @@ void MainWindow::on_txtProblemCaseOutput_cursorPositionChanged()
void MainWindow::on_txtProblemCaseExpected_cursorPositionChanged()
{
QTextCursor cursor = ui->txtProblemCaseExpected->textCursor();
ui->lblProblemCaseExpected->setText(tr("Line %1").arg(cursor.block().firstLineNumber()+1));
//ui->lblProblemCaseExpected->setText(tr("Line %1").arg(cursor.block().firstLineNumber()+1));
}
void MainWindow::on_txtProblemCaseInput_cursorPositionChanged()
{
QTextCursor cursor = ui->txtProblemCaseInput->textCursor();
ui->lblProblemCaseInput->setText(tr("Line %1").arg(cursor.block().firstLineNumber()+1));
//ui->lblProblemCaseInput->setText(tr("Line %1").arg(cursor.block().firstLineNumber()+1));
}
@ -7874,3 +7877,9 @@ void MainWindow::on_actionToggle_Messages_Panel_triggered()
stretchMessagesPanel(ui->tabMessages->isShrinked());
}
void MainWindow::on_chkIgnoreSpaces_stateChanged(int /*arg1*/)
{
pSettings->executor().setIgnoreSpacesWhenValidatingCases(ui->chkIgnoreSpaces->isChecked());
}

View File

@ -680,6 +680,8 @@ private slots:
void on_actionToggle_Messages_Panel_triggered();
void on_chkIgnoreSpaces_stateChanged(int arg1);
private:
Ui::MainWindow *ui;
EditorList *mEditorList;

View File

@ -1738,6 +1738,23 @@
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QLabel" name="lblProblemCaseOutput">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="LineNumberTextEditor" name="txtProblemCaseOutput">
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="LineNumberTextEditor" name="txtProblemCaseExpected">
<property name="lineWrapMode">
@ -1872,28 +1889,49 @@
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="LineNumberTextEditor" name="txtProblemCaseOutput">
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="lblProblemCaseOutputCaption">
<property name="text">
<string>Output</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QLabel" name="lblProblemCaseOutput">
<property name="text">
<string/>
</property>
<widget class="QWidget" name="widgetProblemCaseOutputCaption" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_19">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="lblProblemCaseOutputCaption">
<property name="text">
<string>Output</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="chkIgnoreSpaces">
<property name="text">
<string>Ignore Spaces</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>