mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
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:
parent
cb7dccf0b8
commit
490abbeffc
@ -310,6 +310,7 @@ void ChatLobbyWidget::setCurrentChatPage(ChatLobbyDialog *d)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#define CHAT_LOBBY_GUI_DEBUG
|
||||||
void ChatLobbyWidget::updateDisplay()
|
void ChatLobbyWidget::updateDisplay()
|
||||||
{
|
{
|
||||||
#ifdef CHAT_LOBBY_GUI_DEBUG
|
#ifdef CHAT_LOBBY_GUI_DEBUG
|
||||||
@ -322,14 +323,12 @@ void ChatLobbyWidget::updateDisplay()
|
|||||||
rsMsgs->getChatLobbyList(lobbies);
|
rsMsgs->getChatLobbyList(lobbies);
|
||||||
|
|
||||||
#ifdef CHAT_LOBBY_GUI_DEBUG
|
#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
|
#endif
|
||||||
|
|
||||||
// now, do a nice display of lobbies
|
// now, do a nice display of lobbies
|
||||||
|
|
||||||
std::string vpid;
|
std::string vpid;
|
||||||
uint32_t i;
|
|
||||||
uint32_t size = visibleLobbies.size();
|
|
||||||
std::list<ChatLobbyInfo>::const_iterator lobbyIt;
|
std::list<ChatLobbyInfo>::const_iterator lobbyIt;
|
||||||
|
|
||||||
// remove not existing public lobbies
|
// remove not existing public lobbies
|
||||||
@ -337,12 +336,13 @@ void ChatLobbyWidget::updateDisplay()
|
|||||||
for(int p=0;p<4;++p)
|
for(int p=0;p<4;++p)
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *lobby_item =NULL;
|
QTreeWidgetItem *lobby_item =NULL;
|
||||||
switch (p) {
|
switch (p)
|
||||||
|
{
|
||||||
case 0: lobby_item = privateSubLobbyItem; break;
|
case 0: lobby_item = privateSubLobbyItem; break;
|
||||||
case 1: lobby_item = publicSubLobbyItem; break;
|
case 1: lobby_item = publicSubLobbyItem; break;
|
||||||
case 2: lobby_item = privateLobbyItem; break;
|
case 2: lobby_item = privateLobbyItem; break;
|
||||||
case 4: lobby_item = publicLobbyItem; break;
|
default:
|
||||||
default: lobby_item = publicLobbyItem;
|
case 3: lobby_item = publicLobbyItem; break;
|
||||||
}
|
}
|
||||||
//QTreeWidgetItem *lobby_item = (p==0)?publicLobbyItem:privateLobbyItem ;
|
//QTreeWidgetItem *lobby_item = (p==0)?publicLobbyItem:privateLobbyItem ;
|
||||||
|
|
||||||
@ -354,11 +354,14 @@ void ChatLobbyWidget::updateDisplay()
|
|||||||
if (itemLoop->type() == TYPE_LOBBY)
|
if (itemLoop->type() == TYPE_LOBBY)
|
||||||
{
|
{
|
||||||
// check for visible 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)
|
if (itemLoop->data(COLUMN_DATA, ROLE_ID).toULongLong() == visibleLobbies[i].lobby_id)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (i >= size)
|
if (i >= visibleLobbies.size())
|
||||||
{
|
{
|
||||||
// Check for participating lobby with public level
|
// Check for participating lobby with public level
|
||||||
//
|
//
|
||||||
@ -380,7 +383,7 @@ void ChatLobbyWidget::updateDisplay()
|
|||||||
|
|
||||||
// Now add visible lobbies
|
// Now add visible lobbies
|
||||||
//
|
//
|
||||||
for (i = 0; i < size; ++i)
|
for (uint32_t i = 0; i < visibleLobbies.size(); ++i)
|
||||||
{
|
{
|
||||||
const VisibleChatLobbyRecord &lobby = visibleLobbies[i];
|
const VisibleChatLobbyRecord &lobby = visibleLobbies[i];
|
||||||
|
|
||||||
@ -397,12 +400,31 @@ void ChatLobbyWidget::updateDisplay()
|
|||||||
QTreeWidgetItem *item = NULL;
|
QTreeWidgetItem *item = NULL;
|
||||||
QTreeWidgetItem *lobby_item =NULL;
|
QTreeWidgetItem *lobby_item =NULL;
|
||||||
QTreeWidgetItem *lobby_other_item =NULL;
|
QTreeWidgetItem *lobby_other_item =NULL;
|
||||||
if (lobby.lobby_privacy_level == RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC){
|
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;}
|
if (subscribed)
|
||||||
} else {
|
{
|
||||||
if (subscribed) { lobby_item = privateSubLobbyItem; lobby_other_item = privateLobbyItem;
|
lobby_item = publicSubLobbyItem;
|
||||||
} else { lobby_item = privateLobbyItem; lobby_other_item = privateSubLobbyItem;}
|
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 ;
|
//QTreeWidgetItem *lobby_item = (lobby.lobby_privacy_level == RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC)?publicLobbyItem:privateLobbyItem ;
|
||||||
|
|
||||||
@ -429,11 +451,14 @@ void ChatLobbyWidget::updateDisplay()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QIcon icon;
|
QIcon icon;
|
||||||
if (item == NULL) {
|
if (item == NULL)
|
||||||
|
{
|
||||||
item = new RSTreeWidgetItem(compareRole, TYPE_LOBBY);
|
item = new RSTreeWidgetItem(compareRole, TYPE_LOBBY);
|
||||||
icon = (lobby.lobby_privacy_level == RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC) ? QIcon(IMAGE_PUBLIC) : QIcon(IMAGE_PRIVATE);
|
icon = (lobby.lobby_privacy_level == RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC) ? QIcon(IMAGE_PUBLIC) : QIcon(IMAGE_PRIVATE);
|
||||||
lobby_item->addChild(item);
|
lobby_item->addChild(item);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (item->data(COLUMN_DATA, ROLE_SUBSCRIBED).toBool() != subscribed) {
|
if (item->data(COLUMN_DATA, ROLE_SUBSCRIBED).toBool() != subscribed) {
|
||||||
// Replace icon
|
// Replace icon
|
||||||
icon = (lobby.lobby_privacy_level == RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC) ? QIcon(IMAGE_PUBLIC) : QIcon(IMAGE_PRIVATE);
|
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);
|
updateItem(lobbyTreeWidget, item, lobby.lobby_id, lobby.lobby_name,lobby.lobby_topic, lobby.total_number_of_peers, subscribed, autoSubscribe);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// time_t now = time(NULL) ;
|
// time_t now = time(NULL) ;
|
||||||
|
Loading…
Reference in New Issue
Block a user