Subversion Repositories svn1

Rev

Rev 188 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 188 Rev 189
Line 5... Line 5...
5
#include    "consts.h"
5
#include    "consts.h"
6
#include    "structs.h"
6
#include    "structs.h"
7
#include    "proto.h"
7
#include    "proto.h"
8
 
8
 
9
QmEventStatus::QmEventStatus(QWidget *parent) :
9
QmEventStatus::QmEventStatus(QWidget *parent) :
10
    QDialog(parent),
10
    QWidget(parent)
11
    ui(new Ui::QmEventStatus)
-
 
12
{
11
{
13
    //ui->setupUi(this);
-
 
14
    resize ( 500,400);
12
    resize ( 600,400);
15
 
13
 
16
    verticalLayout = new QVBoxLayout(this);
14
    verticalLayout = new QVBoxLayout(this);
17
    verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
15
    verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
18
    verticalLayout->setContentsMargins(0, 0, 0, 0);
16
    verticalLayout->setContentsMargins(0, 0, 0, 0);
19
    scrollArea = new QScrollArea(this);
17
    scrollArea = new QScrollArea(this);
Line 25... Line 23...
25
    scrollArea->setWidget(scrollAreaWidgetContents);
23
    scrollArea->setWidget(scrollAreaWidgetContents);
26
 
24
 
27
    verticalLayout->addWidget(scrollArea);
25
    verticalLayout->addWidget(scrollArea);
28
 
26
 
29
    buttonBox = new QDialogButtonBox(this);
27
    buttonBox = new QDialogButtonBox(this);
30
    buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
-
 
31
    buttonBox->setOrientation(Qt::Horizontal);
28
    buttonBox->setOrientation(Qt::Horizontal);
32
    buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
29
    buttonBox->addButton( new QPushButton("Recalc"),QDialogButtonBox::AcceptRole);
-
 
30
    QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(calculate()));
33
 
31
 
34
    verticalLayout->addWidget(buttonBox);
32
    verticalLayout->addWidget(buttonBox);
35
 
33
 
36
 
-
 
37
    QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
-
 
38
    QObject::connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
-
 
39
 
-
 
40
    QVBoxLayout *verticalLayout2 = new QVBoxLayout(scrollAreaWidgetContents);
34
    QVBoxLayout *verticalLayout2 = new QVBoxLayout(scrollAreaWidgetContents);
41
 
35
 
42
    for( int j = 0; j <= config.num_class; j++ )
36
    for( int j = 0; j <= config.num_class; j++ )
43
    {
37
    {
44
        QGroupBox * groupBox = new QGroupBox(j ? config.team_class[j - 1].full_name : "Complete Event");
38
        QGroupBox * groupBox = new QGroupBox(j ? config.team_class[j - 1].full_name : "Complete Event");
Line 47... Line 41...
47
        QHBoxLayout * horizontalLayout = new QHBoxLayout(groupBox);
41
        QHBoxLayout * horizontalLayout = new QHBoxLayout(groupBox);
48
 
42
 
49
        for( int i = 0; i <= config.num_legs; i++ )
43
        for( int i = 0; i <= config.num_legs; i++ )
50
        {
44
        {
51
            QmStatusItem * item = new QmStatusItem(i ? config.leg_name[i - 1] : "Overall");
45
            QmStatusItem * item = new QmStatusItem(i ? config.leg_name[i - 1] : "Overall");
-
 
46
            statusItems[i][j] = item;
52
            item->setData(stats.fast.team[i][j], stats.fast.time[i][j],stats.average[i][j] );
47
            //item->setData(stats.fast.team[i][j], stats.fast.time[i][j],stats.average[i][j] );
53
            horizontalLayout->addWidget ( item );
48
            horizontalLayout->addWidget ( item );
54
        }
49
        }
55
    }
50
    }
-
 
51
 
-
 
52
    //calculate();
-
 
53
}
-
 
54
 
-
 
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
    }
56
}
79
}
57
 
80
 
58
QmEventStatus::~QmEventStatus()
81
QmEventStatus::~QmEventStatus()
59
{
82
{
60
    delete ui;
83
 
61
}
84
}