mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-24 15:05:35 -04:00
add changing state for Send button in chat when msg size exceeds allowed size (Patch from Phenom)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7438 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
24ad4b8880
commit
8667cf9f92
9 changed files with 56 additions and 3 deletions
|
@ -131,6 +131,7 @@ ChatWidget::ChatWidget(QWidget *parent) :
|
|||
connect(ui->chatTextEdit, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
|
||||
// reset text and color after removing all characters from the QTextEdit and after calling QTextEdit::clear
|
||||
connect(ui->chatTextEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(chatCharFormatChanged()));
|
||||
connect(ui->chatTextEdit, SIGNAL(textChanged()), this, SLOT(updateLenOfChatTextEdit()));
|
||||
|
||||
ui->infoFrame->setVisible(false);
|
||||
ui->statusMessageLabel->hide();
|
||||
|
@ -837,8 +838,27 @@ void ChatWidget::updateStatusTyping()
|
|||
}
|
||||
}
|
||||
|
||||
void ChatWidget::updateLenOfChatTextEdit()
|
||||
{
|
||||
QTextEdit *chatWidget = ui->chatTextEdit;
|
||||
QString text;
|
||||
RsHtml::optimizeHtml(chatWidget, text);
|
||||
std::wstring msg = text.toStdWString();
|
||||
bool msgToLarge = (msg.length()>=size_t(rsMsgs->getMaxMessageSecuritySize()));
|
||||
|
||||
ui->sendButton->setEnabled(!msgToLarge);
|
||||
text = tr("%1This message counts %2 characters.").arg(msgToLarge?tr("Warning: "):"").arg(msg.length());
|
||||
ui->sendButton->setToolTip(text);
|
||||
ui->chatTextEdit->setToolTip(msgToLarge?text:"");
|
||||
}
|
||||
|
||||
void ChatWidget::sendChat()
|
||||
{
|
||||
if (!ui->sendButton->isEnabled()){
|
||||
//Something block sending
|
||||
return;
|
||||
}
|
||||
|
||||
QTextEdit *chatWidget = ui->chatTextEdit;
|
||||
|
||||
if (chatWidget->toPlainText().isEmpty()) {
|
||||
|
|
|
@ -152,6 +152,7 @@ private slots:
|
|||
void resetFont();
|
||||
void setFont();
|
||||
|
||||
void updateLenOfChatTextEdit();
|
||||
void sendChat();
|
||||
|
||||
void updatePeersCustomStateString(const QString& peer_id, const QString& status_string) ;
|
||||
|
|
|
@ -689,5 +689,8 @@
|
|||
<file>images/library_add.png</file>
|
||||
<file>images/library64.png</file>
|
||||
<file>images/library16.png</file>
|
||||
<file>images/btn_red_pressed.png</file>
|
||||
<file>images/btn_red_hover.png</file>
|
||||
<file>images/btn_red.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -208,8 +208,10 @@ ChatWidget QPushButton#sendButton:hover {
|
|||
|
||||
ChatWidget QPushButton#sendButton:pressed {
|
||||
border-image: url(:/images/btn_green_pressed.png) 4;
|
||||
}
|
||||
|
||||
|
||||
ChatWidget QPushButton#sendButton:disabled {
|
||||
border-image: url(:/images/btn_red.png) 4;
|
||||
}
|
||||
|
||||
PopupChatWindow QToolBar#chattoolBar{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue