Subversion Repositories svn1

Rev

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

Rev 314 Rev 315
Line 17... Line 17...
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"
21
#include "mainwindow.h"
-
 
22
#include "QmEditAddendum.h"
22
 
23
 
23
/*----------------------------------------------------------------------------
24
/*----------------------------------------------------------------------------
24
** FUNCTION           : qmTeamDisplay
25
** FUNCTION           : qmTeamDisplay
25
**
26
**
26
** DESCRIPTION        : Construct a new widget
27
** DESCRIPTION        : Construct a new widget
Line 83... Line 84...
83
    connect(ui->disqualified , SIGNAL(clicked(bool)), this, SLOT(changed()));
84
    connect(ui->disqualified , SIGNAL(clicked(bool)), this, SLOT(changed()));
84
    connect(ui->nonEquestrian , SIGNAL(clicked(bool)), this, SLOT(recalculateTimes()));
85
    connect(ui->nonEquestrian , SIGNAL(clicked(bool)), this, SLOT(recalculateTimes()));
85
    connect(ui->disabled , SIGNAL(clicked(bool)), this, SLOT(changed()));
86
    connect(ui->disabled , SIGNAL(clicked(bool)), this, SLOT(changed()));
86
    connect(ui->VetCheck , SIGNAL(clicked(bool)), this, SLOT(changed()));
87
    connect(ui->VetCheck , SIGNAL(clicked(bool)), this, SLOT(changed()));
87
 
88
 
-
 
89
    connect(ui->editNote, SIGNAL(clicked()), this, SLOT(editNote()));
-
 
90
 
88
    updateChanged(false);
91
    updateChanged(false);
89
}
92
}
90
 
93
 
91
/*----------------------------------------------------------------------------
94
/*----------------------------------------------------------------------------
92
** FUNCTION           : ~qmTeamDisplay
95
** FUNCTION           : ~qmTeamDisplay
Line 271... Line 274...
271
        }
274
        }
272
    }
275
    }
273
    ui->members->resizeColumnsToContents();
276
    ui->members->resizeColumnsToContents();
274
 
277
 
275
    /*
278
    /*
276
    **  Mainatainthe display of total age
279
    **  Mainatain the display of total age
277
    */
280
    */
278
    if ( age_sum <= 0 )
281
    if ( age_sum <= 0 )
279
    {
282
    {
280
        ui->totalAge->setText("--");
283
        ui->totalAge->setText("--");
281
    }
284
    }
Line 291... Line 294...
291
    for ( int ii = 0 ; ii <= config.num_legs; ii++)
294
    for ( int ii = 0 ; ii <= config.num_legs; ii++)
292
    {
295
    {
293
        lt[ii]->setData(&team_buf.leg[ii]);
296
        lt[ii]->setData(&team_buf.leg[ii]);
294
    }
297
    }
295
 
298
 
-
 
299
    /*
-
 
300
    **  Team Note
-
 
301
    */
-
 
302
    populateNote();
-
 
303
 
296
    updateChanged(false);
304
    updateChanged(false);
297
    populating = false;
305
    populating = false;
298
    blockSignals(false);
306
    blockSignals(false);
299
    
307
    
300
}
308
}
Line 507... Line 515...
507
        break;
515
        break;
508
    default:
516
    default:
509
        break;
517
        break;
510
    }
518
    }
511
}
519
}
-
 
520
 
-
 
521
/*----------------------------------------------------------------------------
-
 
522
** FUNCTION           : populateNote
-
 
523
**
-
 
524
** DESCRIPTION        : Populate the Note area of the team display
-
 
525
**                      Must be called during populate as
-
 
526
**
-
 
527
**
-
 
528
** INPUTS             :
-
 
529
**
-
 
530
** RETURNS            :
-
 
531
**
-
 
532
----------------------------------------------------------------------------*/
-
 
533
 
-
 
534
void qmTeamDisplay::populateNote(void)
-
 
535
{
-
 
536
    noteFileName = "TeamNote_" + QString::number(team) + ".txt";
-
 
537
    qDebug("NoteFile:%s",qPrintable(noteFileName));
-
 
538
 
-
 
539
    QFile noteFile(QString(filepath) + noteFileName);
-
 
540
    if ( noteFile.open( QIODevice::ReadOnly ) )
-
 
541
    {
-
 
542
        QTextStream stream( &noteFile );
-
 
543
        QString line;
-
 
544
        line = stream.readLine(); // line of text excluding '\n'
-
 
545
        noteFile.close();
-
 
546
 
-
 
547
        ui->noteText->setText(line);
-
 
548
        ui->noteText->setStyleSheet(line.isEmpty()? "" : "background-color: #FFFFCB;"); 
-
 
549
    }
-
 
550
    else
-
 
551
    {
-
 
552
        ui->noteText->clear();
-
 
553
        ui->noteText->setStyleSheet("");
-
 
554
    }
-
 
555
 
-
 
556
    /*
-
 
557
    ** Delete empy files to keep things clean
-
 
558
    */
-
 
559
    if (noteFile.size() == 0 )
-
 
560
    {
-
 
561
        noteFile.remove();
-
 
562
    }
-
 
563
}
-
 
564
 
-
 
565
/*----------------------------------------------------------------------------
-
 
566
** FUNCTION           : editNote
-
 
567
**
-
 
568
** DESCRIPTION        : Edit the Team Note in a  modal dialog box
-
 
569
**
-
 
570
** INPUTS             :
-
 
571
**
-
 
572
** RETURNS            :
-
 
573
**
-
 
574
----------------------------------------------------------------------------*/
-
 
575
 
-
 
576
void qmTeamDisplay::editNote(void)
-
 
577
{
-
 
578
    QmEditAddendum dialog(QmConfig::getAddendemFile(noteFileName, true));
-
 
579
     dialog.exec();
-
 
580
     populateNote();
-
 
581
}