mirror of
https://github.com/telegramdesktop/tdesktop
synced 2024-12-29 01:52:48 +00:00
Fix settings saving.
Regression was introduced in 5d6a494934
.
Fixes #8168.
This commit is contained in:
parent
d2615dda63
commit
a95b756111
@ -94,7 +94,17 @@ QByteArray Settings::serialize() const {
|
|||||||
}
|
}
|
||||||
stream
|
stream
|
||||||
<< qint32(_autoDownloadDictionaries.current() ? 1 : 0)
|
<< qint32(_autoDownloadDictionaries.current() ? 1 : 0)
|
||||||
<< qint32(_mainMenuAccountsShown.current() ? 1 : 0);
|
<< qint32(_mainMenuAccountsShown.current() ? 1 : 0)
|
||||||
|
<< qint32(_tabbedSelectorSectionEnabled ? 1 : 0)
|
||||||
|
<< qint32(_floatPlayerColumn)
|
||||||
|
<< qint32(_floatPlayerCorner)
|
||||||
|
<< qint32(_thirdSectionInfoEnabled ? 1 : 0)
|
||||||
|
<< qint32(snap(
|
||||||
|
qRound(_dialogsWidthRatio.current() * 1000000),
|
||||||
|
0,
|
||||||
|
1000000))
|
||||||
|
<< qint32(_thirdColumnWidth.current())
|
||||||
|
<< qint32(_thirdSectionExtendedBy);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -150,6 +160,13 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
|||||||
std::vector<int> dictionariesEnabled;
|
std::vector<int> dictionariesEnabled;
|
||||||
qint32 autoDownloadDictionaries = _autoDownloadDictionaries.current() ? 1 : 0;
|
qint32 autoDownloadDictionaries = _autoDownloadDictionaries.current() ? 1 : 0;
|
||||||
qint32 mainMenuAccountsShown = _mainMenuAccountsShown.current() ? 1 : 0;
|
qint32 mainMenuAccountsShown = _mainMenuAccountsShown.current() ? 1 : 0;
|
||||||
|
qint32 tabbedSelectorSectionEnabled = 1;
|
||||||
|
qint32 floatPlayerColumn = static_cast<qint32>(Window::Column::Second);
|
||||||
|
qint32 floatPlayerCorner = static_cast<qint32>(RectPart::TopRight);
|
||||||
|
qint32 thirdSectionInfoEnabled = 0;
|
||||||
|
float64 dialogsWidthRatio = _dialogsWidthRatio.current();
|
||||||
|
qint32 thirdColumnWidth = _thirdColumnWidth.current();
|
||||||
|
qint32 thirdSectionExtendedBy = _thirdSectionExtendedBy;
|
||||||
|
|
||||||
stream >> themesAccentColors;
|
stream >> themesAccentColors;
|
||||||
if (!stream.atEnd()) {
|
if (!stream.atEnd()) {
|
||||||
@ -211,6 +228,18 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
|||||||
>> autoDownloadDictionaries
|
>> autoDownloadDictionaries
|
||||||
>> mainMenuAccountsShown;
|
>> mainMenuAccountsShown;
|
||||||
}
|
}
|
||||||
|
if (!stream.atEnd()) {
|
||||||
|
auto dialogsWidthRatioInt = qint32();
|
||||||
|
stream
|
||||||
|
>> tabbedSelectorSectionEnabled
|
||||||
|
>> floatPlayerColumn
|
||||||
|
>> floatPlayerCorner
|
||||||
|
>> thirdSectionInfoEnabled
|
||||||
|
>> dialogsWidthRatioInt
|
||||||
|
>> thirdColumnWidth
|
||||||
|
>> thirdSectionExtendedBy;
|
||||||
|
dialogsWidthRatio = snap(dialogsWidthRatioInt / 1000000., 0., 1.);
|
||||||
|
}
|
||||||
if (stream.status() != QDataStream::Ok) {
|
if (stream.status() != QDataStream::Ok) {
|
||||||
LOG(("App Error: "
|
LOG(("App Error: "
|
||||||
"Bad data for Core::Settings::constructFromSerialized()"));
|
"Bad data for Core::Settings::constructFromSerialized()"));
|
||||||
@ -281,6 +310,27 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
|||||||
_dictionariesEnabled = std::move(dictionariesEnabled);
|
_dictionariesEnabled = std::move(dictionariesEnabled);
|
||||||
_autoDownloadDictionaries = (autoDownloadDictionaries == 1);
|
_autoDownloadDictionaries = (autoDownloadDictionaries == 1);
|
||||||
_mainMenuAccountsShown = (mainMenuAccountsShown == 1);
|
_mainMenuAccountsShown = (mainMenuAccountsShown == 1);
|
||||||
|
_tabbedSelectorSectionEnabled = (tabbedSelectorSectionEnabled == 1);
|
||||||
|
auto uncheckedColumn = static_cast<Window::Column>(floatPlayerColumn);
|
||||||
|
switch (uncheckedColumn) {
|
||||||
|
case Window::Column::First:
|
||||||
|
case Window::Column::Second:
|
||||||
|
case Window::Column::Third: _floatPlayerColumn = uncheckedColumn; break;
|
||||||
|
}
|
||||||
|
auto uncheckedCorner = static_cast<RectPart>(floatPlayerCorner);
|
||||||
|
switch (uncheckedCorner) {
|
||||||
|
case RectPart::TopLeft:
|
||||||
|
case RectPart::TopRight:
|
||||||
|
case RectPart::BottomLeft:
|
||||||
|
case RectPart::BottomRight: _floatPlayerCorner = uncheckedCorner; break;
|
||||||
|
}
|
||||||
|
_thirdSectionInfoEnabled = thirdSectionInfoEnabled;
|
||||||
|
_dialogsWidthRatio = dialogsWidthRatio;
|
||||||
|
_thirdColumnWidth = thirdColumnWidth;
|
||||||
|
_thirdSectionExtendedBy = thirdSectionExtendedBy;
|
||||||
|
if (_thirdSectionInfoEnabled) {
|
||||||
|
_tabbedSelectorSectionEnabled = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Settings::chatWide() const {
|
bool Settings::chatWide() const {
|
||||||
|
@ -39,7 +39,7 @@ VolumeController::VolumeController(
|
|||||||
Core::App().settings().setRememberedSongVolume(volume);
|
Core::App().settings().setRememberedSongVolume(volume);
|
||||||
}
|
}
|
||||||
applyVolumeChange(volume);
|
applyVolumeChange(volume);
|
||||||
controller->session().saveSettingsDelayed();
|
Core::App().saveSettingsDelayed();
|
||||||
});
|
});
|
||||||
Core::App().settings().songVolumeChanges(
|
Core::App().settings().songVolumeChanges(
|
||||||
) | rpl::start_with_next([=](float64 volume) {
|
) | rpl::start_with_next([=](float64 volume) {
|
||||||
|
@ -132,6 +132,7 @@ Widget::Widget(QWidget *parent, not_null<Main::Session*> session)
|
|||||||
? 0.
|
? 0.
|
||||||
: Core::App().settings().rememberedSongVolume();
|
: Core::App().settings().rememberedSongVolume();
|
||||||
Core::App().settings().setSongVolume(volume);
|
Core::App().settings().setSongVolume(volume);
|
||||||
|
Core::App().saveSettingsDelayed();
|
||||||
mixer()->setSongVolume(volume);
|
mixer()->setSongVolume(volume);
|
||||||
});
|
});
|
||||||
Core::App().settings().songVolumeChanges(
|
Core::App().settings().songVolumeChanges(
|
||||||
|
@ -2653,10 +2653,8 @@ void OverlayWidget::playbackControlsSeekFinished(crl::time position) {
|
|||||||
|
|
||||||
void OverlayWidget::playbackControlsVolumeChanged(float64 volume) {
|
void OverlayWidget::playbackControlsVolumeChanged(float64 volume) {
|
||||||
Core::App().settings().setVideoVolume(volume);
|
Core::App().settings().setVideoVolume(volume);
|
||||||
|
Core::App().saveSettingsDelayed();
|
||||||
updateMixerVideoVolume();
|
updateMixerVideoVolume();
|
||||||
if (_document) {
|
|
||||||
_document->session().saveSettingsDelayed();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float64 OverlayWidget::playbackControlsCurrentVolume() {
|
float64 OverlayWidget::playbackControlsCurrentVolume() {
|
||||||
|
@ -52,7 +52,7 @@ Calls::Calls(
|
|||||||
|
|
||||||
Calls::~Calls() {
|
Calls::~Calls() {
|
||||||
if (_needWriteSettings) {
|
if (_needWriteSettings) {
|
||||||
_controller->session().saveSettingsDelayed();
|
Core::App().saveSettingsDelayed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ void Calls::setupContent() {
|
|||||||
: "default";
|
: "default";
|
||||||
Core::App().settings().setCallOutputDeviceID(
|
Core::App().settings().setCallOutputDeviceID(
|
||||||
QString::fromStdString(deviceId));
|
QString::fromStdString(deviceId));
|
||||||
_controller->session().saveSettingsDelayed();
|
Core::App().saveSettingsDelayed();
|
||||||
if (const auto call = Core::App().calls().currentCall()) {
|
if (const auto call = Core::App().calls().currentCall()) {
|
||||||
call->setCurrentAudioDevice(false, deviceId);
|
call->setCurrentAudioDevice(false, deviceId);
|
||||||
}
|
}
|
||||||
@ -210,7 +210,7 @@ void Calls::setupContent() {
|
|||||||
: "default";
|
: "default";
|
||||||
Core::App().settings().setCallInputDeviceID(
|
Core::App().settings().setCallInputDeviceID(
|
||||||
QString::fromStdString(deviceId));
|
QString::fromStdString(deviceId));
|
||||||
_controller->session().saveSettingsDelayed();
|
Core::App().saveSettingsDelayed();
|
||||||
if (_micTester) {
|
if (_micTester) {
|
||||||
stopTestingMicrophone();
|
stopTestingMicrophone();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user