mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Save preferred video quality to settings.
This commit is contained in:
parent
3f2f3ebd51
commit
37dddda1a0
6 changed files with 37 additions and 9 deletions
|
@ -222,7 +222,7 @@ QByteArray Settings::serialize() const {
|
||||||
+ Serialize::stringSize(_customFontFamily)
|
+ Serialize::stringSize(_customFontFamily)
|
||||||
+ sizeof(qint32) * 3
|
+ sizeof(qint32) * 3
|
||||||
+ Serialize::bytearraySize(_tonsiteStorageToken)
|
+ Serialize::bytearraySize(_tonsiteStorageToken)
|
||||||
+ sizeof(qint32) * 4;
|
+ sizeof(qint32) * 5;
|
||||||
|
|
||||||
auto result = QByteArray();
|
auto result = QByteArray();
|
||||||
result.reserve(size);
|
result.reserve(size);
|
||||||
|
@ -380,7 +380,8 @@ QByteArray Settings::serialize() const {
|
||||||
<< qint32(_includeMutedCounterFolders ? 1 : 0)
|
<< qint32(_includeMutedCounterFolders ? 1 : 0)
|
||||||
<< qint32(_ivZoom.current())
|
<< qint32(_ivZoom.current())
|
||||||
<< qint32(_skipToastsInFocus ? 1 : 0)
|
<< qint32(_skipToastsInFocus ? 1 : 0)
|
||||||
<< qint32(_recordVideoMessages ? 1 : 0);
|
<< qint32(_recordVideoMessages ? 1 : 0)
|
||||||
|
<< qint32(_videoQuality);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ensures(result.size() == size);
|
Ensures(result.size() == size);
|
||||||
|
@ -507,6 +508,7 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
||||||
qint32 ivZoom = _ivZoom.current();
|
qint32 ivZoom = _ivZoom.current();
|
||||||
qint32 skipToastsInFocus = _skipToastsInFocus ? 1 : 0;
|
qint32 skipToastsInFocus = _skipToastsInFocus ? 1 : 0;
|
||||||
qint32 recordVideoMessages = _recordVideoMessages ? 1 : 0;
|
qint32 recordVideoMessages = _recordVideoMessages ? 1 : 0;
|
||||||
|
qint32 videoQuality = _videoQuality;
|
||||||
|
|
||||||
stream >> themesAccentColors;
|
stream >> themesAccentColors;
|
||||||
if (!stream.atEnd()) {
|
if (!stream.atEnd()) {
|
||||||
|
@ -825,6 +827,9 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
||||||
if (!stream.atEnd()) {
|
if (!stream.atEnd()) {
|
||||||
stream >> recordVideoMessages;
|
stream >> recordVideoMessages;
|
||||||
}
|
}
|
||||||
|
if (!stream.atEnd()) {
|
||||||
|
stream >> videoQuality;
|
||||||
|
}
|
||||||
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()"));
|
||||||
|
@ -1039,6 +1044,9 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
||||||
_ivZoom = ivZoom;
|
_ivZoom = ivZoom;
|
||||||
_skipToastsInFocus = (skipToastsInFocus == 1);
|
_skipToastsInFocus = (skipToastsInFocus == 1);
|
||||||
_recordVideoMessages = (recordVideoMessages == 1);
|
_recordVideoMessages = (recordVideoMessages == 1);
|
||||||
|
_videoQuality = (videoQuality >= 0 && videoQuality <= 4320)
|
||||||
|
? videoQuality
|
||||||
|
: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Settings::getSoundPath(const QString &key) const {
|
QString Settings::getSoundPath(const QString &key) const {
|
||||||
|
@ -1429,6 +1437,7 @@ void Settings::resetOnLastLogout() {
|
||||||
_ttlVoiceClickTooltipHidden = false;
|
_ttlVoiceClickTooltipHidden = false;
|
||||||
_ivZoom = 100;
|
_ivZoom = 100;
|
||||||
_recordVideoMessages = false;
|
_recordVideoMessages = false;
|
||||||
|
_videoQuality = 0;
|
||||||
|
|
||||||
_recentEmojiPreload.clear();
|
_recentEmojiPreload.clear();
|
||||||
_recentEmoji.clear();
|
_recentEmoji.clear();
|
||||||
|
@ -1572,6 +1581,7 @@ auto Settings::skipTranslationLanguagesValue() const
|
||||||
void Settings::setRememberedDeleteMessageOnlyForYou(bool value) {
|
void Settings::setRememberedDeleteMessageOnlyForYou(bool value) {
|
||||||
_rememberedDeleteMessageOnlyForYou = value;
|
_rememberedDeleteMessageOnlyForYou = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Settings::rememberedDeleteMessageOnlyForYou() const {
|
bool Settings::rememberedDeleteMessageOnlyForYou() const {
|
||||||
return _rememberedDeleteMessageOnlyForYou;
|
return _rememberedDeleteMessageOnlyForYou;
|
||||||
}
|
}
|
||||||
|
@ -1579,9 +1589,11 @@ bool Settings::rememberedDeleteMessageOnlyForYou() const {
|
||||||
int Settings::ivZoom() const {
|
int Settings::ivZoom() const {
|
||||||
return _ivZoom.current();
|
return _ivZoom.current();
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<int> Settings::ivZoomValue() const {
|
rpl::producer<int> Settings::ivZoomValue() const {
|
||||||
return _ivZoom.value();
|
return _ivZoom.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::setIvZoom(int value) {
|
void Settings::setIvZoom(int value) {
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
constexpr auto kMin = 25;
|
constexpr auto kMin = 25;
|
||||||
|
@ -1593,4 +1605,12 @@ void Settings::setIvZoom(int value) {
|
||||||
_ivZoom = std::clamp(value, kMin, kMax);
|
_ivZoom = std::clamp(value, kMin, kMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Settings::videoQuality() const {
|
||||||
|
return _videoQuality;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::setVideoQuality(int value) {
|
||||||
|
_videoQuality = value;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|
|
@ -929,6 +929,9 @@ public:
|
||||||
[[nodiscard]] rpl::producer<int> ivZoomValue() const;
|
[[nodiscard]] rpl::producer<int> ivZoomValue() const;
|
||||||
void setIvZoom(int value);
|
void setIvZoom(int value);
|
||||||
|
|
||||||
|
[[nodiscard]] int videoQuality() const;
|
||||||
|
void setVideoQuality(int quality);
|
||||||
|
|
||||||
[[nodiscard]] static bool ThirdColumnByDefault();
|
[[nodiscard]] static bool ThirdColumnByDefault();
|
||||||
[[nodiscard]] static float64 DefaultDialogsWidthRatio();
|
[[nodiscard]] static float64 DefaultDialogsWidthRatio();
|
||||||
|
|
||||||
|
@ -1066,6 +1069,7 @@ private:
|
||||||
std::optional<bool> _weatherInCelsius;
|
std::optional<bool> _weatherInCelsius;
|
||||||
QByteArray _tonsiteStorageToken;
|
QByteArray _tonsiteStorageToken;
|
||||||
rpl::variable<int> _ivZoom = 100;
|
rpl::variable<int> _ivZoom = 100;
|
||||||
|
int _videoQuality = 0;
|
||||||
|
|
||||||
bool _tabbedReplacedWithInfo = false; // per-window
|
bool _tabbedReplacedWithInfo = false; // per-window
|
||||||
rpl::event_stream<bool> _tabbedReplacedWithInfoValue; // per-window
|
rpl::event_stream<bool> _tabbedReplacedWithInfoValue; // per-window
|
||||||
|
|
|
@ -192,11 +192,9 @@ void Document::waitingChange(bool waiting) {
|
||||||
_radial.start(
|
_radial.start(
|
||||||
st::defaultInfiniteRadialAnimation.sineDuration);
|
st::defaultInfiniteRadialAnimation.sineDuration);
|
||||||
}
|
}
|
||||||
_fading.start(
|
_fading.start([=] {
|
||||||
[=] { waitingCallback(); },
|
waitingCallback();
|
||||||
_waiting ? 0. : 1.,
|
}, _waiting ? 0. : 1., _waiting ? 1. : 0., duration);
|
||||||
_waiting ? 1. : 0.,
|
|
||||||
duration);
|
|
||||||
};
|
};
|
||||||
if (waiting) {
|
if (waiting) {
|
||||||
if (_radial.animating()) {
|
if (_radial.animating()) {
|
||||||
|
|
|
@ -958,7 +958,9 @@ Media::Player::TrackState Player::prepareLegacyState() const {
|
||||||
if (duration > 0) {
|
if (duration > 0) {
|
||||||
result.length = duration;
|
result.length = duration;
|
||||||
} else {
|
} else {
|
||||||
result.length = std::max(crl::time(result.position), crl::time(0));
|
result.length = std::max(
|
||||||
|
crl::time(result.position),
|
||||||
|
crl::time(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -489,6 +489,7 @@ OverlayWidget::OverlayWidget()
|
||||||
, _widget(_surface->rpWidget())
|
, _widget(_surface->rpWidget())
|
||||||
, _fullscreen(Core::App().settings().mediaViewPosition().maximized == 2)
|
, _fullscreen(Core::App().settings().mediaViewPosition().maximized == 2)
|
||||||
, _windowed(Core::App().settings().mediaViewPosition().maximized == 0)
|
, _windowed(Core::App().settings().mediaViewPosition().maximized == 0)
|
||||||
|
, _quality(Core::App().settings().videoQuality())
|
||||||
, _layerBg(std::make_unique<Ui::LayerManager>(_body))
|
, _layerBg(std::make_unique<Ui::LayerManager>(_body))
|
||||||
, _docDownload(_body, tr::lng_media_download(tr::now), st::mediaviewFileLink)
|
, _docDownload(_body, tr::lng_media_download(tr::now), st::mediaviewFileLink)
|
||||||
, _docSaveAs(_body, tr::lng_mediaview_save_as(tr::now), st::mediaviewFileLink)
|
, _docSaveAs(_body, tr::lng_mediaview_save_as(tr::now), st::mediaviewFileLink)
|
||||||
|
@ -4436,6 +4437,8 @@ void OverlayWidget::playbackControlsQualityChanged(int quality) {
|
||||||
const auto now = _chosenQuality;
|
const auto now = _chosenQuality;
|
||||||
if (_quality != quality) {
|
if (_quality != quality) {
|
||||||
_quality = quality;
|
_quality = quality;
|
||||||
|
Core::App().settings().setVideoQuality(quality);
|
||||||
|
Core::App().saveSettingsDelayed();
|
||||||
if (_document) {
|
if (_document) {
|
||||||
_chosenQuality = chooseQuality();
|
_chosenQuality = chooseQuality();
|
||||||
if (_chosenQuality != now) {
|
if (_chosenQuality != now) {
|
||||||
|
|
|
@ -34,7 +34,8 @@ PlaybackControls::PlaybackControls(
|
||||||
, _playbackProgress(std::make_unique<PlaybackProgress>())
|
, _playbackProgress(std::make_unique<PlaybackProgress>())
|
||||||
, _volumeToggle(this, st::mediaviewVolumeToggle)
|
, _volumeToggle(this, st::mediaviewVolumeToggle)
|
||||||
, _volumeController(this, st::mediaviewPlayback)
|
, _volumeController(this, st::mediaviewPlayback)
|
||||||
, _speedToggle(Media::Audio::SupportsSpeedControl()
|
, _speedToggle((Media::Audio::SupportsSpeedControl()
|
||||||
|
|| !_delegate->playbackControlsQualities().empty())
|
||||||
? object_ptr<Player::SpeedButton>(this, st::mediaviewSpeedButton)
|
? object_ptr<Player::SpeedButton>(this, st::mediaviewSpeedButton)
|
||||||
: nullptr)
|
: nullptr)
|
||||||
, _fullScreenToggle(this, st::mediaviewFullScreenButton)
|
, _fullScreenToggle(this, st::mediaviewFullScreenButton)
|
||||||
|
|
Loading…
Add table
Reference in a new issue