Subversion Repositories svn1

Rev

Rev 127 | Rev 129 | 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()));
128 - 32
    m1->addAction("Generate dummy team names", this, SLOT(generateDummyTeamNames()));
126 david 33
 
34
 
127 - 35
 
126 david 36
}
37
 
38
MainWindow::~MainWindow()
39
{
40
    delete ui;
41
}
42
 
43
void MainWindow::changeEvent(QEvent *e)
44
{
45
    QMainWindow::changeEvent(e);
46
    switch (e->type()) {
47
    case QEvent::LanguageChange:
48
        ui->retranslateUi(this);
49
        break;
50
    default:
51
        break;
52
    }
53
}
54
 
55
void MainWindow::setStartTimes(void)
56
{
127 - 57
    if ( QMessageBox::Ok == QMessageBox::warning(this, tr("Mara"),
126 david 58
                                    tr("This will reset the start times for all teams.\n"
59
                                       "Are you sure you want to do this?"),
60
                                    QMessageBox::Cancel,
61
                                    QMessageBox::Ok))
62
    {
127 - 63
        leg_start();
126 david 64
    }
127 - 65
 
126 david 66
}
67
 
127 - 68
void MainWindow::clearLegTimes(void)
69
{
70
    if ( QMessageBox::Ok == QMessageBox::warning(this, tr("Mara"),
71
                                    tr("This will clear ALL leg times for ALL teams.\n"
72
                                       "Are you sure you want to do this?"),
73
                                    QMessageBox::Cancel,
74
                                    QMessageBox::Ok))
75
    {
76
        leg_ini();
77
    }
78
}
79
 
80
void MainWindow::resetTeamData(void)
81
{
82
    if ( QMessageBox::Ok == QMessageBox::warning(this, tr("Mara"),
83
                                    tr("This will clear ALL team information.\n"
84
                                       "Are you sure you want to do this?"),
85
                                    QMessageBox::Cancel,
86
                                    QMessageBox::Ok))
87
    {
88
        tm_init();
89
    }
90
}
91
 
128 - 92
void MainWindow::generateDummyTeamNames(void)
93
{
94
    if ( QMessageBox::Ok == QMessageBox::warning(this, tr("Mara"),
95
                                    tr("This will generate DUMMY team names.\n"
96
                                       "Are you sure you want to do this?"),
97
                                    QMessageBox::Cancel,
98
                                    QMessageBox::Ok))
99
    {
100
        tm_gen();
101
    }
102
}
103
 
126 david 104
/*========================================================================
105
 *
106
 *  Position the cursor on the screen
107
 *
108
 *  Purpose:
109
 *      This function is called to Position the cursor on the screen
110
 *
111
 *  Parameters:
112
 *      x               col number
113
 *      y               line number
114
 *
115
 *  Returns:
116
 *      Nothing
117
 *
118
 *========================================================================*/
119
 
120
void cur( int x, int y )
121
{
122
}
123
 
124
/*========================================================================
125
 *
126
 *  Clears the vdu screen
127
 *
128
 *  Purpose:
129
 *      This function is called to Clears the vdu screen
130
 *      From the Microsoft Web Site
131
 *
132
 *  Parameters:
133
 *      None
134
 *
135
 *  Returns:
136
 *      Nothing
137
 *
138
 *========================================================================*/
139
 
140
void clearscreen( void )
141
{
142
}
143
#include    <stdio.h>
144
int printf( const char *format, ... )
145
{
146
    va_list     ap;
147
    char        pp[200];
148
    int         len;
149
 
150
 
151
 
152
    va_start( ap, format );
153
    len = vsprintf( pp, format, ap );
154
    va_end( ap );
155
    qDebug("%s",pp);
156
    return ( len );
157
}
158