From e33e8edb80936f8dd04729d70c0c991612340d5e Mon Sep 17 00:00:00 2001 From: gregory guy Date: Wed, 25 Nov 2020 15:16:40 +0100 Subject: Turn into a TDE application. The game is renamed TDEFifteen (original name: q15). Add icons (Public Domaine, https://commons.wikimedia.org/wiki/File:15-puzzle.svg). Signed-off-by: gregory guy --- tdefifteen/src/mainwindow.cpp | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tdefifteen/src/mainwindow.cpp (limited to 'tdefifteen/src/mainwindow.cpp') diff --git a/tdefifteen/src/mainwindow.cpp b/tdefifteen/src/mainwindow.cpp new file mode 100644 index 00000000..258b0220 --- /dev/null +++ b/tdefifteen/src/mainwindow.cpp @@ -0,0 +1,45 @@ +// Author: Denis Kozadaev - (c) 2017-2020 + + +#include "mainwindow.h" + +#include +#include + +#include + + +MainWindow::MainWindow(TQWidget* parent, const char* name) : TDEMainWindow(parent, name) +{ + TDEAction* actionQuit = KStdAction::quit(this, SLOT(close()), 0); + TDEAction* actionNew = new TDEAction( "&New Game", "reload", TQt::CTRL + TQt::Key_N, this, SLOT(newGame()), this, "New Game"); + + mMenu = new TDEPopupMenu(this); + mMenu->insertItem(SmallIcon("images_display"), "Load an image", this, 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" -- cgit v1.2.1