mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge branch 'pr979'
This commit is contained in:
commit
14ad87069e
|
@ -189,7 +189,7 @@ void Settings::load()
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("Privacy");
|
s.beginGroup("Privacy");
|
||||||
typingNotification = s.value("typingNotification", false).toBool();
|
typingNotification = s.value("typingNotification", true).toBool();
|
||||||
enableLogging = s.value("enableLogging", false).toBool();
|
enableLogging = s.value("enableLogging", false).toBool();
|
||||||
encryptLogs = s.value("encryptLogs", false).toBool();
|
encryptLogs = s.value("encryptLogs", false).toBool();
|
||||||
encryptTox = s.value("encryptTox", false).toBool();
|
encryptTox = s.value("encryptTox", false).toBool();
|
||||||
|
|
|
@ -54,6 +54,15 @@ ChatForm::ChatForm(Friend* chatFriend)
|
||||||
statusMessageLabel->setFont(Style::getFont(Style::Medium));
|
statusMessageLabel->setFont(Style::getFont(Style::Medium));
|
||||||
statusMessageLabel->setMinimumHeight(Style::getFont(Style::Medium).pixelSize());
|
statusMessageLabel->setMinimumHeight(Style::getFont(Style::Medium).pixelSize());
|
||||||
|
|
||||||
|
isTypingLabel = new QLabel();
|
||||||
|
QFont font = isTypingLabel->font();
|
||||||
|
font.setItalic(true);
|
||||||
|
font.setPixelSize(8);
|
||||||
|
isTypingLabel->setFont(font);
|
||||||
|
|
||||||
|
QVBoxLayout* mainLayout = dynamic_cast<QVBoxLayout*>(layout());
|
||||||
|
mainLayout->insertWidget(1, isTypingLabel);
|
||||||
|
|
||||||
netcam = new NetCamView();
|
netcam = new NetCamView();
|
||||||
timer = nullptr;
|
timer = nullptr;
|
||||||
|
|
||||||
|
@ -71,6 +80,7 @@ ChatForm::ChatForm(Friend* chatFriend)
|
||||||
connect(callButton, &QPushButton::clicked, this, &ChatForm::onCallTriggered);
|
connect(callButton, &QPushButton::clicked, this, &ChatForm::onCallTriggered);
|
||||||
connect(videoButton, &QPushButton::clicked, this, &ChatForm::onVideoCallTriggered);
|
connect(videoButton, &QPushButton::clicked, this, &ChatForm::onVideoCallTriggered);
|
||||||
connect(msgEdit, &ChatTextEdit::enterPressed, this, &ChatForm::onSendTriggered);
|
connect(msgEdit, &ChatTextEdit::enterPressed, this, &ChatForm::onSendTriggered);
|
||||||
|
connect(msgEdit, &ChatTextEdit::textChanged, this, &ChatForm::onTextEditChanged);
|
||||||
connect(micButton, SIGNAL(clicked()), this, SLOT(onMicMuteToggle()));
|
connect(micButton, SIGNAL(clicked()), this, SLOT(onMicMuteToggle()));
|
||||||
connect(volButton, SIGNAL(clicked()), this, SLOT(onVolMuteToggle()));
|
connect(volButton, SIGNAL(clicked()), this, SLOT(onVolMuteToggle()));
|
||||||
connect(chatWidget, &ChatAreaWidget::onFileTranfertInterract, this, &ChatForm::onFileTansBtnClicked);
|
connect(chatWidget, &ChatAreaWidget::onFileTranfertInterract, this, &ChatForm::onFileTansBtnClicked);
|
||||||
|
@ -132,6 +142,21 @@ void ChatForm::onSendTriggered()
|
||||||
msgEdit->clear();
|
msgEdit->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatForm::onTextEditChanged()
|
||||||
|
{
|
||||||
|
bool isNowTyping;
|
||||||
|
if (!Settings::getInstance().isTypingNotificationEnabled())
|
||||||
|
isNowTyping = false;
|
||||||
|
else
|
||||||
|
isNowTyping = msgEdit->toPlainText().length() > 0;
|
||||||
|
|
||||||
|
if (isTyping != isNowTyping)
|
||||||
|
{
|
||||||
|
isTyping = isNowTyping;
|
||||||
|
Core::getInstance()->sendTyping(f->getFriendID(), isTyping);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ChatForm::onAttachClicked()
|
void ChatForm::onAttachClicked()
|
||||||
{
|
{
|
||||||
QStringList paths = QFileDialog::getOpenFileNames(0,tr("Send a file"));
|
QStringList paths = QFileDialog::getOpenFileNames(0,tr("Send a file"));
|
||||||
|
@ -870,6 +895,14 @@ void ChatForm::dischargeReceipt(int receipt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatForm::setFriendTyping(bool isTyping)
|
||||||
|
{
|
||||||
|
if (isTyping)
|
||||||
|
isTypingLabel->setText(f->getDisplayedName() + " " + tr("is typing..."));
|
||||||
|
else
|
||||||
|
isTypingLabel->clear();
|
||||||
|
}
|
||||||
|
|
||||||
void ChatForm::clearReciepts()
|
void ChatForm::clearReciepts()
|
||||||
{
|
{
|
||||||
receipts.clear();
|
receipts.clear();
|
||||||
|
|
|
@ -39,6 +39,7 @@ public:
|
||||||
void loadHistory(QDateTime since, bool processUndelivered = false);
|
void loadHistory(QDateTime since, bool processUndelivered = false);
|
||||||
|
|
||||||
void dischargeReceipt(int receipt);
|
void dischargeReceipt(int receipt);
|
||||||
|
void setFriendTyping(bool isTyping);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sendFile(int32_t friendId, QString, QString, long long);
|
void sendFile(int32_t friendId, QString, QString, long long);
|
||||||
|
@ -75,6 +76,7 @@ public slots:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onSendTriggered();
|
void onSendTriggered();
|
||||||
|
void onTextEditChanged();
|
||||||
void onAttachClicked();
|
void onAttachClicked();
|
||||||
void onCallTriggered();
|
void onCallTriggered();
|
||||||
void onVideoCallTriggered();
|
void onVideoCallTriggered();
|
||||||
|
@ -100,6 +102,7 @@ private:
|
||||||
QLabel *callDuration;
|
QLabel *callDuration;
|
||||||
QTimer *timer;
|
QTimer *timer;
|
||||||
QElapsedTimer timeElapsed;
|
QElapsedTimer timeElapsed;
|
||||||
|
QLabel *isTypingLabel;
|
||||||
|
|
||||||
QHash<uint, FileTransferInstance*> ftransWidgets;
|
QHash<uint, FileTransferInstance*> ftransWidgets;
|
||||||
void startCounter();
|
void startCounter();
|
||||||
|
@ -107,6 +110,7 @@ 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
|
||||||
|
|
|
@ -43,9 +43,6 @@
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="cbTypingNotification">
|
<widget class="QCheckBox" name="cbTypingNotification">
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Typing Notification</string>
|
<string>Typing Notification</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -242,6 +242,7 @@ void Widget::init()
|
||||||
connect(core, &Core::avInvite, this, &Widget::playRingtone);
|
connect(core, &Core::avInvite, this, &Widget::playRingtone);
|
||||||
connect(core, &Core::blockingClearContacts, this, &Widget::clearContactsList, Qt::BlockingQueuedConnection);
|
connect(core, &Core::blockingClearContacts, this, &Widget::clearContactsList, Qt::BlockingQueuedConnection);
|
||||||
connect(core, &Core::blockingGetPassword, this, &Widget::getPassword, Qt::BlockingQueuedConnection);
|
connect(core, &Core::blockingGetPassword, this, &Widget::getPassword, Qt::BlockingQueuedConnection);
|
||||||
|
connect(core, &Core::friendTypingChanged, this, &Widget::onFriendTypingChanged);
|
||||||
|
|
||||||
connect(core, SIGNAL(messageSentResult(int,QString,int)), this, SLOT(onMessageSendResult(int,QString,int)));
|
connect(core, SIGNAL(messageSentResult(int,QString,int)), this, SLOT(onMessageSendResult(int,QString,int)));
|
||||||
connect(core, SIGNAL(groupSentResult(int,QString,int)), this, SLOT(onGroupSendResult(int,QString,int)));
|
connect(core, SIGNAL(groupSentResult(int,QString,int)), this, SLOT(onGroupSendResult(int,QString,int)));
|
||||||
|
@ -1178,6 +1179,14 @@ void Widget::getPassword(QString info, int passtype, uint8_t* salt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Widget::onFriendTypingChanged(int friendId, bool isTyping)
|
||||||
|
{
|
||||||
|
Friend* f = FriendList::findFriend(friendId);
|
||||||
|
if (!f)
|
||||||
|
return;
|
||||||
|
f->getChatForm()->setFriendTyping(isTyping);
|
||||||
|
}
|
||||||
|
|
||||||
void Widget::onSetShowSystemTray(bool newValue){
|
void Widget::onSetShowSystemTray(bool newValue){
|
||||||
icon->setVisible(newValue);
|
icon->setVisible(newValue);
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,6 +132,7 @@ private slots:
|
||||||
void onIconClick(QSystemTrayIcon::ActivationReason);
|
void onIconClick(QSystemTrayIcon::ActivationReason);
|
||||||
void onUserAwayCheck();
|
void onUserAwayCheck();
|
||||||
void getPassword(QString info, int passtype, uint8_t* salt);
|
void getPassword(QString info, int passtype, uint8_t* salt);
|
||||||
|
void onFriendTypingChanged(int friendId, bool isTyping);
|
||||||
void onSetShowSystemTray(bool newValue);
|
void onSetShowSystemTray(bool newValue);
|
||||||
void onSplitterMoved(int pos, int index);
|
void onSplitterMoved(int pos, int index);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user