diff --git a/q15/src/CMakeLists.txt b/q15/src/CMakeLists.txt index 9a71c1fd..1e60e51f 100644 --- a/q15/src/CMakeLists.txt +++ b/q15/src/CMakeLists.txt @@ -33,7 +33,8 @@ tde_add_executable( q15 AUTOMOC main.cpp mainwindow.cpp LINK - tqt-mt + tdeui-shared + tdecore-shared DESTINATION ${BIN_INSTALL_DIR} ) diff --git a/q15/src/gameboard.cpp b/q15/src/gameboard.cpp index 51767064..23ebbb0e 100644 --- a/q15/src/gameboard.cpp +++ b/q15/src/gameboard.cpp @@ -9,9 +9,9 @@ * Hacked by: */ -#include +#include -#include +#include #include #include #include @@ -251,7 +251,7 @@ GameBoard::startMoving(int i, int t) dx = step(xt, map[n]->x()); dy = step(yt, map[n]->y()); tmr->start(DELAY); - TQApplication::setOverrideCursor(TQCursor(TQt::WaitCursor)); + TDEApplication::setOverrideCursor(TQCursor(TQt::WaitCursor)); } diff --git a/q15/src/main.cpp b/q15/src/main.cpp index 849a4ee6..936551aa 100644 --- a/q15/src/main.cpp +++ b/q15/src/main.cpp @@ -1,41 +1,38 @@ -/* - * $Id: main.cpp,v 0.1 2005/08/14 11:21:13 denis Exp $ - * - * Author: Denis Kozadaev (denis@tambov.ru) - * Description: - * - * See also: style(9) - * - * Hacked by: - */ - -#include - -#include - #include "mainwindow.h" +#include +#include +#include -const int XSize = 640, YSize = 480; -int -main(int argc, char *argv[]) -{ - TQApplication *app; - MainWindow *mw; - int result; - - app = new TQApplication(argc, argv); - mw = new MainWindow(NULL); - - mw->resize(XSize, YSize); - mw->show(); - mw->setMinimumSize(mw->size()); - mw->setMaximumSize(mw->size()); - result = app->exec(); +static const char description[] = I18N_NOOP("TDE Gem/Puzzle Game"); +const int XSize = 640, YSize = 480; - delete mw; - delete app; - return (result); +int main(int argc, char *argv[]) +{ + TDEAboutData about( "TDEFifteenPieces", // program name used internally + "TDEFifteenPieces", // displayable program name + "14.0.10", // program version string + description, // short description + 0, // licence type + "(c) 2017-2020 by Denis Kozadaev", // copyright statement + 0, // text - any information + "http://trinitydesktop.org", // home page address + 0); // bug email address + + about.addAuthor( "Denis Kozadaev", "Author", "denis@tambov.ru" ); + + TDECmdLineArgs::init(argc, argv, &about); + TDEApplication app; + MainWindow* mainWin = new MainWindow(); + + mainWin->resize(XSize, YSize); + mainWin->setMinimumSize( mainWin->size() ); + mainWin->setMaximumSize( mainWin->size() ); + + app.setMainWidget( mainWin ); + mainWin->show(); + + return app.exec(); } diff --git a/q15/src/mainwindow.cpp b/q15/src/mainwindow.cpp index 593b0fc9..dca9e26a 100644 --- a/q15/src/mainwindow.cpp +++ b/q15/src/mainwindow.cpp @@ -9,43 +9,45 @@ * Hacked by: */ -#include - #include "mainwindow.h" -MainWindow::MainWindow(TQWidget *parent, const char *name) - :TQMainWindow(parent, name) +#include +#include + +#include + + +MainWindow::MainWindow(TQWidget* parent, const char* name) : TDEMainWindow(parent, name) { - file = new TQPopupMenu(this); - file->insertItem(tr("New"), this, SLOT(newGame()), TQt::CTRL + TQt::Key_N); - file->insertItem(tr("Load an image"), this, SLOT(loadImage()), - TQt::CTRL + TQt::Key_L); - file->insertItem(tr("Quit"), tqApp, SLOT(quit()), TQt::CTRL + TQt::Key_Q); + 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"); - menuBar()->insertItem(tr("File"), file); + mMenu = new TDEPopupMenu(this); + mMenu->insertItem(SmallIcon("images_display"), "Load an image", this, SLOT(loadImage()), TQt::CTRL + TQt::Key_L); + mMenu->insertSeparator(); - gb = new GameBoard(this); - setCentralWidget(gb); + actionNew->plug(mMenu); + actionQuit->plug(mMenu); + menuBar()->insertItem(tr("Menu"), mMenu); + + mBoard = new GameBoard(this); + setCentralWidget(mBoard); } MainWindow::~MainWindow() { - delete gb; - delete file; + delete mBoard; + delete mMenu; } - -void -MainWindow::newGame() +void MainWindow::newGame() { - gb->newGame(); + mBoard->newGame(); } - -void -MainWindow::loadImage() +void MainWindow::loadImage() { - gb->loadImage(); + mBoard->loadImage(); } #include "mainwindow.moc" diff --git a/q15/src/mainwindow.h b/q15/src/mainwindow.h index 2b898f7e..586deb6c 100644 --- a/q15/src/mainwindow.h +++ b/q15/src/mainwindow.h @@ -12,29 +12,27 @@ #ifndef __MAIN_WINDOW_H__ #define __MAIN_WINDOW_H__ -#include - -#include -#include -#include +#include +#include #include "gameboard.h" -class MainWindow:public TQMainWindow + +class MainWindow : public TDEMainWindow { Q_OBJECT public: - MainWindow(TQWidget *parent = NULL, const char *name = NULL); + MainWindow(TQWidget* parent = 0, const char* name = 0); ~MainWindow(); private: - TQPopupMenu *file; - GameBoard *gb; + TDEPopupMenu* mMenu; + GameBoard* mBoard; private slots: - void newGame(); - void loadImage(); + void newGame(); + void loadImage(); }; #endif /* __MAIN_WINDOW_H__ */