Subversion Repositories svn1

Rev

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

Rev 226 Rev 380
Line 16... Line 16...
16
#include "qmteamdisplay.h"
16
#include "qmteamdisplay.h"
17
#include "ui_qmteamdisplay.h"
17
#include "ui_qmteamdisplay.h"
18
#include "spinboxdelegate.h"
18
#include "spinboxdelegate.h"
19
#include "timedelegate.h"
19
#include "timedelegate.h"
20
#include "textdelegate.h"
20
#include "textdelegate.h"
-
 
21
#include "mainwindow.h"
-
 
22
#include "QmEditAddendum.h"
21
 
23
 
22
/*----------------------------------------------------------------------------
24
/*----------------------------------------------------------------------------
23
** FUNCTION           : qmTeamDisplay
25
** FUNCTION           : qmTeamDisplay
24
**
26
**
25
** DESCRIPTION        : Construct a new widget
27
** DESCRIPTION        : Construct a new widget
Line 30... Line 32...
30
** RETURNS            :
32
** RETURNS            :
31
**
33
**
32
----------------------------------------------------------------------------*/
34
----------------------------------------------------------------------------*/
33
 
35
 
34
 
36
 
35
qmTeamDisplay::qmTeamDisplay(QWidget *parent) :
37
qmTeamDisplay::qmTeamDisplay(QWidget *parent, int initialTeam, bool useDone) :
36
    QWidget(parent),
38
    QWidget(parent),
37
    ui(new Ui::QmTeamDisplay)
39
    ui(new Ui::QmTeamDisplay)
38
{
40
{
39
    ui->setupUi(this);
41
    ui->setupUi(this);
40
    team = 0;
42
    team = 0;
41
    dirty = true;
43
    dirty = true;
42
    populating = true;
44
    populating = false;
43
 
-
 
44
    /*
-
 
45
    ** Populate the Combo Box
-
 
46
    ** Should do more often
45
    enableDone = useDone;
47
    */
-
 
48
    for ( int ii = 0; ii < config.num_class ; ii++)
-
 
49
    {
-
 
50
        ui->category->addItem(config.team_class[ii].full_name, ii);
-
 
51
    }
-
 
52
    ui->category->setCurrentIndex(-1);
-
 
53
 
46
 
54
    /*
47
    /*
55
    **  Set delegates to assist in editing the members table
48
    **  Set delegates to assist in editing the members table
56
    **      Name
49
    **      Name
57
    **      Sex
50
    **      Sex
58
    **      Age
51
    **      Age
59
    */
52
    */
60
    ui->members->setItemDelegateForColumn(0, new textDelegate(MAX_PERSON_NAME));
53
    ui->members->setItemDelegateForColumn(0, new textDelegate(MAX_PERSON_NAME));
61
    ui->members->setItemDelegateForColumn(2, new SpinBoxDelegate(0,120));
54
    ui->members->setItemDelegateForColumn(2, new SpinBoxDelegate(0,120));
62
 
55
 
-
 
56
    ui->members->verticalHeader()->setVisible(true);
-
 
57
    QStringList labels;
-
 
58
    for ( int ii = 0 ; ii < config.num_legs; ii++)
-
 
59
    {
-
 
60
        labels << config.leg_name[ii];
-
 
61
    }
-
 
62
    ui->members->setVerticalHeaderLabels(labels);
-
 
63
 
63
    /*
64
    /*
64
    ** Insert widgets for the Team Times
65
    ** Insert widgets for the Team Times
65
    */
66
    */
-
 
67
    for (int ii = 0; ii <= MAX_LEGS; ii++) {
-
 
68
        lt[ii] = NULL;
-
 
69
    }
-
 
70
 
-
 
71
 
66
    for ( int ii = 1 ; ii <= config.num_legs; ii++)
72
    for ( int ii = 1 ; ii <= config.num_legs; ii++)
67
    {
73
    {
68
        lt[ii] = new QmLegTimes(ii, config.leg_name[ii-1]);
74
        lt[ii] = new QmLegTimes(ii, config.leg_name[ii-1]);
69
        ui->legTime_layout->addWidget(lt[ii]);
75
        ui->legTime_layout->addWidget(lt[ii]);
70
        connect (lt[ii], SIGNAL(dataChanged()), this, SLOT(recalculateTimes()) );
76
        connect (lt[ii], SIGNAL(dataChanged()), this, SLOT(recalculateTimes()) );
71
    }
77
    }
72
    lt[0] = new QmLegTimes(0, "Overall Event");
78
    lt[0] = new QmLegTimes(0, "Overall Event");
73
    ui->legTime_layout->addWidget(lt[0]);
79
    ui->legTime_layout->addWidget(lt[0]);
74
 
80
 
75
    /*
81
    /*
-
 
82
    ** Init initial displayed team
-
 
83
    */
-
 
84
    team = initialTeam ? initialTeam : config.min_team;
-
 
85
 
-
 
86
    /*
76
    **  Connect up various signals
87
    **  Connect up various signals
77
    */
88
    */
78
    connect(ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(save()) );
89
    connect(ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(save()) );
79
    connect(ui->pushButtonRestore, SIGNAL(clicked()), this, SLOT(cancel()) );
90
    connect(ui->pushButtonRestore, SIGNAL(clicked()), this, SLOT(cancel()) );
80
    connect(ui->teamNumber, SIGNAL(valueChanged(int)), this, SLOT(populate(int)) );
91
    connect(ui->teamNumber, SIGNAL(valueChanged(int)), this, SLOT(populate(int)) );
81
 
92
 
82
    connect(ui->name, SIGNAL(editingFinished()), this, SLOT(changed()));
93
    connect(ui->name, SIGNAL(textEdited(QString)), this, SLOT(changed()) );
83
    connect(ui->category , SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
94
    connect(ui->category , SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
84
    connect(ui->category , SIGNAL(currentIndexChanged(int)), this, SLOT(updateCategory()));
95
    connect(ui->category , SIGNAL(currentIndexChanged(int)), this, SLOT(updateCategory()));
85
    connect(ui->members , SIGNAL(cellChanged(int,int)), this, SLOT(changed()));
96
    connect(ui->members , SIGNAL(cellChanged(int,int)), this, SLOT(changed()));
86
    connect(ui->disqualified , SIGNAL(clicked(bool)), this, SLOT(changed()));
97
    connect(ui->disqualified , SIGNAL(clicked(bool)), this, SLOT(changed()));
87
    connect(ui->nonEquestrian , SIGNAL(clicked(bool)), this, SLOT(changed()));
98
    connect(ui->nonEquestrian , SIGNAL(clicked(bool)), this, SLOT(recalculateTimes()));
88
    connect(ui->disabled , SIGNAL(clicked(bool)), this, SLOT(changed()));
99
    connect(ui->disabled , SIGNAL(clicked(bool)), this, SLOT(changed()));
89
    connect(ui->VetCheck , SIGNAL(clicked(bool)), this, SLOT(changed()));
100
    connect(ui->VetCheck , SIGNAL(clicked(bool)), this, SLOT(changed()));
90
 
101
 
-
 
102
    connect(ui->editNote, SIGNAL(clicked()), this, SLOT(editNote()));
-
 
103
 
91
    updateChanged(false);
104
    updateChanged(false);
92
    populating = false;
-
 
93
    populate(config.min_team);
-
 
94
}
105
}
95
 
106
 
96
/*----------------------------------------------------------------------------
107
/*----------------------------------------------------------------------------
97
** FUNCTION           : ~qmTeamDisplay
108
** FUNCTION           : ~qmTeamDisplay
98
**
109
**
Line 109... Line 120...
109
{
120
{
110
    delete ui;
121
    delete ui;
111
}
122
}
112
 
123
 
113
/*----------------------------------------------------------------------------
124
/*----------------------------------------------------------------------------
-
 
125
** FUNCTION           : showEvent
-
 
126
**
-
 
127
** DESCRIPTION        : Slot that is wired into the main windows widget
-
 
128
**                      It will be called when the main window widget changes
-
 
129
**                      If this display is the current display, then load new data
-
 
130
**
-
 
131
** INPUTS             : index of the tab that now has focus
-
 
132
**
-
 
133
----------------------------------------------------------------------------*/
-
 
134
 
-
 
135
void qmTeamDisplay::showEvent ( QShowEvent * event )
-
 
136
{
-
 
137
    //qDebug("showEvent::showEvent");
-
 
138
    if ( ! event->spontaneous() )
-
 
139
    {
-
 
140
        if ( ! dirty)
-
 
141
        {
-
 
142
            populate(team);
-
 
143
        }
-
 
144
    }
-
 
145
}
-
 
146
 
-
 
147
/*----------------------------------------------------------------------------
-
 
148
** FUNCTION           : blockSignals
-
 
149
**
-
 
150
** DESCRIPTION        : Block signal from widgets that set Changed
-
 
151
**                      while populating the display
-
 
152
**
-
 
153
**
-
 
154
** INPUTS             : state - New blocking state
-
 
155
**
-
 
156
** RETURNS            : Nothing
-
 
157
**
-
 
158
----------------------------------------------------------------------------*/
-
 
159
 
-
 
160
void qmTeamDisplay::blockSignals(bool state)
-
 
161
{
-
 
162
//    ui->pushButtonSave->blockSignals(state);
-
 
163
//    ui->pushButtonRestore->blockSignals(state);
-
 
164
//    ui->teamNumber->blockSignals(state);
-
 
165
 
-
 
166
    ui->name->blockSignals(state);
-
 
167
    ui->category->blockSignals(state);
-
 
168
    ui->members->blockSignals(state);
-
 
169
    ui->disqualified->blockSignals(state);
-
 
170
    ui->nonEquestrian->blockSignals(state);
-
 
171
    ui->disabled->blockSignals(state);
-
 
172
    ui->VetCheck->blockSignals(state);
-
 
173
 
-
 
174
    for ( int ii = 0 ; ii <= MAX_LEGS; ii++)
-
 
175
    {
-
 
176
        if (lt[ii]) {
-
 
177
            lt[ii]->blockSignals(state);
-
 
178
        }
-
 
179
    }
-
 
180
}
-
 
181
 
-
 
182
/*----------------------------------------------------------------------------
114
** FUNCTION           : populate
183
** FUNCTION           : populate
115
**
184
**
116
** DESCRIPTION        : Populate the widget with data
185
** DESCRIPTION        : Populate the widget with data
117
**
186
**
118
**
187
**
Line 122... Line 191...
122
**
191
**
123
----------------------------------------------------------------------------*/
192
----------------------------------------------------------------------------*/
124
 
193
 
125
void qmTeamDisplay::populate(int team_number)
194
void qmTeamDisplay::populate(int team_number)
126
{
195
{
-
 
196
    if (MainWindow::shutDown) {
-
 
197
        return;
-
 
198
    }
-
 
199
 
127
    /*
200
    /*
128
    **  Update the spinner that describes the current team number
201
    **  Update the spinner that describes the current team number
129
    */
202
    */
130
    populating = true;
203
    populating = true;
-
 
204
    blockSignals(true);
131
 
205
 
132
    ui->teamNumber->setMaximum(config.max_team);
206
    ui->teamNumber->setMaximum(config.max_team);
133
    ui->teamNumber->setMinimum(config.min_team);
207
    ui->teamNumber->setMinimum(config.min_team);
134
    ui->teamNumber->setValue(team_number);
208
    ui->teamNumber->setValue(team_number);
135
    team = team_number;
209
    team = team_number;
Line 143... Line 217...
143
    /*
217
    /*
144
    ** Basic Data
218
    ** Basic Data
145
    */
219
    */
146
    ui->name->setText( team_buf.name );
220
    ui->name->setText( team_buf.name );
147
    ui->category_abr->setText( config.team_class[team_buf.teamclass - 1].abr );
221
    ui->category_abr->setText( config.team_class[team_buf.teamclass - 1].abr );
-
 
222
 
-
 
223
    /*
-
 
224
    ** ComboBox for Category selection
-
 
225
    **  Save category index as data inthe combobox
-
 
226
    **  Do not show the NE category - it should be selected
-
 
227
    */
-
 
228
    ui->category->clear();
-
 
229
    int selectedIndex = -1;
-
 
230
    for ( int ii = 0; ii < config.num_class ; ii++)
-
 
231
    {
-
 
232
        if (config.team_class[ii].abr[0] && (config.nonequestrian_class != ii + 1))
-
 
233
        {
-
 
234
            ui->category->addItem(config.team_class[ii].full_name, ii);
148
    ui->category->setCurrentIndex(team_buf.teamclass - 1);
235
            if (ii == team_buf.teamclass - 1)
-
 
236
            {
149
    //TODO: Link update of combo box to the abreviation display
237
                selectedIndex = ui->category->count() - 1;
-
 
238
                //qDebug("ComboIndex:%d",ii);
-
 
239
            }
-
 
240
        }
-
 
241
    }
-
 
242
    ui->category->setCurrentIndex(selectedIndex);
150
 
243
 
151
    ui->disqualified->setCheckState(team_buf.flags.disqualified ? Qt::Checked : Qt::Unchecked);
244
    ui->disqualified->setCheckState(team_buf.flags.disqualified ? Qt::Checked : Qt::Unchecked);
152
    ui->nonEquestrian->setCheckState(team_buf.flags.non_equestrian ? Qt::Checked : Qt::Unchecked);
245
    ui->nonEquestrian->setCheckState(team_buf.flags.non_equestrian ? Qt::Checked : Qt::Unchecked);
153
    ui->disabled->setCheckState( !team_buf.flags.valid ? Qt::Checked : Qt::Unchecked);
246
    ui->disabled->setCheckState( !team_buf.flags.valid ? Qt::Checked : Qt::Unchecked);
154
    ui->VetCheck->setCheckState( team_buf.flags.vet_check ? Qt::Checked : Qt::Unchecked);
247
    ui->VetCheck->setCheckState( team_buf.flags.vet_check ? Qt::Checked : Qt::Unchecked);
Line 200... Line 293...
200
        }
293
        }
201
    }
294
    }
202
    ui->members->resizeColumnsToContents();
295
    ui->members->resizeColumnsToContents();
203
 
296
 
204
    /*
297
    /*
205
    **  Mainatainthe display of total age
298
    **  Mainatain the display of total age
206
    */
299
    */
207
    if ( age_sum <= 0 )
300
    if ( age_sum <= 0 )
208
    {
301
    {
209
        ui->totalAge->setText("--");
302
        ui->totalAge->setText("--");
210
    }
303
    }
Line 220... Line 313...
220
    for ( int ii = 0 ; ii <= config.num_legs; ii++)
313
    for ( int ii = 0 ; ii <= config.num_legs; ii++)
221
    {
314
    {
222
        lt[ii]->setData(&team_buf.leg[ii]);
315
        lt[ii]->setData(&team_buf.leg[ii]);
223
    }
316
    }
224
 
317
 
-
 
318
    /*
-
 
319
    **  Team Note
-
 
320
    */
225
    populating = false;
321
    populateNote();
-
 
322
 
226
    updateChanged(false);
323
    updateChanged(false);
-
 
324
    populating = false;
-
 
325
    blockSignals(false);
-
 
326
    
227
}
327
}
228
 
328
 
229
void qmTeamDisplay::updateCategory(void)
329
void qmTeamDisplay::updateCategory(void)
230
{
330
{
-
 
331
    int currentIndex = ui->category->currentIndex();
-
 
332
    if (currentIndex >= 0)
-
 
333
    {
-
 
334
        int itemData = ui->category->itemData(currentIndex).toInt();
231
     ui->category_abr->setText( config.team_class[ui->category->currentIndex()].abr );
335
        ui->category_abr->setText( config.team_class[itemData].abr );
-
 
336
    }
232
}
337
}
233
 
338
 
234
/*----------------------------------------------------------------------------
339
/*----------------------------------------------------------------------------
235
** FUNCTION           : recalculateTimes
340
** FUNCTION           : recalculateTimes
236
**
341
**
Line 247... Line 352...
247
{
352
{
248
    for ( int ii = 0 ; ii <= config.num_legs; ii++)
353
    for ( int ii = 0 ; ii <= config.num_legs; ii++)
249
    {
354
    {
250
        lt[ii]->getData(&team_buf.leg[ii]);
355
        lt[ii]->getData(&team_buf.leg[ii]);
251
    }
356
    }
-
 
357
    suckData();
252
    set_times( &team_buf );
358
    set_times( &team_buf );
253
    test_times( &team_buf, 0 );
359
    test_times( &team_buf, 0 );
254
    for ( int ii = 0 ; ii <= config.num_legs; ii++)
360
    for ( int ii = 0 ; ii <= config.num_legs; ii++)
255
    {
361
    {
256
        lt[ii]->setData(&team_buf.leg[ii]);
362
        lt[ii]->setData(&team_buf.leg[ii]);
Line 259... Line 365...
259
    // Flag data as changed
365
    // Flag data as changed
260
    changed();
366
    changed();
261
}
367
}
262
 
368
 
263
/*----------------------------------------------------------------------------
369
/*----------------------------------------------------------------------------
264
** FUNCTION           : save
370
** FUNCTION           : suckData
265
**
371
**
266
** DESCRIPTION        : Save the data back to disk
372
** DESCRIPTION        : Save the data back to memory
267
**
373
**
268
** INPUTS             :
374
** INPUTS             :
269
**
375
**
270
** RETURNS            :
376
** RETURNS            :
271
**
377
**
272
----------------------------------------------------------------------------*/
378
----------------------------------------------------------------------------*/
273
 
379
 
274
void qmTeamDisplay::save(void)
380
void qmTeamDisplay::suckData(void)
275
{
381
{
276
    /*
382
    /*
277
    ** Extract data from the widgets
383
    ** Extract data from the widgets
278
    ** The time stuff is done on the fly as it changes
384
    ** The time stuff is done on the fly as it changes
279
    */
385
    */
280
    strncpy(team_buf.name , qPrintable(ui->name->text()), sizeof(team_buf.name));
386
    strncpy(team_buf.name , qPrintable(ui->name->text()), sizeof(team_buf.name));
-
 
387
 
281
    team_buf.teamclass = ui->category->currentIndex() + 1;
388
    int currentIndex = ui->category->currentIndex();
-
 
389
    if (currentIndex >= 0)
-
 
390
    {
-
 
391
        int itemData = ui->category->itemData(currentIndex).toInt();
-
 
392
        team_buf.teamclass = itemData + 1;
-
 
393
    }
282
 
394
 
283
    team_buf.flags.disqualified =  ( ui->disqualified->checkState () == Qt::Checked);
395
    team_buf.flags.disqualified =  ( ui->disqualified->checkState () == Qt::Checked);
284
    team_buf.flags.non_equestrian =  ( ui->nonEquestrian->checkState () == Qt::Checked);
396
    team_buf.flags.non_equestrian =  ( ui->nonEquestrian->checkState () == Qt::Checked);
285
    team_buf.flags.valid =  ( ui->disabled->checkState () != Qt::Checked);
397
    team_buf.flags.valid =  ( ui->disabled->checkState () != Qt::Checked);
286
    team_buf.flags.vet_check =  ( ui->VetCheck->checkState () == Qt::Checked);
398
    team_buf.flags.vet_check =  ( ui->VetCheck->checkState () == Qt::Checked);
Line 307... Line 419...
307
 
419
 
308
        item = ui->members->item ( ii, 2 );
420
        item = ui->members->item ( ii, 2 );
309
        team_buf.members[ii].age = item->data(Qt::EditRole).toInt();
421
        team_buf.members[ii].age = item->data(Qt::EditRole).toInt();
310
 
422
 
311
    }
423
    }
-
 
424
}
312
 
425
 
-
 
426
/*----------------------------------------------------------------------------
-
 
427
** FUNCTION           : save
-
 
428
**
-
 
429
** DESCRIPTION        : Save the data back to disk
-
 
430
**                      Also called if nothing to save - ie Done Mode
-
 
431
**
-
 
432
** INPUTS             :
-
 
433
**
-
 
434
** RETURNS            :
-
 
435
**
-
 
436
----------------------------------------------------------------------------*/
-
 
437
 
-
 
438
void qmTeamDisplay::save(void)
-
 
439
{
-
 
440
    if ( dirty )
313
    /*
441
    {
-
 
442
        /*
314
    ** Save the record back to disk
443
        ** Save the record back to disk
315
    */
444
        */
-
 
445
        suckData();
316
    put_team_record( team, &team_buf );
446
        put_team_record( team, &team_buf );
317
    populate(team);
447
        populate(team);
-
 
448
    }
-
 
449
    else
-
 
450
    {
-
 
451
        if ( enableDone )
-
 
452
            emit dialogDone(1);
-
 
453
    }
318
}
454
}
319
 
455
 
320
/*----------------------------------------------------------------------------
456
/*----------------------------------------------------------------------------
321
** FUNCTION           : cancel
457
** FUNCTION           : cancel
322
**
458
**
Line 335... Line 471...
335
    populate(team);
471
    populate(team);
336
}
472
}
337
 
473
 
338
void qmTeamDisplay::changed(void)
474
void qmTeamDisplay::changed(void)
339
{
475
{
-
 
476
//QObject * who = sender () ;
-
 
477
//qDebug ("Changed: %p", who);
340
    if (populating)
478
    if (populating)
341
        return;
479
        return;
342
    updateChanged(true);
480
    updateChanged(true);
343
//qDebug ("Changed");
-
 
-
 
481
 
344
}
482
}
345
 
483
 
346
void qmTeamDisplay::updateChanged(bool newDirty)
484
void qmTeamDisplay::updateChanged(bool newDirty)
347
{
485
{
348
    //qDebug("updateChanged: %d -> %d", newDirty, dirty);
486
    //qDebug("updateChanged: %d, %d -> %d", populating, dirty, newDirty );
349
    if (newDirty != dirty)
487
    if (newDirty != dirty)
350
    {
488
    {
351
        dirty = newDirty;
489
        dirty = newDirty;
352
        if (dirty)
490
        if (dirty)
353
        {
491
        {
354
            ui->Changed->setVisible(true);
492
            ui->Changed->setVisible(true);
355
            ui->teamNumber->setEnabled(false);
493
            ui->teamNumber->setEnabled(false);
356
            ui->pushButtonSave->setEnabled(true);
494
            ui->pushButtonSave->setEnabled(true);
357
            ui->pushButtonSave->setStyleSheet("background-color: rgb(255, 0, 0);");
495
            ui->pushButtonSave->setStyleSheet("background-color: rgb(255, 0, 0);");
-
 
496
            ui->pushButtonSave->setText("Save");
-
 
497
 
-
 
498
            //  Only valid when within a dialog
-
 
499
            //  Now have the dialog swallow <return>
-
 
500
            //ui->pushButtonSave->setDefault(true);
358
        }
501
        }
359
        else
502
        else
360
        {
503
        {
361
            ui->Changed->setVisible(false);
504
            ui->Changed->setVisible(false);
362
            ui->teamNumber->setEnabled(true);
505
            ui->teamNumber->setEnabled(true);
363
            ui->pushButtonSave->setEnabled(false);
506
            //ui->pushButtonSave->setEnabled(false);
364
            ui->pushButtonSave->setStyleSheet("");
507
            ui->pushButtonSave->setStyleSheet("");
-
 
508
 
-
 
509
            if ( enableDone )
-
 
510
                ui->pushButtonSave->setText("Done");
365
        }
511
        }
366
    }
512
    }
367
}
513
}
368
 
514
 
369
/*----------------------------------------------------------------------------
515
/*----------------------------------------------------------------------------
Line 388... Line 534...
388
        break;
534
        break;
389
    default:
535
    default:
390
        break;
536
        break;
391
    }
537
    }
392
}
538
}
-
 
539
 
-
 
540
/*----------------------------------------------------------------------------
-
 
541
** FUNCTION           : populateNote
-
 
542
**
-
 
543
** DESCRIPTION        : Populate the Note area of the team display
-
 
544
**                      Must be called during populate as
-
 
545
**
-
 
546
**
-
 
547
** INPUTS             :
-
 
548
**
-
 
549
** RETURNS            :
-
 
550
**
-
 
551
----------------------------------------------------------------------------*/
-
 
552
 
-
 
553
void qmTeamDisplay::populateNote(void)
-
 
554
{
-
 
555
    noteFileName = "TeamNote_" + QString::number(team) + ".txt";
-
 
556
    //qDebug("NoteFile:%s",qPrintable(noteFileName));
-
 
557
 
-
 
558
    //  Clear combobox before we add text
-
 
559
    ui->noteText->clear();
-
 
560
 
-
 
561
    QFile noteFile(QString(filepath) + noteFileName);
-
 
562
    if ( noteFile.open( QIODevice::ReadOnly ) )
-
 
563
    {
-
 
564
        QTextStream stream( &noteFile );
-
 
565
        QString line;
-
 
566
        do {
-
 
567
             line = stream.readLine();
-
 
568
             if (line.isNull())
-
 
569
                 break;
-
 
570
             ui->noteText->addItem(line);
-
 
571
         } while (true);
-
 
572
        noteFile.close();
-
 
573
    }
-
 
574
    ui->noteText->setStyleSheet( ui->noteText->count() ? "background-color: #FFFFCB;" : "");
-
 
575
 
-
 
576
    /*
-
 
577
    ** Delete empy files to keep things clean
-
 
578
    */
-
 
579
    if (noteFile.size() == 0 )
-
 
580
    {
-
 
581
        noteFile.remove();
-
 
582
    }
-
 
583
}
-
 
584
 
-
 
585
/*----------------------------------------------------------------------------
-
 
586
** FUNCTION           : editNote
-
 
587
**
-
 
588
** DESCRIPTION        : Edit the Team Note in a  modal dialog box
-
 
589
**
-
 
590
** INPUTS             :
-
 
591
**
-
 
592
** RETURNS            :
-
 
593
**
-
 
594
----------------------------------------------------------------------------*/
-
 
595
 
-
 
596
void qmTeamDisplay::editNote(void)
-
 
597
{
-
 
598
    QmEditAddendum dialog(QmConfig::getAddendemFile(noteFileName, true), true);
-
 
599
     dialog.exec();
-
 
600
     populateNote();
-
 
601
}