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

Listen for push-to-talk shortcut on more widgets

This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-11-13 19:25:45 +01:00
parent 0c393e717a
commit d5ab03d03d
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
4 changed files with 19 additions and 6 deletions

View File

@ -207,15 +207,12 @@ void GroupChatForm::onCallClicked()
void GroupChatForm::keyPressEvent(QKeyEvent* ev) void GroupChatForm::keyPressEvent(QKeyEvent* ev)
{ {
qDebug() << "Press:"<<ev->key();
// Push to talk // Push to talk
if (ev->key() == Qt::Key_P && inCall) if (ev->key() == Qt::Key_P && inCall)
{ {
qDebug() << "Press:"<<ev->key();
Core* core = Core::getInstance(); Core* core = Core::getInstance();
if (!core->isGroupCallMicEnabled(group->groupId)) if (!core->isGroupCallMicEnabled(group->groupId))
{ {
qDebug() << "Press:"<<ev->key();
core->enableGroupCallMic(group->groupId); core->enableGroupCallMic(group->groupId);
micButton->setObjectName("green"); micButton->setObjectName("green");
micButton->style()->polish(micButton); micButton->style()->polish(micButton);
@ -226,7 +223,6 @@ void GroupChatForm::keyPressEvent(QKeyEvent* ev)
void GroupChatForm::keyReleaseEvent(QKeyEvent* ev) void GroupChatForm::keyReleaseEvent(QKeyEvent* ev)
{ {
qDebug() << "Release:"<<ev->key();
// Push to talk // Push to talk
if (ev->key() == Qt::Key_P && inCall) if (ev->key() == Qt::Key_P && inCall)
{ {

View File

@ -32,6 +32,9 @@ public:
void onUserListChanged(); void onUserListChanged();
void keyPressEvent(QKeyEvent* ev);
void keyReleaseEvent(QKeyEvent* ev);
private slots: private slots:
void onSendTriggered(); void onSendTriggered();
void onMicMuteToggle(); void onMicMuteToggle();
@ -42,8 +45,6 @@ protected:
// drag & drop // drag & drop
void dragEnterEvent(QDragEnterEvent* ev); void dragEnterEvent(QDragEnterEvent* ev);
void dropEvent(QDropEvent* ev); void dropEvent(QDropEvent* ev);
void keyPressEvent(QKeyEvent* ev);
void keyReleaseEvent(QKeyEvent* ev);
private: private:
Group* group; Group* group;

View File

@ -122,3 +122,17 @@ void GroupWidget::dropEvent(QDropEvent *ev)
Core::getInstance()->groupInviteFriend(friendId, groupId); Core::getInstance()->groupInviteFriend(friendId, groupId);
} }
} }
void GroupWidget::keyPressEvent(QKeyEvent* ev)
{
Group* g = GroupList::findGroup(groupId);
if (g)
g->chatForm->keyPressEvent(ev);
}
void GroupWidget::keyReleaseEvent(QKeyEvent* ev)
{
Group* g = GroupList::findGroup(groupId);
if (g)
g->chatForm->keyReleaseEvent(ev);
}

View File

@ -41,6 +41,8 @@ protected:
// drag & drop // drag & drop
void dragEnterEvent(QDragEnterEvent* ev); void dragEnterEvent(QDragEnterEvent* ev);
void dropEvent(QDropEvent* ev); void dropEvent(QDropEvent* ev);
void keyPressEvent(QKeyEvent* ev);
void keyReleaseEvent(QKeyEvent* ev);
public: public:
int groupId; int groupId;