From 5c71d520fa6a53609c2d18b4128a62f6a7cb5e05 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Tue, 30 May 2017 15:43:43 +0200 Subject: [PATCH] async chat disabled by default in GUI Chat GUI is not ready to show properly GxsTrans async messages --- retroshare-gui/src/gui/chat/ChatWidget.cpp | 19 ++++++++++++++++--- retroshare-gui/src/gui/chat/ChatWidget.h | 8 +++++--- retroshare.pri | 9 +++++++++ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/retroshare-gui/src/gui/chat/ChatWidget.cpp b/retroshare-gui/src/gui/chat/ChatWidget.cpp index 681ff9c7e..d27ac2412 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.cpp +++ b/retroshare-gui/src/gui/chat/ChatWidget.cpp @@ -73,7 +73,7 @@ *****/ ChatWidget::ChatWidget(QWidget *parent) : - QWidget(parent), ui(new Ui::ChatWidget) + QWidget(parent), sendingBlocked(false), ui(new Ui::ChatWidget) { ui->setupUi(this); @@ -416,9 +416,20 @@ ChatWidget::ChatType ChatWidget::chatType() return CHATTYPE_UNKNOWN; } -void ChatWidget::blockSending(QString msg) { ui->sendButton->setToolTip(msg); } +void ChatWidget::blockSending(QString msg) +{ +#ifndef RS_ASYNC_CHAT + sendingBlocked = true; + ui->sendButton->setEnabled(false); +#endif + ui->sendButton->setToolTip(msg); +} -void ChatWidget::unblockSending() { updateLenOfChatTextEdit(); } +void ChatWidget::unblockSending() +{ + sendingBlocked = false; + updateLenOfChatTextEdit(); +} void ChatWidget::processSettings(bool load) { @@ -1130,6 +1141,8 @@ void ChatWidget::updateStatusTyping() void ChatWidget::updateLenOfChatTextEdit() { + if(sendingBlocked) return; + QTextEdit *chatWidget = ui->chatTextEdit; QString text; RsHtml::optimizeHtml(chatWidget, text); diff --git a/retroshare-gui/src/gui/chat/ChatWidget.h b/retroshare-gui/src/gui/chat/ChatWidget.h index 270671af4..174b4d777 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.h +++ b/retroshare-gui/src/gui/chat/ChatWidget.h @@ -36,7 +36,6 @@ #include #include -#include class QAction; class QTextEdit; @@ -79,8 +78,9 @@ public: ChatId getChatId(); ChatType chatType(); - RS_DEPRECATED void blockSending(QString msg); - RS_DEPRECATED void unblockSending(); + // allow/disallow sendng of messages + void blockSending(QString msg); + void unblockSending(); bool hasNewMessages() { return newMessages; } bool isTyping() { return typing; } @@ -216,6 +216,8 @@ private: bool typing; int peerStatus; + bool sendingBlocked; + time_t lastStatusSendTime; ChatStyle chatStyle; diff --git a/retroshare.pri b/retroshare.pri index 722bae1b9..1e91e4caa 100644 --- a/retroshare.pri +++ b/retroshare.pri @@ -70,6 +70,12 @@ rs_nocppwarning:CONFIG -= no_rs_nocppwarning CONFIG *= rs_gxs_trans #no_rs_gxs_trans:CONFIG -= rs_gxs_trans ## Disabing not supported ATM +# To enable GXS based async chat append the following assignation to qmake +# command line "CONFIG+=rs_async_chat" +CONFIG *= no_rs_async_chat +rs_async_chat:CONFIG -= no_rs_async_chat + + unix { isEmpty(PREFIX) { PREFIX = "/usr" } @@ -197,3 +203,6 @@ rs_gxs_trans { } } +rs_async_chat { + DEFINES *= RS_ASYNC_CHAT +}