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 ; last_status_send_time = 0 ;
styleHtm = ":/qss/chat/default.htm"; styleHtm = ":/qss/chat/default.htm";
/* Hide Avatar frame */ /* Hide Avatar and Info frame */
showAvatarFrame(false); showAvatarFrame(false);
ui.infoframe->setVisible(false);
connect(ui.avatarFrameButton, SIGNAL(toggled(bool)), this, SLOT(showAvatarFrame(bool))); 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; std::cerr << "WARNING CANNOT GET PEER INFO!!!!" << std::endl;
#endif #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 timestamp = "[" + QDateTime::currentDateTime().toString("hh:mm:ss") + "]";
QString name = QString::fromStdString(ci ->name); QString name = QString::fromStdString(ci ->name);
QString message = QString::fromStdWString(ci -> msg); QString message = QString::fromStdWString(ci -> msg);
@ -1175,26 +1166,32 @@ void PopupChatDialog::updateStatus(const QString &peer_id, int status)
case RS_STATUS_OFFLINE: case RS_STATUS_OFFLINE:
ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/mystatus_bg_offline.png); }"); ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/mystatus_bg_offline.png); }");
ui.avatarlabel->setEnabled(false); 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; break;
case RS_STATUS_INACTIVE: case RS_STATUS_INACTIVE:
ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/mystatus_bg_idle.png); }"); ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/mystatus_bg_idle.png); }");
ui.avatarlabel->setEnabled(true); ui.avatarlabel->setEnabled(true);
ui.infoframe->setVisible(false);
break; break;
case RS_STATUS_ONLINE: case RS_STATUS_ONLINE:
ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/mystatus_bg_online.png); }"); ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/mystatus_bg_online.png); }");
ui.avatarlabel->setEnabled(true); ui.avatarlabel->setEnabled(true);
ui.infoframe->setVisible(false);
break; break;
case RS_STATUS_AWAY: case RS_STATUS_AWAY:
ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/mystatus_bg_idle.png); }"); ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/mystatus_bg_idle.png); }");
ui.avatarlabel->setEnabled(true); ui.avatarlabel->setEnabled(true);
ui.infoframe->setVisible(false);
break; break;
case RS_STATUS_BUSY: case RS_STATUS_BUSY:
ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/mystatus_bg_busy.png); }"); ui.avatarlabel->setStyleSheet("QLabel#avatarlabel{ border-image:url(:/images/mystatus_bg_busy.png); }");
ui.avatarlabel->setEnabled(true); ui.avatarlabel->setEnabled(true);
ui.infoframe->setVisible(false);
break; break;
} }
} }

View File

@ -9,8 +9,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>568</width> <width>558</width>
<height>418</height> <height>427</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -28,12 +28,77 @@
<number>0</number> <number>0</number>
</property> </property>
<property name="horizontalSpacing"> <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> <number>0</number>
</property> </property>
<property name="verticalSpacing"> <item>
<number>2</number> <widget class="QPushButton" name="avatarFrameButton">
<property name="minimumSize">
<size>
<width>14</width>
<height>31</height>
</size>
</property> </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"> <widget class="QFrame" name="avatarframe">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
@ -133,6 +198,30 @@ border-image: url(:/images/mystatus_bg.png);
</widget> </widget>
</item> </item>
<item row="0" column="2"> <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"> <widget class="QSplitter" name="chatsplitter">
<property name="lineWidth"> <property name="lineWidth">
<number>1</number> <number>1</number>
@ -202,7 +291,7 @@ background: white;}</string>
</widget> </widget>
</widget> </widget>
</item> </item>
<item row="1" column="2"> <item row="2" column="2">
<widget class="QFrame" name="Chatbuttonframe"> <widget class="QFrame" name="Chatbuttonframe">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
@ -573,71 +662,9 @@ border: 1px solid #CCCCCC;
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="2" column="0" colspan="3"> <item row="3" column="0" colspan="3">
<layout class="QVBoxLayout" name="vboxLayout"/> <layout class="QVBoxLayout" name="vboxLayout"/>
</item> </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> </layout>
</widget> </widget>
<widget class="QStatusBar" name="statusbar"/> <widget class="QStatusBar" name="statusbar"/>