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