2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Allow disabling calls on tdesktop device.

This commit is contained in:
John Preston
2021-01-26 15:58:30 +04:00
parent ce5c19dfe9
commit 7da224d725
6 changed files with 52 additions and 13 deletions

View File

@@ -19,8 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Core {
Settings::Settings()
: _callAudioBackend(Webrtc::Backend::OpenAL)
, _sendSubmitWay(Ui::InputSubmitSettings::Enter)
: _sendSubmitWay(Ui::InputSubmitSettings::Enter)
, _floatPlayerColumn(Window::Column::Second)
, _floatPlayerCorner(RectPart::TopRight)
, _dialogsWidthRatio(DefaultDialogsWidthRatio()) {
@@ -115,7 +114,8 @@ QByteArray Settings::serialize() const {
<< qint32(_groupCallPushToTalk ? 1 : 0)
<< _groupCallPushToTalkShortcut
<< qint64(_groupCallPushToTalkDelay)
<< qint32(_callAudioBackend);
<< qint32(0) // Call audio backend
<< qint32(_disableCalls ? 1 : 0);
}
return result;
}
@@ -186,7 +186,8 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
qint32 groupCallPushToTalk = _groupCallPushToTalk ? 1 : 0;
QByteArray groupCallPushToTalkShortcut = _groupCallPushToTalkShortcut;
qint64 groupCallPushToTalkDelay = _groupCallPushToTalkDelay;
qint32 callAudioBackend = static_cast<qint32>(_callAudioBackend);
qint32 callAudioBackend = 0;
qint32 disableCalls = _disableCalls ? 1 : 0;
stream >> themesAccentColors;
if (!stream.atEnd()) {
@@ -285,6 +286,9 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
if (!stream.atEnd()) {
stream >> callAudioBackend;
}
if (!stream.atEnd()) {
stream >> disableCalls;
}
if (stream.status() != QDataStream::Ok) {
LOG(("App Error: "
"Bad data for Core::Settings::constructFromSerialized()"));
@@ -379,12 +383,7 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
_groupCallPushToTalk = (groupCallPushToTalk == 1);
_groupCallPushToTalkShortcut = groupCallPushToTalkShortcut;
_groupCallPushToTalkDelay = groupCallPushToTalkDelay;
auto uncheckedBackend = static_cast<Webrtc::Backend>(callAudioBackend);
switch (uncheckedBackend) {
case Webrtc::Backend::OpenAL:
case Webrtc::Backend::ADM:
case Webrtc::Backend::ADM2: _callAudioBackend = uncheckedBackend; break;
}
_disableCalls = (disableCalls == 1);
}
bool Settings::chatWide() const {
@@ -495,6 +494,8 @@ void Settings::resetOnLastLogout() {
//_callInputVolume = 100;
//_callAudioDuckingEnabled = true;
_disableCalls = false;
_groupCallPushToTalk = false;
_groupCallPushToTalkShortcut = QByteArray();
_groupCallPushToTalkDelay = 20;

View File

@@ -222,8 +222,11 @@ public:
_callAudioDuckingEnabled = value;
}
[[nodiscard]] Webrtc::Backend callAudioBackend() const;
void setCallAudioBackend(Webrtc::Backend backend) {
_callAudioBackend = backend;
void setDisableCalls(bool value) {
_disableCalls = value;
}
[[nodiscard]] bool disableCalls() const {
return _disableCalls;
}
[[nodiscard]] bool groupCallPushToTalk() const {
return _groupCallPushToTalk;
@@ -539,7 +542,7 @@ private:
int _callOutputVolume = 100;
int _callInputVolume = 100;
bool _callAudioDuckingEnabled = true;
Webrtc::Backend _callAudioBackend = Webrtc::Backend();
bool _disableCalls = false;
bool _groupCallPushToTalk = false;
QByteArray _groupCallPushToTalkShortcut;
crl::time _groupCallPushToTalkDelay = 20;