Compare commits

...

19 Commits

Author SHA1 Message Date
John Preston
b0f54822e0 Version 3.0.1.
- Crash fixes.
2021-09-01 19:41:57 +03:00
John Preston
df4c9a0765 Cache correct background faster. 2021-09-01 19:38:36 +03:00
John Preston
47e15d136d Fix background update with all chats closed. 2021-09-01 19:28:02 +03:00
John Preston
5aff4cca0e Fix rare crash in message history resizing. 2021-09-01 19:21:39 +03:00
John Preston
a064e836f2 Removed redundant "base::EnterFromEventLoop". 2021-09-01 19:08:56 +03:00
John Preston
81ed3acfa1 Attempt to fix a crash in event loop nesting tracking. 2021-09-01 19:08:23 +03:00
John Preston
cc2dd31555 Attempt to fix a possible crash in InputField. 2021-09-01 18:50:11 +03:00
John Preston
0ee6395022 Try to a fix crash after lost OpenGL context. 2021-09-01 18:38:12 +03:00
John Preston
1d2a18929a Use QOperatingSystemVersion. 2021-09-01 18:33:53 +03:00
John Preston
a0a3de125a Detect Windows 11 by build number 22000. 2021-09-01 18:33:43 +03:00
John Preston
1cf207671e Fix crash in countries list refresh. 2021-09-01 18:33:24 +03:00
John Preston
c208b5dc58 Couple more of crash fixes. 2021-09-01 13:45:45 +03:00
John Preston
6eb5d47c35 Couple of crash fixes. 2021-09-01 13:27:36 +03:00
23rd
59977da2b4 Added choosing sticker action to field autocomplete. 2021-09-01 01:23:20 +03:00
23rd
4550b2a315 Decreased record bitrate of voice messages.
Fixed #6708.
2021-09-01 01:23:20 +03:00
23rd
bcbab7ad8e Added ability to change playback speed for long audio files. 2021-09-01 01:23:20 +03:00
23rd
b635a9d4a5 Changed voice playback speed setting to storage value of speed. 2021-09-01 01:23:20 +03:00
23rd
eadd7704ef Removed Main::Session forward declaration from data_types. 2021-09-01 01:23:20 +03:00
23rd
e6f0c176f7 Moved AudioMsgId to separated file. 2021-09-01 01:23:20 +03:00
47 changed files with 351 additions and 200 deletions

View File

@@ -354,6 +354,8 @@ PRIVATE
data/data_abstract_sparse_ids.h
data/data_abstract_structure.cpp
data/data_abstract_structure.h
data/data_audio_msg_id.cpp
data/data_audio_msg_id.h
data/data_auto_download.cpp
data/data_auto_download.h
data/data_chat.cpp

View File

@@ -9,7 +9,7 @@
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
ProcessorArchitecture="ARCHITECTURE"
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
Version="3.0.0.0" />
Version="3.0.1.0" />
<Properties>
<DisplayName>Telegram Desktop</DisplayName>
<PublisherDisplayName>Telegram Messenger LLP</PublisherDisplayName>

View File

@@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,0,0,0
PRODUCTVERSION 3,0,0,0
FILEVERSION 3,0,1,0
PRODUCTVERSION 3,0,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -62,10 +62,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram FZ-LLC"
VALUE "FileDescription", "Telegram Desktop"
VALUE "FileVersion", "3.0.0.0"
VALUE "FileVersion", "3.0.1.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2021"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "3.0.0.0"
VALUE "ProductVersion", "3.0.1.0"
END
END
BLOCK "VarFileInfo"

View File

@@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,0,0,0
PRODUCTVERSION 3,0,0,0
FILEVERSION 3,0,1,0
PRODUCTVERSION 3,0,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -53,10 +53,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram FZ-LLC"
VALUE "FileDescription", "Telegram Desktop Updater"
VALUE "FileVersion", "3.0.0.0"
VALUE "FileVersion", "3.0.1.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2021"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "3.0.0.0"
VALUE "ProductVersion", "3.0.1.0"
END
END
BLOCK "VarFileInfo"

View File

@@ -12,6 +12,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
class UserData;
class ChannelData;
namespace Main {
class Session;
} // namespace Main
namespace Window {
class SessionController;
} // namespace Window

View File

@@ -7,6 +7,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
namespace Main {
class Session;
} // namespace Main
class History;
class PhotoData;
class DocumentData;

View File

@@ -1902,14 +1902,17 @@ void StickersBox::Inner::handleMegagroupSetAddressChange() {
void StickersBox::Inner::rebuildMegagroupSet() {
Expects(_megagroupSet != nullptr);
if (!_megagroupSetInput.id) {
const auto clearCurrent = [&] {
if (_megagroupSelectedSet) {
_megagroupSetField->setText(QString());
_megagroupSetField->finishAnimating();
}
_megagroupSelectedSet.reset();
_megagroupSelectedSet = nullptr;
_megagroupSelectedRemove.destroy();
_megagroupSelectedShadow.destroy();
};
if (!_megagroupSetInput.id) {
clearCurrent();
return;
}
auto setId = _megagroupSetInput.id;
@@ -1917,6 +1920,10 @@ void StickersBox::Inner::rebuildMegagroupSet() {
auto it = sets.find(setId);
if (it == sets.cend()
|| (it->second->flags & SetFlag::NotLoaded)) {
// It may have been in sets and stored in _megagroupSelectedSet
// already, but then removed from sets. We need to clear the stored
// pointer, otherwise we may crash in paint event while loading.
clearCurrent();
session().api().scheduleStickerSetRequest(
_megagroupSetInput.id,
_megagroupSetInput.accessHash);

View File

@@ -199,6 +199,11 @@ auto FieldAutocomplete::stickerChosen() const
return _inner->stickerChosen();
}
auto FieldAutocomplete::choosingProcesses() const
-> rpl::producer<FieldAutocomplete::Type> {
return _scroll->scrollTopChanges() | rpl::map([=] { return _type; });
}
FieldAutocomplete::~FieldAutocomplete() = default;
void FieldAutocomplete::paintEvent(QPaintEvent *e) {

View File

@@ -87,6 +87,12 @@ public:
Api::SendOptions options;
ChooseMethod method;
};
enum class Type {
Mentions,
Hashtags,
BotCommands,
Stickers,
};
bool chooseSelected(ChooseMethod method) const;
@@ -111,6 +117,7 @@ public:
rpl::producer<HashtagChosen> hashtagChosen() const;
rpl::producer<BotCommandChosen> botCommandChosen() const;
rpl::producer<StickerChosen> stickerChosen() const;
rpl::producer<Type> choosingProcesses() const;
public Q_SLOTS:
void showAnimated();
@@ -176,12 +183,6 @@ private:
ChannelData *_channel = nullptr;
EmojiPtr _emoji;
uint64 _stickersSeed = 0;
enum class Type {
Mentions,
Hashtags,
BotCommands,
Stickers,
};
Type _type = Type::Mentions;
QString _filter;
QRect _boundings;

View File

@@ -140,7 +140,7 @@ QByteArray Settings::serialize() const {
<< qint32(_askDownloadPath ? 1 : 0)
<< _downloadPath.current()
<< _downloadPathBookmark
<< qint32(_voiceMsgPlaybackDoubled ? 1 : 0)
<< qint32(0) // Old double voice playback speed.
<< qint32(_soundNotify ? 1 : 0)
<< qint32(_desktopNotify ? 1 : 0)
<< qint32(_flashBounceNotify ? 1 : 0)
@@ -219,7 +219,8 @@ QByteArray Settings::serialize() const {
<< qint32(_hiddenGroupCallTooltips.value())
<< qint32(_disableOpenGL ? 1 : 0)
<< _photoEditorBrush
<< qint32(_groupCallNoiseSuppression ? 1 : 0);
<< qint32(_groupCallNoiseSuppression ? 1 : 0)
<< qint32(_voicePlaybackSpeed * 100);
}
return result;
}
@@ -240,7 +241,7 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
qint32 askDownloadPath = _askDownloadPath ? 1 : 0;
QString downloadPath = _downloadPath.current();
QByteArray downloadPathBookmark = _downloadPathBookmark;
qint32 voiceMsgPlaybackDoubled = _voiceMsgPlaybackDoubled ? 1 : 0;
qint32 oldVoiceMsgPlaybackDoubled = 0;
qint32 soundNotify = _soundNotify ? 1 : 0;
qint32 desktopNotify = _desktopNotify ? 1 : 0;
qint32 flashBounceNotify = _flashBounceNotify ? 1 : 0;
@@ -271,6 +272,7 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
qint32 suggestStickersByEmoji = _suggestStickersByEmoji ? 1 : 0;
qint32 spellcheckerEnabled = _spellcheckerEnabled.current() ? 1 : 0;
qint32 videoPlaybackSpeed = Core::Settings::SerializePlaybackSpeed(_videoPlaybackSpeed.current());
qint32 voicePlaybackSpeed = _voicePlaybackSpeed * 100;
QByteArray videoPipGeometry = _videoPipGeometry;
qint32 dictionariesEnabledCount = 0;
std::vector<int> dictionariesEnabled;
@@ -312,7 +314,7 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
>> askDownloadPath
>> downloadPath
>> downloadPathBookmark
>> voiceMsgPlaybackDoubled
>> oldVoiceMsgPlaybackDoubled
>> soundNotify
>> desktopNotify
>> flashBounceNotify
@@ -455,6 +457,9 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
if (!stream.atEnd()) {
stream >> groupCallNoiseSuppression;
}
if (!stream.atEnd()) {
stream >> voicePlaybackSpeed;
}
if (stream.status() != QDataStream::Ok) {
LOG(("App Error: "
"Bad data for Core::Settings::constructFromSerialized()"));
@@ -471,7 +476,6 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
_askDownloadPath = (askDownloadPath == 1);
_downloadPath = downloadPath;
_downloadPathBookmark = downloadPathBookmark;
_voiceMsgPlaybackDoubled = (voiceMsgPlaybackDoubled == 1);
_soundNotify = (soundNotify == 1);
_desktopNotify = (desktopNotify == 1);
_flashBounceNotify = (flashBounceNotify == 1);
@@ -525,6 +529,9 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
_suggestStickersByEmoji = (suggestStickersByEmoji == 1);
_spellcheckerEnabled = (spellcheckerEnabled == 1);
_videoPlaybackSpeed = DeserializePlaybackSpeed(videoPlaybackSpeed);
_voicePlaybackSpeed = oldVoiceMsgPlaybackDoubled
? 2.0
: voicePlaybackSpeed / 100.;
_videoPipGeometry = (videoPipGeometry);
_dictionariesEnabled = std::move(dictionariesEnabled);
_autoDownloadDictionaries = (autoDownloadDictionaries == 1);
@@ -782,7 +789,6 @@ void Settings::resetOnLastLogout() {
_downloadPath = QString();
_downloadPathBookmark = QByteArray();
_voiceMsgPlaybackDoubled = false;
_soundNotify = true;
_desktopNotify = true;
_flashBounceNotify = true;
@@ -826,6 +832,7 @@ void Settings::resetOnLastLogout() {
_suggestStickersByEmoji = true;
_spellcheckerEnabled = true;
_videoPlaybackSpeed = 1.;
_voicePlaybackSpeed = 1.;
//_videoPipGeometry = QByteArray();
_dictionariesEnabled = std::vector<int>();
_autoDownloadDictionaries = true;

View File

@@ -146,12 +146,6 @@ public:
void setDownloadPathBookmark(const QByteArray &value) {
_downloadPathBookmark = value;
}
[[nodiscard]] bool voiceMsgPlaybackDoubled() const {
return _voiceMsgPlaybackDoubled;
}
void setVoiceMsgPlaybackDoubled(bool value) {
_voiceMsgPlaybackDoubled = value;
}
[[nodiscard]] bool soundNotify() const {
return _soundNotify;
}
@@ -427,6 +421,12 @@ public:
void setVideoPlaybackSpeed(float64 speed) {
_videoPlaybackSpeed = speed;
}
[[nodiscard]] float64 voicePlaybackSpeed() const {
return _voicePlaybackSpeed;
}
void setVoicePlaybackSpeed(float64 speed) {
_voicePlaybackSpeed = speed;
}
[[nodiscard]] QByteArray videoPipGeometry() const {
return _videoPipGeometry;
}
@@ -633,7 +633,6 @@ private:
bool _askDownloadPath = false;
rpl::variable<QString> _downloadPath;
QByteArray _downloadPathBookmark;
bool _voiceMsgPlaybackDoubled = false;
bool _soundNotify = true;
bool _desktopNotify = true;
bool _flashBounceNotify = true;
@@ -670,6 +669,7 @@ private:
bool _suggestStickersByEmoji = true;
rpl::variable<bool> _spellcheckerEnabled = true;
rpl::variable<float64> _videoPlaybackSpeed = 1.;
float64 _voicePlaybackSpeed = 1.;
QByteArray _videoPipGeometry;
rpl::variable<std::vector<int>> _dictionariesEnabled;
rpl::variable<bool> _autoDownloadDictionaries = true;

View File

@@ -617,11 +617,3 @@ rpl::producer<> on_main_update_requests() {
}
} // namespace crl
namespace base {
void EnterFromEventLoop(FnMut<void()> &&method) {
Core::Sandbox::Instance().customEnterFromEventLoop(std::move(method));
}
} // namespace base

View File

@@ -22,7 +22,7 @@ constexpr auto AppId = "{53F49750-6209-4FBF-9CA8-7A333C87D1ED}"_cs;
constexpr auto AppNameOld = "Telegram Win (Unofficial)"_cs;
constexpr auto AppName = "Telegram Desktop"_cs;
constexpr auto AppFile = "Telegram"_cs;
constexpr auto AppVersion = 3000000;
constexpr auto AppVersionStr = "3.0";
constexpr auto AppVersion = 3000001;
constexpr auto AppVersionStr = "3.0.1";
constexpr auto AppBetaVersion = false;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;

View File

@@ -260,6 +260,8 @@ const std::vector<Info> &CountriesInstance::list() {
void CountriesInstance::setList(std::vector<Info> &&infos) {
_list = std::move(infos);
_byCode.clear();
_byISO2.clear();
}
const CountriesInstance::Map &CountriesInstance::byCode() {

View File

@@ -0,0 +1,103 @@
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "data/data_audio_msg_id.h"
#include "data/data_document.h"
namespace {
constexpr auto kMinLengthForChangeablePlaybackSpeed = 20 * TimeId(60); // 20 minutes.
} // namespace
AudioMsgId::AudioMsgId() {
}
AudioMsgId::AudioMsgId(
not_null<DocumentData*> audio,
FullMsgId msgId,
uint32 externalPlayId)
: _audio(audio)
, _contextId(msgId)
, _externalPlayId(externalPlayId)
, _changeablePlaybackSpeed(_audio->isVoiceMessage()
|| _audio->isVideoMessage()
|| (_audio->getDuration() >= kMinLengthForChangeablePlaybackSpeed)) {
setTypeFromAudio();
}
uint32 AudioMsgId::CreateExternalPlayId() {
static auto Result = uint32(0);
return ++Result ? Result : ++Result;
}
AudioMsgId AudioMsgId::ForVideo() {
auto result = AudioMsgId();
result._externalPlayId = CreateExternalPlayId();
result._type = Type::Video;
return result;
}
void AudioMsgId::setTypeFromAudio() {
if (_audio->isVoiceMessage() || _audio->isVideoMessage()) {
_type = Type::Voice;
} else if (_audio->isVideoFile()) {
_type = Type::Video;
} else if (_audio->isAudioFile()) {
_type = Type::Song;
} else {
_type = Type::Unknown;
}
}
AudioMsgId::Type AudioMsgId::type() const {
return _type;
}
DocumentData *AudioMsgId::audio() const {
return _audio;
}
FullMsgId AudioMsgId::contextId() const {
return _contextId;
}
uint32 AudioMsgId::externalPlayId() const {
return _externalPlayId;
}
bool AudioMsgId::changeablePlaybackSpeed() const {
return _changeablePlaybackSpeed;
}
AudioMsgId::operator bool() const {
return (_audio != nullptr) || (_externalPlayId != 0);
}
bool AudioMsgId::operator<(const AudioMsgId &other) const {
if (quintptr(audio()) < quintptr(other.audio())) {
return true;
} else if (quintptr(other.audio()) < quintptr(audio())) {
return false;
} else if (contextId() < other.contextId()) {
return true;
} else if (other.contextId() < contextId()) {
return false;
}
return (externalPlayId() < other.externalPlayId());
}
bool AudioMsgId::operator==(const AudioMsgId &other) const {
return (audio() == other.audio())
&& (contextId() == other.contextId())
&& (externalPlayId() == other.externalPlayId());
}
bool AudioMsgId::operator!=(const AudioMsgId &other) const {
return !(*this == other);
}

View File

@@ -0,0 +1,50 @@
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
class DocumentData;
class AudioMsgId final {
public:
enum class Type {
Unknown,
Voice,
Song,
Video,
};
AudioMsgId();
AudioMsgId(
not_null<DocumentData*> audio,
FullMsgId msgId,
uint32 externalPlayId = 0);
[[nodiscard]] static uint32 CreateExternalPlayId();
[[nodiscard]] static AudioMsgId ForVideo();
[[nodiscard]] Type type() const;
[[nodiscard]] DocumentData *audio() const;
[[nodiscard]] FullMsgId contextId() const;
[[nodiscard]] uint32 externalPlayId() const;
[[nodiscard]] bool changeablePlaybackSpeed() const;
[[nodiscard]] explicit operator bool() const;
bool operator<(const AudioMsgId &other) const;
bool operator==(const AudioMsgId &other) const;
bool operator!=(const AudioMsgId &other) const;
private:
void setTypeFromAudio();
DocumentData *_audio = nullptr;
Type _type = Type::Unknown;
FullMsgId _contextId;
uint32 _externalPlayId = 0;
bool _changeablePlaybackSpeed = false;
};

View File

@@ -17,6 +17,10 @@ namespace Dialogs {
class Entry;
} // namespace Dialogs
namespace Main {
class Session;
} // namespace Main
namespace Data {
namespace details {

View File

@@ -7,12 +7,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "data/data_types.h"
#include "data/data_document.h"
#include "data/data_session.h"
#include "ui/widgets/input_fields.h"
#include "storage/cache/storage_cache_types.h"
#include "base/openssl_help.h"
#include "main/main_session.h"
namespace Data {
namespace {
@@ -90,30 +87,6 @@ Storage::Cache::Key GeoPointCacheKey(const GeoPointLocation &location) {
} // namespace Data
uint32 AudioMsgId::CreateExternalPlayId() {
static auto Result = uint32(0);
return ++Result ? Result : ++Result;
}
AudioMsgId AudioMsgId::ForVideo() {
auto result = AudioMsgId();
result._externalPlayId = CreateExternalPlayId();
result._type = Type::Video;
return result;
}
void AudioMsgId::setTypeFromAudio() {
if (_audio->isVoiceMessage() || _audio->isVideoMessage()) {
_type = Type::Voice;
} else if (_audio->isVideoFile()) {
_type = Type::Video;
} else if (_audio->isAudioFile()) {
_type = Type::Song;
} else {
_type = Type::Unknown;
}
}
void MessageCursor::fillFrom(not_null<const Ui::InputField*> field) {
const auto cursor = field->textCursor();
position = cursor.position();

View File

@@ -28,10 +28,6 @@ namespace Ui {
class InputField;
} // namespace Ui
namespace Main {
class Session;
} // namespace Main
namespace Images {
enum class Option;
using Options = base::flags<Option>;
@@ -192,8 +188,6 @@ struct WebPageData;
struct GameData;
struct PollData;
class AudioMsgId;
using PhotoId = uint64;
using VideoId = uint64;
using AudioId = uint64;
@@ -246,78 +240,6 @@ inline constexpr auto kStickerSideSize = 512;
using MediaKey = QPair<uint64, uint64>;
class AudioMsgId {
public:
enum class Type {
Unknown,
Voice,
Song,
Video,
};
AudioMsgId() = default;
AudioMsgId(
not_null<DocumentData*> audio,
FullMsgId msgId,
uint32 externalPlayId = 0)
: _audio(audio)
, _contextId(msgId)
, _externalPlayId(externalPlayId) {
setTypeFromAudio();
}
[[nodiscard]] static uint32 CreateExternalPlayId();
[[nodiscard]] static AudioMsgId ForVideo();
[[nodiscard]] Type type() const {
return _type;
}
[[nodiscard]] DocumentData *audio() const {
return _audio;
}
[[nodiscard]] FullMsgId contextId() const {
return _contextId;
}
[[nodiscard]] uint32 externalPlayId() const {
return _externalPlayId;
}
[[nodiscard]] explicit operator bool() const {
return (_audio != nullptr) || (_externalPlayId != 0);
}
private:
void setTypeFromAudio();
DocumentData *_audio = nullptr;
Type _type = Type::Unknown;
FullMsgId _contextId;
uint32 _externalPlayId = 0;
};
inline bool operator<(const AudioMsgId &a, const AudioMsgId &b) {
if (quintptr(a.audio()) < quintptr(b.audio())) {
return true;
} else if (quintptr(b.audio()) < quintptr(a.audio())) {
return false;
} else if (a.contextId() < b.contextId()) {
return true;
} else if (b.contextId() < a.contextId()) {
return false;
}
return (a.externalPlayId() < b.externalPlayId());
}
inline bool operator==(const AudioMsgId &a, const AudioMsgId &b) {
return (a.audio() == b.audio())
&& (a.contextId() == b.contextId())
&& (a.externalPlayId() == b.externalPlayId());
}
inline bool operator!=(const AudioMsgId &a, const AudioMsgId &b) {
return !(a == b);
}
struct MessageCursor {
MessageCursor() = default;
MessageCursor(int position, int anchor, int scroll)

View File

@@ -14,6 +14,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
class History;
namespace Main {
class Session;
} // namespace Main
namespace Window {
class SessionController;
} // namespace Window

View File

@@ -360,6 +360,18 @@ HistoryWidget::HistoryWidget(
: _keyboard->moderateKeyActivate(key);
});
_fieldAutocomplete->choosingProcesses(
) | rpl::start_with_next([=](FieldAutocomplete::Type type) {
if (!_history) {
return;
}
if (type == FieldAutocomplete::Type::Stickers) {
session().sendProgressManager().update(
_history,
Api::SendProgressType::ChooseSticker);
}
}, lifetime());
_fieldAutocomplete->setSendMenuType([=] { return sendMenuType(); });
if (_supportAutocomplete) {
@@ -5006,6 +5018,8 @@ void HistoryWidget::startItemRevealAnimations() {
}
void HistoryWidget::updateListSize() {
Expects(_list != nullptr);
_list->recountHistoryGeometry();
auto washidden = _scroll->isHidden();
if (washidden) {
@@ -5021,6 +5035,16 @@ void HistoryWidget::updateListSize() {
}
bool HistoryWidget::hasPendingResizedItems() const {
if (!_list) {
// Based on the crash reports there is a codepath (at least on macOS)
// that leads from _list = _scroll->setOwnedWidget(...) right into
// the HistoryWidget::paintEvent (by sending fake mouse move events
// inside scroll area -> hiding tooltip window -> exposing the main
// window -> syncing it backing store synchronously).
//
// So really we could get here with !_list && (_history != nullptr).
return false;
}
return (_history && _history->hasPendingResizedItems())
|| (_migrated && _migrated->hasPendingResizedItems());
}

View File

@@ -1236,6 +1236,15 @@ void ComposeControls::initAutocomplete() {
});
}, _autocomplete->lifetime());
_autocomplete->choosingProcesses(
) | rpl::start_with_next([=](FieldAutocomplete::Type type) {
if (type == FieldAutocomplete::Type::Stickers) {
_sendActionUpdates.fire({
.type = Api::SendProgressType::ChooseSticker,
});
}
}, _autocomplete->lifetime());
_autocomplete->setSendMenuType([=] { return sendMenuType(); });
//_autocomplete->setModerateKeyActivateCallback([=](int key) {

View File

@@ -9,6 +9,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/unique_qptr.h"
namespace Main {
class Session;
} // namespace Main
namespace Ui {
class PopupMenu;
enum class ReportReason;

View File

@@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/effects/animation_value.h"
#include "ui/chat/attach/attach_prepare.h"
#include "core/file_location.h"
#include "data/data_audio_msg_id.h"
#include "base/bytes.h"
#include "base/timer.h"

View File

@@ -305,7 +305,7 @@ void Instance::Inner::start(Fn<void(Update)> updated, Fn<void()> error) {
av_opt_set_int(d->codecContext, "refcounted_frames", 1, 0);
d->codecContext->sample_fmt = AV_SAMPLE_FMT_FLTP;
d->codecContext->bit_rate = 64000;
d->codecContext->bit_rate = 32000;
d->codecContext->channel_layout = AV_CH_LAYOUT_MONO;
d->codecContext->sample_rate = kCaptureFrequency;
d->codecContext->channels = 1;

View File

@@ -36,8 +36,6 @@ namespace {
Instance *SingleInstance = nullptr;
constexpr auto kVoicePlaybackSpeedMultiplier = 1.7;
// Preload X message ids before and after current.
constexpr auto kIdsLimit = 32;
@@ -46,6 +44,10 @@ constexpr auto kIdsPreloadAfter = 28;
constexpr auto kMinLengthForSavePosition = 20 * TimeId(60); // 20 minutes.
auto VoicePlaybackSpeed() {
return std::clamp(Core::App().settings().voicePlaybackSpeed(), 0.6, 1.7);
}
} // namespace
struct Instance::Streamed {
@@ -517,10 +519,8 @@ Streaming::PlaybackOptions Instance::streamingOptions(
result.mode = (document && document->isVideoMessage())
? Streaming::Mode::Both
: Streaming::Mode::Audio;
result.speed = (document
&& (document->isVoiceMessage() || document->isVideoMessage())
&& Core::App().settings().voiceMsgPlaybackDoubled())
? kVoicePlaybackSpeedMultiplier
result.speed = audioId.changeablePlaybackSpeed()
? VoicePlaybackSpeed()
: 1.;
result.audioId = audioId;
if (position >= 0) {
@@ -676,11 +676,12 @@ void Instance::cancelSeeking(AudioMsgId::Type type) {
}
void Instance::updateVoicePlaybackSpeed() {
if (const auto data = getData(AudioMsgId::Type::Voice)) {
if (const auto data = getData(getActiveType())) {
if (!data->current.changeablePlaybackSpeed()) {
return;
}
if (const auto streamed = data->streamed.get()) {
streamed->instance.setSpeed(Core::App().settings().voiceMsgPlaybackDoubled()
? kVoicePlaybackSpeedMultiplier
: 1.);
streamed->instance.setSpeed(VoicePlaybackSpeed());
}
}
}

View File

@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "data/data_audio_msg_id.h"
#include "data/data_shared_media.h"
class AudioMsgId;

View File

@@ -148,8 +148,9 @@ Widget::Widget(QWidget *parent, not_null<Main::Session*> session)
updatePlaybackSpeedIcon();
_playbackSpeed->setClickedCallback([=] {
const auto doubled = !Core::App().settings().voiceMsgPlaybackDoubled();
Core::App().settings().setVoiceMsgPlaybackDoubled(doubled);
const auto doubled = (Core::App().settings().voicePlaybackSpeed()
== 2.);
Core::App().settings().setVoicePlaybackSpeed(doubled ? 1. : 2.);
instance()->updateVoicePlaybackSpeed();
updatePlaybackSpeedIcon();
Core::App().saveSettingsDelayed();
@@ -163,6 +164,8 @@ Widget::Widget(QWidget *parent, not_null<Main::Session*> session)
subscribe(instance()->trackChangedNotifier(), [this](AudioMsgId::Type type) {
if (type == _type) {
handleSongChange();
updateControlsVisibility();
updateLabelsGeometry();
}
});
subscribe(instance()->tracksFinishedNotifier(), [this](AudioMsgId::Type type) {
@@ -277,6 +280,10 @@ void Widget::handleSeekFinished(float64 progress) {
}
void Widget::resizeEvent(QResizeEvent *e) {
updateControlsGeometry();
}
void Widget::updateControlsGeometry() {
auto right = st::mediaPlayerCloseRight;
_close->moveToRight(right, st::mediaPlayerPlayTop); right += _close->width();
if (hasPlaybackSpeedControl()) {
@@ -370,7 +377,8 @@ int Widget::getLabelsRight() const {
auto result = st::mediaPlayerCloseRight + _close->width();
if (_type == AudioMsgId::Type::Song) {
result += _repeatTrack->width() + _volumeToggle->width();
} else if (hasPlaybackSpeedControl()) {
}
if (hasPlaybackSpeedControl()) {
result += _playbackSpeed->width();
}
result += st::mediaPlayerPadding;
@@ -396,8 +404,8 @@ void Widget::updateRepeatTrackIcon() {
}
void Widget::updatePlaybackSpeedIcon() {
const auto doubled = Core::App().settings().voiceMsgPlaybackDoubled();
const auto isDefaultSpeed = !doubled;
const auto speed = Core::App().settings().voicePlaybackSpeed();
const auto isDefaultSpeed = (speed == 1.);
_playbackSpeed->setIconOverride(
isDefaultSpeed ? &st::mediaPlayerSpeedDisabledIcon : nullptr,
isDefaultSpeed ? &st::mediaPlayerSpeedDisabledIconOver : nullptr);
@@ -420,21 +428,26 @@ void Widget::checkForTypeChange() {
}
bool Widget::hasPlaybackSpeedControl() const {
return (_type == AudioMsgId::Type::Voice)
return _lastSongId.changeablePlaybackSpeed()
&& Media::Audio::SupportsSpeedControl();
}
void Widget::updateControlsVisibility() {
_repeatTrack->setVisible(_type == AudioMsgId::Type::Song);
_volumeToggle->setVisible(_type == AudioMsgId::Type::Song);
_playbackSpeed->setVisible(hasPlaybackSpeedControl());
if (!_shadow->isHidden()) {
_playbackSlider->setVisible(_type == AudioMsgId::Type::Song);
}
updateControlsGeometry();
}
void Widget::setType(AudioMsgId::Type type) {
if (_type != type) {
_type = type;
_repeatTrack->setVisible(_type == AudioMsgId::Type::Song);
_volumeToggle->setVisible(_type == AudioMsgId::Type::Song);
_playbackSpeed->setVisible(hasPlaybackSpeedControl());
if (!_shadow->isHidden()) {
_playbackSlider->setVisible(_type == AudioMsgId::Type::Song);
}
updateLabelsGeometry();
handleSongChange();
updateControlsVisibility();
updateLabelsGeometry();
handleSongUpdate(instance()->getState(_type));
updateOverLabelsState(_labelsOver);
_playlistChangesLifetime = instance()->playlistChanges(

View File

@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "data/data_audio_msg_id.h"
#include "ui/rp_widget.h"
#include "base/object_ptr.h"
@@ -74,6 +75,8 @@ private:
void updatePlayPrevNextPositions();
void updateLabelsGeometry();
void updateRepeatTrackIcon();
void updateControlsVisibility();
void updateControlsGeometry();
void updatePlaybackSpeedIcon();
void createPrevNextButtons();
void destroyPrevNextButtons();

View File

@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "data/data_audio_msg_id.h"
#include "ui/rect_part.h"
enum class ImageRoundRadius;

View File

@@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "data/data_audio_msg_id.h"
namespace base::Platform {
class SystemMediaControls;
} // namespace base::Platform

View File

@@ -21,6 +21,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mainwindow.h"
#include "windows_quiethours_h.h"
#include <QtCore/QOperatingSystemVersion>
#include <Shobjidl.h>
#include <shellapi.h>
@@ -261,21 +263,13 @@ DWORD QuietHoursValue = 0;
[[nodiscard]] bool UseQuietHoursRegistryEntry() {
static const bool result = [] {
// Taken from QSysInfo.
OSVERSIONINFO result = { sizeof(OSVERSIONINFO), 0, 0, 0, 0,{ '\0' } };
if (const auto library = GetModuleHandle(L"ntdll.dll")) {
using RtlGetVersionFunction = NTSTATUS(NTAPI*)(LPOSVERSIONINFO);
const auto RtlGetVersion = reinterpret_cast<RtlGetVersionFunction>(
GetProcAddress(library, "RtlGetVersion"));
if (RtlGetVersion) {
RtlGetVersion(&result);
}
}
const auto version = QOperatingSystemVersion::current();
// At build 17134 (Redstone 4) the "Quiet hours" was replaced
// by "Focus assist" and it looks like it doesn't use registry.
return (result.dwMajorVersion == 10
&& result.dwMinorVersion == 0
&& result.dwBuildNumber < 17134);
return (version.majorVersion() == 10)
&& (version.minorVersion() == 0)
&& (version.microVersion() < 17134);
}();
return result;
}

View File

@@ -1112,7 +1112,9 @@ bool ReadSetting(
stream >> v;
if (!CheckStreamStatus(stream)) return false;
Core::App().settings().setVoiceMsgPlaybackDoubled(v == 2);
if (v == 2) {
Core::App().settings().setVoicePlaybackSpeed(2.);
}
context.legacyRead = true;
} break;

View File

@@ -12,6 +12,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "api/api_common.h"
#include "ui/chat/attach/attach_prepare.h"
namespace Main {
class Session;
} // namespace Main
constexpr auto kFileSizeLimit = 2000 * 1024 * 1024; // Load files up to 2000MB
enum class SendMediaType {

View File

@@ -7,6 +7,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
namespace Main {
class Session;
} // namespace Main
namespace Serialize {
int storageImageLocationSize(const StorageImageLocation &location);

View File

@@ -18,7 +18,7 @@ namespace Ui {
namespace {
constexpr auto kMaxChatEntryHistorySize = 50;
constexpr auto kCacheBackgroundTimeout = 3 * crl::time(1000);
constexpr auto kCacheBackgroundTimeout = 1 * crl::time(1000);
constexpr auto kCacheBackgroundFastTimeout = crl::time(200);
constexpr auto kBackgroundFadeDuration = crl::time(200);
constexpr auto kMinimumTiledSize = 512;

View File

@@ -73,7 +73,11 @@ AbstractSectionWidget::AbstractSectionWidget(
peerForBackground
) | rpl::map([=](PeerData *peer) -> rpl::producer<> {
if (!peer) {
return rpl::never<>();
return rpl::single(
rpl::empty_value()
) | rpl::then(
controller->defaultChatTheme()->repaintBackgroundRequests()
);
}
return ChatThemeValueFromPeer(
controller,

View File

@@ -162,7 +162,7 @@ void AddChatMembers(
}
bool PinnedLimitReached(Dialogs::Key key, FilterId filterId) {
Expects(key.entry()->folderKnown());
Expects(filterId != 0 || key.entry()->folderKnown());
const auto entry = key.entry();
const auto owner = &entry->owner();

View File

@@ -29,7 +29,7 @@ ENV LibrariesPath /usr/src/Libraries
WORKDIR $LibrariesPath
FROM builder AS patches
RUN git clone $GIT/desktop-app/patches.git && cd patches && git checkout 3ffe48e
RUN git clone $GIT/desktop-app/patches.git && cd patches && git checkout d58ce6b2b0
FROM builder AS extra-cmake-modules

View File

@@ -1,7 +1,7 @@
AppVersion 3000000
AppVersion 3000001
AppVersionStrMajor 3.0
AppVersionStrSmall 3.0
AppVersionStr 3.0.0
AppVersionStrSmall 3.0.1
AppVersionStr 3.0.1
BetaChannel 0
AlphaVersion 0
AppVersionOriginal 3.0
AppVersionOriginal 3.0.1

View File

@@ -1,3 +1,7 @@
3.0.1 (01.09.21)
- Crash fixes.
3.0 (31.08.21)
- Broadcast video and share your screen to an unlimited number of viewers.

View File

@@ -29,7 +29,7 @@ Go to ***BuildPath*** and run
git clone https://github.com/desktop-app/patches.git
cd patches
git checkout 87a2e9ee07
git checkout d58ce6b2b0
cd ../
git clone https://chromium.googlesource.com/external/gyp
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
@@ -58,7 +58,7 @@ Go to ***BuildPath*** and run
git clone https://github.com/desktop-app/patches.git
cd patches
git checkout 87a2e9ee07
git checkout d58ce6b2b0
cd ..
git clone https://git.tukaani.org/xz.git

View File

@@ -34,7 +34,7 @@ Open **x64 Native Tools Command Prompt for VS 2019.bat**, go to ***BuildPath***
cd ThirdParty
git clone https://github.com/desktop-app/patches.git
cd patches
git checkout 87a2e9ee07
git checkout d58ce6b2b0
cd ../
git clone https://chromium.googlesource.com/external/gyp
cd gyp
@@ -65,7 +65,7 @@ Open **x64 Native Tools Command Prompt for VS 2019.bat**, go to ***BuildPath***
git clone https://github.com/desktop-app/patches.git
cd patches
git checkout 87a2e9ee07
git checkout d58ce6b2b0
cd ..
git clone https://github.com/desktop-app/lzma.git

View File

@@ -34,7 +34,7 @@ Open **x86 Native Tools Command Prompt for VS 2019.bat**, go to ***BuildPath***
cd ThirdParty
git clone https://github.com/desktop-app/patches.git
cd patches
git checkout 87a2e9ee07
git checkout d58ce6b2b0
cd ..
git clone https://chromium.googlesource.com/external/gyp
@@ -68,7 +68,7 @@ Open **x86 Native Tools Command Prompt for VS 2019.bat**, go to ***BuildPath***
git clone https://github.com/desktop-app/patches.git
cd patches
git checkout 87a2e9ee07
git checkout d58ce6b2b0
cd ..
git clone https://github.com/desktop-app/lzma.git