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

Allow to choose camera device in Settings.

This commit is contained in:
John Preston
2020-08-18 18:00:33 +04:00
parent e782e065a0
commit aa87d627c9
10 changed files with 163 additions and 54 deletions

View File

@@ -32,8 +32,9 @@ QByteArray Settings::serialize() const {
+ Serialize::stringSize(_downloadPath.current())
+ Serialize::bytearraySize(_downloadPathBookmark)
+ sizeof(qint32) * 12
+ Serialize::stringSize(_callOutputDeviceID)
+ Serialize::stringSize(_callInputDeviceID)
+ Serialize::stringSize(_callOutputDeviceId)
+ Serialize::stringSize(_callInputDeviceId)
+ Serialize::stringSize(_callVideoInputDeviceId)
+ sizeof(qint32) * 3;
for (const auto &[key, value] : _soundOverrides) {
size += Serialize::stringSize(key) + Serialize::stringSize(value);
@@ -63,8 +64,8 @@ QByteArray Settings::serialize() const {
<< qint32(_notificationsCount)
<< static_cast<qint32>(_notificationsCorner)
<< qint32(_autoLock)
<< _callOutputDeviceID
<< _callInputDeviceID
<< _callOutputDeviceId
<< _callInputDeviceId
<< qint32(_callOutputVolume)
<< qint32(_callInputVolume)
<< qint32(_callAudioDuckingEnabled ? 1 : 0)
@@ -107,7 +108,8 @@ QByteArray Settings::serialize() const {
<< qint32(_thirdSectionExtendedBy)
<< qint32(_notifyFromAll ? 1 : 0)
<< qint32(_nativeWindowFrame.current() ? 1 : 0)
<< qint32(_systemDarkModeEnabled.current() ? 1 : 0);
<< qint32(_systemDarkModeEnabled.current() ? 1 : 0)
<< _callVideoInputDeviceId;
}
return result;
}
@@ -137,8 +139,9 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
qint32 notificationsCount = _notificationsCount;
qint32 notificationsCorner = static_cast<qint32>(_notificationsCorner);
qint32 autoLock = _autoLock;
QString callOutputDeviceID = _callOutputDeviceID;
QString callInputDeviceID = _callInputDeviceID;
QString callOutputDeviceId = _callOutputDeviceId;
QString callInputDeviceId = _callInputDeviceId;
QString callVideoInputDeviceId = _callVideoInputDeviceId;
qint32 callOutputVolume = _callOutputVolume;
qint32 callInputVolume = _callInputVolume;
qint32 callAudioDuckingEnabled = _callAudioDuckingEnabled ? 1 : 0;
@@ -193,8 +196,8 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
>> notificationsCount
>> notificationsCorner
>> autoLock
>> callOutputDeviceID
>> callInputDeviceID
>> callOutputDeviceId
>> callInputDeviceId
>> callOutputVolume
>> callInputVolume
>> callAudioDuckingEnabled
@@ -253,6 +256,9 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
if (!stream.atEnd()) {
stream >> systemDarkModeEnabled;
}
if (!stream.atEnd()) {
stream >> callVideoInputDeviceId;
}
if (stream.status() != QDataStream::Ok) {
LOG(("App Error: "
"Bad data for Core::Settings::constructFromSerialized()"));
@@ -290,8 +296,9 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
_countUnreadMessages = (countUnreadMessages == 1);
_notifyAboutPinned = (notifyAboutPinned == 1);
_autoLock = autoLock;
_callOutputDeviceID = callOutputDeviceID;
_callInputDeviceID = callInputDeviceID;
_callOutputDeviceId = callOutputDeviceId;
_callInputDeviceId = callInputDeviceId;
_callVideoInputDeviceId = callVideoInputDeviceId;
_callOutputVolume = callOutputVolume;
_callInputVolume = callInputVolume;
_callAudioDuckingEnabled = (callAudioDuckingEnabled == 1);
@@ -446,8 +453,9 @@ void Settings::resetOnLastLogout() {
_notifyAboutPinned = true;
//_autoLock = 3600;
//_callOutputDeviceID = u"default"_q;
//_callInputDeviceID = u"default"_q;
//_callOutputDeviceId = u"default"_q;
//_callInputDeviceId = u"default"_q;
//_callVideoInputDeviceId = u"default"_q;
//_callOutputVolume = 100;
//_callInputVolume = 100;
//_callAudioDuckingEnabled = true;

View File

@@ -175,21 +175,29 @@ public:
void setAutoLock(int value) {
_autoLock = value;
}
[[nodiscard]] QString callOutputDeviceID() const {
return _callOutputDeviceID.isEmpty()
[[nodiscard]] QString callOutputDeviceId() const {
return _callOutputDeviceId.isEmpty()
? u"default"_q
: _callOutputDeviceID;
: _callOutputDeviceId;
}
void setCallOutputDeviceID(const QString &value) {
_callOutputDeviceID = value;
void setCallOutputDeviceId(const QString &value) {
_callOutputDeviceId = value;
}
[[nodiscard]] QString callInputDeviceID() const {
return _callInputDeviceID.isEmpty()
[[nodiscard]] QString callInputDeviceId() const {
return _callInputDeviceId.isEmpty()
? u"default"_q
: _callInputDeviceID;
: _callInputDeviceId;
}
void setCallInputDeviceID(const QString &value) {
_callInputDeviceID = value;
void setCallInputDeviceId(const QString &value) {
_callInputDeviceId = value;
}
[[nodiscard]] QString callVideoInputDeviceId() const {
return _callVideoInputDeviceId.isEmpty()
? u"default"_q
: _callVideoInputDeviceId;
}
void setCallVideoInputDeviceId(const QString &value) {
_callVideoInputDeviceId = value;
}
[[nodiscard]] int callOutputVolume() const {
return _callOutputVolume;
@@ -493,8 +501,9 @@ private:
bool _countUnreadMessages = true;
rpl::variable<bool> _notifyAboutPinned = true;
int _autoLock = 3600;
QString _callOutputDeviceID = u"default"_q;
QString _callInputDeviceID = u"default"_q;
QString _callOutputDeviceId = u"default"_q;
QString _callInputDeviceId = u"default"_q;
QString _callVideoInputDeviceId = u"default"_q;
int _callOutputVolume = 100;
int _callInputVolume = 100;
bool _callAudioDuckingEnabled = true;