Subversion Repositories svn1

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
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->setObjectName(QString::fromUtf8("verticalLayout"));
16
    verticalLayout->setContentsMargins(0, 0, 0, 0);
17
    scrollArea = new QScrollArea(this);
18
    scrollArea->setObjectName(QString::fromUtf8("scrollArea"));
19
    scrollArea->setWidgetResizable(true);
20
    scrollAreaWidgetContents = new QWidget();
21
    scrollAreaWidgetContents->setObjectName(QString::fromUtf8("scrollAreaWidgetContents"));
22
    scrollAreaWidgetContents->setGeometry(QRect(0, 0, 395, 264));
23
    scrollArea->setWidget(scrollAreaWidgetContents);
24
 
25
    verticalLayout->addWidget(scrollArea);
26
 
27
    buttonBox = new QDialogButtonBox(this);
28
    buttonBox->setOrientation(Qt::Horizontal);
189 - 29
    buttonBox->addButton( new QPushButton("Recalc"),QDialogButtonBox::AcceptRole);
30
    QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(calculate()));
188 - 31
 
32
    verticalLayout->addWidget(buttonBox);
33
 
34
    QVBoxLayout *verticalLayout2 = new QVBoxLayout(scrollAreaWidgetContents);
35
 
36
    for( int j = 0; j <= config.num_class; j++ )
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);
42
 
43
        for( int i = 0; i <= config.num_legs; i++ )
44
        {
45
            QmStatusItem * item = new QmStatusItem(i ? config.leg_name[i - 1] : "Overall");
189 - 46
            statusItems[i][j] = item;
47
            //item->setData(stats.fast.team[i][j], stats.fast.time[i][j],stats.average[i][j] );
188 - 48
            horizontalLayout->addWidget ( item );
49
        }
50
    }
189 - 51
 
52
    //calculate();
188 - 53
}
54
 
189 - 55
void QmEventStatus::calculate(void)
56
{
57
    if( load_report_data() )
58
    {
59
        srt_place();
60
        qDebug("Calulate Event Status");
61
        for( int j = 0; j <= config.num_class; j++ )
62
        {
63
            for( int i = 0; i <= config.num_legs; i++ )
64
            {
65
                QmStatusItem * item = statusItems[i][j];
66
                item->setData(stats.fast.team[i][j], stats.fast.time[i][j],stats.average[i][j] );
67
            }
68
        }
69
    }
70
}
71
 
72
void QmEventStatus::showEvent ( QShowEvent * event )
73
{
74
    //qDebug("QmEventStatus::showEvent");
75
    if ( ! event->spontaneous() )
76
    {
77
        calculate();
78
    }
79
}
80
 
188 - 81
QmEventStatus::~QmEventStatus()
82
{
189 - 83
 
188 - 84
}