#include <qmessagebox.h>
#include <QtGui>
#include "mainwindow.h"

MainWindow::MainWindow()
{
    createActions();
    createMenus();
    
    QPainterPath rectPath; 

    QPointF center;
    rectPath.moveTo(center);
    rectPath.lineTo(80.0, 30.0);
    rectPath.lineTo(80.0, 70.0);
    rectPath.lineTo(20.0, 70.0);
    rectPath.closeSubpath();
    
    QPainter painter(this);
 	painter.drawPath(rectPath);
    
    setWindowTitle(tr("DSA Spielleiterhilfe"));

    resize(640, 480);
}

void MainWindow::about()
{
    QMessageBox::about(this, tr("About Application"),
	tr("<center><b>DSA Spielleiterhilfe</b><br>"
	"Version 0.1<br>"
	"created by Markus Feldmann<br>"
	"Lizenz: GPL<br>"
	"Programmiert mit Qt4</center>"));
}

void MainWindow::createActions()
{
    exitAct = new QAction(tr("E&xit"), this);
    exitAct->setShortcut(tr("Ctrl+Q"));
    exitAct->setStatusTip(tr("Exit the application"));
    connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));

    aboutAct = new QAction(tr("&About"), this);
    aboutAct->setStatusTip(tr("Show the application's About box"));
    connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
}

void MainWindow::createMenus()
{
    fileMenu = menuBar()->addMenu(tr("&File"));
    fileMenu->addAction(exitAct);

    helpMenu = menuBar()->addMenu(tr("&Help"));
    helpMenu->addAction(aboutAct);
}

void MainWindow::createToolBars()
{
    fileToolBar = addToolBar(tr("File"));
}
