Skip to content

Commit 7289cd7

Browse files
committed
feat(ui): show corresponding contestant name when judging (#197)
1 parent c1bf2b4 commit 7289cd7

9 files changed

Lines changed: 26 additions & 49 deletions

File tree

makespec/BUILDVERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
269
1+
270

src/core/contest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class Contest : public QObject {
7171
void taskDeletedForViewer(int);
7272
void problemTitleChanged();
7373
void dialogAlert(QString);
74-
void singleCaseFinished(int, int, int, int, int, int, int);
74+
void singleCaseFinished(QString, int, int, int, int, int, int, int);
7575
void singleSubtaskDependenceFinished(int, int, int);
7676
void taskJudgingStarted(QString);
7777
void taskJudgingFinished();

src/core/taskjudger.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -519,10 +519,10 @@ int TaskJudger::judge() {
519519
qMin(nowScore, statusToScore(overallStatus[i], task->getTestCase(i)->getFullScore()));
520520
}
521521

522-
emit singleCaseFinished(task->getTestCase(i)->getTimeLimit(), i, j, int(result[i][j]),
523-
(j + 1 == task->getTestCase(i)->getInputFiles().size() ? 1 : -1) *
524-
nowScore,
525-
timeUsed[i][j], memoryUsed[i][j]);
522+
emit singleCaseFinished(
523+
contestantName, task->getTestCase(i)->getTimeLimit(), i, j, int(result[i][j]),
524+
(j + 1 == task->getTestCase(i)->getInputFiles().size() ? 1 : -1) * nowScore, timeUsed[i][j],
525+
memoryUsed[i][j]);
526526

527527
if (score[i][j] < testCaseScore[i])
528528
testCaseScore[i] = score[i][j];
@@ -534,8 +534,8 @@ int TaskJudger::judge() {
534534

535535
void TaskJudger::makeDialogAlert(QString msg) { emit dialogAlert(std::move(msg)); }
536536
void TaskJudger::taskSkipped(const std::pair<int, int> &cur) {
537-
emit singleCaseFinished(task->getTestCase(cur.first)->getTimeLimit(), cur.first, cur.second,
538-
int(result[cur.first][cur.second]), 0, 0, 0);
537+
emit singleCaseFinished(contestant->getContestantName(), task->getTestCase(cur.first)->getTimeLimit(),
538+
cur.first, cur.second, int(result[cur.first][cur.second]), 0, 0, 0);
539539
}
540540

541541
void TaskJudger::stop() { isJudging = false; }

src/core/taskjudger.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class TaskJudger : public QObject {
8080
void judgingStarted(QString);
8181
void judgingFinished();
8282
void dialogAlert(QString);
83-
void singleCaseFinished(int, int, int, int, int, int, int);
83+
void singleCaseFinished(QString, int, int, int, int, int, int, int);
8484
void singleSubtaskDependenceFinished(int, int, int);
8585
void compileError(int, int);
8686
void stopJudgingSignal();

src/judgingdialog.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ void JudgingDialog::judgeAll() {
8484
accept();
8585
}
8686

87-
void JudgingDialog::singleCaseFinished(int progress, int x, int y, int result, int scoreGot, int timeUsed,
88-
int memoryUsed) {
87+
void JudgingDialog::singleCaseFinished(QString contestantName, int progress, int x, int y, int result,
88+
int scoreGot, int timeUsed, int memoryUsed) {
8989
bool isOnMaxValue =
9090
ui->logViewer->verticalScrollBar()->value() == ui->logViewer->verticalScrollBar()->maximum();
9191
QTextBlockFormat blockFormat;
@@ -219,7 +219,8 @@ void JudgingDialog::singleCaseFinished(int progress, int x, int y, int result, i
219219
break;
220220
}
221221

222-
cursor->insertText(tr("Test case %1.%2: ").arg(x + 1).arg(y + 1), preCharFormat);
222+
cursor->insertText(tr("Contestant %3 Test case %1.%2: ").arg(x + 1).arg(y + 1).arg(contestantName),
223+
preCharFormat);
223224
cursor->insertText(text, charFormat);
224225

225226
if (addtext.length() > 0)

src/judgingdialog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class JudgingDialog : public QDialog {
4444

4545
public slots:
4646
void dialogAlert(const QString &);
47-
void singleCaseFinished(int, int, int, int, int, int, int);
47+
void singleCaseFinished(QString, int, int, int, int, int, int, int);
4848
void singleSubtaskDependenceFinished(int, int, int);
4949
void taskJudgingStarted(const QString &);
5050
void taskJudgedDisplay(const QString &, const QList<QList<int>> &, const int);

translations/en_US.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,10 +1211,6 @@ Depends: </source>
12111211
<source>Special judge run time error</source>
12121212
<translation></translation>
12131213
</message>
1214-
<message>
1215-
<source>Test case %1.%2: </source>
1216-
<translation></translation>
1217-
</message>
12181214
<message>
12191215
<source>Subtask Dependence %1: #%2: </source>
12201216
<translation></translation>
@@ -1288,6 +1284,10 @@ Depends: </source>
12881284
<source>Main grader (grader.*) cannot be found</source>
12891285
<translation></translation>
12901286
</message>
1287+
<message>
1288+
<source>Contestant %3 Test case %1.%2: </source>
1289+
<translation type="unfinished"></translation>
1290+
</message>
12911291
</context>
12921292
<context>
12931293
<name>JudgingThread</name>
@@ -1936,14 +1936,6 @@ Depends: </source>
19361936
</context>
19371937
<context>
19381938
<name>QObject</name>
1939-
<message>
1940-
<source>Pure</source>
1941-
<translation></translation>
1942-
</message>
1943-
<message>
1944-
<source>Lost</source>
1945-
<translation></translation>
1946-
</message>
19471939
<message>
19481940
<source>Enable debug output</source>
19491941
<translation></translation>

translations/zh_CN.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,10 +1165,6 @@ Depends: </source>
11651165
<source>Cancel</source>
11661166
<translation>停止测试</translation>
11671167
</message>
1168-
<message>
1169-
<source>Test case %1.%2: </source>
1170-
<translation>测试点 %1.%2: </translation>
1171-
</message>
11721168
<message>
11731169
<source>Correct answer</source>
11741170
<translation>答案正确</translation>
@@ -1313,6 +1309,10 @@ Depends: </source>
13131309
<source>Main grader (grader.*) cannot be found</source>
13141310
<translation>未找到主接口程序(grader.*)</translation>
13151311
</message>
1312+
<message>
1313+
<source>Contestant %3 Test case %1.%2: </source>
1314+
<translation>选手 %3 测试点 %1.%2: </translation>
1315+
</message>
13161316
</context>
13171317
<context>
13181318
<name>JudgingThread</name>
@@ -1961,14 +1961,6 @@ Depends: </source>
19611961
</context>
19621962
<context>
19631963
<name>QObject</name>
1964-
<message>
1965-
<source>Pure</source>
1966-
<translation>Pure</translation>
1967-
</message>
1968-
<message>
1969-
<source>Lost</source>
1970-
<translation>Lost</translation>
1971-
</message>
19721964
<message>
19731965
<source>Enable debug output</source>
19741966
<translation>启用 Debug 输出</translation>

translations/zh_TW.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,10 +1165,6 @@ Depends: </source>
11651165
<source>Cancel</source>
11661166
<translation>停止測試</translation>
11671167
</message>
1168-
<message>
1169-
<source>Test case %1.%2: </source>
1170-
<translation>測試點 %1.%2: </translation>
1171-
</message>
11721168
<message>
11731169
<source>Correct answer</source>
11741170
<translation>答案正確</translation>
@@ -1313,6 +1309,10 @@ Depends: </source>
13131309
<source>Main grader (grader.*) cannot be found</source>
13141310
<translation type="unfinished"></translation>
13151311
</message>
1312+
<message>
1313+
<source>Contestant %3 Test case %1.%2: </source>
1314+
<translation type="unfinished"></translation>
1315+
</message>
13161316
</context>
13171317
<context>
13181318
<name>JudgingThread</name>
@@ -1961,14 +1961,6 @@ Depends: </source>
19611961
</context>
19621962
<context>
19631963
<name>QObject</name>
1964-
<message>
1965-
<source>Pure</source>
1966-
<translation>Pure</translation>
1967-
</message>
1968-
<message>
1969-
<source>Lost</source>
1970-
<translation>Lost</translation>
1971-
</message>
19721964
<message>
19731965
<source>Enable debug output</source>
19741966
<translation>啓用 Debug 輸出</translation>

0 commit comments

Comments
 (0)