mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
disable switching buttons during calls
fixes #436, fixes #500 (well, "fixes" by preventing users from doing dumb things)
This commit is contained in:
parent
57a995117f
commit
576fd7269e
|
@ -128,8 +128,8 @@ void Core::answerCall(int callId)
|
||||||
void Core::hangupCall(int callId)
|
void Core::hangupCall(int callId)
|
||||||
{
|
{
|
||||||
qDebug() << QString("Core: hanging up call %1").arg(callId);
|
qDebug() << QString("Core: hanging up call %1").arg(callId);
|
||||||
calls[callId].active = false;
|
|
||||||
toxav_hangup(toxav, callId);
|
toxav_hangup(toxav, callId);
|
||||||
|
calls[callId].active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::startCall(int friendId, bool video)
|
void Core::startCall(int friendId, bool video)
|
||||||
|
@ -157,20 +157,20 @@ void Core::startCall(int friendId, bool video)
|
||||||
void Core::cancelCall(int callId, int friendId)
|
void Core::cancelCall(int callId, int friendId)
|
||||||
{
|
{
|
||||||
qDebug() << QString("Core: Cancelling call with %1").arg(friendId);
|
qDebug() << QString("Core: Cancelling call with %1").arg(friendId);
|
||||||
calls[callId].active = false;
|
|
||||||
toxav_cancel(toxav, callId, friendId, 0);
|
toxav_cancel(toxav, callId, friendId, 0);
|
||||||
|
calls[callId].active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::cleanupCall(int callId)
|
void Core::cleanupCall(int callId)
|
||||||
{
|
{
|
||||||
qDebug() << QString("Core: cleaning up call %1").arg(callId);
|
qDebug() << QString("Core: cleaning up call %1").arg(callId);
|
||||||
calls[callId].active = false;
|
|
||||||
disconnect(calls[callId].sendAudioTimer,0,0,0);
|
disconnect(calls[callId].sendAudioTimer,0,0,0);
|
||||||
calls[callId].sendAudioTimer->stop();
|
calls[callId].sendAudioTimer->stop();
|
||||||
calls[callId].sendVideoTimer->stop();
|
calls[callId].sendVideoTimer->stop();
|
||||||
if (calls[callId].videoEnabled)
|
if (calls[callId].videoEnabled)
|
||||||
Camera::getInstance()->unsubscribe();
|
Camera::getInstance()->unsubscribe();
|
||||||
alcCaptureStop(alInDev);
|
alcCaptureStop(alInDev);
|
||||||
|
calls[callId].active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::playCallAudio(ToxAv* toxav, int32_t callId, int16_t *data, int samples, void *user_data)
|
void Core::playCallAudio(ToxAv* toxav, int32_t callId, int16_t *data, int samples, void *user_data)
|
||||||
|
|
|
@ -36,6 +36,7 @@ IdentityForm::IdentityForm() :
|
||||||
{
|
{
|
||||||
bodyUI = new Ui::IdentitySettings;
|
bodyUI = new Ui::IdentitySettings;
|
||||||
bodyUI->setupUi(this);
|
bodyUI->setupUi(this);
|
||||||
|
core = Core::getInstance();
|
||||||
|
|
||||||
// tox
|
// tox
|
||||||
toxId = new ClickableTE();
|
toxId = new ClickableTE();
|
||||||
|
@ -47,7 +48,7 @@ IdentityForm::IdentityForm() :
|
||||||
|
|
||||||
connect(bodyUI->toxIdLabel, SIGNAL(clicked()), this, SLOT(copyIdClicked()));
|
connect(bodyUI->toxIdLabel, SIGNAL(clicked()), this, SLOT(copyIdClicked()));
|
||||||
connect(toxId, SIGNAL(clicked()), this, SLOT(copyIdClicked()));
|
connect(toxId, SIGNAL(clicked()), this, SLOT(copyIdClicked()));
|
||||||
connect(Core::getInstance(), &Core::idSet, this, &IdentityForm::setToxId);
|
connect(core, &Core::idSet, this, &IdentityForm::setToxId);
|
||||||
connect(bodyUI->userName, SIGNAL(editingFinished()), this, SLOT(onUserNameEdited()));
|
connect(bodyUI->userName, SIGNAL(editingFinished()), this, SLOT(onUserNameEdited()));
|
||||||
connect(bodyUI->statusMessage, SIGNAL(editingFinished()), this, SLOT(onStatusMessageEdited()));
|
connect(bodyUI->statusMessage, SIGNAL(editingFinished()), this, SLOT(onStatusMessageEdited()));
|
||||||
connect(bodyUI->loadButton, &QPushButton::clicked, this, &IdentityForm::onLoadClicked);
|
connect(bodyUI->loadButton, &QPushButton::clicked, this, &IdentityForm::onLoadClicked);
|
||||||
|
@ -57,6 +58,16 @@ IdentityForm::IdentityForm() :
|
||||||
connect(bodyUI->importButton, &QPushButton::clicked, this, &IdentityForm::onImportClicked);
|
connect(bodyUI->importButton, &QPushButton::clicked, this, &IdentityForm::onImportClicked);
|
||||||
connect(bodyUI->newButton, &QPushButton::clicked, this, &IdentityForm::onNewClicked);
|
connect(bodyUI->newButton, &QPushButton::clicked, this, &IdentityForm::onNewClicked);
|
||||||
|
|
||||||
|
connect(core, &Core::avStart, this, &IdentityForm::disableSwitching);
|
||||||
|
connect(core, &Core::avStarting, this, &IdentityForm::disableSwitching);
|
||||||
|
connect(core, &Core::avInvite, this, &IdentityForm::disableSwitching);
|
||||||
|
connect(core, &Core::avRinging, this, &IdentityForm::disableSwitching);
|
||||||
|
connect(core, &Core::avCancel, this, &IdentityForm::enableSwitching);
|
||||||
|
connect(core, &Core::avEnd, this, &IdentityForm::enableSwitching);
|
||||||
|
connect(core, &Core::avEnding, this, &IdentityForm::enableSwitching);
|
||||||
|
connect(core, &Core::avPeerTimeout, this, &IdentityForm::enableSwitching);
|
||||||
|
connect(core, &Core::avRequestTimeout, this, &IdentityForm::enableSwitching);
|
||||||
|
|
||||||
connect(Core::getInstance(), &Core::usernameSet, this, [=](const QString& val) { bodyUI->userName->setText(val); });
|
connect(Core::getInstance(), &Core::usernameSet, this, [=](const QString& val) { bodyUI->userName->setText(val); });
|
||||||
connect(Core::getInstance(), &Core::statusMessageSet, this, [=](const QString& val) { bodyUI->statusMessage->setText(val); });
|
connect(Core::getInstance(), &Core::statusMessageSet, this, [=](const QString& val) { bodyUI->statusMessage->setText(val); });
|
||||||
}
|
}
|
||||||
|
@ -203,3 +214,18 @@ bool IdentityForm::checkContinue(const QString& title, const QString& msg)
|
||||||
QMessageBox::StandardButton resp = QMessageBox::question(this, title, msg, QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
QMessageBox::StandardButton resp = QMessageBox::question(this, title, msg, QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
||||||
return resp == QMessageBox::Yes;
|
return resp == QMessageBox::Yes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IdentityForm::disableSwitching()
|
||||||
|
{
|
||||||
|
bodyUI->loadButton->setEnabled(false);
|
||||||
|
bodyUI->newButton->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IdentityForm::enableSwitching()
|
||||||
|
{
|
||||||
|
if (!core->anyActiveCalls())
|
||||||
|
{
|
||||||
|
bodyUI->loadButton->setEnabled(true);
|
||||||
|
bodyUI->newButton->setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
class CroppingLabel;
|
class CroppingLabel;
|
||||||
|
class Core;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class IdentitySettings;
|
class IdentitySettings;
|
||||||
|
@ -65,9 +66,12 @@ private slots:
|
||||||
void onImportClicked();
|
void onImportClicked();
|
||||||
void onNewClicked();
|
void onNewClicked();
|
||||||
bool checkContinue(const QString& title, const QString& msg);
|
bool checkContinue(const QString& title, const QString& msg);
|
||||||
|
void disableSwitching();
|
||||||
|
void enableSwitching();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::IdentitySettings* bodyUI;
|
Ui::IdentitySettings* bodyUI;
|
||||||
|
Core* core;
|
||||||
|
|
||||||
ClickableTE* toxId;
|
ClickableTE* toxId;
|
||||||
};
|
};
|
||||||
|
|
|
@ -114,6 +114,9 @@
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string comment="load profile button">Load</string>
|
<string comment="load profile button">Load</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string comment="tooltip">Switching profiles is disabled during calls</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -156,6 +159,9 @@
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string comment="new profile button">New Tox ID</string>
|
<string comment="new profile button">New Tox ID</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string comment="tooltip">Switching profiles is disabled during calls</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user