summaryrefslogtreecommitdiffstats
path: root/tdefifteen/src/mainwindow.cpp
blob: 688c1743fce9ead122741581a2cc8aea7db2df8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Author: Denis Kozadaev - (c) 2017-2020


#include "mainwindow.h"

#include <tdeactionclasses.h>
#include <tdemenubar.h>

#include <kiconloader.h>


MainWindow::MainWindow(TQWidget* parent, const char* name) : TDEMainWindow(parent, name)
{
    TDEAction* actionQuit = KStdAction::quit(this, TQ_SLOT(close()), 0);
    TDEAction* actionNew  = new TDEAction( "&New Game", "reload", TQt::CTRL + TQt::Key_N, this, TQ_SLOT(newGame()), this, "New Game");

    mMenu = new TDEPopupMenu(this);
    mMenu->insertItem(SmallIcon("images_display"), "Load an image", this, TQ_SLOT(loadImage()), TQt::CTRL + TQt::Key_L);
    mMenu->insertSeparator();

    actionNew->plug(mMenu);
    actionQuit->plug(mMenu);
    menuBar()->insertItem(tr("Menu"), mMenu);

	mBoard = new GameBoard(this);
	setCentralWidget(mBoard);
}

MainWindow::~MainWindow()
{
	delete mBoard;
	delete mMenu;
}

void MainWindow::newGame()
{
	mBoard->newGame();
}

void MainWindow::loadImage()
{
	mBoard->loadImage();
}

#include "mainwindow.moc"