-
Notifications
You must be signed in to change notification settings - Fork 0
/
submitdetails.cpp
executable file
·63 lines (48 loc) · 1.78 KB
/
submitdetails.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
* This file is part of community judge client project developed by Shervin Kh.
* Copyright (C) 2014 Shervin Kh.
* License: GPLv3 Or Later
* Full license could be found in License file shipped with program or at http://www.gnu.org/licenses/
*/
#include "submitdetails.h"
#include <QtGui>
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#endif
SubmitDetails::SubmitDetails(const QString &tit, QList<qint8> res, QWidget *parent) :
QDialog(parent)
{
title = new QLabel(QString("<b>%1: </b>").arg(tit));
QFont fnt;
fnt.setPointSize(15);
title->setFont(fnt);
tw = new QTableWidget;
#if QT_VERSION >= 0x050000
tw->setSizeAdjustPolicy(QTableWidget::AdjustToContents);
#endif
tw->setColumnCount(2);
tw->setHorizontalHeaderItem(0, new QTableWidgetItem());
tw->setHorizontalHeaderItem(1, new QTableWidgetItem());
tw->setRowCount(res.size());
for (int i = 0; i < res.size(); i++)
{
tw->setVerticalHeaderItem(i, new QTableWidgetItem());
QTableWidgetItem *first, *second;
first = new QTableWidgetItem(QString("Testcase #%1").arg(i + 1));
first->setFlags(Qt::ItemIsEnabled);
int status = static_cast<int>(res[i]);
int baseStat = static_cast<int>(StatCode::InQueue);
second = new QTableWidgetItem(statusString[status - baseStat]);
second->setFlags(Qt::ItemIsEnabled);
first->setBackgroundColor(backgroundColors[status - baseStat]);
second->setBackgroundColor(backgroundColors[status - baseStat]);
tw->setItem(i, 0, first);
tw->setItem(i, 1, second);
}
tw->resizeColumnsToContents();
totalLayout = new QVBoxLayout;
totalLayout->addWidget(title);
totalLayout->addWidget(tw);
setLayout(totalLayout);
setWindowTitle("Submission Details");
}