fixed small issue in chat lobby list. Not yet the cause for the ghost lobby

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6964 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2013-12-26 21:44:02 +00:00
parent cb7dccf0b8
commit 490abbeffc

View File

@ -310,6 +310,7 @@ void ChatLobbyWidget::setCurrentChatPage(ChatLobbyDialog *d)
}
}
//#define CHAT_LOBBY_GUI_DEBUG
void ChatLobbyWidget::updateDisplay()
{
#ifdef CHAT_LOBBY_GUI_DEBUG
@ -322,14 +323,12 @@ void ChatLobbyWidget::updateDisplay()
rsMsgs->getChatLobbyList(lobbies);
#ifdef CHAT_LOBBY_GUI_DEBUG
std::cerr << "got " << visibleLobbies.size() << " visible lobbies, and " << lobbies.size() << " private lobbies." << std::endl;
std::cerr << "got " << visibleLobbies.size() << " visible lobbies" << std::endl;
#endif
// now, do a nice display of lobbies
std::string vpid;
uint32_t i;
uint32_t size = visibleLobbies.size();
std::list<ChatLobbyInfo>::const_iterator lobbyIt;
// remove not existing public lobbies
@ -337,12 +336,13 @@ void ChatLobbyWidget::updateDisplay()
for(int p=0;p<4;++p)
{
QTreeWidgetItem *lobby_item =NULL;
switch (p) {
switch (p)
{
case 0: lobby_item = privateSubLobbyItem; break;
case 1: lobby_item = publicSubLobbyItem; break;
case 2: lobby_item = privateLobbyItem; break;
case 4: lobby_item = publicLobbyItem; break;
default: lobby_item = publicLobbyItem;
default:
case 3: lobby_item = publicLobbyItem; break;
}
//QTreeWidgetItem *lobby_item = (p==0)?publicLobbyItem:privateLobbyItem ;
@ -354,11 +354,14 @@ void ChatLobbyWidget::updateDisplay()
if (itemLoop->type() == TYPE_LOBBY)
{
// check for visible lobby
for (i = 0; i < size; ++i)
//
uint32_t i;
for (i = 0; i < visibleLobbies.size(); ++i)
if (itemLoop->data(COLUMN_DATA, ROLE_ID).toULongLong() == visibleLobbies[i].lobby_id)
break;
if (i >= size)
if (i >= visibleLobbies.size())
{
// Check for participating lobby with public level
//
@ -380,7 +383,7 @@ void ChatLobbyWidget::updateDisplay()
// Now add visible lobbies
//
for (i = 0; i < size; ++i)
for (uint32_t i = 0; i < visibleLobbies.size(); ++i)
{
const VisibleChatLobbyRecord &lobby = visibleLobbies[i];
@ -397,12 +400,31 @@ void ChatLobbyWidget::updateDisplay()
QTreeWidgetItem *item = NULL;
QTreeWidgetItem *lobby_item =NULL;
QTreeWidgetItem *lobby_other_item =NULL;
if (lobby.lobby_privacy_level == RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC){
if (subscribed) { lobby_item = publicSubLobbyItem; lobby_other_item = publicLobbyItem;
} else { lobby_item = publicLobbyItem; lobby_other_item = publicSubLobbyItem;}
} else {
if (subscribed) { lobby_item = privateSubLobbyItem; lobby_other_item = privateLobbyItem;
} else { lobby_item = privateLobbyItem; lobby_other_item = privateSubLobbyItem;}
if (lobby.lobby_privacy_level == RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC)
{
if (subscribed)
{
lobby_item = publicSubLobbyItem;
lobby_other_item = publicLobbyItem;
}
else
{
lobby_item = publicLobbyItem;
lobby_other_item = publicSubLobbyItem;
}
}
else
{
if (subscribed)
{
lobby_item = privateSubLobbyItem;
lobby_other_item = privateLobbyItem;
}
else
{
lobby_item = privateLobbyItem;
lobby_other_item = privateSubLobbyItem;
}
}
//QTreeWidgetItem *lobby_item = (lobby.lobby_privacy_level == RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC)?publicLobbyItem:privateLobbyItem ;
@ -429,11 +451,14 @@ void ChatLobbyWidget::updateDisplay()
}
QIcon icon;
if (item == NULL) {
if (item == NULL)
{
item = new RSTreeWidgetItem(compareRole, TYPE_LOBBY);
icon = (lobby.lobby_privacy_level == RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC) ? QIcon(IMAGE_PUBLIC) : QIcon(IMAGE_PRIVATE);
lobby_item->addChild(item);
} else {
}
else
{
if (item->data(COLUMN_DATA, ROLE_SUBSCRIBED).toBool() != subscribed) {
// Replace icon
icon = (lobby.lobby_privacy_level == RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC) ? QIcon(IMAGE_PUBLIC) : QIcon(IMAGE_PRIVATE);
@ -459,7 +484,6 @@ void ChatLobbyWidget::updateDisplay()
}
updateItem(lobbyTreeWidget, item, lobby.lobby_id, lobby.lobby_name,lobby.lobby_topic, lobby.total_number_of_peers, subscribed, autoSubscribe);
}
// time_t now = time(NULL) ;