mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
a bit of gui. Not working yet.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4760 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
485c394e2b
commit
30411659e0
@ -412,6 +412,7 @@ FORMS += gui/StartDialog.ui \
|
||||
gui/chat/PopupChatWindow.ui \
|
||||
gui/chat/PopupChatDialog.ui \
|
||||
gui/chat/CreateLobbyDialog.ui \
|
||||
gui/ChatLobbyWidget.ui \
|
||||
gui/connect/ConfCertDialog.ui \
|
||||
gui/msgs/MessageComposer.ui \
|
||||
gui/msgs/MessageWindow.ui\
|
||||
|
@ -1,9 +1,32 @@
|
||||
#include <QTableWidget>
|
||||
#include <retroshare/rsmsgs.h>
|
||||
#include "ChatLobbyWidget.h"
|
||||
|
||||
#define COL_LOBBY_NAME 0
|
||||
#define COL_LOBBY_ID 1
|
||||
#define COL_LOBBY_TYPE 2
|
||||
#define COL_LOBBY_STATE 3
|
||||
#define COL_LOBBY_COUNT 4
|
||||
|
||||
ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WFlags flags)
|
||||
: RsAutoUpdatePage(5000,parent)
|
||||
{
|
||||
setupUi(this) ;
|
||||
|
||||
_lobby_table_TW->setColumnCount(5) ;
|
||||
|
||||
QStringList list ;
|
||||
list.push_back(tr("Lobby name")) ;
|
||||
list.push_back(tr("Lobby ID")) ;
|
||||
list.push_back(tr("Lobby type")) ;
|
||||
list.push_back(tr("Subscribed")) ;
|
||||
list.push_back(tr("Count")) ;
|
||||
|
||||
_lobby_table_TW->setHorizontalHeaderLabels(list) ;
|
||||
|
||||
QObject::connect(this,SIGNAL(cellDoubleClicked(int,int)),this,SLOT(doubleClickCell(int,int))) ;
|
||||
|
||||
updateDisplay() ;
|
||||
}
|
||||
ChatLobbyWidget::~ChatLobbyWidget()
|
||||
{
|
||||
@ -11,11 +34,43 @@ ChatLobbyWidget::~ChatLobbyWidget()
|
||||
|
||||
void ChatLobbyWidget::updateDisplay()
|
||||
{
|
||||
std::cerr << "updating chat lobby display!" << std::endl;
|
||||
std::vector<PublicChatLobbyRecord> public_lobbies ;
|
||||
rsMsgs->getListOfNearbyChatLobbies(public_lobbies) ;
|
||||
|
||||
std::list<ChatLobbyInfo> linfos ;
|
||||
rsMsgs->getChatLobbyList(linfos) ;
|
||||
|
||||
// now, do a nice display of public lobbies.
|
||||
|
||||
_lobby_table_TW->clear() ;
|
||||
int n=0 ;
|
||||
|
||||
for(uint32_t i=0;i<public_lobbies.size();++i,++n)
|
||||
{
|
||||
_lobby_table_TW->setItem(n,COL_LOBBY_NAME,new QTableWidgetItem(QString::fromUtf8(public_lobbies[i].lobby_name.c_str()))) ;
|
||||
_lobby_table_TW->setItem(n,COL_LOBBY_ID ,new QTableWidgetItem(QString::number(public_lobbies[i].lobby_id,16))) ;
|
||||
_lobby_table_TW->setItem(n,COL_LOBBY_TYPE,new QTableWidgetItem(tr("Public"))) ;
|
||||
_lobby_table_TW->setItem(n,COL_LOBBY_COUNT,new QTableWidgetItem(QString::number(public_lobbies[i].total_number_of_peers))) ;
|
||||
|
||||
std::string vpid ;
|
||||
if(rsMsgs->getVirtualPeerId(public_lobbies[i].lobby_id,vpid))
|
||||
_lobby_table_TW->setItem(n,COL_LOBBY_STATE,new QTableWidgetItem(tr("subscribed"))) ;
|
||||
else
|
||||
_lobby_table_TW->setItem(n,COL_LOBBY_STATE,new QTableWidgetItem("")) ;
|
||||
}
|
||||
|
||||
for(std::list<ChatLobbyInfo>::const_iterator it(linfos.begin());it!=linfos.end();++it,++n)
|
||||
if((*it).lobby_privacy_level == RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE)
|
||||
{
|
||||
_lobby_table_TW->setItem(n,COL_LOBBY_NAME,new QTableWidgetItem(QString::fromUtf8((*it).lobby_name.c_str()))) ;
|
||||
_lobby_table_TW->setItem(n,COL_LOBBY_ID ,new QTableWidgetItem(QString::number((*it).lobby_id,16))) ;
|
||||
_lobby_table_TW->setItem(n,COL_LOBBY_TYPE,new QTableWidgetItem(tr("Private"))) ;
|
||||
_lobby_table_TW->setItem(n,COL_LOBBY_COUNT,new QTableWidgetItem(QString::number((*it).nick_names.size()))) ;
|
||||
|
||||
_lobby_table_TW->setItem(n,COL_LOBBY_STATE,new QTableWidgetItem(tr("subscribed"))) ;
|
||||
}
|
||||
|
||||
// Each lobby can be joined directly, by calling
|
||||
// rsMsgs->joinPublicLobby(chatLobbyId) ;
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui_ChatLobbyWidget.h"
|
||||
#include "RsAutoUpdatePage.h"
|
||||
|
||||
class ChatLobbyWidget : public RsAutoUpdatePage
|
||||
class ChatLobbyWidget : public RsAutoUpdatePage, public Ui::ChatLobbyWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
38
retroshare-gui/src/gui/ChatLobbyWidget.ui
Normal file
38
retroshare-gui/src/gui/ChatLobbyWidget.ui
Normal file
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ChatLobbyWidget</class>
|
||||
<widget class="QWidget" name="ChatLobbyWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>608</width>
|
||||
<height>397</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="_lobby_table_TW">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="_lobby_tab_TW">
|
||||
<property name="currentIndex">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in New Issue
Block a user