startwindow refactoring. BROKEN

This commit is contained in:
doitux
2008-09-02 22:04:18 +00:00
parent a9133233fa
commit 97f58c467f
5 changed files with 27 additions and 19 deletions
+1 -5
View File
@@ -29,17 +29,13 @@
using namespace std;
GuiWrapper::GuiWrapper(ConfigFile *c) : myLog(NULL), myW(NULL), myConfig(c)
GuiWrapper::GuiWrapper(ConfigFile *c, startWindowImpl *s) : myLog(NULL), myW(NULL), myConfig(c), myStartWindow(s)
{
myW = new gameTableImpl(myConfig);
// myW->show();
myLog = new Log(myW, myConfig);
myStartWindow = boost::shared_ptr<startWindowImpl>(new startWindowImpl(myW, myConfig));
myStartWindow->show();
myW->setStartWindow(myStartWindow);
}
+2 -1
View File
@@ -31,10 +31,11 @@ class Log;
class Chat;
class ConfigFile;
class GuiWrapper : public GuiInterface
{
public:
GuiWrapper(ConfigFile*);
GuiWrapper(ConfigFile*, startWindowImpl*);
~GuiWrapper();
+13 -4
View File
@@ -25,6 +25,7 @@
#include "session.h"
#include "game.h"
#include "guiwrapper.h"
#include "configfile.h"
#include "gametableimpl.h"
@@ -43,11 +44,18 @@
#include "timeoutmsgboximpl.h"
#include "lobbychat.h"
startWindowImpl::startWindowImpl(gameTableImpl *w, ConfigFile *c)
: myW(w), myConfig(c)
startWindowImpl::startWindowImpl(ConfigFile *c)
: myW(NULL), myConfig(c)
{
boost::shared_ptr<GuiInterface> myGuiInterface(new GuiWrapper(myConfig, this));
{
boost::shared_ptr<Session> session(new Session(myGuiInterface.get(), myConfig));
session->init(); // TODO handle error
myGuiInterface->setSession(session);
}
// #ifdef __APPLE__
// setWindowModality(Qt::ApplicationModal);
// setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog);
@@ -123,6 +131,7 @@ startWindowImpl::startWindowImpl(gameTableImpl *w, ConfigFile *c)
connect(this, SIGNAL(signalIrcError(int)), myGameLobbyDialog->getLobbyChat(), SLOT(chatError(int)));
connect(this, SIGNAL(signalIrcServerError(int)), myGameLobbyDialog->getLobbyChat(), SLOT(chatServerError(int)));
this->show();
}
+2 -1
View File
@@ -25,6 +25,7 @@
#include "game_defs.h"
class GuiInterface;
class GuiWrapper;
class Session;
class Game;
@@ -46,7 +47,7 @@ class timeoutMsgBoxImpl;
class startWindowImpl: public QMainWindow, public Ui::startWindow {
Q_OBJECT
public:
startWindowImpl(gameTableImpl *w = 0, ConfigFile *c =0);
startWindowImpl(ConfigFile *c =0);
void setSession(boost::shared_ptr<Session> session) { mySession = session; }
Session &getSession() { assert(mySession.get()); return *mySession; }