diff options
author | gregory guy <gregory-tde@laposte.net> | 2020-11-25 15:16:40 +0100 |
---|---|---|
committer | gregory guy <gregory-tde@laposte.net> | 2020-12-01 12:21:04 +0100 |
commit | e33e8edb80936f8dd04729d70c0c991612340d5e (patch) | |
tree | e0b1b8d6098491db4d7d642bed7d5ef5747952d2 /tdefifteen/src/mainwindow.cpp | |
parent | 4fd2e55a49048dcecdf7ebd7ce7e78b822c06156 (diff) | |
download | tdegames-e33e8edb80936f8dd04729d70c0c991612340d5e.tar.gz tdegames-e33e8edb80936f8dd04729d70c0c991612340d5e.zip |
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 <gregory-tde@laposte.net>
Diffstat (limited to 'tdefifteen/src/mainwindow.cpp')
-rw-r--r-- | tdefifteen/src/mainwindow.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
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 <tdeactionclasses.h> +#include <tdemenubar.h> + +#include <kiconloader.h> + + +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" |