Merge pull request #856 from G10h4ck/GxsTransOptionalChat

Async chat disabled by default in GUI
This commit is contained in:
csoler 2017-05-30 21:42:29 +02:00 committed by GitHub
commit d7797f1b09
3 changed files with 30 additions and 6 deletions

View File

@ -73,7 +73,7 @@
*****/ *****/
ChatWidget::ChatWidget(QWidget *parent) : ChatWidget::ChatWidget(QWidget *parent) :
QWidget(parent), ui(new Ui::ChatWidget) QWidget(parent), sendingBlocked(false), ui(new Ui::ChatWidget)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -416,9 +416,20 @@ ChatWidget::ChatType ChatWidget::chatType()
return CHATTYPE_UNKNOWN; 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) void ChatWidget::processSettings(bool load)
{ {
@ -1130,6 +1141,8 @@ void ChatWidget::updateStatusTyping()
void ChatWidget::updateLenOfChatTextEdit() void ChatWidget::updateLenOfChatTextEdit()
{ {
if(sendingBlocked) return;
QTextEdit *chatWidget = ui->chatTextEdit; QTextEdit *chatWidget = ui->chatTextEdit;
QString text; QString text;
RsHtml::optimizeHtml(chatWidget, text); RsHtml::optimizeHtml(chatWidget, text);

View File

@ -36,7 +36,6 @@
#include <retroshare/rsmsgs.h> #include <retroshare/rsmsgs.h>
#include <retroshare/rsfiles.h> #include <retroshare/rsfiles.h>
#include <util/rsdeprecate.h>
class QAction; class QAction;
class QTextEdit; class QTextEdit;
@ -79,8 +78,9 @@ public:
ChatId getChatId(); ChatId getChatId();
ChatType chatType(); ChatType chatType();
RS_DEPRECATED void blockSending(QString msg); // allow/disallow sendng of messages
RS_DEPRECATED void unblockSending(); void blockSending(QString msg);
void unblockSending();
bool hasNewMessages() { return newMessages; } bool hasNewMessages() { return newMessages; }
bool isTyping() { return typing; } bool isTyping() { return typing; }
@ -216,6 +216,8 @@ private:
bool typing; bool typing;
int peerStatus; int peerStatus;
bool sendingBlocked;
time_t lastStatusSendTime; time_t lastStatusSendTime;
ChatStyle chatStyle; ChatStyle chatStyle;

View File

@ -70,6 +70,12 @@ rs_nocppwarning:CONFIG -= no_rs_nocppwarning
CONFIG *= rs_gxs_trans CONFIG *= rs_gxs_trans
#no_rs_gxs_trans:CONFIG -= rs_gxs_trans ## Disabing not supported ATM #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 { unix {
isEmpty(PREFIX) { PREFIX = "/usr" } isEmpty(PREFIX) { PREFIX = "/usr" }
@ -197,3 +203,6 @@ rs_gxs_trans {
} }
} }
rs_async_chat {
DEFINES *= RS_ASYNC_CHAT
}