Subversion Repositories svn1-original

Rev

Rev 318 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 318 Rev 327
Line 27... Line 27...
27
    buttonBox->addButton( new QPushButton("Recalc"),QDialogButtonBox::AcceptRole);
27
    buttonBox->addButton( new QPushButton("Recalc"),QDialogButtonBox::AcceptRole);
28
    QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(calculate()));
28
    QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(calculate()));
29
 
29
 
30
    verticalLayout->addWidget(buttonBox);
30
    verticalLayout->addWidget(buttonBox);
31
 
31
 
32
    QVBoxLayout *verticalLayout2 = new QVBoxLayout(scrollAreaWidgetContents);
32
    verticalLayout2 = new QVBoxLayout(scrollAreaWidgetContents);
33
 
33
 
34
    for( int j = 0; j <= config.num_class; j++ )
-
 
35
    {
-
 
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);
-
 
42
 
-
 
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
            }
-
 
53
        }
-
 
54
    }
-
 
55
}
34
}
56
 
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
 
57
void QmEventStatus::calculate(void)
49
void QmEventStatus::calculate(void)
58
{
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
    */
59
    if( load_report_data() )
70
    if( load_report_data() )
60
    {
71
    {
61
        srt_place();
72
        srt_place();
62
        //qDebug("Calulate Event Status");
73
        //qDebug("Calulate Event Status");
-
 
74
 
-
 
75
        /*
-
 
76
        ** Insert Data by Category
-
 
77
        */
63
        for( int j = 0; j <= config.num_class; j++ )
78
        for( int j = 0; j <= config.num_class; j++ )
64
        {
79
        {
65
            if (j == 0 || config.team_class[j-1].abr[0])
80
            if (j == 0 || config.team_class[j-1].abr[0])
66
            {
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
                */
67
                for( int i = 0; i <= config.num_legs; i++ )
90
                for( int i = 0; i <= config.num_legs; i++ )
68
                {
91
                {
69
                    QmStatusItem * item = statusItems[i][j];
92
                    if (i == 0 || config.team_class[i-1].abr[0])
70
                    if (item)
-
 
71
                    {
93
                    {
-
 
94
                        QmStatusItem *item = new QmStatusItem(i ? config.leg_name[i - 1] : "Overall");
72
                        item->setData(stats.fast.team[i][j], stats.fast.time[i][j], stats.average[i][j]); 
95
                        item->setData(stats.fast.team[i][j], stats.fast.time[i][j],stats.average[i][j] );
-
 
96
                        horizontalLayout->addWidget ( item );
73
                    }
97
                    }
74
                }
98
                }
75
            }
99
            }
76
        }
100
        }
77
    }
101
    }