Added for PeerItem too "Quick Message"

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3459 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2010-09-08 18:46:30 +00:00
parent 196e9cbf2d
commit 2fa6afd36d
3 changed files with 128 additions and 75 deletions

View File

@ -46,16 +46,18 @@ PeerItem::PeerItem(FeedHolder *parent, uint32_t feedId, std::string peerId, uint
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
setupUi(this); setupUi(this);
messageframe->setVisible(false);
/* general ones */ /* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) ); connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) ); connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
//connect( gotoButton, SIGNAL( clicked( void ) ), this, SLOT( gotoHome ( void ) ) );
/* specific ones */ /* specific ones */
connect( chatButton, SIGNAL( clicked( void ) ), this, SLOT( openChat ( void ) ) ); connect( chatButton, SIGNAL( clicked( void ) ), this, SLOT( openChat ( void ) ) );
connect( msgButton, SIGNAL( clicked( void ) ), this, SLOT( sendMsg ( void ) ) ); connect( msgButton, SIGNAL( clicked( void ) ), this, SLOT( sendMsg ( void ) ) );
//connect( addButton, SIGNAL( clicked( void ) ), this, SLOT( addFriend ( void ) ) );
//connect( removeButton, SIGNAL( clicked( void ) ), this, SLOT( removeFriend ( void ) ) ); connect( quickmsgButton, SIGNAL( clicked( ) ), this, SLOT( togglequickmessage() ) );
connect( sendmsgButton, SIGNAL( clicked( ) ), this, SLOT( sendMessage() ) );
connect(NotifyQt::getInstance(), SIGNAL(peerHasNewAvatar(const QString&)), this, SLOT(updateAvatar(const QString&))); connect(NotifyQt::getInstance(), SIGNAL(peerHasNewAvatar(const QString&)), this, SLOT(updateAvatar(const QString&)));
@ -115,9 +117,7 @@ void PeerItem::updateItemStatic()
/* expanded Info */ /* expanded Info */
nameLabel->setText(QString::fromStdString(details.name)); nameLabel->setText(QString::fromStdString(details.name));
idLabel->setText(QString::fromStdString(details.id)); idLabel->setText(QString::fromStdString(details.id));
orgLabel->setText(QString::fromStdString(details.org));
locLabel->setText(QString::fromStdString(details.location)); locLabel->setText(QString::fromStdString(details.location));
countryLabel->setText("");
} }
else else
{ {
@ -126,9 +126,7 @@ void PeerItem::updateItemStatic()
trustLabel->setText("Unknown Peer"); trustLabel->setText("Unknown Peer");
nameLabel->setText("Unknown Peer"); nameLabel->setText("Unknown Peer");
idLabel->setText("Unknown Peer"); idLabel->setText("Unknown Peer");
orgLabel->setText("Unknown Peer");
locLabel->setText("Unknown Peer"); locLabel->setText("Unknown Peer");
countryLabel->setText("Unknown Peer");
ipLabel->setText("Unknown Peer"); ipLabel->setText("Unknown Peer");
connLabel->setText("Unknown Peer"); connLabel->setText("Unknown Peer");
lastLabel->setText("Unknown Peer"); lastLabel->setText("Unknown Peer");
@ -352,4 +350,31 @@ void PeerItem::updateAvatar(const QString &peer_id)
} }
void PeerItem::togglequickmessage()
{
if (messageframe->isHidden())
{
messageframe->setVisible(true);
}
else
{
messageframe->setVisible(false);
}
}
void PeerItem::sendMessage()
{
/* construct a message */
MessageInfo mi;
mi.title = tr("Quick Message").toStdWString();
mi.msg = quickmsgText->toHtml().toStdWString();
mi.msgto.push_back(mPeerId);
rsMsgs->MessageSend(mi);
quickmsgText->clear();
messageframe->setVisible(false);
}

View File

@ -60,6 +60,9 @@ private slots:
void updateItem(); void updateItem();
void updateAvatar(const QString &peer_id); void updateAvatar(const QString &peer_id);
void togglequickmessage();
void sendMessage();
private: private:
FeedHolder *mParent; FeedHolder *mParent;
uint32_t mFeedId; uint32_t mFeedId;

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>652</width> <width>589</width>
<height>357</height> <height>370</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -37,7 +37,7 @@ border-radius: 10px}</string>
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0" rowspan="2"> <item row="0" column="0" rowspan="2">
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" rowspan="2"> <item row="0" column="0" rowspan="2">
@ -203,6 +203,23 @@ border-radius: 10px}</string>
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<widget class="QToolButton" name="quickmsgButton">
<property name="text">
<string>Write a quick Message</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/message-mail.png</normaloff>:/images/message-mail.png</iconset>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item> <item>
<widget class="QToolButton" name="msgButton"> <widget class="QToolButton" name="msgButton">
<property name="sizePolicy"> <property name="sizePolicy">
@ -258,6 +275,53 @@ border-radius: 10px}</string>
</layout> </layout>
</item> </item>
<item row="2" column="0" colspan="2"> <item row="2" column="0" colspan="2">
<widget class="QFrame" name="messageframe">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>130</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="verticalSpacing">
<number>2</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0" colspan="2">
<widget class="QTextEdit" name="quickmsgText"/>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>469</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="sendmsgButton">
<property name="text">
<string>Send</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QFrame" name="expandFrame"> <widget class="QFrame" name="expandFrame">
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::StyledPanel</enum>
@ -319,19 +383,6 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Organisation</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="font"> <property name="font">
@ -345,19 +396,6 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="label_7">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Country</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="font"> <property name="font">
@ -441,19 +479,6 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="orgLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QLabel" name="locLabel"> <widget class="QLabel" name="locLabel">
<property name="sizePolicy"> <property name="sizePolicy">
@ -467,19 +492,6 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="countryLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QLabel" name="ipLabel"> <widget class="QLabel" name="ipLabel">
<property name="sizePolicy"> <property name="sizePolicy">
@ -536,6 +548,19 @@ p, li { white-space: pre-wrap; }
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="1" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
<resources> <resources>