[2] | 1 | #include "nimform.h"
|
---|
| 2 | #include "optionsform.h"
|
---|
| 3 | #include "stapeldisplay.h"
|
---|
| 4 |
|
---|
| 5 | #include <qaction.h>
|
---|
| 6 | #include <qapplication.h>
|
---|
| 7 | #include <qmenubar.h>
|
---|
| 8 | #include <qmessagebox.h>
|
---|
| 9 | #include <qpopupmenu.h>
|
---|
| 10 | #include <qslider.h>
|
---|
| 11 |
|
---|
| 12 | NimForm::NimForm( )
|
---|
| 13 | : QMainWindow( 0, 0, WDestructiveClose)
|
---|
| 14 | {
|
---|
| 15 | QAction *fileNewAction;
|
---|
| 16 | QAction *fileQuitAction;
|
---|
| 17 |
|
---|
| 18 | fileNewAction = new QAction(
|
---|
| 19 | "New Game",
|
---|
| 20 | "&New", CTRL+Key_N,this, "new");
|
---|
| 21 | connect( fileNewAction, SIGNAL( activated() ), this, SLOT( fileNew() ) );
|
---|
| 22 |
|
---|
| 23 | fileQuitAction = new QAction(
|
---|
| 24 | "Quit",
|
---|
| 25 | "&Quit", CTRL+Key_Q, this, "quit" );
|
---|
| 26 | connect( fileQuitAction, SIGNAL( activated() ), this, SLOT( fileQuit() ) );
|
---|
| 27 |
|
---|
| 28 | fileMenu = new QPopupMenu( this );
|
---|
| 29 | menuBar()->insertItem( "&File", fileMenu );
|
---|
| 30 | fileNewAction->addTo( fileMenu );
|
---|
| 31 | fileQuitAction->addTo ( fileMenu );
|
---|
| 32 |
|
---|
| 33 | QAction *helpHelpAction;
|
---|
| 34 | QAction *helpAboutAction;
|
---|
| 35 |
|
---|
| 36 | helpHelpAction = new QAction(
|
---|
| 37 | "H&elp",
|
---|
| 38 | "H&elp", CTRL+Key_H,this, "help");
|
---|
| 39 | connect( fileNewAction, SIGNAL( activated() ), this, SLOT( helpHelp() ) );
|
---|
| 40 |
|
---|
| 41 | helpAboutAction = new QAction(
|
---|
| 42 | "&About",
|
---|
| 43 | "&About", CTRL+Key_A,this, "about");
|
---|
| 44 | connect( fileNewAction, SIGNAL( activated() ), this, SLOT( helpAbout() ) );
|
---|
| 45 |
|
---|
| 46 | helpMenu = new QPopupMenu( this );
|
---|
| 47 | menuBar()->insertItem( "&Help", helpMenu );
|
---|
| 48 | helpHelpAction->addTo ( helpMenu );
|
---|
| 49 | helpAboutAction->addTo ( helpMenu );
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 | int Y = 0;
|
---|
| 53 | // for(int i = 0; i < 4; i++) {
|
---|
| 54 | // Y = Y + 70;
|
---|
| 55 | testbox = new StapelGroupBox( this, "x" );
|
---|
| 56 | testbox->setXY( 10, Y );
|
---|
| 57 | StapelGroupBox * tb2;
|
---|
| 58 | tb2 = new StapelGroupBox( this, "y" );
|
---|
| 59 | tb2->setXY(10,100);
|
---|
| 60 | // }
|
---|
| 61 | resize( QSize(600, 480).expandedTo(minimumSizeHint()) );
|
---|
| 62 | clearWState( WState_Polished );
|
---|
| 63 |
|
---|
| 64 |
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 |
|
---|
| 68 | NimForm::~NimForm()
|
---|
| 69 | {
|
---|
| 70 |
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | void NimForm::createGame()
|
---|
| 74 | {
|
---|
| 75 |
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 |
|
---|
| 79 | //void NimForm::closeEvent( QCloseEvent * )
|
---|
| 80 | //{
|
---|
| 81 | //
|
---|
| 82 | //}
|
---|
| 83 |
|
---|
| 84 |
|
---|
| 85 | void NimForm::fileNew()
|
---|
| 86 | {
|
---|
| 87 | OptionsForm * optionsForm = new OptionsForm( this );
|
---|
| 88 | if ( optionsForm->exec() ) {
|
---|
| 89 | aantalStapels = optionsForm->stapelsSlider->value();
|
---|
| 90 | }
|
---|
| 91 | delete optionsForm;
|
---|
| 92 | }
|
---|
| 93 |
|
---|
| 94 |
|
---|
| 95 | void NimForm::fileQuit()
|
---|
| 96 | {
|
---|
| 97 | qApp->exit ( 0 );
|
---|
| 98 | }
|
---|
| 99 |
|
---|
| 100 |
|
---|
| 101 | void NimForm::helpHelp()
|
---|
| 102 | {
|
---|
| 103 | delete testbox;
|
---|
| 104 | }
|
---|
| 105 |
|
---|
| 106 |
|
---|
| 107 | void NimForm::helpAbout()
|
---|
| 108 | {
|
---|
| 109 |
|
---|
| 110 | }
|
---|
| 111 |
|
---|
| 112 |
|
---|