Subversion Repositories svn1

Rev

Rev 126 | Rev 128 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
126 david 1
#include "mainwindow.h"
2
#include "ui_mainwindow.h"
3
#include "qmconfigure.h"
4
#include "qmconfclass.h"
5
#include "qmconfwinners.h"
6
#include "qmteamdisplay.h"
7
#include "QMessageBox"
8
 
9
#include    "consts.h"
10
#include    "structs.h"
11
#include    "proto.h"
12
 
13
MainWindow *mw = NULL;
14
 
15
MainWindow::MainWindow(QWidget *parent) :
16
    QMainWindow(parent),
17
    ui(new Ui::MainWindow)
18
{
19
    ui->setupUi(this);
20
    mw = this;
21
 
22
    ui->tabWidget->addTab( new QmConfigure,   "Configure");
23
    ui->tabWidget->addTab( new QmConfClass,   "Class");
24
    ui->tabWidget->addTab( new QmConfWinners, "Winners");
25
    ui->tabWidget->addTab( new qmTeamDisplay, "Team Data");
26
 
127 - 27
    QMenu *m1 = new QMenu ("Leg Time Setup");
28
    ui->menuBar->addMenu(m1);
126 david 29
    m1->addAction("Set Start Times", this, SLOT(setStartTimes()));
127 - 30
    m1->addAction("Clear ALL Leg Times", this, SLOT(clearLegTimes()));
31
    m1->addAction("Reset All Team Data", this, SLOT(resetTeamData()));
126 david 32
 
33
 
127 - 34
 
126 david 35
}
36
 
37
MainWindow::~MainWindow()
38
{
39
    delete ui;
40
}
41
 
42
void MainWindow::changeEvent(QEvent *e)
43
{
44
    QMainWindow::changeEvent(e);
45
    switch (e->type()) {
46
    case QEvent::LanguageChange:
47
        ui->retranslateUi(this);
48
        break;
49
    default:
50
        break;
51
    }
52
}
53
 
54
void MainWindow::setStartTimes(void)
55
{
127 - 56
    if ( QMessageBox::Ok == QMessageBox::warning(this, tr("Mara"),
126 david 57
                                    tr("This will reset the start times for all teams.\n"
58
                                       "Are you sure you want to do this?"),
59
                                    QMessageBox::Cancel,
60
                                    QMessageBox::Ok))
61
    {
127 - 62
        leg_start();
126 david 63
    }
127 - 64
 
126 david 65
}
66
 
127 - 67
void MainWindow::clearLegTimes(void)
68
{
69
    if ( QMessageBox::Ok == QMessageBox::warning(this, tr("Mara"),
70
                                    tr("This will clear ALL leg times for ALL teams.\n"
71
                                       "Are you sure you want to do this?"),
72
                                    QMessageBox::Cancel,
73
                                    QMessageBox::Ok))
74
    {
75
        leg_ini();
76
    }
77
}
78
 
79
void MainWindow::resetTeamData(void)
80
{
81
    if ( QMessageBox::Ok == QMessageBox::warning(this, tr("Mara"),
82
                                    tr("This will clear ALL team information.\n"
83
                                       "Are you sure you want to do this?"),
84
                                    QMessageBox::Cancel,
85
                                    QMessageBox::Ok))
86
    {
87
        tm_init();
88
    }
89
}
90
 
126 david 91
/*========================================================================
92
 *
93
 *  Position the cursor on the screen
94
 *
95
 *  Purpose:
96
 *      This function is called to Position the cursor on the screen
97
 *
98
 *  Parameters:
99
 *      x               col number
100
 *      y               line number
101
 *
102
 *  Returns:
103
 *      Nothing
104
 *
105
 *========================================================================*/
106
 
107
void cur( int x, int y )
108
{
109
}
110
 
111
/*========================================================================
112
 *
113
 *  Clears the vdu screen
114
 *
115
 *  Purpose:
116
 *      This function is called to Clears the vdu screen
117
 *      From the Microsoft Web Site
118
 *
119
 *  Parameters:
120
 *      None
121
 *
122
 *  Returns:
123
 *      Nothing
124
 *
125
 *========================================================================*/
126
 
127
void clearscreen( void )
128
{
129
}
130
#include    <stdio.h>
131
int printf( const char *format, ... )
132
{
133
    va_list     ap;
134
    char        pp[200];
135
    int         len;
136
 
137
 
138
 
139
    va_start( ap, format );
140
    len = vsprintf( pp, format, ap );
141
    va_end( ap );
142
    qDebug("%s",pp);
143
    return ( len );
144
}
145