mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
parent
dd8ae8109e
commit
320099faf8
|
@ -168,6 +168,26 @@ bool CoreAV::anyActiveCalls() const
|
||||||
return !calls.isEmpty();
|
return !calls.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks the call status for a Tox friend.
|
||||||
|
* @param f the friend to check
|
||||||
|
* @return true, if call is started for the friend, false otherwise
|
||||||
|
*/
|
||||||
|
bool CoreAV::isCallStarted(const Friend* f) const
|
||||||
|
{
|
||||||
|
return f && calls.contains(f->getFriendId());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks the call status for a Tox group.
|
||||||
|
* @param g the group to check
|
||||||
|
* @return true, if call is started for the group, false otherwise
|
||||||
|
*/
|
||||||
|
bool CoreAV::isCallStarted(const Group* g) const
|
||||||
|
{
|
||||||
|
return g && groupCalls.contains(g->getGroupId());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Checks the call status for a Tox friend.
|
* @brief Checks the call status for a Tox friend.
|
||||||
* @param f the friend to check
|
* @param f the friend to check
|
||||||
|
@ -175,7 +195,7 @@ bool CoreAV::anyActiveCalls() const
|
||||||
*/
|
*/
|
||||||
bool CoreAV::isCallActive(const Friend* f) const
|
bool CoreAV::isCallActive(const Friend* f) const
|
||||||
{
|
{
|
||||||
return f && calls.contains(f->getFriendId())
|
return isCallStarted(f)
|
||||||
? !(calls[f->getFriendId()].inactive)
|
? !(calls[f->getFriendId()].inactive)
|
||||||
: false;
|
: false;
|
||||||
}
|
}
|
||||||
|
@ -187,14 +207,14 @@ bool CoreAV::isCallActive(const Friend* f) const
|
||||||
*/
|
*/
|
||||||
bool CoreAV::isCallActive(const Group* g) const
|
bool CoreAV::isCallActive(const Group* g) const
|
||||||
{
|
{
|
||||||
return g && groupCalls.contains(g->getGroupId())
|
return isCallStarted(g)
|
||||||
? !(groupCalls[g->getGroupId()].inactive)
|
? !(groupCalls[g->getGroupId()].inactive)
|
||||||
: false;
|
: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CoreAV::isCallVideoEnabled(const Friend* f) const
|
bool CoreAV::isCallVideoEnabled(const Friend* f) const
|
||||||
{
|
{
|
||||||
return f && calls.contains(f->getFriendId())
|
return isCallStarted(f)
|
||||||
? calls[f->getFriendId()].videoEnabled
|
? calls[f->getFriendId()].videoEnabled
|
||||||
: false;
|
: false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,8 @@ public:
|
||||||
const ToxAV* getToxAv() const;
|
const ToxAV* getToxAv() const;
|
||||||
|
|
||||||
bool anyActiveCalls() const;
|
bool anyActiveCalls() const;
|
||||||
|
bool isCallStarted(const Friend* f) const;
|
||||||
|
bool isCallStarted(const Group* f) const;
|
||||||
bool isCallActive(const Friend* f) const;
|
bool isCallActive(const Friend* f) const;
|
||||||
bool isCallActive(const Group* g) const;
|
bool isCallActive(const Group* g) const;
|
||||||
bool isCallVideoEnabled(const Friend* f) const;
|
bool isCallVideoEnabled(const Friend* f) const;
|
||||||
|
|
|
@ -468,7 +468,7 @@ void ChatForm::onRejectCallTriggered()
|
||||||
void ChatForm::onCallTriggered()
|
void ChatForm::onCallTriggered()
|
||||||
{
|
{
|
||||||
CoreAV* av = Core::getInstance()->getAv();
|
CoreAV* av = Core::getInstance()->getAv();
|
||||||
if (av->isCallActive(f))
|
if (av->isCallStarted(f))
|
||||||
{
|
{
|
||||||
av->cancelCall(f->getFriendId());
|
av->cancelCall(f->getFriendId());
|
||||||
}
|
}
|
||||||
|
@ -481,7 +481,7 @@ void ChatForm::onCallTriggered()
|
||||||
void ChatForm::onVideoCallTriggered()
|
void ChatForm::onVideoCallTriggered()
|
||||||
{
|
{
|
||||||
CoreAV* av = Core::getInstance()->getAv();
|
CoreAV* av = Core::getInstance()->getAv();
|
||||||
if (av->isCallActive(f))
|
if (av->isCallStarted(f))
|
||||||
{
|
{
|
||||||
// TODO: We want to activate video on the active call.
|
// TODO: We want to activate video on the active call.
|
||||||
if (av->isCallVideoEnabled(f))
|
if (av->isCallVideoEnabled(f))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user