| 188 |
- |
1 |
#include "qmeventstatus.h"
|
|
|
2 |
#include "ui_qmeventstatus.h"
|
|
|
3 |
#include "qmstatusitem.h"
|
|
|
4 |
#include "QGroupBox"
|
|
|
5 |
#include "consts.h"
|
|
|
6 |
#include "structs.h"
|
|
|
7 |
#include "proto.h"
|
|
|
8 |
|
|
|
9 |
QmEventStatus::QmEventStatus(QWidget *parent) :
|
| 189 |
- |
10 |
QWidget(parent)
|
| 188 |
- |
11 |
{
|
| 189 |
- |
12 |
resize ( 600,400);
|
| 188 |
- |
13 |
|
|
|
14 |
verticalLayout = new QVBoxLayout(this);
|
|
|
15 |
verticalLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
16 |
scrollArea = new QScrollArea(this);
|
|
|
17 |
scrollArea->setWidgetResizable(true);
|
|
|
18 |
scrollAreaWidgetContents = new QWidget();
|
|
|
19 |
scrollAreaWidgetContents->setGeometry(QRect(0, 0, 395, 264));
|
|
|
20 |
scrollArea->setWidget(scrollAreaWidgetContents);
|
|
|
21 |
|
|
|
22 |
verticalLayout->addWidget(scrollArea);
|
|
|
23 |
|
|
|
24 |
buttonBox = new QDialogButtonBox(this);
|
|
|
25 |
buttonBox->setOrientation(Qt::Horizontal);
|
| 286 |
david |
26 |
buttonBox->setContentsMargins(0,0,5,5);
|
| 189 |
- |
27 |
buttonBox->addButton( new QPushButton("Recalc"),QDialogButtonBox::AcceptRole);
|
|
|
28 |
QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(calculate()));
|
| 188 |
- |
29 |
|
|
|
30 |
verticalLayout->addWidget(buttonBox);
|
|
|
31 |
|
|
|
32 |
QVBoxLayout *verticalLayout2 = new QVBoxLayout(scrollAreaWidgetContents);
|
|
|
33 |
|
|
|
34 |
for( int j = 0; j <= config.num_class; j++ )
|
|
|
35 |
{
|
| 313 |
david |
36 |
if (j == 0 || config.team_class[j-1].abr[0])
|
|
|
37 |
{
|
|
|
38 |
QGroupBox * groupBox = new QGroupBox(j ? config.team_class[j - 1].full_name : "Complete Event");
|
|
|
39 |
groupBox->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
|
|
40 |
verticalLayout2->addWidget(groupBox);
|
|
|
41 |
QHBoxLayout * horizontalLayout = new QHBoxLayout(groupBox);
|
| 188 |
- |
42 |
|
| 313 |
david |
43 |
for( int i = 0; i <= config.num_legs; i++ )
|
|
|
44 |
{
|
|
|
45 |
if (i == 0 || config.team_class[i-1].abr[0])
|
|
|
46 |
{
|
|
|
47 |
QmStatusItem *item = new QmStatusItem(i ? config.leg_name[i - 1] : "Overall");
|
|
|
48 |
statusItems[i][j] = item;
|
|
|
49 |
//item->setData(stats.fast.team[i][j], stats.fast.time[i][j],stats.average[i][j] );
|
|
|
50 |
horizontalLayout->addWidget ( item );
|
|
|
51 |
}
|
|
|
52 |
}
|
| 188 |
- |
53 |
}
|
|
|
54 |
}
|
|
|
55 |
}
|
|
|
56 |
|
| 189 |
- |
57 |
void QmEventStatus::calculate(void)
|
|
|
58 |
{
|
|
|
59 |
if( load_report_data() )
|
|
|
60 |
{
|
|
|
61 |
srt_place();
|
| 314 |
david |
62 |
//qDebug("Calulate Event Status");
|
| 189 |
- |
63 |
for( int j = 0; j <= config.num_class; j++ )
|
|
|
64 |
{
|
| 313 |
david |
65 |
if (j == 0 || config.team_class[j-1].abr[0])
|
| 189 |
- |
66 |
{
|
| 313 |
david |
67 |
for( int i = 0; i <= config.num_legs; i++ )
|
|
|
68 |
{
|
|
|
69 |
QmStatusItem * item = statusItems[i][j];
|
| 314 |
david |
70 |
if (item)
|
|
|
71 |
{
|
|
|
72 |
item->setData(stats.fast.team[i][j], stats.fast.time[i][j], stats.average[i][j]);
|
|
|
73 |
}
|
| 313 |
david |
74 |
}
|
| 189 |
- |
75 |
}
|
|
|
76 |
}
|
|
|
77 |
}
|
|
|
78 |
}
|
|
|
79 |
|
|
|
80 |
void QmEventStatus::showEvent ( QShowEvent * event )
|
|
|
81 |
{
|
|
|
82 |
//qDebug("QmEventStatus::showEvent");
|
|
|
83 |
if ( ! event->spontaneous() )
|
|
|
84 |
{
|
|
|
85 |
calculate();
|
|
|
86 |
}
|
|
|
87 |
}
|
|
|
88 |
|
| 188 |
- |
89 |
QmEventStatus::~QmEventStatus()
|
|
|
90 |
{
|
| 189 |
- |
91 |
|
| 188 |
- |
92 |
}
|