From d417a143b55de03bfb3269783374c6a636aecda6 Mon Sep 17 00:00:00 2001 From: defnax Date: Thu, 2 Sep 2010 01:37:47 +0000 Subject: [PATCH] Added new Frame and Labels to Private Chat Window to display Friend name, status and status message. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3427 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- .../src/gui/chat/PopupChatDialog.cpp | 52 ++++++++- retroshare-gui/src/gui/chat/PopupChatDialog.h | 2 + .../src/gui/chat/PopupChatDialog.ui | 109 ++++++++++++++++-- 3 files changed, 153 insertions(+), 10 deletions(-) diff --git a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp index 41a46d826..ea391e36f 100644 --- a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp +++ b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp @@ -47,6 +47,7 @@ #include #include "gui/settings/rsharesettings.h" #include "gui/notifyqt.h" +#include "../RsAutoUpdatePage.h" #include "gui/feeds/AttachFileItem.h" #include "gui/msgs/MessageComposer.h" @@ -108,6 +109,7 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name, /* Hide Avatar and Info frame */ showAvatarFrame(false); ui.infoframe->setVisible(false); + ui.statusmessagelabel->hide(); connect(ui.avatarFrameButton, SIGNAL(toggled(bool)), this, SLOT(showAvatarFrame(bool))); @@ -181,6 +183,8 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name, updateAvatar() ; updatePeerAvatar(id) ; + updateStatusMessage(); + // load settings processSettings(true); @@ -407,7 +411,6 @@ void PopupChatDialog::contextMenu( QPoint point ) void PopupChatDialog::resetStatusBar() { - statusBar()->showMessage(tr("Chatting with ") + QString::fromStdString(dialogName)) ; ui.statusLabel->setText(QString("")) ; } @@ -1239,6 +1242,8 @@ void PopupChatDialog::updateStatus(const QString &peer_id, int status) ui.avatarlabel->setEnabled(false); ui.infoframe->setVisible(true); ui.infolabel->setText( QString::fromStdString(dialogName) + " " + tr("apears to be Offline.") +"\n" + tr("Messages you send will be lost and not delivered, rs-Mail this contact instead.")); + ui.friendnamelabel->setText( QString::fromStdString(dialogName)) ; + ui.statuslabel->setText( tr("(Offline)")) ; break; case RS_STATUS_INACTIVE: @@ -1246,12 +1251,16 @@ void PopupChatDialog::updateStatus(const QString &peer_id, int status) ui.avatarlabel->setEnabled(true); ui.infoframe->setVisible(true); ui.infolabel->setText( QString::fromStdString(dialogName) + " " + tr("is Idle and may not reply")); + ui.friendnamelabel->setText( QString::fromStdString(dialogName)) ; + ui.statuslabel->setText( tr("(Idle)")) ; break; case RS_STATUS_ONLINE: ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/avatarstatus_bg_online.png); }"); ui.avatarlabel->setEnabled(true); ui.infoframe->setVisible(false); + ui.friendnamelabel->setText( QString::fromStdString(dialogName)) ; + ui.statuslabel->setText( tr("(Online)")) ; break; case RS_STATUS_AWAY: @@ -1259,6 +1268,8 @@ void PopupChatDialog::updateStatus(const QString &peer_id, int status) ui.avatarlabel->setEnabled(true); ui.infolabel->setText( QString::fromStdString(dialogName) + " " + tr("is Away and may not reply")); ui.infoframe->setVisible(true); + ui.friendnamelabel->setText( QString::fromStdString(dialogName)) ; + ui.statuslabel->setText( tr("(Away)")) ; break; case RS_STATUS_BUSY: @@ -1266,6 +1277,8 @@ void PopupChatDialog::updateStatus(const QString &peer_id, int status) ui.avatarlabel->setEnabled(true); ui.infolabel->setText( QString::fromStdString(dialogName) + " " + tr("is Busy and may not reply")); ui.infoframe->setVisible(true); + ui.friendnamelabel->setText( QString::fromStdString(dialogName)); + ui.statuslabel->setText( tr("(Busy)")) ; break; } return; @@ -1301,3 +1314,40 @@ void PopupChatDialog::updateStatus(const QString &peer_id, int status) // ignore status change } + +void PopupChatDialog::updateStatusMessage() +{ + if (!rsPeers) + return; + + + if(!RsAutoUpdatePage::eventsLocked()) { + RsPeerDetails details; + if (!rsPeers->getPeerDetails(dialogId, details)) + { + return; + } + + QString sCustomString; + if (details.state & RS_PEER_STATE_CONNECTED) { + sCustomString = QString::fromStdString(rsMsgs->getCustomStateString(details.id)); + } + + if (sCustomString.isEmpty()) + { + ui.statusmessagelabel->hide(); + } + else + { + ui.statusmessagelabel->show(); + ui.statusmessagelabel->setText(sCustomString); + } + + } + + /* slow Tick */ + int msec_rate = 10129; + + QTimer::singleShot( msec_rate, this, SLOT(updateStatusMessage( void ) )); + return; +} diff --git a/retroshare-gui/src/gui/chat/PopupChatDialog.h b/retroshare-gui/src/gui/chat/PopupChatDialog.h index cf168016a..f482f4af3 100644 --- a/retroshare-gui/src/gui/chat/PopupChatDialog.h +++ b/retroshare-gui/src/gui/chat/PopupChatDialog.h @@ -86,6 +86,8 @@ protected: void loadEmoticons2(); void updateAvatar(); + void updateStatusMessage(); + QString loadEmptyStyle(); QPixmap picture; diff --git a/retroshare-gui/src/gui/chat/PopupChatDialog.ui b/retroshare-gui/src/gui/chat/PopupChatDialog.ui index 828a8639e..8edc112f7 100644 --- a/retroshare-gui/src/gui/chat/PopupChatDialog.ui +++ b/retroshare-gui/src/gui/chat/PopupChatDialog.ui @@ -9,8 +9,8 @@ 0 0 - 504 - 430 + 528 + 451 @@ -20,17 +20,20 @@ QToolBar#toolBar{background-image: url(:/images/connect/connectFriendBanner.png)} - + 0 0 - + + 0 + + 1 - + @@ -98,7 +101,7 @@ - + @@ -198,6 +201,91 @@ border-image: url(:/images/avatarstatus_bg.png); + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 2 + + + 2 + + + 6 + + + 6 + + + + + + 0 + 0 + + + + + Arial + 13 + 75 + true + true + + + + TextLabel + + + + + + + + Arial + 9 + + + + TextLabel + + + + + + + + Arial + 9 + + + + TextLabel + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + QFrame#infoframe{border: 1px solid #DCDC41; @@ -279,7 +367,7 @@ border-image: url(:/images/closepressed.png) - + 1 @@ -371,7 +459,7 @@ background: white;} - + @@ -742,7 +830,7 @@ border: 1px solid #CCCCCC; - + @@ -833,6 +921,9 @@ border: 1px solid #CCCCCC; + + +