Subversion Repositories svn1-original

Rev

Rev 130 | Rev 132 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "qmconfigure.h"
#include "qmconfclass.h"
#include "qmconfwinners.h"
#include "qmteamdisplay.h"
#include "QMessageBox"

#include    "consts.h"
#include    "structs.h"
#include    "proto.h"

MainWindow *mw = NULL;

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    mw = this;

    ui->tabWidget->addTab( new QmConfigure,   "Configure");
    ui->tabWidget->addTab( new QmConfClass,   "Class");
    ui->tabWidget->addTab( new QmConfWinners, "Winners");
    ui->tabWidget->addTab( new qmTeamDisplay, "Team Data");

    QMenu *m1 = new QMenu ("Leg Time Setup");
    ui->menuBar->addMenu(m1);
    m1->addAction("Set Start Times", this, SLOT(setStartTimes()));
    m1->addAction("Clear ALL Leg Times", this, SLOT(clearLegTimes()));
    m1->addAction("Reset All Team Data", this, SLOT(resetTeamData()));



}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::changeEvent(QEvent *e)
{
    QMainWindow::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}

void MainWindow::setStartTimes(void)
{
    if ( QMessageBox::Ok == QMessageBox::warning(this, tr("Mara"),
                                    tr("This will reset the start times for all teams.\n"
                                       "Are you sure you want to do this?"),
                                    QMessageBox::Cancel,
                                    QMessageBox::Ok))
    {
        leg_start();
    }

}

void MainWindow::clearLegTimes(void)
{
    if ( QMessageBox::Ok == QMessageBox::warning(this, tr("Mara"),
                                    tr("This will clear ALL leg times for ALL teams.\n"
                                       "Are you sure you want to do this?"),
                                    QMessageBox::Cancel,
                                    QMessageBox::Ok))
    {
        leg_ini();
    }
}

void MainWindow::resetTeamData(void)
{
    if ( QMessageBox::Ok == QMessageBox::warning(this, tr("Mara"),
                                    tr("This will clear ALL team information.\n"
                                       "Are you sure you want to do this?"),
                                    QMessageBox::Cancel,
                                    QMessageBox::Ok))
    {
        tm_init();
    }
}

/*========================================================================
 *
 *  Position the cursor on the screen
 *
 *  Purpose:
 *      This function is called to Position the cursor on the screen
 *
 *  Parameters:
 *      x               col number
 *      y               line number
 *
 *  Returns:
 *      Nothing
 *
 *========================================================================*/

void cur( int x, int y )
{
}

/*========================================================================
 *
 *  Clears the vdu screen
 *
 *  Purpose:
 *      This function is called to Clears the vdu screen
 *      From the Microsoft Web Site
 *
 *  Parameters:
 *      None
 *
 *  Returns:
 *      Nothing
 *
 *========================================================================*/

void clearscreen( void )
{
}
#include    <stdio.h>
int printf( const char *format, ... )
{
    va_list     ap;
    char        pp[200];
    int         len;



    va_start( ap, format );
    len = vsprintf( pp, format, ap );
    va_end( ap );
    qDebug("%s",pp);
    return ( len );
}