mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-06 21:58:57 -04: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
3 changed files with 109 additions and 8 deletions
|
@ -48,12 +48,18 @@ ChatMsgItem::ChatMsgItem(FeedHolder *parent, uint32_t feedId, std::string peerId
|
||||||
/* Invoke the Qt Designer generated object setup routine */
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
|
messageframe->setVisible(false);
|
||||||
|
sendButton->hide();
|
||||||
|
|
||||||
/* general ones */
|
/* general ones */
|
||||||
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
|
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( 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( 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&)));
|
connect(NotifyQt::getInstance(), SIGNAL(peerHasNewAvatar(const QString&)), this, SLOT(updateAvatar(const QString&)));
|
||||||
|
|
||||||
|
@ -123,6 +129,15 @@ void ChatMsgItem::updateItem()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*if (quickmsgText->toPlainText().isEmpty())
|
||||||
|
{
|
||||||
|
sendButton->setEnabled(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sendButton->setEnabled(true);
|
||||||
|
}*/
|
||||||
|
|
||||||
/* slow Tick */
|
/* slow Tick */
|
||||||
int msec_rate = 10129;
|
int msec_rate = 10129;
|
||||||
|
|
||||||
|
@ -239,3 +254,34 @@ void ChatMsgItem::updateAvatar(const QString &peer_id)
|
||||||
avatar_label->setPixmap(QPixmap(":/images/user/personal64.png"));
|
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();
|
||||||
|
}
|
|
@ -52,6 +52,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:
|
||||||
void insertChat(std::string &message);
|
void insertChat(std::string &message);
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>602</width>
|
<width>513</width>
|
||||||
<height>142</height>
|
<height>213</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -189,11 +189,56 @@ border-radius: 10px}</string>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
<property name="margin">
|
<property name="margin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</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">
|
<widget class="QToolButton" name="msgButton">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
@ -219,7 +264,7 @@ border-radius: 10px}</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="2">
|
||||||
<widget class="QToolButton" name="chatButton">
|
<widget class="QToolButton" name="chatButton">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
@ -248,7 +293,7 @@ border-radius: 10px}</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="3">
|
||||||
<spacer name="horizontalSpacer_3">
|
<spacer name="horizontalSpacer_3">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
|
@ -261,6 +306,13 @@ border-radius: 10px}</string>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="4">
|
||||||
|
<widget class="QPushButton" name="sendButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Send</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue