startwindow refactoring. BROKEN
This commit is contained in:
@@ -29,17 +29,13 @@
|
|||||||
using namespace std;
|
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 = new gameTableImpl(myConfig);
|
||||||
// myW->show();
|
|
||||||
myLog = new Log(myW, myConfig);
|
myLog = new Log(myW, myConfig);
|
||||||
|
|
||||||
myStartWindow = boost::shared_ptr<startWindowImpl>(new startWindowImpl(myW, myConfig));
|
|
||||||
myStartWindow->show();
|
|
||||||
|
|
||||||
myW->setStartWindow(myStartWindow);
|
myW->setStartWindow(myStartWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,10 +31,11 @@ class Log;
|
|||||||
class Chat;
|
class Chat;
|
||||||
class ConfigFile;
|
class ConfigFile;
|
||||||
|
|
||||||
|
|
||||||
class GuiWrapper : public GuiInterface
|
class GuiWrapper : public GuiInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GuiWrapper(ConfigFile*);
|
GuiWrapper(ConfigFile*, startWindowImpl*);
|
||||||
|
|
||||||
~GuiWrapper();
|
~GuiWrapper();
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
|
#include "guiwrapper.h"
|
||||||
|
|
||||||
#include "configfile.h"
|
#include "configfile.h"
|
||||||
#include "gametableimpl.h"
|
#include "gametableimpl.h"
|
||||||
@@ -43,11 +44,18 @@
|
|||||||
#include "timeoutmsgboximpl.h"
|
#include "timeoutmsgboximpl.h"
|
||||||
#include "lobbychat.h"
|
#include "lobbychat.h"
|
||||||
|
|
||||||
|
startWindowImpl::startWindowImpl(ConfigFile *c)
|
||||||
|
: myW(NULL), myConfig(c)
|
||||||
startWindowImpl::startWindowImpl(gameTableImpl *w, ConfigFile *c)
|
|
||||||
: myW(w), 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__
|
// #ifdef __APPLE__
|
||||||
// setWindowModality(Qt::ApplicationModal);
|
// setWindowModality(Qt::ApplicationModal);
|
||||||
// setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog);
|
// 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(signalIrcError(int)), myGameLobbyDialog->getLobbyChat(), SLOT(chatError(int)));
|
||||||
connect(this, SIGNAL(signalIrcServerError(int)), myGameLobbyDialog->getLobbyChat(), SLOT(chatServerError(int)));
|
connect(this, SIGNAL(signalIrcServerError(int)), myGameLobbyDialog->getLobbyChat(), SLOT(chatServerError(int)));
|
||||||
|
|
||||||
|
this->show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include "game_defs.h"
|
#include "game_defs.h"
|
||||||
|
|
||||||
class GuiInterface;
|
class GuiInterface;
|
||||||
|
class GuiWrapper;
|
||||||
class Session;
|
class Session;
|
||||||
class Game;
|
class Game;
|
||||||
|
|
||||||
@@ -46,7 +47,7 @@ class timeoutMsgBoxImpl;
|
|||||||
class startWindowImpl: public QMainWindow, public Ui::startWindow {
|
class startWindowImpl: public QMainWindow, public Ui::startWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
startWindowImpl(gameTableImpl *w = 0, ConfigFile *c =0);
|
startWindowImpl(ConfigFile *c =0);
|
||||||
|
|
||||||
void setSession(boost::shared_ptr<Session> session) { mySession = session; }
|
void setSession(boost::shared_ptr<Session> session) { mySession = session; }
|
||||||
Session &getSession() { assert(mySession.get()); return *mySession; }
|
Session &getSession() { assert(mySession.get()); return *mySession; }
|
||||||
|
|||||||
+9
-8
@@ -25,7 +25,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "guiwrapper.h"
|
#include "startwindowimpl.h"
|
||||||
#include "configfile.h"
|
#include "configfile.h"
|
||||||
#include "startsplash.h"
|
#include "startsplash.h"
|
||||||
#include "game_defs.h"
|
#include "game_defs.h"
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
class GuiWrapper;
|
class startWindowImpl;
|
||||||
class Game;
|
class Game;
|
||||||
|
|
||||||
int main( int argc, char **argv )
|
int main( int argc, char **argv )
|
||||||
@@ -133,12 +133,13 @@ int main( int argc, char **argv )
|
|||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
boost::shared_ptr<GuiInterface> myGuiInterface(new GuiWrapper(myConfig));
|
boost::shared_ptr<startWindowImpl>(new startWindowImpl(myConfig));
|
||||||
{
|
// boost::shared_ptr<GuiInterface> myGuiInterface(new GuiWrapper(myConfig));
|
||||||
boost::shared_ptr<Session> session(new Session(myGuiInterface.get(), myConfig));
|
// {
|
||||||
session->init(); // TODO handle error
|
// boost::shared_ptr<Session> session(new Session(myGuiInterface.get(), myConfig));
|
||||||
myGuiInterface->setSession(session);
|
// session->init(); // TODO handle error
|
||||||
}
|
// myGuiInterface->setSession(session);
|
||||||
|
// }
|
||||||
|
|
||||||
int retVal = a.exec();
|
int retVal = a.exec();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user