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