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
This commit is contained in:
defnax 2010-08-23 19:09:16 +00:00
parent 6a84e7cefa
commit 7470c72042
2 changed files with 110 additions and 86 deletions

View File

@ -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 */
/* Hide Avatar and Info frame */
showAvatarFrame(false);
ui.infoframe->setVisible(false);
connect(ui.avatarFrameButton, SIGNAL(toggled(bool)), this, SLOT(showAvatarFrame(bool)));
@ -446,19 +447,9 @@ 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 = "<br>\n<span style=\"color:#1D84C9\"><strong> ----- PEER OFFLINE (Chat will be lost) -----</strong></span> \n<br>";
ui.textBrowser->append(offlineMsg);
}
QString timestamp = "[" + QDateTime::currentDateTime().toString("hh:mm:ss") + "]";
QString name = QString::fromStdString(ci ->name);
QString message = QString::fromStdWString(ci -> msg);
@ -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;
}
}

View File

@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>568</width>
<height>418</height>
<width>558</width>
<height>427</height>
</rect>
</property>
<property name="windowTitle">
@ -28,12 +28,77 @@
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>1</number>
</property>
<item row="0" column="0" rowspan="3">
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>14</width>
<height>16777215</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>2</number>
<item>
<widget class="QPushButton" name="avatarFrameButton">
<property name="minimumSize">
<size>
<width>14</width>
<height>31</height>
</size>
</property>
<item row="0" column="1" rowspan="2">
<property name="maximumSize">
<size>
<width>14</width>
<height>31</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>31</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>12</width>
<height>335</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="0" column="1" rowspan="3">
<widget class="QFrame" name="avatarframe">
<property name="maximumSize">
<size>
@ -133,6 +198,30 @@ border-image: url(:/images/mystatus_bg.png);
</widget>
</item>
<item row="0" column="2">
<widget class="QFrame" name="infoframe">
<property name="styleSheet">
<string notr="true">QFrame#infoframe{border: 1px solid #DCDC41;
border-radius: 6px;
background: #FFFFD7;}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="infolabel">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="2">
<widget class="QSplitter" name="chatsplitter">
<property name="lineWidth">
<number>1</number>
@ -202,7 +291,7 @@ background: white;}</string>
</widget>
</widget>
</item>
<item row="1" column="2">
<item row="2" column="2">
<widget class="QFrame" name="Chatbuttonframe">
<property name="minimumSize">
<size>
@ -573,71 +662,9 @@ border: 1px solid #CCCCCC;
</layout>
</widget>
</item>
<item row="2" column="0" colspan="3">
<item row="3" column="0" colspan="3">
<layout class="QVBoxLayout" name="vboxLayout"/>
</item>
<item row="0" column="0" rowspan="2">
<widget class="QFrame" name="frame">
<property name="maximumSize">
<size>
<width>14</width>
<height>16777215</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="avatarFrameButton">
<property name="minimumSize">
<size>
<width>14</width>
<height>31</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>14</width>
<height>31</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>31</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>13</width>
<height>335</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar"/>