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 "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;
}

View File

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

View File

@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>504</width>
<height>430</height>
<width>528</width>
<height>451</height>
</rect>
</property>
<property name="windowTitle">
@ -20,17 +20,20 @@
<string notr="true">QToolBar#toolBar{background-image: url(:/images/connect/connectFriendBanner.png)}</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<property name="horizontalSpacing">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>1</number>
</property>
<item row="0" column="0" rowspan="3">
<item row="0" column="0" rowspan="4">
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@ -98,7 +101,7 @@
</layout>
</widget>
</item>
<item row="0" column="1" rowspan="3">
<item row="0" column="1" rowspan="4">
<widget class="QFrame" name="avatarframe">
<property name="maximumSize">
<size>
@ -198,6 +201,91 @@ border-image: url(:/images/avatarstatus_bg.png);
</widget>
</item>
<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">
<property name="styleSheet">
<string notr="true">QFrame#infoframe{border: 1px solid #DCDC41;
@ -279,7 +367,7 @@ border-image: url(:/images/closepressed.png)
</layout>
</widget>
</item>
<item row="1" column="2">
<item row="2" column="2">
<widget class="QSplitter" name="chatsplitter">
<property name="lineWidth">
<number>1</number>
@ -371,7 +459,7 @@ background: white;}</string>
</widget>
</widget>
</item>
<item row="2" column="2">
<item row="3" column="2">
<widget class="QFrame" name="Chatbuttonframe">
<property name="minimumSize">
<size>
@ -742,7 +830,7 @@ border: 1px solid #CCCCCC;
</layout>
</widget>
</item>
<item row="3" column="0" colspan="3">
<item row="4" column="0" colspan="3">
<layout class="QVBoxLayout" name="vboxLayout"/>
</item>
</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"/>
</resources>
<connections/>
</ui>