Subversion Repositories svn1

Rev

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

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