mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-20 04:14:27 -04: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
2 changed files with 48 additions and 23 deletions
|
@ -13,19 +13,9 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WFlags flags)
|
||||||
{
|
{
|
||||||
setupUi(this) ;
|
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))) ;
|
QObject::connect(this,SIGNAL(cellDoubleClicked(int,int)),this,SLOT(doubleClickCell(int,int))) ;
|
||||||
|
|
||||||
|
_lobby_table_TW->setColumnHidden(1,true) ;
|
||||||
updateDisplay() ;
|
updateDisplay() ;
|
||||||
}
|
}
|
||||||
ChatLobbyWidget::~ChatLobbyWidget()
|
ChatLobbyWidget::~ChatLobbyWidget()
|
||||||
|
@ -48,34 +38,44 @@ void ChatLobbyWidget::updateDisplay()
|
||||||
_lobby_table_TW->clear() ;
|
_lobby_table_TW->clear() ;
|
||||||
int n=0 ;
|
int n=0 ;
|
||||||
|
|
||||||
|
QList<QTreeWidgetItem*> list ;
|
||||||
std::string vpid ;
|
std::string vpid ;
|
||||||
for(uint32_t i=0;i<public_lobbies.size();++i,++n)
|
for(uint32_t i=0;i<public_lobbies.size();++i,++n)
|
||||||
if(!rsMsgs->getVirtualPeerId(public_lobbies[i].lobby_id,vpid)) // only display unsubscribed lobbies
|
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;
|
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()))) ;
|
QStringList strl ;
|
||||||
_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"))) ;
|
strl.push_back(QString::fromUtf8(public_lobbies[i].lobby_name.c_str())) ;
|
||||||
_lobby_table_TW->setItem(n,COL_LOBBY_COUNT,new QTableWidgetItem(QString::number(public_lobbies[i].total_number_of_peers))) ;
|
strl.push_back(QString::number(public_lobbies[i].lobby_id,16)) ;
|
||||||
_lobby_table_TW->setItem(n,COL_LOBBY_STATE,new QTableWidgetItem("")) ;
|
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)
|
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;
|
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()))) ;
|
QStringList strl ;
|
||||||
_lobby_table_TW->setItem(n,COL_LOBBY_ID ,new QTableWidgetItem(QString::number((*it).lobby_id,16))) ;
|
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)
|
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
|
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()))) ;
|
strl.push_back(QString::number((*it).nick_names.size())) ;
|
||||||
_lobby_table_TW->setItem(n,COL_LOBBY_STATE,new QTableWidgetItem(tr("subscribed"))) ;
|
strl.push_back(tr("subscribed")) ;
|
||||||
|
|
||||||
|
list.push_back(new QTreeWidgetItem(strl)) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_lobby_table_TW->addTopLevelItems(list) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatLobbyWidget::doubleClickCell(int row,int col)
|
void ChatLobbyWidget::doubleClickCell(int row,int col)
|
||||||
|
|
|
@ -15,13 +15,38 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTableWidget" name="_lobby_table_TW">
|
<widget class="QTreeWidget" name="_lobby_table_TW">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Expanding">
|
<sizepolicy hsizetype="Maximum" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</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>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue