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

@ -43,26 +43,28 @@ PeerItem::PeerItem(FeedHolder *parent, uint32_t feedId, std::string peerId, uint
:QWidget(NULL), mParent(parent), mFeedId(feedId),
mPeerId(peerId), mType(type), mIsHome(isHome)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
messageframe->setVisible(false);
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
//connect( gotoButton, SIGNAL( clicked( void ) ), this, SLOT( gotoHome ( void ) ) );
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
/* specific ones */
connect( chatButton, SIGNAL( clicked( void ) ), this, SLOT( openChat ( 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 ) ) );
/* specific ones */
connect( chatButton, SIGNAL( clicked( void ) ), this, SLOT( openChat ( void ) ) );
connect( msgButton, SIGNAL( clicked( void ) ), this, SLOT( sendMsg ( void ) ) );
connect(NotifyQt::getInstance(), SIGNAL(peerHasNewAvatar(const QString&)), this, SLOT(updateAvatar(const QString&)));
connect( quickmsgButton, SIGNAL( clicked( ) ), this, SLOT( togglequickmessage() ) );
connect( sendmsgButton, SIGNAL( clicked( ) ), this, SLOT( sendMessage() ) );
small();
updateItemStatic();
updateItem();
updateAvatar(QString::fromStdString(mPeerId));
connect(NotifyQt::getInstance(), SIGNAL(peerHasNewAvatar(const QString&)), this, SLOT(updateAvatar(const QString&)));
small();
updateItemStatic();
updateItem();
updateAvatar(QString::fromStdString(mPeerId));
}
@ -115,9 +117,7 @@ void PeerItem::updateItemStatic()
/* expanded Info */
nameLabel->setText(QString::fromStdString(details.name));
idLabel->setText(QString::fromStdString(details.id));
orgLabel->setText(QString::fromStdString(details.org));
locLabel->setText(QString::fromStdString(details.location));
countryLabel->setText("");
}
else
{
@ -126,9 +126,7 @@ void PeerItem::updateItemStatic()
trustLabel->setText("Unknown Peer");
nameLabel->setText("Unknown Peer");
idLabel->setText("Unknown Peer");
orgLabel->setText("Unknown Peer");
locLabel->setText("Unknown Peer");
countryLabel->setText("Unknown Peer");
ipLabel->setText("Unknown Peer");
connLabel->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

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

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>652</width>
<height>357</height>
<width>589</width>
<height>370</height>
</rect>
</property>
<property name="windowTitle">
@ -37,7 +37,7 @@ border-radius: 10px}</string>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0" rowspan="2">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" rowspan="2">
@ -203,6 +203,23 @@ border-radius: 10px}</string>
</property>
</spacer>
</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>
<widget class="QToolButton" name="msgButton">
<property name="sizePolicy">
@ -258,6 +275,53 @@ border-radius: 10px}</string>
</layout>
</item>
<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">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
@ -319,19 +383,6 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</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>
<widget class="QLabel" name="label_6">
<property name="font">
@ -345,19 +396,6 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</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>
<widget class="QLabel" name="label_8">
<property name="font">
@ -441,19 +479,6 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</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>
<widget class="QLabel" name="locLabel">
<property name="sizePolicy">
@ -467,19 +492,6 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</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>
<widget class="QLabel" name="ipLabel">
<property name="sizePolicy">
@ -536,6 +548,19 @@ p, li { white-space: pre-wrap; }
</layout>
</widget>
</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>
</widget>
<resources>