mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-27 15:57:08 -05:00
improved gui of chat lobby
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4762 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
1a191c7f91
commit
6df92753b1
@ -13,19 +13,9 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WFlags flags)
|
||||
{
|
||||
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))) ;
|
||||
|
||||
_lobby_table_TW->setColumnHidden(1,true) ;
|
||||
updateDisplay() ;
|
||||
}
|
||||
ChatLobbyWidget::~ChatLobbyWidget()
|
||||
@ -48,34 +38,44 @@ void ChatLobbyWidget::updateDisplay()
|
||||
_lobby_table_TW->clear() ;
|
||||
int n=0 ;
|
||||
|
||||
QList<QTreeWidgetItem*> list ;
|
||||
std::string vpid ;
|
||||
for(uint32_t i=0;i<public_lobbies.size();++i,++n)
|
||||
if(!rsMsgs->getVirtualPeerId(public_lobbies[i].lobby_id,vpid)) // only display unsubscribed lobbies
|
||||
{
|
||||
std::cerr << "adding " << public_lobbies[i].lobby_name << " #" << std::hex << public_lobbies[i].lobby_id << std::dec << " public " << public_lobbies[i].total_number_of_peers << " peers." << std::endl;
|
||||
|
||||
_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))) ;
|
||||
_lobby_table_TW->setItem(n,COL_LOBBY_STATE,new QTableWidgetItem("")) ;
|
||||
QStringList strl ;
|
||||
|
||||
strl.push_back(QString::fromUtf8(public_lobbies[i].lobby_name.c_str())) ;
|
||||
strl.push_back(QString::number(public_lobbies[i].lobby_id,16)) ;
|
||||
strl.push_back(tr("Public")) ;
|
||||
strl.push_back(QString::number(public_lobbies[i].total_number_of_peers)) ;
|
||||
strl.push_back("") ;
|
||||
|
||||
list.push_back(new QTreeWidgetItem(strl)) ;
|
||||
}
|
||||
|
||||
for(std::list<ChatLobbyInfo>::const_iterator it(linfos.begin());it!=linfos.end();++it,++n)
|
||||
{
|
||||
std::cerr << "adding " << (*it).lobby_name << " #" << std::hex << (*it).lobby_id << std::dec << " private " << (*it).nick_names.size() << " peers." << std::endl;
|
||||
|
||||
_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))) ;
|
||||
QStringList strl ;
|
||||
strl.push_back(QString::fromUtf8((*it).lobby_name.c_str())) ;
|
||||
strl.push_back(QString::number((*it).lobby_id,16)) ;
|
||||
|
||||
if( (*it).lobby_privacy_level == RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC)
|
||||
_lobby_table_TW->setItem(n,COL_LOBBY_TYPE,new QTableWidgetItem(tr("Public"))) ;
|
||||
strl.push_back(tr("Public")) ;
|
||||
else
|
||||
_lobby_table_TW->setItem(n,COL_LOBBY_TYPE,new QTableWidgetItem(tr("Private"))) ;
|
||||
strl.push_back(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"))) ;
|
||||
strl.push_back(QString::number((*it).nick_names.size())) ;
|
||||
strl.push_back(tr("subscribed")) ;
|
||||
|
||||
list.push_back(new QTreeWidgetItem(strl)) ;
|
||||
}
|
||||
|
||||
_lobby_table_TW->addTopLevelItems(list) ;
|
||||
}
|
||||
|
||||
void ChatLobbyWidget::doubleClickCell(int row,int col)
|
||||
|
@ -15,13 +15,38 @@
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="_lobby_table_TW">
|
||||
<widget class="QTreeWidget" name="_lobby_table_TW">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>ID</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Type</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Count</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>S</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user