Subversion Repositories svn1

Rev

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

Rev 189 Rev 380
Line 10... Line 10...
10
    QWidget(parent)
10
    QWidget(parent)
11
{
11
{
12
    resize ( 600,400);
12
    resize ( 600,400);
13
 
13
 
14
    verticalLayout = new QVBoxLayout(this);
14
    verticalLayout = new QVBoxLayout(this);
15
    verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
-
 
16
    verticalLayout->setContentsMargins(0, 0, 0, 0);
15
    verticalLayout->setContentsMargins(0, 0, 0, 0);
17
    scrollArea = new QScrollArea(this);
16
    scrollArea = new QScrollArea(this);
18
    scrollArea->setObjectName(QString::fromUtf8("scrollArea"));
-
 
19
    scrollArea->setWidgetResizable(true);
17
    scrollArea->setWidgetResizable(true);
20
    scrollAreaWidgetContents = new QWidget();
18
    scrollAreaWidgetContents = new QWidget();
21
    scrollAreaWidgetContents->setObjectName(QString::fromUtf8("scrollAreaWidgetContents"));
-
 
22
    scrollAreaWidgetContents->setGeometry(QRect(0, 0, 395, 264));
19
    scrollAreaWidgetContents->setGeometry(QRect(0, 0, 395, 264));
23
    scrollArea->setWidget(scrollAreaWidgetContents);
20
    scrollArea->setWidget(scrollAreaWidgetContents);
24
 
21
 
25
    verticalLayout->addWidget(scrollArea);
22
    verticalLayout->addWidget(scrollArea);
26
 
23
 
27
    buttonBox = new QDialogButtonBox(this);
24
    buttonBox = new QDialogButtonBox(this);
28
    buttonBox->setOrientation(Qt::Horizontal);
25
    buttonBox->setOrientation(Qt::Horizontal);
-
 
26
    buttonBox->setContentsMargins(0,0,5,5);
29
    buttonBox->addButton( new QPushButton("Recalc"),QDialogButtonBox::AcceptRole);
27
    buttonBox->addButton( new QPushButton("Recalc"),QDialogButtonBox::AcceptRole);
30
    QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(calculate()));
28
    QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(calculate()));
31
 
29
 
32
    verticalLayout->addWidget(buttonBox);
30
    verticalLayout->addWidget(buttonBox);
33
 
31
 
34
    QVBoxLayout *verticalLayout2 = new QVBoxLayout(scrollAreaWidgetContents);
32
    verticalLayout2 = new QVBoxLayout(scrollAreaWidgetContents);
35
 
33
 
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");
-
 
46
            statusItems[i][j] = item;
-
 
47
            //item->setData(stats.fast.team[i][j], stats.fast.time[i][j],stats.average[i][j] );
-
 
48
            horizontalLayout->addWidget ( item );
-
 
49
        }
-
 
50
    }
-
 
51
 
-
 
52
    //calculate();
-
 
53
}
34
}
54
 
35
 
-
 
36
/*----------------------------------------------------------------------------
-
 
37
** FUNCTION           : calculate
-
 
38
**
-
 
39
** DESCRIPTION        : Recalculate an dre-display event status
-
 
40
**                      Delete and recreate a large amount of the widget
-
 
41
**
-
 
42
**
-
 
43
** INPUTS             :
-
 
44
**
-
 
45
** RETURNS            :
-
 
46
**
-
 
47
----------------------------------------------------------------------------*/
-
 
48
 
55
void QmEventStatus::calculate(void)
49
void QmEventStatus::calculate(void)
56
{
50
{
-
 
51
 
-
 
52
    /*
-
 
53
    ** Delete the contents of the existing layout
-
 
54
    */
-
 
55
    //qDebug("QmEventStatus::calculate:%d",verticalLayout2->layout()->count());
-
 
56
    QLayoutItem *child;
-
 
57
    while ((child = verticalLayout2->layout()->takeAt(0)) != 0) {
-
 
58
         //qDebug("Child Found:%p,%p, %p", child,child->layout(), child->widget());
-
 
59
        QWidget *childWidget = child->widget();
-
 
60
        if (childWidget)
-
 
61
        {
-
 
62
            delete child->widget();
-
 
63
        }
-
 
64
        delete child;
-
 
65
     }
-
 
66
 
-
 
67
    /*
-
 
68
    ** Load report data and generate place sorting
-
 
69
    */
57
    if( load_report_data() )
70
    if( load_report_data() )
58
    {
71
    {
59
        srt_place();
72
        srt_place();
60
        qDebug("Calulate Event Status");
73
        //qDebug("Calulate Event Status");
-
 
74
 
-
 
75
        /*
-
 
76
        ** Insert Data by Category
-
 
77
        */
61
        for( int j = 0; j <= config.num_class; j++ )
78
        for( int j = 0; j <= config.num_class; j++ )
62
        {
79
        {
63
            for( int i = 0; i <= config.num_legs; i++ )
80
            if (j == 0 || config.team_class[j-1].abr[0])
64
            {
81
            {
-
 
82
                QGroupBox * groupBox = new QGroupBox(j ? config.team_class[j - 1].full_name : "Complete Event");
-
 
83
                groupBox->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
-
 
84
                verticalLayout2->addWidget(groupBox);
-
 
85
                QHBoxLayout * horizontalLayout = new QHBoxLayout(groupBox);
-
 
86
 
-
 
87
                /*
-
 
88
                ** Insert Data by Leg
-
 
89
                */
65
                QmStatusItem * item = statusItems[i][j];
90
                for( int i = 0; i <= config.num_legs; i++ )
-
 
91
                {
-
 
92
                    QmStatusItem *item = new QmStatusItem(i ? config.leg_name[i - 1] : "Overall");
66
                item->setData(stats.fast.team[i][j], stats.fast.time[i][j],stats.average[i][j] );
93
                    item->setData(stats.fast.team[i][j], stats.fast.time[i][j],stats.average[i][j] );
-
 
94
                    horizontalLayout->addWidget ( item );
-
 
95
                }
67
            }
96
            }
68
        }
97
        }
69
    }
98
    }
70
}
99
}
71
 
100