Subversion Repositories svn1

Rev

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

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