1
0
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:
midnight079 2014-08-19 19:20:20 +04:00 committed by Tux3 / Mlkj / !Lev.uXFMLA
parent ca9a9b79cb
commit b474ff2c2b
7 changed files with 1563 additions and 6 deletions

View File

@ -30,6 +30,7 @@
#include <QtEndian>
#include <QThread>
#include <QtConcurrent/QtConcurrent>
#include <QMessageBox>
const QString Core::CONFIG_FILE_NAME = "data";
QList<ToxFile> Core::fileSendQueue;
@ -1519,5 +1520,13 @@ void Core::increaseVideoBusyness()
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

File diff suppressed because it is too large Load Diff

2
core.h
View File

@ -165,6 +165,8 @@ public slots:
void startCall(int friendId, bool video=false);
void cancelCall(int callId, int friendId);
void micMuteToggle(int callId);
signals:
void connected();
void disconnected();

View File

@ -1,7 +1,7 @@
QPushButton#green
{
background-color: transparent;
background-image: url(":/micButton/micButton.css");
background-image: url(":/ui/micButton/micButton.png");
background-repeat: none;
border: none;
width: 25px;

View File

@ -45,6 +45,7 @@ ChatForm::ChatForm(Friend* chatFriend)
volButton = new QPushButton(), micButton = new QPushButton();
chatArea = new QScrollArea();
netcam = new NetCamView();
audioInputFlag = false;
QFont bold;
bold.setBold(true);
@ -159,6 +160,7 @@ ChatForm::ChatForm(Friend* chatFriend)
connect(chatArea->verticalScrollBar(), &QScrollBar::rangeChanged, this, &ChatForm::onSliderRangeChanged);
connect(chatArea, &QScrollArea::customContextMenuRequested, this, &ChatForm::onChatContextMenuRequested);
connect(emoteButton, &QPushButton::clicked, this, &ChatForm::onEmoteButtonClicked);
connect(micButton, SIGNAL(clicked()), this, SLOT(onMicMuteToggle()));
}
ChatForm::~ChatForm()
@ -559,19 +561,22 @@ void ChatForm::onAvPeerTimeout(int FriendId, int)
void ChatForm::onAnswerCallTriggered()
{
audioInputFlag = !audioInputFlag;
emit answerCall(callId);
}
void ChatForm::onHangupCallTriggered()
{
audioInputFlag = !audioInputFlag;
emit hangupCall(callId);
}
void ChatForm::onCallTriggered()
{
callButton->disconnect();
videoButton->disconnect();
emit startCall(f->friendId);
audioInputFlag = !audioInputFlag;
callButton->disconnect();
videoButton->disconnect();
emit startCall(f->friendId);
}
void ChatForm::onVideoCallTriggered()
@ -583,6 +588,7 @@ void ChatForm::onVideoCallTriggered()
void ChatForm::onCancelCallTriggered()
{
audioInputFlag = !audioInputFlag;
callButton->disconnect();
videoButton->disconnect();
callButton->setObjectName("green");
@ -664,3 +670,21 @@ void ChatForm::onEmoteInsertRequested(QString str)
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);
}
}
}

View File

@ -58,6 +58,7 @@ signals:
void answerCall(int callId);
void hangupCall(int callId);
void cancelCall(int callId, int friendId);
void micMuteToggle(int callId);
public slots:
void startFileSend(ToxFile file);
@ -71,6 +72,7 @@ public slots:
void onAvEnding(int FriendId, int CallId);
void onAvRequestTimeout(int FriendId, int CallId);
void onAvPeerTimeout(int FriendId, int CallId);
void onMicMuteToggle();
private slots:
void onSendTriggered();
@ -99,7 +101,7 @@ private:
QString previousName;
NetCamView* netcam;
int curRow;
bool lockSliderToBottom;
bool lockSliderToBottom, audioInputFlag;
int callId;
};

View File

@ -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(startVideoCall(int,bool)), core, SLOT(startCall(int,bool)));
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::avInvite, newfriend->chatForm, &ChatForm::onAvInvite);
connect(core, &Core::avStart, newfriend->chatForm, &ChatForm::onAvStart);