mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-24 06:11:11 -05:00
Added "Write a Quick Message" functionality to answer faster from the ChatMsgItem.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3457 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
20887fc93b
commit
3ffbcb5569
@ -47,6 +47,9 @@ ChatMsgItem::ChatMsgItem(FeedHolder *parent, uint32_t feedId, std::string peerId
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
setupUi(this);
|
||||
|
||||
messageframe->setVisible(false);
|
||||
sendButton->hide();
|
||||
|
||||
/* general ones */
|
||||
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
|
||||
@ -54,6 +57,9 @@ ChatMsgItem::ChatMsgItem(FeedHolder *parent, uint32_t feedId, std::string peerId
|
||||
/* specific ones */
|
||||
connect( chatButton, SIGNAL( clicked( void ) ), this, SLOT( openChat ( void ) ) );
|
||||
connect( msgButton, SIGNAL( clicked( void ) ), this, SLOT( sendMsg ( void ) ) );
|
||||
connect( quickmsgButton, SIGNAL( clicked( ) ), this, SLOT( togglequickmessage() ) );
|
||||
connect( sendButton, SIGNAL( clicked( ) ), this, SLOT( sendMessage() ) );
|
||||
|
||||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(peerHasNewAvatar(const QString&)), this, SLOT(updateAvatar(const QString&)));
|
||||
|
||||
@ -122,6 +128,15 @@ void ChatMsgItem::updateItem()
|
||||
msgButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
/*if (quickmsgText->toPlainText().isEmpty())
|
||||
{
|
||||
sendButton->setEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendButton->setEnabled(true);
|
||||
}*/
|
||||
|
||||
/* slow Tick */
|
||||
int msec_rate = 10129;
|
||||
@ -239,3 +254,34 @@ void ChatMsgItem::updateAvatar(const QString &peer_id)
|
||||
avatar_label->setPixmap(QPixmap(":/images/user/personal64.png"));
|
||||
}
|
||||
}
|
||||
|
||||
void ChatMsgItem::togglequickmessage()
|
||||
{
|
||||
if (messageframe->isHidden())
|
||||
{
|
||||
messageframe->setVisible(true);
|
||||
sendButton->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
messageframe->setVisible(false);
|
||||
sendButton->hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ChatMsgItem::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);
|
||||
sendButton->hide();
|
||||
}
|
@ -51,11 +51,14 @@ private slots:
|
||||
|
||||
void updateItem();
|
||||
void updateAvatar(const QString &peer_id);
|
||||
|
||||
void togglequickmessage();
|
||||
void sendMessage();
|
||||
|
||||
private:
|
||||
void insertChat(std::string &message);
|
||||
void insertChat(std::string &message);
|
||||
|
||||
FeedHolder *mParent;
|
||||
FeedHolder *mParent;
|
||||
uint32_t mFeedId;
|
||||
|
||||
std::string mPeerId;
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>602</width>
|
||||
<height>142</height>
|
||||
<width>513</width>
|
||||
<height>213</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -189,11 +189,56 @@ border-radius: 10px}</string>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<item row="0" column="0" colspan="5">
|
||||
<widget class="QFrame" name="messageframe">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QTextEdit" name="quickmsgText">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>115</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<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="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QToolButton" name="msgButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
@ -219,7 +264,7 @@ border-radius: 10px}</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QToolButton" name="chatButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
@ -248,7 +293,7 @@ border-radius: 10px}</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="3">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -261,6 +306,13 @@ border-radius: 10px}</string>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QPushButton" name="sendButton">
|
||||
<property name="text">
|
||||
<string>Send</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
Reference in New Issue
Block a user