| 138 |
david |
1 |
#include "qmdisqualified.h"
|
|
|
2 |
#include "ui_qmdisqualified.h"
|
|
|
3 |
|
|
|
4 |
#include "consts.h"
|
|
|
5 |
#include "structs.h"
|
|
|
6 |
#include "proto.h"
|
|
|
7 |
|
|
|
8 |
qmDisqualified::qmDisqualified(QWidget *parent) :
|
|
|
9 |
QWidget(parent),
|
|
|
10 |
ui(new Ui::qmDisqualified)
|
|
|
11 |
{
|
|
|
12 |
inPopulate = FALSE;
|
|
|
13 |
ui->setupUi(this);
|
|
|
14 |
|
|
|
15 |
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(save()) );
|
|
|
16 |
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(cancel()) );
|
|
|
17 |
connect(ui->loadButton, SIGNAL(released()), this, SLOT(populate()) );
|
|
|
18 |
connect(ui->tableWidget, SIGNAL(itemChanged(QTableWidgetItem*)), this, SLOT(tableItemChanged(QTableWidgetItem *)));
|
|
|
19 |
}
|
|
|
20 |
|
|
|
21 |
qmDisqualified::~qmDisqualified()
|
|
|
22 |
{
|
|
|
23 |
delete ui;
|
|
|
24 |
}
|
|
|
25 |
|
|
|
26 |
void qmDisqualified::save(void)
|
|
|
27 |
{
|
|
|
28 |
}
|
|
|
29 |
|
|
|
30 |
void qmDisqualified::cancel(void)
|
|
|
31 |
{
|
|
|
32 |
populate();
|
|
|
33 |
}
|
|
|
34 |
|
|
|
35 |
void qmDisqualified::populate(void)
|
|
|
36 |
{
|
|
|
37 |
team_type team_buf;
|
|
|
38 |
inPopulate = TRUE;
|
|
|
39 |
|
|
|
40 |
/*
|
|
|
41 |
** Delete existing entries in the table
|
|
|
42 |
*/
|
|
|
43 |
ui->tableWidget->clearContents();
|
|
|
44 |
ui->tableWidget->setRowCount(config.max_team);
|
|
|
45 |
ui->tableWidget->setSortingEnabled(FALSE);
|
|
|
46 |
|
|
|
47 |
/*
|
|
|
48 |
** Scan all the team data
|
|
|
49 |
*/
|
|
|
50 |
for ( int team = config.min_team; team <= config.max_team; team++)
|
|
|
51 |
{
|
|
|
52 |
ui->tableWidget->hideRow ( team );
|
|
|
53 |
if( valid_field( team ) )
|
|
|
54 |
{
|
|
|
55 |
g_record( team, &team_buf );
|
|
|
56 |
if( team_buf.flags.valid )
|
|
|
57 |
{
|
|
|
58 |
QTableWidgetItem *item;
|
|
|
59 |
|
|
|
60 |
ui->tableWidget->showRow( team );
|
|
|
61 |
|
|
|
62 |
item = new QTableWidgetItem(QString::number(team));
|
|
|
63 |
item->setFlags(Qt::NoItemFlags);
|
|
|
64 |
ui->tableWidget->setItem(team, 0, item );
|
|
|
65 |
|
|
|
66 |
item = new QTableWidgetItem(team_buf.name);
|
|
|
67 |
item->setFlags(Qt::NoItemFlags);
|
|
|
68 |
ui->tableWidget->setItem(team, 1, item );
|
|
|
69 |
|
|
|
70 |
item = new QTableWidgetItem("Disq");
|
|
|
71 |
item->setCheckState(team_buf.flags.disqualified ? Qt::Checked : Qt::Unchecked);
|
|
|
72 |
ui->tableWidget->setItem(team, 2, item );
|
|
|
73 |
|
|
|
74 |
item = new QTableWidgetItem("Non Equest");
|
|
|
75 |
item->setCheckState(team_buf.flags.non_equestrian ? Qt::Checked : Qt::Unchecked);
|
|
|
76 |
ui->tableWidget->setItem(team, 3, item );
|
|
|
77 |
}
|
|
|
78 |
}
|
|
|
79 |
}
|
|
|
80 |
//ui->tableWidget->setSortingEnabled(TRUE);
|
|
|
81 |
inPopulate = FALSE;
|
|
|
82 |
}
|
|
|
83 |
|
|
|
84 |
void qmDisqualified::tableItemChanged(QTableWidgetItem *item)
|
|
|
85 |
{
|
|
|
86 |
if ( !inPopulate )
|
|
|
87 |
{
|
|
|
88 |
qDebug ("DataChanged");
|
|
|
89 |
}
|
|
|
90 |
}
|