mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Reuse new speed change control for video.
This commit is contained in:
@@ -15,7 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "base/platform/base_platform_info.h"
|
||||
#include "webrtc/webrtc_create_adm.h"
|
||||
#include "media/player/media_player_instance.h"
|
||||
#include "media/audio/media_audio.h"
|
||||
#include "media/media_common.h"
|
||||
#include "ui/gl/gl_detection.h"
|
||||
#include "calls/group/calls_group_common.h"
|
||||
#include "spellcheck/spellcheck_types.h"
|
||||
@@ -119,10 +119,6 @@ void LogPosition(const WindowPosition &position, const QString &name) {
|
||||
return position;
|
||||
}
|
||||
|
||||
float64 Settings::PlaybackSpeed::Default() {
|
||||
return Media::Audio::kSpedUpDefault;
|
||||
}
|
||||
|
||||
Settings::Settings()
|
||||
: _sendSubmitWay(Ui::InputSubmitSettings::Enter)
|
||||
, _floatPlayerColumn(Window::Column::Second)
|
||||
@@ -814,17 +810,17 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
||||
_closeToTaskbar = (closeToTaskbar == 1);
|
||||
_customDeviceModel = customDeviceModel;
|
||||
_accountsOrder = accountsOrder;
|
||||
const auto uncheckedPlayerRepeatMode = static_cast<Media::Player::RepeatMode>(playerRepeatMode);
|
||||
const auto uncheckedPlayerRepeatMode = static_cast<Media::RepeatMode>(playerRepeatMode);
|
||||
switch (uncheckedPlayerRepeatMode) {
|
||||
case Media::Player::RepeatMode::None:
|
||||
case Media::Player::RepeatMode::One:
|
||||
case Media::Player::RepeatMode::All: _playerRepeatMode = uncheckedPlayerRepeatMode; break;
|
||||
case Media::RepeatMode::None:
|
||||
case Media::RepeatMode::One:
|
||||
case Media::RepeatMode::All: _playerRepeatMode = uncheckedPlayerRepeatMode; break;
|
||||
}
|
||||
const auto uncheckedPlayerOrderMode = static_cast<Media::Player::OrderMode>(playerOrderMode);
|
||||
const auto uncheckedPlayerOrderMode = static_cast<Media::OrderMode>(playerOrderMode);
|
||||
switch (uncheckedPlayerOrderMode) {
|
||||
case Media::Player::OrderMode::Default:
|
||||
case Media::Player::OrderMode::Reverse:
|
||||
case Media::Player::OrderMode::Shuffle: _playerOrderMode = uncheckedPlayerOrderMode; break;
|
||||
case Media::OrderMode::Default:
|
||||
case Media::OrderMode::Reverse:
|
||||
case Media::OrderMode::Shuffle: _playerOrderMode = uncheckedPlayerOrderMode; break;
|
||||
}
|
||||
_macWarnBeforeQuit = (macWarnBeforeQuit == 1);
|
||||
_hardwareAcceleratedVideo = (hardwareAcceleratedVideo == 1);
|
||||
@@ -1178,7 +1174,7 @@ float64 Settings::DefaultDialogsWidthRatio() {
|
||||
}
|
||||
|
||||
qint32 Settings::SerializePlaybackSpeed(PlaybackSpeed speed) {
|
||||
using namespace Media::Audio;
|
||||
using namespace Media;
|
||||
|
||||
const auto value = int(base::SafeRound(
|
||||
std::clamp(speed.value, kSpeedMin, kSpeedMax) * 100));
|
||||
@@ -1186,7 +1182,7 @@ qint32 Settings::SerializePlaybackSpeed(PlaybackSpeed speed) {
|
||||
}
|
||||
|
||||
auto Settings::DeserializePlaybackSpeed(qint32 speed) -> PlaybackSpeed {
|
||||
using namespace Media::Audio;
|
||||
using namespace Media;
|
||||
|
||||
auto enabled = true;
|
||||
const auto validate = [&](float64 result) {
|
||||
|
@@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#pragma once
|
||||
|
||||
#include "core/core_settings_proxy.h"
|
||||
#include "media/media_common.h"
|
||||
#include "window/themes/window_themes_embedded.h"
|
||||
#include "ui/chat/attach/attach_send_files_way.h"
|
||||
#include "platform/platform_notifications_manager.h"
|
||||
@@ -37,11 +38,6 @@ namespace Calls::Group {
|
||||
enum class StickedTooltip;
|
||||
} // namespace Calls::Group
|
||||
|
||||
namespace Media::Player {
|
||||
enum class RepeatMode;
|
||||
enum class OrderMode;
|
||||
} // namespace Media::Player
|
||||
|
||||
namespace Core {
|
||||
|
||||
struct WindowPosition {
|
||||
@@ -718,28 +714,28 @@ public:
|
||||
[[nodiscard]] rpl::producer<QString> deviceModelChanges() const;
|
||||
[[nodiscard]] rpl::producer<QString> deviceModelValue() const;
|
||||
|
||||
void setPlayerRepeatMode(Media::Player::RepeatMode mode) {
|
||||
void setPlayerRepeatMode(Media::RepeatMode mode) {
|
||||
_playerRepeatMode = mode;
|
||||
}
|
||||
[[nodiscard]] Media::Player::RepeatMode playerRepeatMode() const {
|
||||
[[nodiscard]] Media::RepeatMode playerRepeatMode() const {
|
||||
return _playerRepeatMode.current();
|
||||
}
|
||||
[[nodiscard]] rpl::producer<Media::Player::RepeatMode> playerRepeatModeValue() const {
|
||||
[[nodiscard]] rpl::producer<Media::RepeatMode> playerRepeatModeValue() const {
|
||||
return _playerRepeatMode.value();
|
||||
}
|
||||
[[nodiscard]] rpl::producer<Media::Player::RepeatMode> playerRepeatModeChanges() const {
|
||||
[[nodiscard]] rpl::producer<Media::RepeatMode> playerRepeatModeChanges() const {
|
||||
return _playerRepeatMode.changes();
|
||||
}
|
||||
void setPlayerOrderMode(Media::Player::OrderMode mode) {
|
||||
void setPlayerOrderMode(Media::OrderMode mode) {
|
||||
_playerOrderMode = mode;
|
||||
}
|
||||
[[nodiscard]] Media::Player::OrderMode playerOrderMode() const {
|
||||
[[nodiscard]] Media::OrderMode playerOrderMode() const {
|
||||
return _playerOrderMode.current();
|
||||
}
|
||||
[[nodiscard]] rpl::producer<Media::Player::OrderMode> playerOrderModeValue() const {
|
||||
[[nodiscard]] rpl::producer<Media::OrderMode> playerOrderModeValue() const {
|
||||
return _playerOrderMode.value();
|
||||
}
|
||||
[[nodiscard]] rpl::producer<Media::Player::OrderMode> playerOrderModeChanges() const {
|
||||
[[nodiscard]] rpl::producer<Media::OrderMode> playerOrderModeChanges() const {
|
||||
return _playerOrderMode.changes();
|
||||
}
|
||||
[[nodiscard]] std::vector<uint64> accountsOrder() const {
|
||||
@@ -811,9 +807,7 @@ public:
|
||||
[[nodiscard]] static float64 DefaultDialogsWidthRatio();
|
||||
|
||||
struct PlaybackSpeed {
|
||||
[[nodiscard]] static float64 Default();
|
||||
|
||||
float64 value = Default();
|
||||
float64 value = Media::kSpedUpDefault;
|
||||
bool enabled = false;
|
||||
};
|
||||
[[nodiscard]] static qint32 SerializePlaybackSpeed(PlaybackSpeed speed);
|
||||
@@ -909,8 +903,8 @@ private:
|
||||
base::flags<Calls::Group::StickedTooltip> _hiddenGroupCallTooltips;
|
||||
rpl::variable<bool> _closeToTaskbar = false;
|
||||
rpl::variable<QString> _customDeviceModel;
|
||||
rpl::variable<Media::Player::RepeatMode> _playerRepeatMode;
|
||||
rpl::variable<Media::Player::OrderMode> _playerOrderMode;
|
||||
rpl::variable<Media::RepeatMode> _playerRepeatMode;
|
||||
rpl::variable<Media::OrderMode> _playerOrderMode;
|
||||
bool _macWarnBeforeQuit = true;
|
||||
std::vector<uint64> _accountsOrder;
|
||||
#ifdef Q_OS_MAC
|
||||
|
Reference in New Issue
Block a user