mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
parent
e233c8171f
commit
2d2522626c
|
@ -59,6 +59,7 @@ ChatForm::ChatForm(Friend* chatFriend)
|
||||||
font.setItalic(true);
|
font.setItalic(true);
|
||||||
font.setPixelSize(8);
|
font.setPixelSize(8);
|
||||||
isTypingLabel->setFont(font);
|
isTypingLabel->setFont(font);
|
||||||
|
typingTimer.setSingleShot(true);
|
||||||
|
|
||||||
QVBoxLayout* mainLayout = dynamic_cast<QVBoxLayout*>(layout());
|
QVBoxLayout* mainLayout = dynamic_cast<QVBoxLayout*>(layout());
|
||||||
mainLayout->insertWidget(1, isTypingLabel);
|
mainLayout->insertWidget(1, isTypingLabel);
|
||||||
|
@ -88,6 +89,7 @@ ChatForm::ChatForm(Friend* chatFriend)
|
||||||
connect(this, SIGNAL(chatAreaCleared()), this, SLOT(clearReciepts()));
|
connect(this, SIGNAL(chatAreaCleared()), this, SLOT(clearReciepts()));
|
||||||
connect(nameLabel, &CroppingLabel::textChanged, this, [=](QString text, QString orig)
|
connect(nameLabel, &CroppingLabel::textChanged, this, [=](QString text, QString orig)
|
||||||
{if (text != orig) emit aliasChanged(text);} );
|
{if (text != orig) emit aliasChanged(text);} );
|
||||||
|
connect(&typingTimer, &QTimer::timeout, this, [=]{Core::getInstance()->sendTyping(f->getFriendID(), false);});
|
||||||
|
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
}
|
}
|
||||||
|
@ -150,11 +152,10 @@ void ChatForm::onTextEditChanged()
|
||||||
else
|
else
|
||||||
isNowTyping = msgEdit->toPlainText().length() > 0;
|
isNowTyping = msgEdit->toPlainText().length() > 0;
|
||||||
|
|
||||||
if (isTyping != isNowTyping)
|
if (isNowTyping)
|
||||||
{
|
typingTimer.start(3000);
|
||||||
isTyping = isNowTyping;
|
|
||||||
Core::getInstance()->sendTyping(f->getFriendID(), isTyping);
|
Core::getInstance()->sendTyping(f->getFriendID(), isNowTyping);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::onAttachClicked()
|
void ChatForm::onAttachClicked()
|
||||||
|
|
|
@ -103,6 +103,7 @@ private:
|
||||||
QTimer *timer;
|
QTimer *timer;
|
||||||
QElapsedTimer timeElapsed;
|
QElapsedTimer timeElapsed;
|
||||||
QLabel *isTypingLabel;
|
QLabel *isTypingLabel;
|
||||||
|
QTimer typingTimer;
|
||||||
|
|
||||||
QHash<uint, FileTransferInstance*> ftransWidgets;
|
QHash<uint, FileTransferInstance*> ftransWidgets;
|
||||||
void startCounter();
|
void startCounter();
|
||||||
|
@ -110,7 +111,6 @@ private:
|
||||||
QString secondsToDHMS(quint32 duration);
|
QString secondsToDHMS(quint32 duration);
|
||||||
QHash<int, int> receipts;
|
QHash<int, int> receipts;
|
||||||
QMap<int, MessageActionPtr> undeliveredMsgs;
|
QMap<int, MessageActionPtr> undeliveredMsgs;
|
||||||
bool isTyping;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CHATFORM_H
|
#endif // CHATFORM_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user