Rename testgame to game/GameWidget

This commit is contained in:
Stefan Bühler 2009-02-09 19:04:09 +01:00
parent 08c264a9b6
commit abc6356f55
4 changed files with 24 additions and 44 deletions

View File

@ -17,7 +17,7 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "testgame.h"
#include "game.h"
#include <QGridLayout>
#include <QResizeEvent>
@ -42,7 +42,7 @@ namespace toruschess {
return a;
}
TestGame::TestGame(QWidget *parent)
GameWidget::GameWidget(QWidget *parent)
: QMainWindow(parent), m_game(new Game()), m_optionDlg(new OptionDlg(m_game, this)), m_viewMode((ViewMode) -1) {
connect(this, SIGNAL(changedViewMode(ViewMode)), m_optionDlg, SLOT(changedViewMode(ViewMode)));
connect(m_optionDlg, SIGNAL(setViewMode(ViewMode)), this, SLOT(setViewMode(ViewMode)));
@ -88,19 +88,19 @@ namespace toruschess {
updateGeometry();
}
void TestGame::gameChanged(GameState state) {
void GameWidget::gameChanged(GameState state) {
statusBar()->showMessage(state2string(state));
}
void TestGame::menuRestart() {
void GameWidget::menuRestart() {
m_game->restart();
}
void TestGame::menuOptions() {
void GameWidget::menuOptions() {
m_optionDlg->exec();
}
void TestGame::setViewMode(ViewMode viewMode) {
void GameWidget::setViewMode(ViewMode viewMode) {
if (m_viewMode == viewMode) return;
m_viewMode = viewMode;
switch (m_viewMode) {
@ -122,13 +122,13 @@ namespace toruschess {
emit changedViewMode(viewMode);
}
void TestGame::menuView2d() {
void GameWidget::menuView2d() {
setViewMode(VIEW_2D);
}
void TestGame::menuView3d() {
void GameWidget::menuView3d() {
setViewMode(VIEW_3D);
}
void TestGame::menuViewTorus() {
void GameWidget::menuViewTorus() {
setViewMode(VIEW_TORUS);
}

View File

@ -39,10 +39,10 @@
*/
namespace toruschess {
class TestGame : public QMainWindow {
class GameWidget : public QMainWindow {
Q_OBJECT
public:
TestGame(QWidget *parent = 0);
GameWidget(QWidget *parent = 0);
ViewMode viewMode() const { return m_viewMode; }

View File

@ -21,7 +21,7 @@
#include <QApplication>
#include "testgame.h"
#include "game.h"
using namespace toruschess;
@ -29,8 +29,8 @@ int main(int argc, char *argv[]) {
QApplication app(argc, argv);
Q_INIT_RESOURCE(media);
TestGame testGame;
testGame.show();
GameWidget game;
game.show();
return app.exec();
}

View File

@ -1,38 +1,18 @@
SOURCES += main.cpp \
testgame.cpp \
toruschess.cpp \
field2d.cpp \
piecelibrary.cpp \
field3d.cpp \
ai.cpp \
optiondlg.cpp
TEMPLATE = app
CONFIG += warn_on \
thread \
qt \
opengl \
debug
TARGET = toruschess
DESTDIR = ../bin
RESOURCES += media.qrc
QT += svg \
opengl
HEADERS += testgame.h \
toruschess.h \
field2d.h \
piecelibrary.h \
field3d.h \
ai.h \
optiondlg.h
LIBS += -l3ds
CONFIG += warn_on thread qt opengl debug
CONFIG -= release
QT += svg opengl
QMAKE_CXXFLAGS_RELEASE += -g
CONFIG -= release
TARGET = toruschess
DESTDIR = ../bin
RESOURCES += media.qrc
SOURCES += main.cpp game.cpp toruschess.cpp field2d.cpp piecelibrary.cpp field3d.cpp ai.cpp optiondlg.cpp
HEADERS += game.h toruschess.h field2d.h piecelibrary.h field3d.h ai.h optiondlg.h
FORMS += optiondlg.ui
DISTFILES += ../README
LIBS += -l3ds
DISTFILES += ../README