mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
realized micButton for calls
This commit is contained in:
parent
ca9a9b79cb
commit
b474ff2c2b
11
core.cpp
11
core.cpp
|
@ -30,6 +30,7 @@
|
||||||
#include <QtEndian>
|
#include <QtEndian>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QtConcurrent/QtConcurrent>
|
#include <QtConcurrent/QtConcurrent>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
const QString Core::CONFIG_FILE_NAME = "data";
|
const QString Core::CONFIG_FILE_NAME = "data";
|
||||||
QList<ToxFile> Core::fileSendQueue;
|
QList<ToxFile> Core::fileSendQueue;
|
||||||
|
@ -1519,5 +1520,13 @@ void Core::increaseVideoBusyness()
|
||||||
|
|
||||||
void Core::decreaseVideoBusyness()
|
void Core::decreaseVideoBusyness()
|
||||||
{
|
{
|
||||||
videoBusyness--;
|
videoBusyness--;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Core::micMuteToggle(int callId)
|
||||||
|
{
|
||||||
|
// if (calls[callId].audioInput->state() == QAudio::ActiveState)
|
||||||
|
// calls[callId].audioInput->stop();
|
||||||
|
// else
|
||||||
|
// calls[callId].audioInput->start();
|
||||||
}
|
}
|
||||||
|
|
1519
core.cpp.autosave
Normal file
1519
core.cpp.autosave
Normal file
File diff suppressed because it is too large
Load Diff
2
core.h
2
core.h
|
@ -165,6 +165,8 @@ public slots:
|
||||||
void startCall(int friendId, bool video=false);
|
void startCall(int friendId, bool video=false);
|
||||||
void cancelCall(int callId, int friendId);
|
void cancelCall(int callId, int friendId);
|
||||||
|
|
||||||
|
void micMuteToggle(int callId);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void connected();
|
void connected();
|
||||||
void disconnected();
|
void disconnected();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
QPushButton#green
|
QPushButton#green
|
||||||
{
|
{
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
background-image: url(":/micButton/micButton.css");
|
background-image: url(":/ui/micButton/micButton.png");
|
||||||
background-repeat: none;
|
background-repeat: none;
|
||||||
border: none;
|
border: none;
|
||||||
width: 25px;
|
width: 25px;
|
||||||
|
|
|
@ -45,6 +45,7 @@ ChatForm::ChatForm(Friend* chatFriend)
|
||||||
volButton = new QPushButton(), micButton = new QPushButton();
|
volButton = new QPushButton(), micButton = new QPushButton();
|
||||||
chatArea = new QScrollArea();
|
chatArea = new QScrollArea();
|
||||||
netcam = new NetCamView();
|
netcam = new NetCamView();
|
||||||
|
audioInputFlag = false;
|
||||||
|
|
||||||
QFont bold;
|
QFont bold;
|
||||||
bold.setBold(true);
|
bold.setBold(true);
|
||||||
|
@ -159,6 +160,7 @@ ChatForm::ChatForm(Friend* chatFriend)
|
||||||
connect(chatArea->verticalScrollBar(), &QScrollBar::rangeChanged, this, &ChatForm::onSliderRangeChanged);
|
connect(chatArea->verticalScrollBar(), &QScrollBar::rangeChanged, this, &ChatForm::onSliderRangeChanged);
|
||||||
connect(chatArea, &QScrollArea::customContextMenuRequested, this, &ChatForm::onChatContextMenuRequested);
|
connect(chatArea, &QScrollArea::customContextMenuRequested, this, &ChatForm::onChatContextMenuRequested);
|
||||||
connect(emoteButton, &QPushButton::clicked, this, &ChatForm::onEmoteButtonClicked);
|
connect(emoteButton, &QPushButton::clicked, this, &ChatForm::onEmoteButtonClicked);
|
||||||
|
connect(micButton, SIGNAL(clicked()), this, SLOT(onMicMuteToggle()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatForm::~ChatForm()
|
ChatForm::~ChatForm()
|
||||||
|
@ -559,19 +561,22 @@ void ChatForm::onAvPeerTimeout(int FriendId, int)
|
||||||
|
|
||||||
void ChatForm::onAnswerCallTriggered()
|
void ChatForm::onAnswerCallTriggered()
|
||||||
{
|
{
|
||||||
|
audioInputFlag = !audioInputFlag;
|
||||||
emit answerCall(callId);
|
emit answerCall(callId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::onHangupCallTriggered()
|
void ChatForm::onHangupCallTriggered()
|
||||||
{
|
{
|
||||||
|
audioInputFlag = !audioInputFlag;
|
||||||
emit hangupCall(callId);
|
emit hangupCall(callId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::onCallTriggered()
|
void ChatForm::onCallTriggered()
|
||||||
{
|
{
|
||||||
callButton->disconnect();
|
audioInputFlag = !audioInputFlag;
|
||||||
videoButton->disconnect();
|
callButton->disconnect();
|
||||||
emit startCall(f->friendId);
|
videoButton->disconnect();
|
||||||
|
emit startCall(f->friendId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::onVideoCallTriggered()
|
void ChatForm::onVideoCallTriggered()
|
||||||
|
@ -583,6 +588,7 @@ void ChatForm::onVideoCallTriggered()
|
||||||
|
|
||||||
void ChatForm::onCancelCallTriggered()
|
void ChatForm::onCancelCallTriggered()
|
||||||
{
|
{
|
||||||
|
audioInputFlag = !audioInputFlag;
|
||||||
callButton->disconnect();
|
callButton->disconnect();
|
||||||
videoButton->disconnect();
|
videoButton->disconnect();
|
||||||
callButton->setObjectName("green");
|
callButton->setObjectName("green");
|
||||||
|
@ -664,3 +670,21 @@ void ChatForm::onEmoteInsertRequested(QString str)
|
||||||
|
|
||||||
msgEdit->setFocus(); // refocus so that we can continue typing
|
msgEdit->setFocus(); // refocus so that we can continue typing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatForm::onMicMuteToggle()
|
||||||
|
{
|
||||||
|
if (audioInputFlag == true)
|
||||||
|
{
|
||||||
|
emit micMuteToggle(callId);
|
||||||
|
if (micButton->objectName() == "red")
|
||||||
|
{
|
||||||
|
micButton->setObjectName("green");
|
||||||
|
micButton->style()->polish(micButton);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
micButton->setObjectName("red");
|
||||||
|
micButton->style()->polish(micButton);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -58,6 +58,7 @@ signals:
|
||||||
void answerCall(int callId);
|
void answerCall(int callId);
|
||||||
void hangupCall(int callId);
|
void hangupCall(int callId);
|
||||||
void cancelCall(int callId, int friendId);
|
void cancelCall(int callId, int friendId);
|
||||||
|
void micMuteToggle(int callId);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void startFileSend(ToxFile file);
|
void startFileSend(ToxFile file);
|
||||||
|
@ -71,6 +72,7 @@ public slots:
|
||||||
void onAvEnding(int FriendId, int CallId);
|
void onAvEnding(int FriendId, int CallId);
|
||||||
void onAvRequestTimeout(int FriendId, int CallId);
|
void onAvRequestTimeout(int FriendId, int CallId);
|
||||||
void onAvPeerTimeout(int FriendId, int CallId);
|
void onAvPeerTimeout(int FriendId, int CallId);
|
||||||
|
void onMicMuteToggle();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onSendTriggered();
|
void onSendTriggered();
|
||||||
|
@ -99,7 +101,7 @@ private:
|
||||||
QString previousName;
|
QString previousName;
|
||||||
NetCamView* netcam;
|
NetCamView* netcam;
|
||||||
int curRow;
|
int curRow;
|
||||||
bool lockSliderToBottom;
|
bool lockSliderToBottom, audioInputFlag;
|
||||||
int callId;
|
int callId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -427,6 +427,7 @@ void Widget::addFriend(int friendId, const QString &userId)
|
||||||
connect(newfriend->chatForm, SIGNAL(startCall(int)), core, SLOT(startCall(int)));
|
connect(newfriend->chatForm, SIGNAL(startCall(int)), core, SLOT(startCall(int)));
|
||||||
connect(newfriend->chatForm, SIGNAL(startVideoCall(int,bool)), core, SLOT(startCall(int,bool)));
|
connect(newfriend->chatForm, SIGNAL(startVideoCall(int,bool)), core, SLOT(startCall(int,bool)));
|
||||||
connect(newfriend->chatForm, SIGNAL(cancelCall(int,int)), core, SLOT(cancelCall(int,int)));
|
connect(newfriend->chatForm, SIGNAL(cancelCall(int,int)), core, SLOT(cancelCall(int,int)));
|
||||||
|
connect(newfriend->chatForm, SIGNAL(micMuteToggle(int)), core, SLOT(micMuteToggle(int)));
|
||||||
connect(core, &Core::fileReceiveRequested, newfriend->chatForm, &ChatForm::onFileRecvRequest);
|
connect(core, &Core::fileReceiveRequested, newfriend->chatForm, &ChatForm::onFileRecvRequest);
|
||||||
connect(core, &Core::avInvite, newfriend->chatForm, &ChatForm::onAvInvite);
|
connect(core, &Core::avInvite, newfriend->chatForm, &ChatForm::onAvInvite);
|
||||||
connect(core, &Core::avStart, newfriend->chatForm, &ChatForm::onAvStart);
|
connect(core, &Core::avStart, newfriend->chatForm, &ChatForm::onAvStart);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user