diff options
| author | gregory guy <gregory-tde@laposte.net> | 2020-11-25 15:16:40 +0100 |
|---|---|---|
| committer | Slávek Banko <slavek.banko@axis.cz> | 2020-12-02 19:51:38 +0100 |
| commit | d607668c5a772823d6cf59df205b7aa6d2ac2130 (patch) | |
| tree | 7f8b4d8c5b0f26fed9bc870bea548cac766099a0 /tdefifteen/src/mainwindow.cpp | |
| parent | cc192fd9396098134f6aa1369d63c4b270cddfe9 (diff) | |
| download | tdegames-d607668c.tar.gz tdegames-d607668c.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>
(cherry picked from commit e33e8edb80936f8dd04729d70c0c991612340d5e)
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" |
