Subversion Repositories svn1

Rev

Rev 236 | Rev 313 | Go to most recent revision | Details | Compare with Previous | 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);
286 david 29
    buttonBox->setContentsMargins(0,0,5,5);
189 - 30
    buttonBox->addButton( new QPushButton("Recalc"),QDialogButtonBox::AcceptRole);
31
    QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(calculate()));
188 - 32
 
33
    verticalLayout->addWidget(buttonBox);
34
 
35
    QVBoxLayout *verticalLayout2 = new QVBoxLayout(scrollAreaWidgetContents);
36
 
37
    for( int j = 0; j <= config.num_class; j++ )
38
    {
39
        QGroupBox * groupBox = new QGroupBox(j ? config.team_class[j - 1].full_name : "Complete Event");
40
        groupBox->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
41
        verticalLayout2->addWidget(groupBox);
42
        QHBoxLayout * horizontalLayout = new QHBoxLayout(groupBox);
43
 
44
        for( int i = 0; i <= config.num_legs; i++ )
45
        {
46
            QmStatusItem * item = new QmStatusItem(i ? config.leg_name[i - 1] : "Overall");
189 - 47
            statusItems[i][j] = item;
48
            //item->setData(stats.fast.team[i][j], stats.fast.time[i][j],stats.average[i][j] );
188 - 49
            horizontalLayout->addWidget ( item );
50
        }
51
    }
189 - 52
 
53
    //calculate();
188 - 54
}
55
 
189 - 56
void QmEventStatus::calculate(void)
57
{
58
    if( load_report_data() )
59
    {
60
        srt_place();
61
        qDebug("Calulate Event Status");
62
        for( int j = 0; j <= config.num_class; j++ )
63
        {
64
            for( int i = 0; i <= config.num_legs; i++ )
65
            {
66
                QmStatusItem * item = statusItems[i][j];
67
                item->setData(stats.fast.team[i][j], stats.fast.time[i][j],stats.average[i][j] );
68
            }
69
        }
70
    }
71
}
72
 
73
void QmEventStatus::showEvent ( QShowEvent * event )
74
{
75
    //qDebug("QmEventStatus::showEvent");
76
    if ( ! event->spontaneous() )
77
    {
78
        calculate();
79
    }
80
}
81
 
188 - 82
QmEventStatus::~QmEventStatus()
83
{
189 - 84
 
188 - 85
}