Subversion Repositories svn1

Rev

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

Rev 312 Rev 313
Line 42... Line 42...
42
    dirty = true;
42
    dirty = true;
43
    populating = false;
43
    populating = false;
44
    enableDone = useDone;
44
    enableDone = useDone;
45
 
45
 
46
    /*
46
    /*
47
    ** Populate the Combo Box
-
 
48
    ** Should do more often
-
 
49
    */
-
 
50
    for ( int ii = 0; ii < config.num_class ; ii++)
-
 
51
    {
-
 
52
        ui->category->addItem(config.team_class[ii].full_name, ii);
-
 
53
    }
-
 
54
    ui->category->setCurrentIndex(-1);
-
 
55
 
-
 
56
    /*
-
 
57
    **  Set delegates to assist in editing the members table
47
    **  Set delegates to assist in editing the members table
58
    **      Name
48
    **      Name
59
    **      Sex
49
    **      Sex
60
    **      Age
50
    **      Age
61
    */
51
    */
Line 73... Line 63...
73
    }
63
    }
74
    lt[0] = new QmLegTimes(0, "Overall Event");
64
    lt[0] = new QmLegTimes(0, "Overall Event");
75
    ui->legTime_layout->addWidget(lt[0]);
65
    ui->legTime_layout->addWidget(lt[0]);
76
 
66
 
77
    /*
67
    /*
-
 
68
    ** Init initial displayed team
-
 
69
    */
-
 
70
    team = initialTeam ? initialTeam : config.min_team;
-
 
71
 
-
 
72
    /*
78
    **  Connect up various signals
73
    **  Connect up various signals
79
    */
74
    */
80
    connect(ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(save()) );
75
    connect(ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(save()) );
81
    connect(ui->pushButtonRestore, SIGNAL(clicked()), this, SLOT(cancel()) );
76
    connect(ui->pushButtonRestore, SIGNAL(clicked()), this, SLOT(cancel()) );
82
    connect(ui->teamNumber, SIGNAL(valueChanged(int)), this, SLOT(populate(int)) );
77
    connect(ui->teamNumber, SIGNAL(valueChanged(int)), this, SLOT(populate(int)) );
Line 89... Line 84...
89
    connect(ui->nonEquestrian , SIGNAL(clicked(bool)), this, SLOT(recalculateTimes()));
84
    connect(ui->nonEquestrian , SIGNAL(clicked(bool)), this, SLOT(recalculateTimes()));
90
    connect(ui->disabled , SIGNAL(clicked(bool)), this, SLOT(changed()));
85
    connect(ui->disabled , SIGNAL(clicked(bool)), this, SLOT(changed()));
91
    connect(ui->VetCheck , SIGNAL(clicked(bool)), this, SLOT(changed()));
86
    connect(ui->VetCheck , SIGNAL(clicked(bool)), this, SLOT(changed()));
92
 
87
 
93
    updateChanged(false);
88
    updateChanged(false);
94
    populate(initialTeam ? initialTeam : config.min_team);
-
 
95
}
89
}
96
 
90
 
97
/*----------------------------------------------------------------------------
91
/*----------------------------------------------------------------------------
98
** FUNCTION           : ~qmTeamDisplay
92
** FUNCTION           : ~qmTeamDisplay
99
**
93
**
Line 127... Line 121...
127
    qDebug("showEvent::showEvent");
121
    qDebug("showEvent::showEvent");
128
    if ( ! event->spontaneous() )
122
    if ( ! event->spontaneous() )
129
    {
123
    {
130
        if ( ! dirty)
124
        if ( ! dirty)
131
        {
125
        {
132
            populate(ui->teamNumber->value());
126
            populate(team);
133
        }
127
        }
134
    }
128
    }
135
}
129
}
136
 
130
 
137
/*----------------------------------------------------------------------------
131
/*----------------------------------------------------------------------------
Line 165... Line 159...
165
    {
159
    {
166
        lt[ii]->blockSignals(state);
160
        lt[ii]->blockSignals(state);
167
    }
161
    }
168
}
162
}
169
 
163
 
170
 
-
 
171
 
-
 
172
/*----------------------------------------------------------------------------
164
/*----------------------------------------------------------------------------
173
** FUNCTION           : populate
165
** FUNCTION           : populate
174
**
166
**
175
** DESCRIPTION        : Populate the widget with data
167
** DESCRIPTION        : Populate the widget with data
176
**
168
**
Line 203... Line 195...
203
    /*
195
    /*
204
    ** Basic Data
196
    ** Basic Data
205
    */
197
    */
206
    ui->name->setText( team_buf.name );
198
    ui->name->setText( team_buf.name );
207
    ui->category_abr->setText( config.team_class[team_buf.teamclass - 1].abr );
199
    ui->category_abr->setText( config.team_class[team_buf.teamclass - 1].abr );
-
 
200
 
-
 
201
    /*
-
 
202
    ** ComboBox for Category selection
-
 
203
    **  Save category index as data inthe combobox
-
 
204
    **  Do not show the NE category - it should be selected
-
 
205
    */
-
 
206
    ui->category->clear();
-
 
207
    int selectedIndex = -1;
-
 
208
    for ( int ii = 0; ii < config.num_class ; ii++)
-
 
209
    {
-
 
210
        if (config.team_class[ii].abr[0] && (config.nonequestrian_class != ii + 1))
-
 
211
        {
-
 
212
            ui->category->addItem(config.team_class[ii].full_name, ii);
208
    ui->category->setCurrentIndex(team_buf.teamclass - 1);
213
            if (ii == team_buf.teamclass - 1)
-
 
214
            {
209
    //TODO: Link update of combo box to the abreviation display
215
                selectedIndex = ui->category->count() - 1;
-
 
216
                qDebug("ComboIndex:%d",ii);
-
 
217
            }
-
 
218
        }
-
 
219
    }
-
 
220
    ui->category->setCurrentIndex(selectedIndex);
210
 
221
 
211
    ui->disqualified->setCheckState(team_buf.flags.disqualified ? Qt::Checked : Qt::Unchecked);
222
    ui->disqualified->setCheckState(team_buf.flags.disqualified ? Qt::Checked : Qt::Unchecked);
212
    ui->nonEquestrian->setCheckState(team_buf.flags.non_equestrian ? Qt::Checked : Qt::Unchecked);
223
    ui->nonEquestrian->setCheckState(team_buf.flags.non_equestrian ? Qt::Checked : Qt::Unchecked);
213
    ui->disabled->setCheckState( !team_buf.flags.valid ? Qt::Checked : Qt::Unchecked);
224
    ui->disabled->setCheckState( !team_buf.flags.valid ? Qt::Checked : Qt::Unchecked);
214
    ui->VetCheck->setCheckState( team_buf.flags.vet_check ? Qt::Checked : Qt::Unchecked);
225
    ui->VetCheck->setCheckState( team_buf.flags.vet_check ? Qt::Checked : Qt::Unchecked);
Line 288... Line 299...
288
    
299
    
289
}
300
}
290
 
301
 
291
void qmTeamDisplay::updateCategory(void)
302
void qmTeamDisplay::updateCategory(void)
292
{
303
{
-
 
304
    int currentIndex = ui->category->currentIndex();
-
 
305
    if (currentIndex >= 0)
-
 
306
    {
-
 
307
        int itemData = ui->category->itemData(currentIndex).toInt();
293
     ui->category_abr->setText( config.team_class[ui->category->currentIndex()].abr );
308
        ui->category_abr->setText( config.team_class[itemData].abr );
-
 
309
    }
294
}
310
}
295
 
311
 
296
/*----------------------------------------------------------------------------
312
/*----------------------------------------------------------------------------
297
** FUNCTION           : recalculateTimes
313
** FUNCTION           : recalculateTimes
298
**
314
**
Line 339... Line 355...
339
    /*
355
    /*
340
    ** Extract data from the widgets
356
    ** Extract data from the widgets
341
    ** The time stuff is done on the fly as it changes
357
    ** The time stuff is done on the fly as it changes
342
    */
358
    */
343
    strncpy(team_buf.name , qPrintable(ui->name->text()), sizeof(team_buf.name));
359
    strncpy(team_buf.name , qPrintable(ui->name->text()), sizeof(team_buf.name));
-
 
360
 
344
    team_buf.teamclass = ui->category->currentIndex() + 1;
361
    int currentIndex = ui->category->currentIndex();
-
 
362
    if (currentIndex >= 0)
-
 
363
    {
-
 
364
        int itemData = ui->category->itemData(currentIndex).toInt();
-
 
365
        team_buf.teamclass = itemData + 1;
-
 
366
    }
345
 
367
 
346
    team_buf.flags.disqualified =  ( ui->disqualified->checkState () == Qt::Checked);
368
    team_buf.flags.disqualified =  ( ui->disqualified->checkState () == Qt::Checked);
347
    team_buf.flags.non_equestrian =  ( ui->nonEquestrian->checkState () == Qt::Checked);
369
    team_buf.flags.non_equestrian =  ( ui->nonEquestrian->checkState () == Qt::Checked);
348
    team_buf.flags.valid =  ( ui->disabled->checkState () != Qt::Checked);
370
    team_buf.flags.valid =  ( ui->disabled->checkState () != Qt::Checked);
349
    team_buf.flags.vet_check =  ( ui->VetCheck->checkState () == Qt::Checked);
371
    team_buf.flags.vet_check =  ( ui->VetCheck->checkState () == Qt::Checked);