diff --git a/retroshare-gui/src/gui/ChatLobbyWidget.cpp b/retroshare-gui/src/gui/ChatLobbyWidget.cpp index 9682bc4c5..2754e3639 100644 --- a/retroshare-gui/src/gui/ChatLobbyWidget.cpp +++ b/retroshare-gui/src/gui/ChatLobbyWidget.cpp @@ -912,10 +912,21 @@ void ChatLobbyWidget::showBlankPage(ChatLobbyId id, bool subscribed /*= false*/) { ui.lobbyname_lineEdit->setText( RsHtml::plainText(it->lobby_name) ); ui.lobbyid_lineEdit->setText( QString::number((*it).lobby_id,16) ); - ui.lobbytopic_lineEdit->setText( RsHtml::plainText(it->lobby_topic) ); + //ui.lobbytopic_lineEdit->setText( RsHtml::plainText(it->lobby_topic) ); ui.lobbytype_lineEdit->setText( (( (*it).lobby_flags & RS_CHAT_LOBBY_FLAGS_PUBLIC)?tr("Public"):tr("Private")) ); ui.lobbysec_lineEdit->setText( (( (*it).lobby_flags & RS_CHAT_LOBBY_FLAGS_PGP_SIGNED)?tr("No anonymous IDs"):tr("Anonymous IDs accepted")) ); ui.lobbypeers_lineEdit->setText( QString::number((*it).total_number_of_peers) ); + + QString Topic = RsHtml::plainText(it->lobby_topic); + QString shortTopic = Topic.left(130) + "..."; + ui.lobbytopic_lineEdit->setText(shortTopic); + + QString formatDescription = QString::fromUtf8(it->lobby_topic.c_str()); + unsigned int formatFlag = RSHTML_FORMATTEXT_EMBED_LINKS; + + formatDescription = RsHtml().formatText(NULL, formatDescription, formatFlag); + + ui.lobbydesc_textBrowser->setText(formatDescription); QString text = tr("You're subscribed to this chat room; Double click to show window and chat.") ; if (!subscribed) @@ -940,6 +951,7 @@ void ChatLobbyWidget::showBlankPage(ChatLobbyId id, bool subscribed /*= false*/) ui.lobbytype_lineEdit->clear(); ui.lobbypeers_lineEdit->clear(); ui.lobbysec_lineEdit->clear(); + ui.lobbydesc_textBrowser->clear(); QString text = tr("No chat room selected. \nSelect chat rooms at left to show details.\nDouble click a chat room to enter and chat.") ; ui.info_Label_Lobby->setText(text) ; diff --git a/retroshare-gui/src/gui/ChatLobbyWidget.ui b/retroshare-gui/src/gui/ChatLobbyWidget.ui index b2f711b72..aba6a6217 100644 --- a/retroshare-gui/src/gui/ChatLobbyWidget.ui +++ b/retroshare-gui/src/gui/ChatLobbyWidget.ui @@ -254,17 +254,10 @@ 6 - - - - - 12 - 75 - true - - + + - Chat room Name: + TextLabel @@ -288,17 +281,29 @@ - - - - - 12 - 75 - true - + + + + + 0 + 0 + - Chat room Id: + TextLabel + + + + + + + + 0 + 0 + + + + TextLabel @@ -315,8 +320,8 @@ - - + + 12 @@ -325,7 +330,35 @@ - Topic: + Type: + + + + + + + + 12 + 75 + true + + + + Chat room Name: + + + + + + + + 12 + 75 + true + + + + Chat room Id: @@ -345,8 +378,8 @@ - - + + 12 @@ -355,20 +388,7 @@ - Type: - - - - - - - - 0 - 0 - - - - TextLabel + Peers: @@ -386,15 +406,33 @@ - - - - TextLabel + + + + + 75 + true + + + Room infos + + + + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + true + + + + - - + + 12 @@ -403,35 +441,12 @@ - Peers: - - - - - - - - 0 - 0 - - - - TextLabel + Topic: - - - - TextLabel - - - true - - - @@ -445,6 +460,16 @@ + + + + TextLabel + + + true + + + diff --git a/retroshare-gui/src/gui/chat/ChatWidget.cpp b/retroshare-gui/src/gui/chat/ChatWidget.cpp index abab8336a..bda749c38 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.cpp +++ b/retroshare-gui/src/gui/chat/ChatWidget.cpp @@ -998,7 +998,10 @@ void ChatWidget::scrollToAnchor(QString anchor) void ChatWidget::setWelcomeMessage(QString &text) { - ui->textBrowser->setText(text); + unsigned int formatTextFlag = RSHTML_FORMATTEXT_EMBED_LINKS | RSHTML_FORMATTEXT_OPTIMIZE; + QString formattedWelcomeMessage = RsHtml().formatText(ui->textBrowser->document(), text, formatTextFlag); + + ui->textBrowser->setText(formattedWelcomeMessage); } void ChatWidget::addChatMsg(bool incoming, const QString &name, const QDateTime &sendTime, const QDateTime &recvTime, const QString &message, MsgType chatType) diff --git a/retroshare-gui/src/gui/chat/CreateLobbyDialog.cpp b/retroshare-gui/src/gui/chat/CreateLobbyDialog.cpp index a3416b403..450671ba6 100644 --- a/retroshare-gui/src/gui/chat/CreateLobbyDialog.cpp +++ b/retroshare-gui/src/gui/chat/CreateLobbyDialog.cpp @@ -129,6 +129,8 @@ void CreateLobbyDialog::createLobby() // create chat lobby !! std::string lobby_name = ui->lobbyName_LE->text().toUtf8().constData() ; std::string lobby_topic = ui->lobbyTopic_LE->text().toUtf8().constData() ; + std::string lobby_description = ui->lobbyDescription_TE->toPlainText().toUtf8().constData() ; + std::string lobby_topicwithdesc = lobby_topic + "\n" + lobby_description; // set nick name ! RsGxsId gxs_id ; @@ -149,7 +151,7 @@ void CreateLobbyDialog::createLobby() if(ui->pgp_signed_CB->isChecked()) lobby_flags |= RS_CHAT_LOBBY_FLAGS_PGP_SIGNED ; - ChatLobbyId id = rsMsgs->createChatLobby(lobby_name,gxs_id, lobby_topic, shareList, lobby_flags); + ChatLobbyId id = rsMsgs->createChatLobby(lobby_name,gxs_id, lobby_topicwithdesc, shareList, lobby_flags); std::cerr << "gui: Created chat room " << std::hex << id << std::dec << std::endl ; diff --git a/retroshare-gui/src/gui/chat/CreateLobbyDialog.ui b/retroshare-gui/src/gui/chat/CreateLobbyDialog.ui index 15dab649d..caaf33125 100644 --- a/retroshare-gui/src/gui/chat/CreateLobbyDialog.ui +++ b/retroshare-gui/src/gui/chat/CreateLobbyDialog.ui @@ -149,6 +149,22 @@ + + + + Room info + + + + + + Add additional room rules, links & infos + + + + + + diff --git a/retroshare-gui/src/gui/common/FriendListModel.cpp b/retroshare-gui/src/gui/common/FriendListModel.cpp index 9ea271f86..ecbdd8b4c 100644 --- a/retroshare-gui/src/gui/common/FriendListModel.cpp +++ b/retroshare-gui/src/gui/common/FriendListModel.cpp @@ -34,6 +34,7 @@ #include "gui/common/FriendListModel.h" #include "gui/gxs/GxsIdDetails.h" #include "gui/gxs/GxsIdTreeWidgetItem.h" +#include "gui/chat/ChatUserNotify.h" #include "retroshare/rsexpr.h" #include "retroshare/rsmsgs.h" @@ -998,6 +999,12 @@ QVariant RsFriendListModel::decorationRole(const EntryIndex& entry,int col) cons { QPixmap sslAvatar; bool foundAvatar = false; + bool hasPrivateChat = false; + + // get peers with waiting incoming chats + std::vector privateChatIds; + ChatUserNotify::getPeersWithWaitingChat(privateChatIds); + const HierarchicalProfileInformation *hn = getProfileInfo(entry); uint32_t status = RS_STATUS_OFFLINE; const HierarchicalNodeInformation *bestNodeInformation = NULL; @@ -1025,11 +1032,26 @@ QVariant RsFriendListModel::decorationRole(const EntryIndex& entry,int col) cons if (!foundAvatar || sslAvatar.isNull()) { sslAvatar = FilesDefs::getPixmapFromQtResourcePath(AVATAR_DEFAULT_IMAGE); } + + if (mDisplayStatusIcon) { + for(uint32_t i=0;ichild_node_indices.size();++i) { + if (std::find(privateChatIds.begin(), privateChatIds.end(), RsPeerId(mLocations[hn->child_node_indices[i]].node_info.id.toStdString())) != privateChatIds.end()) { + // private chat is available + hasPrivateChat = true; + break; + } + } + } if (mDisplayStatusIcon) { if (bestNodeInformation) { - QPixmap sslOverlayIcon = FilesDefs::getPixmapFromQtResourcePath(StatusDefs::imageStatus(status)); - return QVariant(QIcon(createAvatar(sslAvatar, sslOverlayIcon))); + if (hasPrivateChat) { + QPixmap sslOverlayIcon = FilesDefs::getPixmapFromQtResourcePath(":/images/orange-bubble-64.png"); + return QVariant(QIcon(createAvatar(sslAvatar, sslOverlayIcon))); + } else { + QPixmap sslOverlayIcon = FilesDefs::getPixmapFromQtResourcePath(StatusDefs::imageStatus(status)); + return QVariant(QIcon(createAvatar(sslAvatar, sslOverlayIcon))); + } } } @@ -1047,10 +1069,31 @@ QVariant RsFriendListModel::decorationRole(const EntryIndex& entry,int col) cons return QVariant(); QPixmap sslAvatar; + bool hasPrivateChat = false; AvatarDefs::getAvatarFromSslId(RsPeerId(hn->node_info.id.toStdString()), sslAvatar); + + // get peers with waiting incoming chats + std::vector privateChatIds; + ChatUserNotify::getPeersWithWaitingChat(privateChatIds); + if (mDisplayStatusIcon) { - QPixmap sslOverlayIcon = FilesDefs::getPixmapFromQtResourcePath(StatusDefs::imageStatus(statusRole(entry, col).toInt())); - return QVariant(QIcon(createAvatar(sslAvatar, sslOverlayIcon))); + for(uint32_t i=0;inode_info.id.toStdString())) != privateChatIds.end()) { + // private chat is available + hasPrivateChat = true; + break; + } + } + } + + if (mDisplayStatusIcon) { + if (hasPrivateChat) { + QPixmap sslOverlayIcon = FilesDefs::getPixmapFromQtResourcePath(":/images/orange-bubble-64.png"); + return QVariant(QIcon(createAvatar(sslAvatar, sslOverlayIcon))); + } else { + QPixmap sslOverlayIcon = FilesDefs::getPixmapFromQtResourcePath(StatusDefs::imageStatus(statusRole(entry, col).toInt())); + return QVariant(QIcon(createAvatar(sslAvatar, sslOverlayIcon))); + } } return QVariant(QIcon(sslAvatar)); diff --git a/retroshare-gui/src/gui/images/orange-bubble-64.png b/retroshare-gui/src/gui/images/orange-bubble-64.png index 694549936..23f91242a 100644 Binary files a/retroshare-gui/src/gui/images/orange-bubble-64.png and b/retroshare-gui/src/gui/images/orange-bubble-64.png differ