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
This commit is contained in:
defnax 2010-09-02 01:37:47 +00:00
parent d5ea522eb0
commit d417a143b5
3 changed files with 153 additions and 10 deletions

View File

@ -47,6 +47,7 @@
#include <retroshare/rsiface.h> #include <retroshare/rsiface.h>
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "gui/notifyqt.h" #include "gui/notifyqt.h"
#include "../RsAutoUpdatePage.h"
#include "gui/feeds/AttachFileItem.h" #include "gui/feeds/AttachFileItem.h"
#include "gui/msgs/MessageComposer.h" #include "gui/msgs/MessageComposer.h"
@ -108,6 +109,7 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
/* Hide Avatar and Info frame */ /* Hide Avatar and Info frame */
showAvatarFrame(false); showAvatarFrame(false);
ui.infoframe->setVisible(false); ui.infoframe->setVisible(false);
ui.statusmessagelabel->hide();
connect(ui.avatarFrameButton, SIGNAL(toggled(bool)), this, SLOT(showAvatarFrame(bool))); connect(ui.avatarFrameButton, SIGNAL(toggled(bool)), this, SLOT(showAvatarFrame(bool)));
@ -181,6 +183,8 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
updateAvatar() ; updateAvatar() ;
updatePeerAvatar(id) ; updatePeerAvatar(id) ;
updateStatusMessage();
// load settings // load settings
processSettings(true); processSettings(true);
@ -407,7 +411,6 @@ void PopupChatDialog::contextMenu( QPoint point )
void PopupChatDialog::resetStatusBar() void PopupChatDialog::resetStatusBar()
{ {
statusBar()->showMessage(tr("Chatting with ") + QString::fromStdString(dialogName)) ;
ui.statusLabel->setText(QString("")) ; ui.statusLabel->setText(QString("")) ;
} }
@ -1239,6 +1242,8 @@ void PopupChatDialog::updateStatus(const QString &peer_id, int status)
ui.avatarlabel->setEnabled(false); ui.avatarlabel->setEnabled(false);
ui.infoframe->setVisible(true); 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.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; break;
case RS_STATUS_INACTIVE: case RS_STATUS_INACTIVE:
@ -1246,12 +1251,16 @@ void PopupChatDialog::updateStatus(const QString &peer_id, int status)
ui.avatarlabel->setEnabled(true); ui.avatarlabel->setEnabled(true);
ui.infoframe->setVisible(true); ui.infoframe->setVisible(true);
ui.infolabel->setText( QString::fromStdString(dialogName) + " " + tr("is Idle and may not reply")); 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; break;
case RS_STATUS_ONLINE: case RS_STATUS_ONLINE:
ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/avatarstatus_bg_online.png); }"); ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/avatarstatus_bg_online.png); }");
ui.avatarlabel->setEnabled(true); ui.avatarlabel->setEnabled(true);
ui.infoframe->setVisible(false); ui.infoframe->setVisible(false);
ui.friendnamelabel->setText( QString::fromStdString(dialogName)) ;
ui.statuslabel->setText( tr("(Online)")) ;
break; break;
case RS_STATUS_AWAY: case RS_STATUS_AWAY:
@ -1259,6 +1268,8 @@ void PopupChatDialog::updateStatus(const QString &peer_id, int status)
ui.avatarlabel->setEnabled(true); ui.avatarlabel->setEnabled(true);
ui.infolabel->setText( QString::fromStdString(dialogName) + " " + tr("is Away and may not reply")); ui.infolabel->setText( QString::fromStdString(dialogName) + " " + tr("is Away and may not reply"));
ui.infoframe->setVisible(true); ui.infoframe->setVisible(true);
ui.friendnamelabel->setText( QString::fromStdString(dialogName)) ;
ui.statuslabel->setText( tr("(Away)")) ;
break; break;
case RS_STATUS_BUSY: case RS_STATUS_BUSY:
@ -1266,6 +1277,8 @@ void PopupChatDialog::updateStatus(const QString &peer_id, int status)
ui.avatarlabel->setEnabled(true); ui.avatarlabel->setEnabled(true);
ui.infolabel->setText( QString::fromStdString(dialogName) + " " + tr("is Busy and may not reply")); ui.infolabel->setText( QString::fromStdString(dialogName) + " " + tr("is Busy and may not reply"));
ui.infoframe->setVisible(true); ui.infoframe->setVisible(true);
ui.friendnamelabel->setText( QString::fromStdString(dialogName));
ui.statuslabel->setText( tr("(Busy)")) ;
break; break;
} }
return; return;
@ -1301,3 +1314,40 @@ void PopupChatDialog::updateStatus(const QString &peer_id, int status)
// ignore status change // 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;
}

View File

@ -86,6 +86,8 @@ protected:
void loadEmoticons2(); void loadEmoticons2();
void updateAvatar(); void updateAvatar();
void updateStatusMessage();
QString loadEmptyStyle(); QString loadEmptyStyle();
QPixmap picture; QPixmap picture;

View File

@ -9,8 +9,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>504</width> <width>528</width>
<height>430</height> <height>451</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -20,17 +20,20 @@
<string notr="true">QToolBar#toolBar{background-image: url(:/images/connect/connectFriendBanner.png)}</string> <string notr="true">QToolBar#toolBar{background-image: url(:/images/connect/connectFriendBanner.png)}</string>
</property> </property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<property name="spacing"> <property name="horizontalSpacing">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>1</number> <number>1</number>
</property> </property>
<item row="0" column="0" rowspan="3"> <item row="0" column="0" rowspan="4">
<widget class="QFrame" name="frame"> <widget class="QFrame" name="frame">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@ -98,7 +101,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="0" column="1" rowspan="3"> <item row="0" column="1" rowspan="4">
<widget class="QFrame" name="avatarframe"> <widget class="QFrame" name="avatarframe">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
@ -198,6 +201,91 @@ border-image: url(:/images/avatarstatus_bg.png);
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="0" column="2">
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="friendnamelabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>13</pointsize>
<weight>75</weight>
<bold>true</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="statuslabel">
<property name="font">
<font>
<family>Arial</family>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QLabel" name="statusmessagelabel">
<property name="font">
<font>
<family>Arial</family>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="2">
<widget class="QFrame" name="infoframe"> <widget class="QFrame" name="infoframe">
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">QFrame#infoframe{border: 1px solid #DCDC41; <string notr="true">QFrame#infoframe{border: 1px solid #DCDC41;
@ -279,7 +367,7 @@ border-image: url(:/images/closepressed.png)
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="1" column="2"> <item row="2" column="2">
<widget class="QSplitter" name="chatsplitter"> <widget class="QSplitter" name="chatsplitter">
<property name="lineWidth"> <property name="lineWidth">
<number>1</number> <number>1</number>
@ -371,7 +459,7 @@ background: white;}</string>
</widget> </widget>
</widget> </widget>
</item> </item>
<item row="2" column="2"> <item row="3" column="2">
<widget class="QFrame" name="Chatbuttonframe"> <widget class="QFrame" name="Chatbuttonframe">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
@ -742,7 +830,7 @@ border: 1px solid #CCCCCC;
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="3" column="0" colspan="3"> <item row="4" column="0" colspan="3">
<layout class="QVBoxLayout" name="vboxLayout"/> <layout class="QVBoxLayout" name="vboxLayout"/>
</item> </item>
</layout> </layout>
@ -833,6 +921,9 @@ border: 1px solid #CCCCCC;
<include location="../images.qrc"/> <include location="../images.qrc"/>
<include location="../images.qrc"/> <include location="../images.qrc"/>
<include location="../images.qrc"/> <include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>