1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Typing notifications disappear automagically

Fixes #984
This commit is contained in:
Dubslow 2015-01-20 01:27:48 -06:00
parent e233c8171f
commit 2d2522626c
No known key found for this signature in database
GPG Key ID: 3DB8E05315C220AA
2 changed files with 7 additions and 6 deletions

View File

@ -59,6 +59,7 @@ ChatForm::ChatForm(Friend* chatFriend)
font.setItalic(true);
font.setPixelSize(8);
isTypingLabel->setFont(font);
typingTimer.setSingleShot(true);
QVBoxLayout* mainLayout = dynamic_cast<QVBoxLayout*>(layout());
mainLayout->insertWidget(1, isTypingLabel);
@ -88,6 +89,7 @@ ChatForm::ChatForm(Friend* chatFriend)
connect(this, SIGNAL(chatAreaCleared()), this, SLOT(clearReciepts()));
connect(nameLabel, &CroppingLabel::textChanged, this, [=](QString text, QString orig)
{if (text != orig) emit aliasChanged(text);} );
connect(&typingTimer, &QTimer::timeout, this, [=]{Core::getInstance()->sendTyping(f->getFriendID(), false);});
setAcceptDrops(true);
}
@ -150,11 +152,10 @@ void ChatForm::onTextEditChanged()
else
isNowTyping = msgEdit->toPlainText().length() > 0;
if (isTyping != isNowTyping)
{
isTyping = isNowTyping;
Core::getInstance()->sendTyping(f->getFriendID(), isTyping);
}
if (isNowTyping)
typingTimer.start(3000);
Core::getInstance()->sendTyping(f->getFriendID(), isNowTyping);
}
void ChatForm::onAttachClicked()

View File

@ -103,6 +103,7 @@ private:
QTimer *timer;
QElapsedTimer timeElapsed;
QLabel *isTypingLabel;
QTimer typingTimer;
QHash<uint, FileTransferInstance*> ftransWidgets;
void startCounter();
@ -110,7 +111,6 @@ private:
QString secondsToDHMS(quint32 duration);
QHash<int, int> receipts;
QMap<int, MessageActionPtr> undeliveredMsgs;
bool isTyping;
};
#endif // CHATFORM_H