next steps serverlist gui (doubleclick item will connect to server)
This commit is contained in:
@@ -5,16 +5,22 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>289</width>
|
||||||
<height>300</height>
|
<height>241</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle" >
|
||||||
<string>Dialog</string>
|
<string>Internet-Game Serverlist</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout" >
|
<layout class="QGridLayout" name="gridLayout" >
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0" >
|
||||||
<widget class="QTreeWidget" name="treeWidget_serverList" >
|
<widget class="QTreeWidget" name="treeWidget_serverList" >
|
||||||
|
<property name="alternatingRowColors" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="rootIsDecorated" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<column>
|
<column>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Servername</string>
|
<string>Servername</string>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "serverlistdialogimpl.h"
|
#include "serverlistdialogimpl.h"
|
||||||
#include "configfile.h"
|
#include "configfile.h"
|
||||||
#include "startwindowimpl.h"
|
#include "startwindowimpl.h"
|
||||||
|
#include "connecttoserverdialogimpl.h"
|
||||||
#include "serverdata.h"
|
#include "serverdata.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
|
|
||||||
@@ -32,10 +33,10 @@ serverListDialogImpl::serverListDialogImpl(startWindowImpl *sw, QMainWindow *par
|
|||||||
#endif
|
#endif
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
|
connect( treeWidget_serverList, SIGNAL( itemDoubleClicked ( QTreeWidgetItem*, int) ), this, SLOT( connectToServer() ));
|
||||||
connect( buttonBox, SIGNAL( accepted() ), this, SLOT( connectToServer() ));
|
connect( buttonBox, SIGNAL( accepted() ), this, SLOT( connectToServer() ));
|
||||||
connect( buttonBox, SIGNAL( rejected() ), this, SLOT( closeNetworkClient() ));
|
connect( buttonBox, SIGNAL( rejected() ), this, SLOT( closeNetworkClient() ));
|
||||||
|
connect( this, SIGNAL( rejected() ), this, SLOT( closeNetworkClient() ));
|
||||||
}
|
}
|
||||||
|
|
||||||
void serverListDialogImpl::exec() {
|
void serverListDialogImpl::exec() {
|
||||||
@@ -55,6 +56,8 @@ void serverListDialogImpl::addServerItem(unsigned serverId)
|
|||||||
item->setData(0, Qt::DisplayRole, QString::fromUtf8(info.name.c_str()));
|
item->setData(0, Qt::DisplayRole, QString::fromUtf8(info.name.c_str()));
|
||||||
item->setData(0, Qt::UserRole, serverId);
|
item->setData(0, Qt::UserRole, serverId);
|
||||||
item->setData(1, Qt::DisplayRole, QString::fromUtf8(info.country.c_str()));
|
item->setData(1, Qt::DisplayRole, QString::fromUtf8(info.country.c_str()));
|
||||||
|
|
||||||
|
treeWidget_serverList->resizeColumnToContents(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void serverListDialogImpl::connectToServer()
|
void serverListDialogImpl::connectToServer()
|
||||||
@@ -63,9 +66,11 @@ void serverListDialogImpl::connectToServer()
|
|||||||
if (item) {
|
if (item) {
|
||||||
mySw->getSession()->selectServer(item->data(0, Qt::UserRole).toUInt());
|
mySw->getSession()->selectServer(item->data(0, Qt::UserRole).toUInt());
|
||||||
}
|
}
|
||||||
|
this->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void serverListDialogImpl::closeNetworkClient() {
|
void serverListDialogImpl::closeNetworkClient() {
|
||||||
|
|
||||||
mySw->getSession()->terminateNetworkClient();
|
mySw->getSession()->terminateNetworkClient();
|
||||||
|
mySw->getMyConnectToServerDialog()->reject();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ public:
|
|||||||
void setSession(boost::shared_ptr<Session> session) { mySession = session; }
|
void setSession(boost::shared_ptr<Session> session) { mySession = session; }
|
||||||
boost::shared_ptr<Session> getSession() { assert(mySession.get()); return mySession; }
|
boost::shared_ptr<Session> getSession() { assert(mySession.get()); return mySession; }
|
||||||
boost::shared_ptr< GuiInterface > getMyServerGuiInterface() const { return myServerGuiInterface; }
|
boost::shared_ptr< GuiInterface > getMyServerGuiInterface() const { return myServerGuiInterface; }
|
||||||
|
connectToServerDialogImpl* getMyConnectToServerDialog() const { return myConnectToServerDialog; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void signalShowClientDialog();
|
void signalShowClientDialog();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user