Added ability to save icon of last voice playback speed.
This commit is contained in:
parent
81a72caf07
commit
150dbef19f
|
@ -140,7 +140,7 @@ QByteArray Settings::serialize() const {
|
||||||
<< qint32(_askDownloadPath ? 1 : 0)
|
<< qint32(_askDownloadPath ? 1 : 0)
|
||||||
<< _downloadPath.current()
|
<< _downloadPath.current()
|
||||||
<< _downloadPathBookmark
|
<< _downloadPathBookmark
|
||||||
<< qint32(0) // Old double voice playback speed.
|
<< qint32(_nonDefaultVoicePlaybackSpeed ? 1 : 0)
|
||||||
<< qint32(_soundNotify ? 1 : 0)
|
<< qint32(_soundNotify ? 1 : 0)
|
||||||
<< qint32(_desktopNotify ? 1 : 0)
|
<< qint32(_desktopNotify ? 1 : 0)
|
||||||
<< qint32(_flashBounceNotify ? 1 : 0)
|
<< qint32(_flashBounceNotify ? 1 : 0)
|
||||||
|
@ -241,7 +241,7 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
||||||
qint32 askDownloadPath = _askDownloadPath ? 1 : 0;
|
qint32 askDownloadPath = _askDownloadPath ? 1 : 0;
|
||||||
QString downloadPath = _downloadPath.current();
|
QString downloadPath = _downloadPath.current();
|
||||||
QByteArray downloadPathBookmark = _downloadPathBookmark;
|
QByteArray downloadPathBookmark = _downloadPathBookmark;
|
||||||
qint32 oldVoiceMsgPlaybackDoubled = 0;
|
qint32 nonDefaultVoicePlaybackSpeed = _nonDefaultVoicePlaybackSpeed ? 1 : 0;
|
||||||
qint32 soundNotify = _soundNotify ? 1 : 0;
|
qint32 soundNotify = _soundNotify ? 1 : 0;
|
||||||
qint32 desktopNotify = _desktopNotify ? 1 : 0;
|
qint32 desktopNotify = _desktopNotify ? 1 : 0;
|
||||||
qint32 flashBounceNotify = _flashBounceNotify ? 1 : 0;
|
qint32 flashBounceNotify = _flashBounceNotify ? 1 : 0;
|
||||||
|
@ -314,7 +314,7 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
||||||
>> askDownloadPath
|
>> askDownloadPath
|
||||||
>> downloadPath
|
>> downloadPath
|
||||||
>> downloadPathBookmark
|
>> downloadPathBookmark
|
||||||
>> oldVoiceMsgPlaybackDoubled
|
>> nonDefaultVoicePlaybackSpeed
|
||||||
>> soundNotify
|
>> soundNotify
|
||||||
>> desktopNotify
|
>> desktopNotify
|
||||||
>> flashBounceNotify
|
>> flashBounceNotify
|
||||||
|
@ -529,9 +529,17 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
||||||
_suggestStickersByEmoji = (suggestStickersByEmoji == 1);
|
_suggestStickersByEmoji = (suggestStickersByEmoji == 1);
|
||||||
_spellcheckerEnabled = (spellcheckerEnabled == 1);
|
_spellcheckerEnabled = (spellcheckerEnabled == 1);
|
||||||
_videoPlaybackSpeed = DeserializePlaybackSpeed(videoPlaybackSpeed);
|
_videoPlaybackSpeed = DeserializePlaybackSpeed(videoPlaybackSpeed);
|
||||||
_voicePlaybackSpeed = oldVoiceMsgPlaybackDoubled
|
{
|
||||||
? 2.0
|
// Restore settings from 3.0.1 version.
|
||||||
: voicePlaybackSpeed / 100.;
|
if (voicePlaybackSpeed == 100) {
|
||||||
|
_nonDefaultVoicePlaybackSpeed = false;
|
||||||
|
_voicePlaybackSpeed = 2.0;
|
||||||
|
} else {
|
||||||
|
_nonDefaultVoicePlaybackSpeed =
|
||||||
|
(nonDefaultVoicePlaybackSpeed == 1);
|
||||||
|
_voicePlaybackSpeed = voicePlaybackSpeed / 100.;
|
||||||
|
}
|
||||||
|
}
|
||||||
_videoPipGeometry = (videoPipGeometry);
|
_videoPipGeometry = (videoPipGeometry);
|
||||||
_dictionariesEnabled = std::move(dictionariesEnabled);
|
_dictionariesEnabled = std::move(dictionariesEnabled);
|
||||||
_autoDownloadDictionaries = (autoDownloadDictionaries == 1);
|
_autoDownloadDictionaries = (autoDownloadDictionaries == 1);
|
||||||
|
@ -789,6 +797,7 @@ void Settings::resetOnLastLogout() {
|
||||||
_downloadPath = QString();
|
_downloadPath = QString();
|
||||||
_downloadPathBookmark = QByteArray();
|
_downloadPathBookmark = QByteArray();
|
||||||
|
|
||||||
|
_nonDefaultVoicePlaybackSpeed = false;
|
||||||
_soundNotify = true;
|
_soundNotify = true;
|
||||||
_desktopNotify = true;
|
_desktopNotify = true;
|
||||||
_flashBounceNotify = true;
|
_flashBounceNotify = true;
|
||||||
|
|
|
@ -421,11 +421,16 @@ public:
|
||||||
void setVideoPlaybackSpeed(float64 speed) {
|
void setVideoPlaybackSpeed(float64 speed) {
|
||||||
_videoPlaybackSpeed = speed;
|
_videoPlaybackSpeed = speed;
|
||||||
}
|
}
|
||||||
[[nodiscard]] float64 voicePlaybackSpeed() const {
|
[[nodiscard]] float64 voicePlaybackSpeed(
|
||||||
return _voicePlaybackSpeed;
|
bool lastNonDefault = false) const {
|
||||||
|
return (_nonDefaultVoicePlaybackSpeed || lastNonDefault)
|
||||||
|
? _voicePlaybackSpeed
|
||||||
|
: 1.0;
|
||||||
}
|
}
|
||||||
void setVoicePlaybackSpeed(float64 speed) {
|
void setVoicePlaybackSpeed(float64 speed) {
|
||||||
_voicePlaybackSpeed = speed;
|
if ((_nonDefaultVoicePlaybackSpeed = (speed != 1.0))) {
|
||||||
|
_voicePlaybackSpeed = speed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
[[nodiscard]] QByteArray videoPipGeometry() const {
|
[[nodiscard]] QByteArray videoPipGeometry() const {
|
||||||
return _videoPipGeometry;
|
return _videoPipGeometry;
|
||||||
|
@ -669,7 +674,8 @@ private:
|
||||||
bool _suggestStickersByEmoji = true;
|
bool _suggestStickersByEmoji = true;
|
||||||
rpl::variable<bool> _spellcheckerEnabled = true;
|
rpl::variable<bool> _spellcheckerEnabled = true;
|
||||||
rpl::variable<float64> _videoPlaybackSpeed = 1.;
|
rpl::variable<float64> _videoPlaybackSpeed = 1.;
|
||||||
float64 _voicePlaybackSpeed = 1.;
|
float64 _voicePlaybackSpeed = 2.;
|
||||||
|
bool _nonDefaultVoicePlaybackSpeed = false;
|
||||||
QByteArray _videoPipGeometry;
|
QByteArray _videoPipGeometry;
|
||||||
rpl::variable<std::vector<int>> _dictionariesEnabled;
|
rpl::variable<std::vector<int>> _dictionariesEnabled;
|
||||||
rpl::variable<bool> _autoDownloadDictionaries = true;
|
rpl::variable<bool> _autoDownloadDictionaries = true;
|
||||||
|
|
|
@ -75,6 +75,7 @@ private:
|
||||||
public:
|
public:
|
||||||
SpeedController() {
|
SpeedController() {
|
||||||
setSpeed(Core::App().settings().voicePlaybackSpeed());
|
setSpeed(Core::App().settings().voicePlaybackSpeed());
|
||||||
|
_speed = Core::App().settings().voicePlaybackSpeed(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] rpl::producer<float64> speedValue() const {
|
[[nodiscard]] rpl::producer<float64> speedValue() const {
|
||||||
|
|
Loading…
Reference in New Issue