From 7470c720425a511734c3fd406083bd6ea85ae5a2 Mon Sep 17 00:00:00 2001 From: defnax Date: Mon, 23 Aug 2010 19:09:16 +0000 Subject: [PATCH] Added a info Frame when friend is offline for Private Chat. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3384 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- .../src/gui/chat/PopupChatDialog.cpp | 27 ++- .../src/gui/chat/PopupChatDialog.ui | 169 ++++++++++-------- 2 files changed, 110 insertions(+), 86 deletions(-) diff --git a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp index fd54ecc3b..c962fde66 100644 --- a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp +++ b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp @@ -84,8 +84,9 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name, last_status_send_time = 0 ; styleHtm = ":/qss/chat/default.htm"; - /* Hide Avatar frame */ - showAvatarFrame(false); + /* Hide Avatar and Info frame */ + showAvatarFrame(false); + ui.infoframe->setVisible(false); connect(ui.avatarFrameButton, SIGNAL(toggled(bool)), this, SLOT(showAvatarFrame(bool))); @@ -446,22 +447,12 @@ void PopupChatDialog::addChatMsg(ChatInfo *ci) std::cerr << "WARNING CANNOT GET PEER INFO!!!!" << std::endl; #endif } - else if (detail.state & RS_PEER_STATE_CONNECTED) - { - offline = false; - } - } - if (offline) - { - QString offlineMsg = "
\n ----- PEER OFFLINE (Chat will be lost) ----- \n
"; - ui.textBrowser->append(offlineMsg); } - - QString timestamp = "[" + QDateTime::currentDateTime().toString("hh:mm:ss") + "]"; - QString name = QString::fromStdString(ci ->name); - QString message = QString::fromStdWString(ci -> msg); + QString timestamp = "[" + QDateTime::currentDateTime().toString("hh:mm:ss") + "]"; + QString name = QString::fromStdString(ci ->name); + QString message = QString::fromStdWString(ci -> msg); //replace http://, https:// and www. with links QRegExp rx("(retroshare://[^ <>]*)|(https?://[^ <>]*)|(www\\.[^ <>]*)"); @@ -1175,26 +1166,32 @@ void PopupChatDialog::updateStatus(const QString &peer_id, int status) case RS_STATUS_OFFLINE: ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/mystatus_bg_offline.png); }"); ui.avatarlabel->setEnabled(false); + ui.infoframe->setVisible(true); + ui.infolabel->setText( QString::fromStdString(dialogName) + tr(" is Offline") +"\n" + tr("Chat message will be lost and not delivered, write instead a Message.")); break; case RS_STATUS_INACTIVE: ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/mystatus_bg_idle.png); }"); ui.avatarlabel->setEnabled(true); + ui.infoframe->setVisible(false); break; case RS_STATUS_ONLINE: ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/mystatus_bg_online.png); }"); ui.avatarlabel->setEnabled(true); + ui.infoframe->setVisible(false); break; case RS_STATUS_AWAY: ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/mystatus_bg_idle.png); }"); ui.avatarlabel->setEnabled(true); + ui.infoframe->setVisible(false); break; case RS_STATUS_BUSY: ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/mystatus_bg_busy.png); }"); ui.avatarlabel->setEnabled(true); + ui.infoframe->setVisible(false); break; } } diff --git a/retroshare-gui/src/gui/chat/PopupChatDialog.ui b/retroshare-gui/src/gui/chat/PopupChatDialog.ui index 487756dc1..ebc1fdfe8 100644 --- a/retroshare-gui/src/gui/chat/PopupChatDialog.ui +++ b/retroshare-gui/src/gui/chat/PopupChatDialog.ui @@ -9,8 +9,8 @@ 0 0 - 568 - 418 + 558 + 427 @@ -28,12 +28,77 @@ 0 - 0 + 1 - - 2 - - + + + + + 0 + 0 + + + + + 14 + 16777215 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + + + + 14 + 31 + + + + + 14 + 31 + + + + + + + + 16 + 31 + + + + true + + + + + + + Qt::Vertical + + + + 12 + 335 + + + + + + + + @@ -133,6 +198,30 @@ border-image: url(:/images/mystatus_bg.png); + + + QFrame#infoframe{border: 1px solid #DCDC41; +border-radius: 6px; +background: #FFFFD7;} + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + TextLabel + + + + + + + 1 @@ -202,7 +291,7 @@ background: white;} - + @@ -573,71 +662,9 @@ border: 1px solid #CCCCCC; - + - - - - - 14 - 16777215 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - - - - 14 - 31 - - - - - 14 - 31 - - - - - - - - 16 - 31 - - - - true - - - - - - - Qt::Vertical - - - - 13 - 335 - - - - - - -