Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de230332b9 | ||
|
|
dcf79df0b2 | ||
|
|
9773563926 | ||
|
|
3779ad46ca | ||
|
|
4e7946d03e | ||
|
|
606a90a4ac | ||
|
|
af818b40aa | ||
|
|
ecfe1dacb2 | ||
|
|
60640c7087 | ||
|
|
982edcb310 | ||
|
|
4669c07dc5 | ||
|
|
c164985233 | ||
|
|
497df7f4b2 | ||
|
|
56aab1aa07 | ||
|
|
8abeb4a9db | ||
|
|
d78716d7d4 | ||
|
|
d7489f8e67 | ||
|
|
9d850b71e7 | ||
|
|
684cfa16b8 | ||
|
|
2cb7d76417 | ||
|
|
9bf8b619fe | ||
|
|
664162982c | ||
|
|
718f862be0 | ||
|
|
489bd22828 | ||
|
|
65b5a29288 | ||
|
|
bf345da87b | ||
|
|
1e5aa2a78d | ||
|
|
8cf62c312f | ||
|
|
3b0bf7cb1e | ||
|
|
673072ea5b | ||
|
|
849deb57e2 | ||
|
|
dda587a2fc | ||
|
|
c057f28425 | ||
|
|
a16c6ca41a | ||
|
|
c5845f17ae | ||
|
|
e2f54eb3e9 | ||
|
|
5a1c8e6a0a | ||
|
|
b73390a3f6 | ||
|
|
0c713a930a |
@@ -28,7 +28,7 @@ GOTO:EOF
|
||||
git clone -q --depth 1 --branch master https://github.com/telegramdesktop/dependencies_windows.git %LIB_DIR%
|
||||
cd %LIB_DIR%
|
||||
|
||||
git clone --depth 1 --branch 0.5.0 https://github.com/ericniebler/range-v3
|
||||
git clone --depth 1 --branch 0.9.1 https://github.com/ericniebler/range-v3
|
||||
|
||||
if exist prepare.bat (
|
||||
call prepare.bat
|
||||
|
||||
@@ -28,7 +28,7 @@ GYP_CACHE_VERSION="3"
|
||||
GYP_PATCH="$UPSTREAM/Telegram/Patches/gyp.diff"
|
||||
|
||||
RANGE_PATH="$BUILD/range-v3"
|
||||
RANGE_CACHE_VERSION="4"
|
||||
RANGE_CACHE_VERSION="3"
|
||||
|
||||
VA_PATH="$BUILD/libva"
|
||||
VA_CACHE_VERSION="3"
|
||||
@@ -217,7 +217,7 @@ buildRange() {
|
||||
rm -rf *
|
||||
|
||||
cd "$EXTERNAL"
|
||||
git clone --depth 1 --branch 0.5.0 https://github.com/ericniebler/range-v3
|
||||
git clone --depth 1 --branch 0.9.1 https://github.com/ericniebler/range-v3
|
||||
|
||||
cd "$EXTERNAL/range-v3"
|
||||
cp -r * "$RANGE_PATH/"
|
||||
|
||||
@@ -72,8 +72,11 @@ linkCropLimit: 360px;
|
||||
linkFont: normalFont;
|
||||
linkOverFont: font(fsize underline);
|
||||
|
||||
dateRadius: 6px;
|
||||
buttonRadius: 3px;
|
||||
roundRadiusLarge: 6px;
|
||||
roundRadiusSmall: 3px;
|
||||
|
||||
dateRadius: roundRadiusLarge;
|
||||
buttonRadius: roundRadiusSmall;
|
||||
|
||||
setLittleSkip: 9px;
|
||||
|
||||
|
||||
7
Telegram/Resources/qrc/fonts.qrc
Normal file
7
Telegram/Resources/qrc/fonts.qrc
Normal file
@@ -0,0 +1,7 @@
|
||||
<RCC>
|
||||
<qresource prefix="/gui">
|
||||
<file alias="fonts/OpenSans-Regular.ttf">../fonts/OpenSans-Regular.ttf</file>
|
||||
<file alias="fonts/OpenSans-Bold.ttf">../fonts/OpenSans-Bold.ttf</file>
|
||||
<file alias="fonts/OpenSans-Semibold.ttf">../fonts/OpenSans-Semibold.ttf</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -1,71 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/export">
|
||||
<file alias="css/style.css">../export_html/css/style.css</file>
|
||||
<file alias="images/back.png">../export_html/images/back.png</file>
|
||||
<file alias="images/back@2x.png">../export_html/images/back@2x.png</file>
|
||||
<file alias="images/media_call.png">../export_html/images/media_call.png</file>
|
||||
<file alias="images/media_call@2x.png">../export_html/images/media_call@2x.png</file>
|
||||
<file alias="images/media_contact.png">../export_html/images/media_contact.png</file>
|
||||
<file alias="images/media_contact@2x.png">../export_html/images/media_contact@2x.png</file>
|
||||
<file alias="images/media_file.png">../export_html/images/media_file.png</file>
|
||||
<file alias="images/media_file@2x.png">../export_html/images/media_file@2x.png</file>
|
||||
<file alias="images/media_game.png">../export_html/images/media_game.png</file>
|
||||
<file alias="images/media_game@2x.png">../export_html/images/media_game@2x.png</file>
|
||||
<file alias="images/media_location.png">../export_html/images/media_location.png</file>
|
||||
<file alias="images/media_location@2x.png">../export_html/images/media_location@2x.png</file>
|
||||
<file alias="images/media_music.png">../export_html/images/media_music.png</file>
|
||||
<file alias="images/media_music@2x.png">../export_html/images/media_music@2x.png</file>
|
||||
<file alias="images/media_photo.png">../export_html/images/media_photo.png</file>
|
||||
<file alias="images/media_photo@2x.png">../export_html/images/media_photo@2x.png</file>
|
||||
<file alias="images/media_shop.png">../export_html/images/media_shop.png</file>
|
||||
<file alias="images/media_shop@2x.png">../export_html/images/media_shop@2x.png</file>
|
||||
<file alias="images/media_video.png">../export_html/images/media_video.png</file>
|
||||
<file alias="images/media_video@2x.png">../export_html/images/media_video@2x.png</file>
|
||||
<file alias="images/media_voice.png">../export_html/images/media_voice.png</file>
|
||||
<file alias="images/media_voice@2x.png">../export_html/images/media_voice@2x.png</file>
|
||||
<file alias="images/section_calls.png">../export_html/images/section_calls.png</file>
|
||||
<file alias="images/section_calls@2x.png">../export_html/images/section_calls@2x.png</file>
|
||||
<file alias="images/section_chats.png">../export_html/images/section_chats.png</file>
|
||||
<file alias="images/section_chats@2x.png">../export_html/images/section_chats@2x.png</file>
|
||||
<file alias="images/section_contacts.png">../export_html/images/section_contacts.png</file>
|
||||
<file alias="images/section_contacts@2x.png">../export_html/images/section_contacts@2x.png</file>
|
||||
<file alias="images/section_frequent.png">../export_html/images/section_frequent.png</file>
|
||||
<file alias="images/section_frequent@2x.png">../export_html/images/section_frequent@2x.png</file>
|
||||
<file alias="images/section_other.png">../export_html/images/section_other.png</file>
|
||||
<file alias="images/section_other@2x.png">../export_html/images/section_other@2x.png</file>
|
||||
<file alias="images/section_photos.png">../export_html/images/section_photos.png</file>
|
||||
<file alias="images/section_photos@2x.png">../export_html/images/section_photos@2x.png</file>
|
||||
<file alias="images/section_sessions.png">../export_html/images/section_sessions.png</file>
|
||||
<file alias="images/section_sessions@2x.png">../export_html/images/section_sessions@2x.png</file>
|
||||
<file alias="images/section_web.png">../export_html/images/section_web.png</file>
|
||||
<file alias="images/section_web@2x.png">../export_html/images/section_web@2x.png</file>
|
||||
<file alias="js/script.js">../export_html/js/script.js</file>
|
||||
</qresource>
|
||||
<qresource prefix="/gui">
|
||||
<file alias="fonts/OpenSans-Regular.ttf">../fonts/OpenSans-Regular.ttf</file>
|
||||
<file alias="fonts/OpenSans-Bold.ttf">../fonts/OpenSans-Bold.ttf</file>
|
||||
<file alias="fonts/OpenSans-Semibold.ttf">../fonts/OpenSans-Semibold.ttf</file>
|
||||
<file alias="art/bg.jpg">../art/bg.jpg</file>
|
||||
<file alias="art/bg_initial.jpg">../art/bg_initial.jpg</file>
|
||||
<file alias="art/logo_256.png">../art/logo_256.png</file>
|
||||
<file alias="art/logo_256_no_margin.png">../art/logo_256_no_margin.png</file>
|
||||
<file alias="art/sunrise.jpg">../art/sunrise.jpg</file>
|
||||
<file alias="day-blue.tdesktop-theme">../day-blue.tdesktop-theme</file>
|
||||
<file alias="night.tdesktop-theme">../night.tdesktop-theme</file>
|
||||
<file alias="night-green.tdesktop-theme">../night-green.tdesktop-theme</file>
|
||||
</qresource>
|
||||
<qresource prefix="/sounds">
|
||||
<file alias="msg_incoming.mp3">../sounds/msg_incoming.mp3</file>
|
||||
<file alias="call_incoming.mp3">../sounds/call_incoming.mp3</file>
|
||||
<file alias="call_outgoing.mp3">../sounds/call_outgoing.mp3</file>
|
||||
<file alias="call_busy.mp3">../sounds/call_busy.mp3</file>
|
||||
<file alias="call_connect.mp3">../sounds/call_connect.mp3</file>
|
||||
<file alias="call_end.mp3">../sounds/call_end.mp3</file>
|
||||
</qresource>
|
||||
<qresource prefix="/qt-project.org">
|
||||
<file>qmime/freedesktop.org.xml</file>
|
||||
</qresource>
|
||||
<qresource prefix="/misc">
|
||||
<file alias="default_shortcuts-custom.json">../default_shortcuts-custom.json</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
10
Telegram/Resources/qrc/telegram/sounds.qrc
Normal file
10
Telegram/Resources/qrc/telegram/sounds.qrc
Normal file
@@ -0,0 +1,10 @@
|
||||
<RCC>
|
||||
<qresource prefix="/sounds">
|
||||
<file alias="msg_incoming.mp3">../../sounds/msg_incoming.mp3</file>
|
||||
<file alias="call_busy.mp3">../../sounds/call_busy.mp3</file>
|
||||
<file alias="call_connect.mp3">../../sounds/call_connect.mp3</file>
|
||||
<file alias="call_end.mp3">../../sounds/call_end.mp3</file>
|
||||
<file alias="call_incoming.mp3">../../sounds/call_incoming.mp3</file>
|
||||
<file alias="call_outgoing.mp3">../../sounds/call_outgoing.mp3</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
60
Telegram/Resources/qrc/telegram/telegram.qrc
Normal file
60
Telegram/Resources/qrc/telegram/telegram.qrc
Normal file
@@ -0,0 +1,60 @@
|
||||
<RCC>
|
||||
<qresource prefix="/export">
|
||||
<file alias="css/style.css">../../export_html/css/style.css</file>
|
||||
<file alias="images/back.png">../../export_html/images/back.png</file>
|
||||
<file alias="images/back@2x.png">../../export_html/images/back@2x.png</file>
|
||||
<file alias="images/media_call.png">../../export_html/images/media_call.png</file>
|
||||
<file alias="images/media_call@2x.png">../../export_html/images/media_call@2x.png</file>
|
||||
<file alias="images/media_contact.png">../../export_html/images/media_contact.png</file>
|
||||
<file alias="images/media_contact@2x.png">../../export_html/images/media_contact@2x.png</file>
|
||||
<file alias="images/media_file.png">../../export_html/images/media_file.png</file>
|
||||
<file alias="images/media_file@2x.png">../../export_html/images/media_file@2x.png</file>
|
||||
<file alias="images/media_game.png">../../export_html/images/media_game.png</file>
|
||||
<file alias="images/media_game@2x.png">../../export_html/images/media_game@2x.png</file>
|
||||
<file alias="images/media_location.png">../../export_html/images/media_location.png</file>
|
||||
<file alias="images/media_location@2x.png">../../export_html/images/media_location@2x.png</file>
|
||||
<file alias="images/media_music.png">../../export_html/images/media_music.png</file>
|
||||
<file alias="images/media_music@2x.png">../../export_html/images/media_music@2x.png</file>
|
||||
<file alias="images/media_photo.png">../../export_html/images/media_photo.png</file>
|
||||
<file alias="images/media_photo@2x.png">../../export_html/images/media_photo@2x.png</file>
|
||||
<file alias="images/media_shop.png">../../export_html/images/media_shop.png</file>
|
||||
<file alias="images/media_shop@2x.png">../../export_html/images/media_shop@2x.png</file>
|
||||
<file alias="images/media_video.png">../../export_html/images/media_video.png</file>
|
||||
<file alias="images/media_video@2x.png">../../export_html/images/media_video@2x.png</file>
|
||||
<file alias="images/media_voice.png">../../export_html/images/media_voice.png</file>
|
||||
<file alias="images/media_voice@2x.png">../../export_html/images/media_voice@2x.png</file>
|
||||
<file alias="images/section_calls.png">../../export_html/images/section_calls.png</file>
|
||||
<file alias="images/section_calls@2x.png">../../export_html/images/section_calls@2x.png</file>
|
||||
<file alias="images/section_chats.png">../../export_html/images/section_chats.png</file>
|
||||
<file alias="images/section_chats@2x.png">../../export_html/images/section_chats@2x.png</file>
|
||||
<file alias="images/section_contacts.png">../../export_html/images/section_contacts.png</file>
|
||||
<file alias="images/section_contacts@2x.png">../../export_html/images/section_contacts@2x.png</file>
|
||||
<file alias="images/section_frequent.png">../../export_html/images/section_frequent.png</file>
|
||||
<file alias="images/section_frequent@2x.png">../../export_html/images/section_frequent@2x.png</file>
|
||||
<file alias="images/section_other.png">../../export_html/images/section_other.png</file>
|
||||
<file alias="images/section_other@2x.png">../../export_html/images/section_other@2x.png</file>
|
||||
<file alias="images/section_photos.png">../../export_html/images/section_photos.png</file>
|
||||
<file alias="images/section_photos@2x.png">../../export_html/images/section_photos@2x.png</file>
|
||||
<file alias="images/section_sessions.png">../../export_html/images/section_sessions.png</file>
|
||||
<file alias="images/section_sessions@2x.png">../../export_html/images/section_sessions@2x.png</file>
|
||||
<file alias="images/section_web.png">../../export_html/images/section_web.png</file>
|
||||
<file alias="images/section_web@2x.png">../../export_html/images/section_web@2x.png</file>
|
||||
<file alias="js/script.js">../../export_html/js/script.js</file>
|
||||
</qresource>
|
||||
<qresource prefix="/gui">
|
||||
<file alias="art/bg.jpg">../../art/bg.jpg</file>
|
||||
<file alias="art/bg_initial.jpg">../../art/bg_initial.jpg</file>
|
||||
<file alias="art/logo_256.png">../../art/logo_256.png</file>
|
||||
<file alias="art/logo_256_no_margin.png">../../art/logo_256_no_margin.png</file>
|
||||
<file alias="art/sunrise.jpg">../../art/sunrise.jpg</file>
|
||||
<file alias="day-blue.tdesktop-theme">../../day-blue.tdesktop-theme</file>
|
||||
<file alias="night.tdesktop-theme">../../night.tdesktop-theme</file>
|
||||
<file alias="night-green.tdesktop-theme">../../night-green.tdesktop-theme</file>
|
||||
</qresource>
|
||||
<qresource prefix="/qt-project.org">
|
||||
<file>../qmime/freedesktop.org.xml</file>
|
||||
</qresource>
|
||||
<qresource prefix="/misc">
|
||||
<file alias="default_shortcuts-custom.json">../../default_shortcuts-custom.json</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -1,10 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/sounds">
|
||||
<file alias="msg_incoming.mp3">../sounds/msg_incoming.mp3</file>
|
||||
<file alias="call_busy.mp3">../sounds/call_busy.mp3</file>
|
||||
<file alias="call_connect.mp3">../sounds/call_connect.mp3</file>
|
||||
<file alias="call_end.mp3">../sounds/call_end.mp3</file>
|
||||
<file alias="call_incoming.mp3">../sounds/call_incoming.mp3</file>
|
||||
<file alias="call_outgoing.mp3">../sounds/call_outgoing.mp3</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -9,7 +9,7 @@
|
||||
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
|
||||
ProcessorArchitecture="ARCHITECTURE"
|
||||
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
|
||||
Version="1.8.10.0" />
|
||||
Version="1.8.14.0" />
|
||||
<Properties>
|
||||
<DisplayName>Telegram Desktop</DisplayName>
|
||||
<PublisherDisplayName>Telegram FZ-LLC</PublisherDisplayName>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -34,8 +33,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,8,10,0
|
||||
PRODUCTVERSION 1,8,10,0
|
||||
FILEVERSION 1,8,14,0
|
||||
PRODUCTVERSION 1,8,14,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -52,10 +51,10 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Telegram FZ-LLC"
|
||||
VALUE "FileDescription", "Telegram Desktop"
|
||||
VALUE "FileVersion", "1.8.10.0"
|
||||
VALUE "FileVersion", "1.8.14.0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2014-2019"
|
||||
VALUE "ProductName", "Telegram Desktop"
|
||||
VALUE "ProductVersion", "1.8.10.0"
|
||||
VALUE "ProductVersion", "1.8.14.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
@@ -66,16 +65,3 @@ END
|
||||
|
||||
#endif // English (United States) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource1.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -25,8 +24,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,8,10,0
|
||||
PRODUCTVERSION 1,8,10,0
|
||||
FILEVERSION 1,8,14,0
|
||||
PRODUCTVERSION 1,8,14,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -43,10 +42,10 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Telegram FZ-LLC"
|
||||
VALUE "FileDescription", "Telegram Desktop Updater"
|
||||
VALUE "FileVersion", "1.8.10.0"
|
||||
VALUE "FileVersion", "1.8.14.0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2014-2019"
|
||||
VALUE "ProductName", "Telegram Desktop"
|
||||
VALUE "ProductVersion", "1.8.10.0"
|
||||
VALUE "ProductVersion", "1.8.14.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
@@ -57,16 +56,3 @@ END
|
||||
|
||||
#endif // English (United States) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
|
||||
Binary file not shown.
@@ -1,14 +0,0 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by Updater.rc
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
@@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
class History;
|
||||
|
||||
namespace Api {
|
||||
|
||||
struct SendOptions {
|
||||
|
||||
@@ -7,11 +7,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "api/api_sending.h"
|
||||
|
||||
#include "api/api_text_entities.h"
|
||||
#include "base/unixtime.h"
|
||||
#include "data/data_document.h"
|
||||
#include "data/data_photo.h"
|
||||
#include "data/data_channel.h" // ChannelData::addsSignature.
|
||||
#include "data/data_user.h" // App::peerName(UserData*).
|
||||
#include "data/data_user.h" // UserData::name
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_file_origin.h"
|
||||
#include "history/history.h"
|
||||
@@ -21,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "main/main_session.h"
|
||||
#include "mainwidget.h"
|
||||
#include "apiwrap.h"
|
||||
#include "app.h"
|
||||
|
||||
namespace Api {
|
||||
namespace {
|
||||
@@ -68,18 +70,16 @@ void SendExistingMedia(
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_silent;
|
||||
}
|
||||
auto messageFromId = channelPost ? 0 : session->userId();
|
||||
auto messagePostAuthor = channelPost
|
||||
? App::peerName(session->user())
|
||||
: QString();
|
||||
auto messagePostAuthor = channelPost ? session->user()->name : QString();
|
||||
|
||||
auto caption = TextWithEntities{
|
||||
message.textWithTags.text,
|
||||
ConvertTextTagsToEntities(message.textWithTags.tags)
|
||||
TextUtilities::ConvertTextTagsToEntities(message.textWithTags.tags)
|
||||
};
|
||||
TextUtilities::Trim(caption);
|
||||
auto sentEntities = TextUtilities::EntitiesToMTP(
|
||||
auto sentEntities = EntitiesToMTP(
|
||||
caption.entities,
|
||||
TextUtilities::ConvertOption::SkipLocal);
|
||||
ConvertOption::SkipLocal);
|
||||
if (!sentEntities.v.isEmpty()) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_entities;
|
||||
}
|
||||
|
||||
129
Telegram/SourceFiles/api/api_text_entities.cpp
Normal file
129
Telegram/SourceFiles/api/api_text_entities.cpp
Normal file
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
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 "api/api_text_entities.h"
|
||||
|
||||
#include "main/main_session.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_user.h"
|
||||
|
||||
namespace Api {
|
||||
namespace {
|
||||
|
||||
using namespace TextUtilities;
|
||||
|
||||
} // namespace
|
||||
|
||||
EntitiesInText EntitiesFromMTP(const QVector<MTPMessageEntity> &entities) {
|
||||
auto result = EntitiesInText();
|
||||
if (!entities.isEmpty()) {
|
||||
result.reserve(entities.size());
|
||||
for_const (auto &entity, entities) {
|
||||
switch (entity.type()) {
|
||||
case mtpc_messageEntityUrl: { auto &d = entity.c_messageEntityUrl(); result.push_back({ EntityType::Url, d.voffset().v, d.vlength().v }); } break;
|
||||
case mtpc_messageEntityTextUrl: { auto &d = entity.c_messageEntityTextUrl(); result.push_back({ EntityType::CustomUrl, d.voffset().v, d.vlength().v, Clean(qs(d.vurl())) }); } break;
|
||||
case mtpc_messageEntityEmail: { auto &d = entity.c_messageEntityEmail(); result.push_back({ EntityType::Email, d.voffset().v, d.vlength().v }); } break;
|
||||
case mtpc_messageEntityHashtag: { auto &d = entity.c_messageEntityHashtag(); result.push_back({ EntityType::Hashtag, d.voffset().v, d.vlength().v }); } break;
|
||||
case mtpc_messageEntityCashtag: { auto &d = entity.c_messageEntityCashtag(); result.push_back({ EntityType::Cashtag, d.voffset().v, d.vlength().v }); } break;
|
||||
case mtpc_messageEntityPhone: break; // Skipping phones.
|
||||
case mtpc_messageEntityMention: { auto &d = entity.c_messageEntityMention(); result.push_back({ EntityType::Mention, d.voffset().v, d.vlength().v }); } break;
|
||||
case mtpc_messageEntityMentionName: {
|
||||
auto &d = entity.c_messageEntityMentionName();
|
||||
auto data = [&d] {
|
||||
if (auto user = Auth().data().userLoaded(d.vuser_id().v)) {
|
||||
return MentionNameDataFromFields({
|
||||
d.vuser_id().v,
|
||||
user->accessHash() });
|
||||
}
|
||||
return MentionNameDataFromFields(d.vuser_id().v);
|
||||
};
|
||||
result.push_back({ EntityType::MentionName, d.voffset().v, d.vlength().v, data() });
|
||||
} break;
|
||||
case mtpc_inputMessageEntityMentionName: {
|
||||
auto &d = entity.c_inputMessageEntityMentionName();
|
||||
auto data = ([&d]() -> QString {
|
||||
if (d.vuser_id().type() == mtpc_inputUserSelf) {
|
||||
return MentionNameDataFromFields(Auth().userId());
|
||||
} else if (d.vuser_id().type() == mtpc_inputUser) {
|
||||
auto &user = d.vuser_id().c_inputUser();
|
||||
return MentionNameDataFromFields({ user.vuser_id().v, user.vaccess_hash().v });
|
||||
}
|
||||
return QString();
|
||||
})();
|
||||
if (!data.isEmpty()) {
|
||||
result.push_back({ EntityType::MentionName, d.voffset().v, d.vlength().v, data });
|
||||
}
|
||||
} break;
|
||||
case mtpc_messageEntityBotCommand: { auto &d = entity.c_messageEntityBotCommand(); result.push_back({ EntityType::BotCommand, d.voffset().v, d.vlength().v }); } break;
|
||||
case mtpc_messageEntityBold: { auto &d = entity.c_messageEntityBold(); result.push_back({ EntityType::Bold, d.voffset().v, d.vlength().v }); } break;
|
||||
case mtpc_messageEntityItalic: { auto &d = entity.c_messageEntityItalic(); result.push_back({ EntityType::Italic, d.voffset().v, d.vlength().v }); } break;
|
||||
case mtpc_messageEntityUnderline: { auto &d = entity.c_messageEntityUnderline(); result.push_back({ EntityType::Underline, d.voffset().v, d.vlength().v }); } break;
|
||||
case mtpc_messageEntityStrike: { auto &d = entity.c_messageEntityStrike(); result.push_back({ EntityType::StrikeOut, d.voffset().v, d.vlength().v }); } break;
|
||||
case mtpc_messageEntityCode: { auto &d = entity.c_messageEntityCode(); result.push_back({ EntityType::Code, d.voffset().v, d.vlength().v }); } break;
|
||||
case mtpc_messageEntityPre: { auto &d = entity.c_messageEntityPre(); result.push_back({ EntityType::Pre, d.voffset().v, d.vlength().v, Clean(qs(d.vlanguage())) }); } break;
|
||||
// #TODO entities
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
MTPVector<MTPMessageEntity> EntitiesToMTP(
|
||||
const EntitiesInText &entities,
|
||||
ConvertOption option) {
|
||||
auto v = QVector<MTPMessageEntity>();
|
||||
v.reserve(entities.size());
|
||||
for_const (auto &entity, entities) {
|
||||
if (entity.length() <= 0) continue;
|
||||
if (option == ConvertOption::SkipLocal
|
||||
&& entity.type() != EntityType::Bold
|
||||
&& entity.type() != EntityType::Italic
|
||||
&& entity.type() != EntityType::Underline
|
||||
&& entity.type() != EntityType::StrikeOut
|
||||
&& entity.type() != EntityType::Code // #TODO entities
|
||||
&& entity.type() != EntityType::Pre
|
||||
&& entity.type() != EntityType::MentionName
|
||||
&& entity.type() != EntityType::CustomUrl) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto offset = MTP_int(entity.offset());
|
||||
auto length = MTP_int(entity.length());
|
||||
switch (entity.type()) {
|
||||
case EntityType::Url: v.push_back(MTP_messageEntityUrl(offset, length)); break;
|
||||
case EntityType::CustomUrl: v.push_back(MTP_messageEntityTextUrl(offset, length, MTP_string(entity.data()))); break;
|
||||
case EntityType::Email: v.push_back(MTP_messageEntityEmail(offset, length)); break;
|
||||
case EntityType::Hashtag: v.push_back(MTP_messageEntityHashtag(offset, length)); break;
|
||||
case EntityType::Cashtag: v.push_back(MTP_messageEntityCashtag(offset, length)); break;
|
||||
case EntityType::Mention: v.push_back(MTP_messageEntityMention(offset, length)); break;
|
||||
case EntityType::MentionName: {
|
||||
auto inputUser = ([](const QString &data) -> MTPInputUser {
|
||||
auto fields = MentionNameDataToFields(data);
|
||||
if (fields.userId == Auth().userId()) {
|
||||
return MTP_inputUserSelf();
|
||||
} else if (fields.userId) {
|
||||
return MTP_inputUser(MTP_int(fields.userId), MTP_long(fields.accessHash));
|
||||
}
|
||||
return MTP_inputUserEmpty();
|
||||
})(entity.data());
|
||||
if (inputUser.type() != mtpc_inputUserEmpty) {
|
||||
v.push_back(MTP_inputMessageEntityMentionName(offset, length, inputUser));
|
||||
}
|
||||
} break;
|
||||
case EntityType::BotCommand: v.push_back(MTP_messageEntityBotCommand(offset, length)); break;
|
||||
case EntityType::Bold: v.push_back(MTP_messageEntityBold(offset, length)); break;
|
||||
case EntityType::Italic: v.push_back(MTP_messageEntityItalic(offset, length)); break;
|
||||
case EntityType::Underline: v.push_back(MTP_messageEntityUnderline(offset, length)); break;
|
||||
case EntityType::StrikeOut: v.push_back(MTP_messageEntityStrike(offset, length)); break;
|
||||
case EntityType::Code: v.push_back(MTP_messageEntityCode(offset, length)); break; // #TODO entities
|
||||
case EntityType::Pre: v.push_back(MTP_messageEntityPre(offset, length, MTP_string(entity.data()))); break;
|
||||
}
|
||||
}
|
||||
return MTP_vector<MTPMessageEntity>(std::move(v));
|
||||
}
|
||||
|
||||
} // namespace Api
|
||||
23
Telegram/SourceFiles/api/api_text_entities.h
Normal file
23
Telegram/SourceFiles/api/api_text_entities.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
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
|
||||
|
||||
#include "ui/text/text_entity.h"
|
||||
|
||||
namespace Api {
|
||||
|
||||
EntitiesInText EntitiesFromMTP(const QVector<MTPMessageEntity> &entities);
|
||||
enum class ConvertOption {
|
||||
WithLocal,
|
||||
SkipLocal,
|
||||
};
|
||||
MTPVector<MTPMessageEntity> EntitiesToMTP(
|
||||
const EntitiesInText &entities,
|
||||
ConvertOption option = ConvertOption::WithLocal);
|
||||
|
||||
} // namespace Api
|
||||
@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "apiwrap.h"
|
||||
|
||||
#include "api/api_text_entities.h"
|
||||
#include "data/data_drafts.h"
|
||||
#include "data/data_photo.h"
|
||||
#include "data/data_web_page.h"
|
||||
@@ -58,6 +59,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "storage/storage_shared_media.h"
|
||||
#include "storage/storage_user_photos.h"
|
||||
#include "storage/storage_media_prepare.h"
|
||||
#include "facades.h"
|
||||
#include "app.h"
|
||||
//#include "storage/storage_feed_messages.h" // #feed
|
||||
|
||||
namespace {
|
||||
@@ -2560,9 +2563,9 @@ void ApiWrap::saveDraftsToCloud() {
|
||||
if (!textWithTags.tags.isEmpty()) {
|
||||
flags |= MTPmessages_SaveDraft::Flag::f_entities;
|
||||
}
|
||||
auto entities = TextUtilities::EntitiesToMTP(
|
||||
ConvertTextTagsToEntities(textWithTags.tags),
|
||||
TextUtilities::ConvertOption::SkipLocal);
|
||||
auto entities = Api::EntitiesToMTP(
|
||||
TextUtilities::ConvertTextTagsToEntities(textWithTags.tags),
|
||||
Api::ConvertOption::SkipLocal);
|
||||
|
||||
const auto draftText = textWithTags.text;
|
||||
history->setSentDraftText(draftText);
|
||||
@@ -4514,7 +4517,7 @@ void ApiWrap::forwardMessages(
|
||||
? UserId(0)
|
||||
: peerToUser(self->id);
|
||||
const auto messagePostAuthor = channelPost
|
||||
? App::peerName(self)
|
||||
? self->name
|
||||
: QString();
|
||||
history->addNewLocalMessage(
|
||||
newId.msg,
|
||||
@@ -4608,7 +4611,7 @@ void ApiWrap::sendSharedContact(
|
||||
}
|
||||
const auto messageFromId = channelPost ? 0 : _session->userId();
|
||||
const auto messagePostAuthor = channelPost
|
||||
? App::peerName(_session->user())
|
||||
? _session->user()->name
|
||||
: QString();
|
||||
const auto vcard = QString();
|
||||
const auto views = 1;
|
||||
@@ -4828,9 +4831,9 @@ void ApiWrap::editUploadedFile(
|
||||
return;
|
||||
}
|
||||
|
||||
auto sentEntities = TextUtilities::EntitiesToMTP(
|
||||
auto sentEntities = Api::EntitiesToMTP(
|
||||
item->originalText().entities,
|
||||
TextUtilities::ConvertOption::SkipLocal);
|
||||
Api::ConvertOption::SkipLocal);
|
||||
|
||||
auto flagsEditMsg = MTPmessages_EditMessage::Flag::f_message | 0;
|
||||
flagsEditMsg |= MTPmessages_EditMessage::Flag::f_no_webpage;
|
||||
@@ -4932,7 +4935,7 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
||||
auto sending = TextWithEntities();
|
||||
auto left = TextWithEntities {
|
||||
textWithTags.text,
|
||||
ConvertTextTagsToEntities(textWithTags.tags)
|
||||
TextUtilities::ConvertTextTagsToEntities(textWithTags.tags)
|
||||
};
|
||||
auto prepareFlags = Ui::ItemTextOptions(
|
||||
history,
|
||||
@@ -4986,8 +4989,10 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
||||
if (silentPost) {
|
||||
sendFlags |= MTPmessages_SendMessage::Flag::f_silent;
|
||||
}
|
||||
auto localEntities = TextUtilities::EntitiesToMTP(sending.entities);
|
||||
auto sentEntities = TextUtilities::EntitiesToMTP(sending.entities, TextUtilities::ConvertOption::SkipLocal);
|
||||
auto localEntities = Api::EntitiesToMTP(sending.entities);
|
||||
auto sentEntities = Api::EntitiesToMTP(
|
||||
sending.entities,
|
||||
Api::ConvertOption::SkipLocal);
|
||||
if (!sentEntities.v.isEmpty()) {
|
||||
sendFlags |= MTPmessages_SendMessage::Flag::f_entities;
|
||||
}
|
||||
@@ -4998,7 +5003,7 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
||||
}
|
||||
auto messageFromId = channelPost ? 0 : _session->userId();
|
||||
auto messagePostAuthor = channelPost
|
||||
? App::peerName(_session->user())
|
||||
? _session->user()->name
|
||||
: QString();
|
||||
if (action.options.scheduled) {
|
||||
flags |= MTPDmessage::Flag::f_from_scheduled;
|
||||
@@ -5136,7 +5141,7 @@ void ApiWrap::sendInlineResult(
|
||||
|
||||
const auto messageFromId = channelPost ? 0 : _session->userId();
|
||||
const auto messagePostAuthor = channelPost
|
||||
? App::peerName(_session->user())
|
||||
? _session->user()->name
|
||||
: QString();
|
||||
|
||||
_session->data().registerMessageRandomId(randomId, newId);
|
||||
@@ -5272,9 +5277,9 @@ void ApiWrap::sendMediaWithRandomId(
|
||||
|
||||
auto caption = item->originalText();
|
||||
TextUtilities::Trim(caption);
|
||||
auto sentEntities = TextUtilities::EntitiesToMTP(
|
||||
auto sentEntities = Api::EntitiesToMTP(
|
||||
caption.entities,
|
||||
TextUtilities::ConvertOption::SkipLocal);
|
||||
Api::ConvertOption::SkipLocal);
|
||||
|
||||
const auto flags = MTPmessages_SendMedia::Flags(0)
|
||||
| (replyTo
|
||||
|
||||
@@ -63,8 +63,6 @@ namespace {
|
||||
*pressedLinkItem = nullptr,
|
||||
*mousedItem = nullptr;
|
||||
|
||||
style::font monofont;
|
||||
|
||||
struct CornersPixmaps {
|
||||
QPixmap p[4];
|
||||
};
|
||||
@@ -105,23 +103,6 @@ namespace App {
|
||||
return result;
|
||||
}
|
||||
|
||||
MainWindow *wnd() {
|
||||
return (Core::IsAppLaunched() && Core::App().activeWindow())
|
||||
? Core::App().activeWindow()->widget().get()
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
MainWidget *main() {
|
||||
if (auto window = wnd()) {
|
||||
return window->mainWidget();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QString peerName(const PeerData *peer, bool forDialogs) {
|
||||
return peer ? ((forDialogs && peer->isUser() && !peer->asUser()->nameOrPhone.isEmpty()) ? peer->asUser()->nameOrPhone : peer->name) : tr::lng_deleted(tr::now);
|
||||
}
|
||||
|
||||
void prepareCorners(RoundCorners index, int32 radius, const QBrush &brush, const style::color *shadow = nullptr, QImage *cors = nullptr) {
|
||||
Expects(::corners.size() > index);
|
||||
|
||||
@@ -155,14 +136,6 @@ namespace App {
|
||||
}
|
||||
}
|
||||
|
||||
void tryFontFamily(QString &family, const QString &tryFamily) {
|
||||
if (family.isEmpty()) {
|
||||
if (!QFontInfo(QFont(tryFamily)).family().trimmed().compare(tryFamily, Qt::CaseInsensitive)) {
|
||||
family = tryFamily;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void createMaskCorners() {
|
||||
QImage mask[4];
|
||||
prepareCorners(SmallMaskCorners, st::buttonRadius, QColor(255, 255, 255), nullptr, mask);
|
||||
@@ -221,16 +194,6 @@ namespace App {
|
||||
}
|
||||
|
||||
void initMedia() {
|
||||
if (!::monofont) {
|
||||
QString family;
|
||||
tryFontFamily(family, qsl("Consolas"));
|
||||
tryFontFamily(family, qsl("Liberation Mono"));
|
||||
tryFontFamily(family, qsl("Menlo"));
|
||||
tryFontFamily(family, qsl("Courier"));
|
||||
if (family.isEmpty()) family = QFontDatabase::systemFont(QFontDatabase::FixedFont).family();
|
||||
::monofont = style::font(st::normalFont->f.pixelSize(), 0, family);
|
||||
}
|
||||
|
||||
createCorners();
|
||||
|
||||
using Update = Window::Theme::BackgroundUpdate;
|
||||
@@ -310,10 +273,6 @@ namespace App {
|
||||
mousedItem(nullptr);
|
||||
}
|
||||
|
||||
const style::font &monofont() {
|
||||
return ::monofont;
|
||||
}
|
||||
|
||||
void quit() {
|
||||
if (quitting()) {
|
||||
return;
|
||||
@@ -468,15 +427,6 @@ namespace App {
|
||||
rectWithCorners(p, rect, st::msgInBg, MessageInCorners, corners);
|
||||
}
|
||||
|
||||
QImage *cornersMask(ImageRoundRadius radius) {
|
||||
switch (radius) {
|
||||
case ImageRoundRadius::Large: return ::cornersMaskLarge;
|
||||
case ImageRoundRadius::Small:
|
||||
default: break;
|
||||
}
|
||||
return ::cornersMaskSmall;
|
||||
}
|
||||
|
||||
void roundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, style::color bg, const CornersPixmaps &corner, const style::color *shadow, RectParts parts) {
|
||||
auto cornerWidth = corner.p[0].width() / cIntRetinaFactor();
|
||||
auto cornerHeight = corner.p[0].height() / cIntRetinaFactor();
|
||||
|
||||
@@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#pragma once
|
||||
|
||||
#include "data/data_types.h"
|
||||
#include "ui/rect_part.h"
|
||||
|
||||
enum class ImageRoundRadius;
|
||||
class MainWindow;
|
||||
@@ -18,10 +19,16 @@ namespace HistoryView {
|
||||
class Element;
|
||||
} // namespace HistoryView
|
||||
|
||||
namespace Media {
|
||||
namespace Clip {
|
||||
class Reader;
|
||||
} // namespace Clip
|
||||
} // namespace Media
|
||||
|
||||
using HistoryItemsMap = base::flat_set<not_null<HistoryItem*>>;
|
||||
using GifItems = QHash<Media::Clip::Reader*, HistoryItem*>;
|
||||
|
||||
enum RoundCorners {
|
||||
enum RoundCorners : int {
|
||||
SmallMaskCorners = 0x00, // for images
|
||||
LargeMaskCorners,
|
||||
|
||||
@@ -60,13 +67,8 @@ enum RoundCorners {
|
||||
};
|
||||
|
||||
namespace App {
|
||||
MainWindow *wnd();
|
||||
MainWidget *main();
|
||||
|
||||
QString formatPhone(QString phone);
|
||||
|
||||
[[nodiscard]] QString peerName(const PeerData *peer, bool forDialogs = false);
|
||||
|
||||
void hoveredItem(HistoryView::Element *item);
|
||||
HistoryView::Element *hoveredItem();
|
||||
void pressedItem(HistoryView::Element *item);
|
||||
@@ -79,8 +81,6 @@ namespace App {
|
||||
HistoryView::Element *mousedItem();
|
||||
void clearMousedItems();
|
||||
|
||||
const style::font &monofont();
|
||||
|
||||
void initMedia();
|
||||
void deinitMedia();
|
||||
|
||||
@@ -104,7 +104,6 @@ namespace App {
|
||||
void complexOverlayRect(Painter &p, QRect rect, ImageRoundRadius radius, RectParts corners);
|
||||
void complexLocationRect(Painter &p, QRect rect, ImageRoundRadius radius, RectParts corners);
|
||||
|
||||
QImage *cornersMask(ImageRoundRadius radius);
|
||||
void roundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, style::color bg, RoundCorners index, const style::color *shadow = nullptr, RectParts parts = RectPart::Full);
|
||||
inline void roundRect(Painter &p, const QRect &rect, style::color bg, RoundCorners index, const style::color *shadow = nullptr, RectParts parts = RectPart::Full) {
|
||||
return roundRect(p, rect.x(), rect.y(), rect.width(), rect.height(), bg, index, shadow, parts);
|
||||
|
||||
@@ -32,6 +32,17 @@ inline bool contains(const Container &container, const T &value) {
|
||||
return std::find(std::begin(container), end, value) != end;
|
||||
}
|
||||
|
||||
template <typename D, typename T>
|
||||
inline constexpr D up_cast(T object) {
|
||||
using DV = std::decay_t<decltype(*D())>;
|
||||
using TV = std::decay_t<decltype(*T())>;
|
||||
if constexpr (std::is_base_of_v<DV, TV>) {
|
||||
return object;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// We need a custom comparator for set<std::unique_ptr<T>>::find to work with pointers.
|
||||
// thanks to http://stackoverflow.com/questions/18939882/raw-pointer-lookup-for-sets-of-unique-ptrs
|
||||
template <typename T>
|
||||
@@ -70,6 +81,23 @@ struct pointer_comparator {
|
||||
|
||||
};
|
||||
|
||||
inline QString FromUtf8Safe(const char *string, int size = -1) {
|
||||
if (!string || !size) {
|
||||
return QString();
|
||||
} else if (size < 0) {
|
||||
size = strlen(string);
|
||||
}
|
||||
const auto result = QString::fromUtf8(string, size);
|
||||
const auto back = result.toUtf8();
|
||||
return (back.size() != size || memcmp(back.constData(), string, size))
|
||||
? QString::fromLocal8Bit(string, size)
|
||||
: result;
|
||||
}
|
||||
|
||||
inline QString FromUtf8Safe(const QByteArray &string) {
|
||||
return FromUtf8Safe(string.constData(), string.size());
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -9,6 +9,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
// Ensures/Expects.
|
||||
#include <gsl/gsl_assert>
|
||||
|
||||
namespace base {
|
||||
namespace assertion {
|
||||
|
||||
|
||||
18
Telegram/SourceFiles/base/base_integration.h
Normal file
18
Telegram/SourceFiles/base/base_integration.h
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
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
|
||||
|
||||
#include "base/basic_types.h"
|
||||
|
||||
// Methods that must be implemented outside lib_base.
|
||||
|
||||
namespace base {
|
||||
|
||||
void EnterFromEventLoop(FnMut<void()> &&method);
|
||||
|
||||
} // namespace
|
||||
@@ -7,3 +7,4 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "base/base_pch.h"
|
||||
|
||||
// Precompiled header helper.
|
||||
|
||||
61
Telegram/SourceFiles/base/crc32hash.cpp
Normal file
61
Telegram/SourceFiles/base/crc32hash.cpp
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
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 "base/crc32hash.h"
|
||||
|
||||
namespace base {
|
||||
namespace {
|
||||
|
||||
class Crc32Table {
|
||||
public:
|
||||
Crc32Table() {
|
||||
auto poly = std::uint32_t(0x04c11db7);
|
||||
for (auto i = 0; i != 256; ++i) {
|
||||
_data[i] = reflect(i, 8) << 24;
|
||||
for (auto j = 0; j != 8; ++j) {
|
||||
_data[i] = (_data[i] << 1) ^ (_data[i] & (1 << 31) ? poly : 0);
|
||||
}
|
||||
_data[i] = reflect(_data[i], 32);
|
||||
}
|
||||
}
|
||||
|
||||
std::uint32_t operator[](int index) const {
|
||||
return _data[index];
|
||||
}
|
||||
|
||||
private:
|
||||
std::uint32_t reflect(std::uint32_t val, char ch) {
|
||||
auto result = std::uint32_t(0);
|
||||
for (int i = 1; i < (ch + 1); ++i) {
|
||||
if (val & 1) {
|
||||
result |= 1 << (ch - i);
|
||||
}
|
||||
val >>= 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
std::uint32_t _data[256];
|
||||
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
std::int32_t crc32(const void *data, int len) {
|
||||
static const auto kTable = Crc32Table();
|
||||
|
||||
const auto buffer = static_cast<const std::uint8_t*>(data);
|
||||
|
||||
auto crc = std::uint32_t(0xffffffff);
|
||||
for (auto i = 0; i != len; ++i) {
|
||||
crc = (crc >> 8) ^ kTable[(crc & 0xFF) ^ buffer[i]];
|
||||
}
|
||||
|
||||
return static_cast<std::int32_t>(crc ^ 0xffffffff);
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
16
Telegram/SourceFiles/base/crc32hash.h
Normal file
16
Telegram/SourceFiles/base/crc32hash.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
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
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace base {
|
||||
|
||||
std::int32_t crc32(const void *data, int len);
|
||||
|
||||
} // namespace base
|
||||
@@ -40,3 +40,23 @@ inline void InvokeQueued(const QObject *context, Lambda &&lambda) {
|
||||
const_cast<QObject*>(context),
|
||||
new base::InvokeQueuedEvent(std::forward<Lambda>(lambda)));
|
||||
}
|
||||
|
||||
class SingleQueuedInvokation : public QObject {
|
||||
public:
|
||||
SingleQueuedInvokation(Fn<void()> callback) : _callback(callback) {
|
||||
}
|
||||
void call() {
|
||||
if (_pending.testAndSetAcquire(0, 1)) {
|
||||
InvokeQueued(this, [this] {
|
||||
if (_pending.testAndSetRelease(1, 0)) {
|
||||
_callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
Fn<void()> _callback;
|
||||
QAtomicInt _pending = { 0 };
|
||||
|
||||
};
|
||||
|
||||
121
Telegram/SourceFiles/base/object_ptr.h
Normal file
121
Telegram/SourceFiles/base/object_ptr.h
Normal file
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
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
|
||||
|
||||
#include <QtCore/QPointer>
|
||||
|
||||
// Smart pointer for QObject*, has move semantics, destroys object if it doesn't have a parent.
|
||||
template <typename Object>
|
||||
class object_ptr {
|
||||
public:
|
||||
object_ptr(std::nullptr_t) noexcept {
|
||||
}
|
||||
|
||||
// No default constructor, but constructors with at least
|
||||
// one argument are simply make functions.
|
||||
template <typename Parent, typename... Args>
|
||||
explicit object_ptr(Parent &&parent, Args&&... args)
|
||||
: _object(new Object(std::forward<Parent>(parent), std::forward<Args>(args)...)) {
|
||||
}
|
||||
static object_ptr<Object> fromRaw(Object *value) noexcept {
|
||||
object_ptr<Object> result = { nullptr };
|
||||
result._object = value;
|
||||
return result;
|
||||
}
|
||||
Object *release() noexcept {
|
||||
return static_cast<Object*>(base::take(_object).data());
|
||||
}
|
||||
|
||||
object_ptr(const object_ptr &other) = delete;
|
||||
object_ptr &operator=(const object_ptr &other) = delete;
|
||||
object_ptr(object_ptr &&other) noexcept : _object(base::take(other._object)) {
|
||||
}
|
||||
object_ptr &operator=(object_ptr &&other) noexcept {
|
||||
auto temp = std::move(other);
|
||||
destroy();
|
||||
std::swap(_object, temp._object);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <
|
||||
typename OtherObject,
|
||||
typename = std::enable_if_t<
|
||||
std::is_base_of_v<Object, OtherObject>>>
|
||||
object_ptr(object_ptr<OtherObject> &&other) noexcept
|
||||
: _object(base::take(other._object)) {
|
||||
}
|
||||
|
||||
template <
|
||||
typename OtherObject,
|
||||
typename = std::enable_if_t<
|
||||
std::is_base_of_v<Object, OtherObject>>>
|
||||
object_ptr &operator=(object_ptr<OtherObject> &&other) noexcept {
|
||||
_object = base::take(other._object);
|
||||
return *this;
|
||||
}
|
||||
|
||||
object_ptr &operator=(std::nullptr_t) noexcept {
|
||||
_object = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// So we can pass this pointer to methods like connect().
|
||||
Object *data() const noexcept {
|
||||
return static_cast<Object*>(_object.data());
|
||||
}
|
||||
operator Object*() const noexcept {
|
||||
return data();
|
||||
}
|
||||
|
||||
explicit operator bool() const noexcept {
|
||||
return _object != nullptr;
|
||||
}
|
||||
|
||||
Object *operator->() const noexcept {
|
||||
return data();
|
||||
}
|
||||
Object &operator*() const noexcept {
|
||||
return *data();
|
||||
}
|
||||
|
||||
// Use that instead "= new Object(parent, ...)"
|
||||
template <typename Parent, typename... Args>
|
||||
Object *create(Parent &&parent, Args&&... args) {
|
||||
destroy();
|
||||
_object = new Object(
|
||||
std::forward<Parent>(parent),
|
||||
std::forward<Args>(args)...);
|
||||
return data();
|
||||
}
|
||||
void destroy() noexcept {
|
||||
delete base::take(_object);
|
||||
}
|
||||
void destroyDelayed() {
|
||||
if (_object) {
|
||||
if (auto widget = base::up_cast<QWidget*>(data())) {
|
||||
widget->hide();
|
||||
}
|
||||
base::take(_object)->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
~object_ptr() noexcept {
|
||||
if (auto pointer = _object) {
|
||||
if (!pointer->parent()) {
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename OtherObject>
|
||||
friend class object_ptr;
|
||||
|
||||
QPointer<QObject> _object;
|
||||
|
||||
};
|
||||
@@ -524,6 +524,17 @@ inline void AddRandomSeed(bytes::const_span data) {
|
||||
RAND_seed(data.data(), data.size());
|
||||
}
|
||||
|
||||
template <typename T, typename = std::enable_if_t<std::is_integral_v<T>>>
|
||||
[[nodiscard]] inline T RandomValue() {
|
||||
unsigned char buffer[sizeof(T)];
|
||||
if (!RAND_bytes(buffer, sizeof(T))) {
|
||||
Unexpected("Could not generate random bytes!");
|
||||
}
|
||||
auto result = T();
|
||||
memcpy(&result, buffer, sizeof(T));
|
||||
return result;
|
||||
}
|
||||
|
||||
inline bytes::vector Pbkdf2Sha512(
|
||||
bytes::const_span password,
|
||||
bytes::const_span salt,
|
||||
|
||||
49
Telegram/SourceFiles/base/qt_connection.h
Normal file
49
Telegram/SourceFiles/base/qt_connection.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
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
|
||||
|
||||
#include "base/algorithm.h"
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
namespace base {
|
||||
|
||||
class qt_connection final {
|
||||
public:
|
||||
qt_connection(QMetaObject::Connection data = {}) : _data(data) {
|
||||
}
|
||||
qt_connection(qt_connection &&other) : _data(base::take(other._data)) {
|
||||
}
|
||||
qt_connection &operator=(qt_connection &&other) {
|
||||
reset(base::take(other._data));
|
||||
return *this;
|
||||
}
|
||||
~qt_connection() {
|
||||
disconnect();
|
||||
}
|
||||
|
||||
void release() {
|
||||
_data = QMetaObject::Connection();
|
||||
}
|
||||
void reset(QMetaObject::Connection data = {}) {
|
||||
disconnect();
|
||||
_data = data;
|
||||
}
|
||||
|
||||
private:
|
||||
void disconnect() {
|
||||
if (_data) {
|
||||
QObject::disconnect(base::take(_data));
|
||||
}
|
||||
}
|
||||
|
||||
QMetaObject::Connection _data;
|
||||
|
||||
};
|
||||
|
||||
} // namespace base
|
||||
@@ -7,9 +7,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "core/sandbox.h"
|
||||
#include "base/base_integration.h"
|
||||
|
||||
namespace Core {
|
||||
namespace base {
|
||||
|
||||
// This method allows to create an rpl::producer from a Qt object
|
||||
// and a signal with none or one reported value.
|
||||
@@ -20,34 +20,34 @@ namespace Core {
|
||||
// This means that all postponeCall's will be invoked right after
|
||||
// the value processing by the current consumer finishes.
|
||||
template <typename Object, typename Signal>
|
||||
auto QtSignalProducer(Object *object, Signal signal);
|
||||
auto qt_signal_producer(Object *object, Signal signal);
|
||||
|
||||
namespace details {
|
||||
|
||||
template <typename Signal>
|
||||
struct QtSignalArgument;
|
||||
struct qt_signal_argument;
|
||||
|
||||
template <typename Class, typename Return, typename Value>
|
||||
struct QtSignalArgument<Return(Class::*)(Value)> {
|
||||
struct qt_signal_argument<Return(Class::*)(Value)> {
|
||||
using type = Value;
|
||||
};
|
||||
|
||||
template <typename Class, typename Return>
|
||||
struct QtSignalArgument<Return(Class::*)()> {
|
||||
struct qt_signal_argument<Return(Class::*)()> {
|
||||
using type = void;
|
||||
};
|
||||
|
||||
} // namespace details
|
||||
|
||||
template <typename Object, typename Signal>
|
||||
auto QtSignalProducer(Object *object, Signal signal) {
|
||||
using Value = typename details::QtSignalArgument<Signal>::type;
|
||||
auto qt_signal_producer(Object *object, Signal signal) {
|
||||
using Value = typename details::qt_signal_argument<Signal>::type;
|
||||
static constexpr auto NoArgument = std::is_same_v<Value, void>;
|
||||
using Produced = std::conditional_t<
|
||||
NoArgument,
|
||||
rpl::empty_value,
|
||||
std::remove_const_t<std::decay_t<Value>>>;
|
||||
const auto guarded = make_weak(object);
|
||||
const auto guarded = QPointer<Object>(object);
|
||||
return rpl::make_producer<Produced>([=](auto consumer) {
|
||||
if (!guarded) {
|
||||
return rpl::lifetime();
|
||||
@@ -59,7 +59,7 @@ auto QtSignalProducer(Object *object, Signal signal) {
|
||||
signal,
|
||||
listener,
|
||||
std::forward<decltype(handler)>(handler));
|
||||
const auto weak = make_weak(listener);
|
||||
const auto weak = QPointer<QObject>(listener);
|
||||
return rpl::lifetime([=] {
|
||||
if (weak) {
|
||||
delete weak;
|
||||
@@ -67,7 +67,7 @@ auto QtSignalProducer(Object *object, Signal signal) {
|
||||
});
|
||||
};
|
||||
auto put = [=](const Produced &value) {
|
||||
Sandbox::Instance().customEnterFromEventLoop([&] {
|
||||
EnterFromEventLoop([&] {
|
||||
consumer.put_next_copy(value);
|
||||
});
|
||||
};
|
||||
@@ -79,4 +79,4 @@ auto QtSignalProducer(Object *object, Signal signal) {
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace Core
|
||||
} // namespace base
|
||||
@@ -7,6 +7,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QtCore/QUrl>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QRegularExpression>
|
||||
|
||||
namespace qthelp {
|
||||
|
||||
const QRegularExpression &RegExpDomain();
|
||||
|
||||
@@ -108,8 +108,8 @@ void Timer::timerEvent(QTimerEvent *e) {
|
||||
cancel();
|
||||
}
|
||||
|
||||
if (_callback) {
|
||||
_callback();
|
||||
if (const auto onstack = _callback) {
|
||||
onstack();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QtCore/QPointer>
|
||||
|
||||
namespace base {
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -7,8 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "base/unixtime.h"
|
||||
|
||||
#include "logs.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QReadWriteLock>
|
||||
|
||||
@@ -125,19 +123,15 @@ TimeId now() {
|
||||
|
||||
void update(TimeId now, bool force) {
|
||||
if (force) {
|
||||
DEBUG_LOG(("MTP Info: forcing client unixtime to %1"
|
||||
).arg(now));
|
||||
ValueUpdated = true;
|
||||
} else {
|
||||
auto expected = false;
|
||||
if (!ValueUpdated.compare_exchange_strong(expected, true)) {
|
||||
return;
|
||||
}
|
||||
DEBUG_LOG(("MTP Info: setting client unixtime to %1").arg(now));
|
||||
}
|
||||
const auto shift = now + 1 - local();
|
||||
ValueShift = shift;
|
||||
DEBUG_LOG(("MTP Info: now unixtimeDelta is %1").arg(shift));
|
||||
|
||||
HttpValueShift = 0;
|
||||
HttpValueValid = false;
|
||||
|
||||
@@ -18,9 +18,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/widgets/shadow.h"
|
||||
#include "ui/wrap/fade_wrap.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/painter.h"
|
||||
#include "base/timer.h"
|
||||
#include "mainwidget.h"
|
||||
#include "mainwindow.h"
|
||||
#include "app.h"
|
||||
|
||||
struct AbstractBox::LoadingProgress {
|
||||
LoadingProgress(
|
||||
@@ -134,7 +136,7 @@ void BoxContent::onDraggingScrollDelta(int delta) {
|
||||
}
|
||||
|
||||
void BoxContent::onDraggingScrollTimer() {
|
||||
auto delta = (_draggingScrollDelta > 0) ? qMin(_draggingScrollDelta * 3 / 20 + 1, int32(MaxScrollSpeed)) : qMax(_draggingScrollDelta * 3 / 20 - 1, -int32(MaxScrollSpeed));
|
||||
auto delta = (_draggingScrollDelta > 0) ? qMin(_draggingScrollDelta * 3 / 20 + 1, int32(Ui::kMaxScrollSpeed)) : qMax(_draggingScrollDelta * 3 / 20 - 1, -int32(Ui::kMaxScrollSpeed));
|
||||
_scroll->scrollToY(_scroll->scrollTop() + delta);
|
||||
}
|
||||
|
||||
@@ -275,7 +277,6 @@ AbstractBox::AbstractBox(
|
||||
: LayerWidget(layer)
|
||||
, _layer(layer)
|
||||
, _content(std::move(content)) {
|
||||
subscribe(Lang::Current().updated(), [=] { refreshLang(); });
|
||||
_content->setParent(this);
|
||||
_content->setDelegate(this);
|
||||
|
||||
@@ -397,10 +398,6 @@ bool AbstractBox::closeByOutsideClick() const {
|
||||
return _closeByOutsideClick;
|
||||
}
|
||||
|
||||
void AbstractBox::refreshLang() {
|
||||
InvokeQueued(this, [this] { updateButtonsPositions(); });
|
||||
}
|
||||
|
||||
bool AbstractBox::hasTitle() const {
|
||||
return (_title != nullptr) || !_additionalTitle.current().isEmpty();
|
||||
}
|
||||
@@ -463,7 +460,10 @@ QPointer<Ui::RoundButton> AbstractBox::addButton(
|
||||
auto result = QPointer<Ui::RoundButton>(_buttons.back());
|
||||
result->setClickedCallback(std::move(clickCallback));
|
||||
result->show();
|
||||
updateButtonsPositions();
|
||||
result->widthValue(
|
||||
) | rpl::start_with_next([=] {
|
||||
updateButtonsPositions();
|
||||
}, result->lifetime());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -475,7 +475,10 @@ QPointer<Ui::RoundButton> AbstractBox::addLeftButton(
|
||||
auto result = QPointer<Ui::RoundButton>(_leftButton);
|
||||
result->setClickedCallback(std::move(clickCallback));
|
||||
result->show();
|
||||
updateButtonsPositions();
|
||||
result->widthValue(
|
||||
) | rpl::start_with_next([=] {
|
||||
updateButtonsPositions();
|
||||
}, result->lifetime());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -596,3 +599,39 @@ void BoxContentDivider::paintEvent(QPaintEvent *e) {
|
||||
auto dividerFillBottom = myrtlrect(0, height() - st::profileDividerBottom.height(), width(), st::profileDividerBottom.height());
|
||||
st::profileDividerBottom.fill(p, dividerFillBottom);
|
||||
}
|
||||
|
||||
namespace Ui {
|
||||
namespace internal {
|
||||
|
||||
void showBox(
|
||||
object_ptr<BoxContent> content,
|
||||
LayerOptions options,
|
||||
anim::type animated) {
|
||||
if (auto w = App::wnd()) {
|
||||
w->ui_showBox(std::move(content), options, animated);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
||||
void hideLayer(anim::type animated) {
|
||||
if (auto w = App::wnd()) {
|
||||
w->ui_showBox(
|
||||
{ nullptr },
|
||||
LayerOption::CloseOther,
|
||||
animated);
|
||||
}
|
||||
}
|
||||
|
||||
void hideSettingsAndLayer(anim::type animated) {
|
||||
if (auto w = App::wnd()) {
|
||||
w->ui_hideSettingsAndLayer(animated);
|
||||
}
|
||||
}
|
||||
|
||||
bool isLayerShown() {
|
||||
if (auto w = App::wnd()) return w->ui_isLayerShown();
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Ui
|
||||
|
||||
@@ -9,8 +9,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
#include "window/layer_widget.h"
|
||||
#include "base/unique_qptr.h"
|
||||
#include "base/flags.h"
|
||||
#include "ui/effects/animation_value.h"
|
||||
#include "ui/text/text_entity.h"
|
||||
#include "ui/rp_widget.h"
|
||||
|
||||
class Painter;
|
||||
|
||||
namespace style {
|
||||
struct RoundButton;
|
||||
struct IconButton;
|
||||
@@ -75,7 +80,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
class BoxContent : public Ui::RpWidget, protected base::Subscriber {
|
||||
class BoxContent : public Ui::RpWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
@@ -223,7 +228,8 @@ protected:
|
||||
|
||||
template <typename Widget>
|
||||
object_ptr<Widget> takeInnerWidget() {
|
||||
return static_object_cast<Widget>(doTakeInnerWidget());
|
||||
return object_ptr<Widget>::fromRaw(
|
||||
static_cast<Widget*>(doTakeInnerWidget().release()));
|
||||
}
|
||||
|
||||
void setInnerVisible(bool scrollAreaVisible);
|
||||
@@ -267,10 +273,7 @@ private:
|
||||
|
||||
};
|
||||
|
||||
class AbstractBox
|
||||
: public Window::LayerWidget
|
||||
, public BoxContentDelegate
|
||||
, protected base::Subscriber {
|
||||
class AbstractBox : public Window::LayerWidget, public BoxContentDelegate {
|
||||
public:
|
||||
AbstractBox(
|
||||
not_null<Window::LayerStackWidget*> layer,
|
||||
@@ -342,7 +345,6 @@ private:
|
||||
|
||||
void paintAdditionalTitle(Painter &p);
|
||||
void updateTitlePosition();
|
||||
void refreshLang();
|
||||
|
||||
[[nodiscard]] bool hasTitle() const;
|
||||
[[nodiscard]] int titleHeight() const;
|
||||
@@ -427,3 +429,30 @@ private:
|
||||
QPointer<BoxContent> _value;
|
||||
|
||||
};
|
||||
|
||||
// Legacy global method.
|
||||
namespace Ui {
|
||||
namespace internal {
|
||||
|
||||
void showBox(
|
||||
object_ptr<BoxContent> content,
|
||||
LayerOptions options,
|
||||
anim::type animated);
|
||||
|
||||
} // namespace internal
|
||||
|
||||
template <typename BoxType>
|
||||
QPointer<BoxType> show(
|
||||
object_ptr<BoxType> content,
|
||||
LayerOptions options = LayerOption::CloseOther,
|
||||
anim::type animated = anim::type::normal) {
|
||||
auto result = QPointer<BoxType>(content.data());
|
||||
internal::showBox(std::move(content), options, animated);
|
||||
return result;
|
||||
}
|
||||
|
||||
void hideLayer(anim::type animated = anim::type::normal);
|
||||
void hideSettingsAndLayer(anim::type animated = anim::type::normal);
|
||||
bool isLayerShown();
|
||||
|
||||
} // namespace Ui
|
||||
|
||||
@@ -25,12 +25,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "window/window_session_controller.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "ui/special_buttons.h"
|
||||
#include "ui/special_fields.h"
|
||||
#include "ui/text_options.h"
|
||||
#include "ui/unread_badge.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat.h"
|
||||
#include "data/data_user.h"
|
||||
@@ -40,6 +41,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "apiwrap.h"
|
||||
#include "observer_peer.h"
|
||||
#include "main/main_session.h"
|
||||
#include "facades.h"
|
||||
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QClipboard>
|
||||
@@ -578,7 +580,7 @@ void GroupInfoBox::createGroup(
|
||||
}).fail([=](const RPCError &error) {
|
||||
_creationRequestId = 0;
|
||||
if (error.type() == qstr("NO_CHAT_TITLE")) {
|
||||
auto weak = make_weak(this);
|
||||
auto weak = Ui::MakeWeak(this);
|
||||
selectUsersBox->closeBox();
|
||||
if (weak) {
|
||||
_title->showError();
|
||||
@@ -617,7 +619,7 @@ void GroupInfoBox::submit() {
|
||||
if (_type != Type::Group) {
|
||||
createChannel(title, description);
|
||||
} else {
|
||||
auto initBox = [title, weak = make_weak(this)](
|
||||
auto initBox = [title, weak = Ui::MakeWeak(this)](
|
||||
not_null<PeerListBox*> box) {
|
||||
auto create = [box, title, weak] {
|
||||
if (weak) {
|
||||
@@ -1361,7 +1363,7 @@ void RevokePublicLinkBox::Inner::updateSelected() {
|
||||
PeerData *selected = nullptr;
|
||||
auto top = _rowsTop;
|
||||
for (const auto &row : _rows) {
|
||||
auto revokeLink = rtlrect(width() - st::contactsPadding.right() - st::contactsCheckPosition.x() - _revokeWidth, top + st::contactsPadding.top() + (st::contactsPhotoSize - st::normalFont->height) / 2, _revokeWidth, st::normalFont->height, width());
|
||||
auto revokeLink = style::rtlrect(width() - st::contactsPadding.right() - st::contactsCheckPosition.x() - _revokeWidth, top + st::contactsPadding.top() + (st::contactsPhotoSize - st::normalFont->height) / 2, _revokeWidth, st::normalFont->height, width());
|
||||
if (revokeLink.contains(point)) {
|
||||
selected = row.peer;
|
||||
break;
|
||||
|
||||
@@ -11,6 +11,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "mtproto/sender.h"
|
||||
#include "styles/style_widgets.h"
|
||||
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
class ConfirmBox;
|
||||
class PeerListBox;
|
||||
|
||||
@@ -137,7 +139,10 @@ private:
|
||||
|
||||
};
|
||||
|
||||
class SetupChannelBox : public BoxContent, public RPCSender {
|
||||
class SetupChannelBox
|
||||
: public BoxContent
|
||||
, public RPCSender
|
||||
, private base::Subscriber {
|
||||
public:
|
||||
SetupChannelBox(
|
||||
QWidget*,
|
||||
@@ -232,7 +237,10 @@ private:
|
||||
|
||||
};
|
||||
|
||||
class RevokePublicLinkBox : public BoxContent, public RPCSender {
|
||||
class RevokePublicLinkBox
|
||||
: public BoxContent
|
||||
, public RPCSender
|
||||
, private base::Subscriber {
|
||||
public:
|
||||
RevokePublicLinkBox(
|
||||
QWidget*,
|
||||
|
||||
@@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "storage/localstorage.h"
|
||||
#include "mainwindow.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "facades.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
AutoLockBox::AutoLockBox(QWidget*, not_null<Main::Session*> session)
|
||||
|
||||
@@ -10,12 +10,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "lang/lang_keys.h"
|
||||
#include "ui/effects/round_checkbox.h"
|
||||
#include "ui/image/image.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "main/main_session.h"
|
||||
#include "apiwrap.h"
|
||||
#include "mtproto/sender.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_file_origin.h"
|
||||
#include "boxes/background_preview_box.h"
|
||||
#include "boxes/confirm_box.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_overview.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_chat_helpers.h"
|
||||
@@ -153,7 +156,7 @@ void BackgroundBox::prepare() {
|
||||
void BackgroundBox::removePaper(const Data::WallPaper &paper) {
|
||||
const auto box = std::make_shared<QPointer<BoxContent>>();
|
||||
const auto session = _session;
|
||||
const auto remove = [=, weak = make_weak(this)]{
|
||||
const auto remove = [=, weak = Ui::MakeWeak(this)]{
|
||||
if (*box) {
|
||||
(*box)->closeBox();
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/toast/toast.h"
|
||||
#include "ui/image/image.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_message.h"
|
||||
#include "history/view/history_view_message.h"
|
||||
@@ -24,6 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "base/unixtime.h"
|
||||
#include "boxes/confirm_box.h"
|
||||
#include "boxes/background_preview_box.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_history.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@ class Checkbox;
|
||||
|
||||
class BackgroundPreviewBox
|
||||
: public BoxContent
|
||||
, private HistoryView::SimpleElementDelegate {
|
||||
, private HistoryView::SimpleElementDelegate
|
||||
, private base::Subscriber {
|
||||
public:
|
||||
BackgroundPreviewBox(
|
||||
QWidget*,
|
||||
|
||||
@@ -8,10 +8,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "boxes/calendar_box.h"
|
||||
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "ui/effects/ripple_animation.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -258,7 +259,7 @@ void CalendarBox::Inner::monthChanged(QDate month) {
|
||||
_ripples.clear();
|
||||
resizeToCurrent();
|
||||
update();
|
||||
sendSynteticMouseEvent(this, QEvent::MouseMove, Qt::NoButton);
|
||||
Ui::SendSynteticMouseEvent(this, QEvent::MouseMove, Qt::NoButton);
|
||||
}
|
||||
|
||||
void CalendarBox::Inner::resizeToCurrent() {
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Ui {
|
||||
class IconButton;
|
||||
} // namespace Ui
|
||||
|
||||
class CalendarBox : public BoxContent {
|
||||
class CalendarBox : public BoxContent, private base::Subscriber {
|
||||
public:
|
||||
CalendarBox(
|
||||
QWidget*,
|
||||
|
||||
@@ -13,11 +13,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/wrap/fade_wrap.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/special_fields.h"
|
||||
#include "boxes/confirm_phone_box.h"
|
||||
#include "boxes/confirm_box.h"
|
||||
#include "main/main_session.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_user.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
namespace {
|
||||
@@ -308,7 +310,7 @@ void ChangePhoneBox::EnterCode::submit() {
|
||||
|
||||
const auto session = _session;
|
||||
const auto code = _code->getDigitsOnly();
|
||||
const auto weak = make_weak(this);
|
||||
const auto weak = Ui::MakeWeak(this);
|
||||
_requestId = MTP::send(MTPaccount_ChangePhone(
|
||||
MTP_string(_phone),
|
||||
MTP_string(_hash),
|
||||
|
||||
@@ -34,6 +34,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "base/unixtime.h"
|
||||
#include "main/main_session.h"
|
||||
#include "observer_peer.h"
|
||||
#include "facades.h"
|
||||
#include "app.h"
|
||||
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QClipboard>
|
||||
@@ -252,8 +254,9 @@ void ConfirmBox::mouseReleaseEvent(QMouseEvent *e) {
|
||||
_lastMousePos = e->globalPos();
|
||||
updateHover();
|
||||
if (const auto activated = ClickHandler::unpressed()) {
|
||||
const auto guard = window();
|
||||
Ui::hideLayer();
|
||||
App::activateClickHandler(activated, e->button());
|
||||
ActivateClickHandler(guard, activated, e->button());
|
||||
return;
|
||||
}
|
||||
BoxContent::mouseReleaseEvent(e);
|
||||
@@ -907,7 +910,9 @@ void ConfirmInviteBox::prepare() {
|
||||
for (const auto user : _participants) {
|
||||
auto name = new Ui::FlatLabel(this, st::confirmInviteUserName);
|
||||
name->resizeToWidth(st::confirmInviteUserPhotoSize + padding);
|
||||
name->setText(user->firstName.isEmpty() ? App::peerName(user) : user->firstName);
|
||||
name->setText(user->firstName.isEmpty()
|
||||
? user->name
|
||||
: user->firstName);
|
||||
name->moveToLeft(left + (padding / 2), st::confirmInviteUserNameTop);
|
||||
left += _userWidth;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
class MaxInviteBox : public BoxContent {
|
||||
class MaxInviteBox : public BoxContent, private base::Subscriber {
|
||||
public:
|
||||
MaxInviteBox(QWidget*, not_null<ChannelData*> channel);
|
||||
|
||||
@@ -201,7 +201,10 @@ private:
|
||||
|
||||
};
|
||||
|
||||
class ConfirmInviteBox : public BoxContent, public RPCSender {
|
||||
class ConfirmInviteBox
|
||||
: public BoxContent
|
||||
, public RPCSender
|
||||
, private base::Subscriber {
|
||||
public:
|
||||
ConfirmInviteBox(
|
||||
QWidget*,
|
||||
|
||||
@@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "platform/platform_info.h" // Platform::SystemVersionPretty
|
||||
#include "mainwidget.h"
|
||||
#include "numbers.h"
|
||||
#include "app.h"
|
||||
#include "lang/lang_keys.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -24,6 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/effects/animations.h"
|
||||
#include "ui/effects/radial_animation.h"
|
||||
#include "ui/text_options.h"
|
||||
#include "facades.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_chat_helpers.h"
|
||||
#include "styles/style_info.h"
|
||||
@@ -414,7 +415,7 @@ void ProxyRow::paintCheck(Painter &p) {
|
||||
pen.setCapStyle(Qt::RoundCap);
|
||||
p.setPen(pen);
|
||||
p.setBrush(_st->bg);
|
||||
const auto rect = rtlrect(QRectF(left, top, _st->diameter, _st->diameter).marginsRemoved(QMarginsF(_st->thickness / 2., _st->thickness / 2., _st->thickness / 2., _st->thickness / 2.)), outerWidth);
|
||||
const auto rect = style::rtlrect(QRectF(left, top, _st->diameter, _st->diameter).marginsRemoved(QMarginsF(_st->thickness / 2., _st->thickness / 2., _st->thickness / 2., _st->thickness / 2.)), outerWidth);
|
||||
if (_progress && loading.shown > 0 && anim::Disabled()) {
|
||||
anim::DrawStaticLoading(
|
||||
p,
|
||||
@@ -433,7 +434,7 @@ void ProxyRow::paintCheck(Painter &p) {
|
||||
p.setBrush(anim::brush(_st->untoggledFg, _st->toggledFg, toggled * set));
|
||||
|
||||
auto skip0 = _st->diameter / 2., skip1 = _st->skip / 10., checkSkip = skip0 * (1. - toggled) + skip1 * toggled;
|
||||
p.drawEllipse(rtlrect(QRectF(left, top, _st->diameter, _st->diameter).marginsRemoved(QMarginsF(checkSkip, checkSkip, checkSkip, checkSkip)), outerWidth));
|
||||
p.drawEllipse(style::rtlrect(QRectF(left, top, _st->diameter, _st->diameter).marginsRemoved(QMarginsF(checkSkip, checkSkip, checkSkip, checkSkip)), outerWidth));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "history/view/history_view_schedule_box.h"
|
||||
#include "settings/settings_common.h"
|
||||
#include "base/unique_qptr.h"
|
||||
#include "facades.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_settings.h"
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "platform/platform_specific.h"
|
||||
#include "facades.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
DownloadPathBox::DownloadPathBox(QWidget *parent)
|
||||
|
||||
@@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "boxes/edit_caption_box.h"
|
||||
|
||||
#include "apiwrap.h"
|
||||
#include "api/api_text_entities.h"
|
||||
#include "main/main_session.h"
|
||||
#include "chat_helpers/emoji_suggestions_widget.h"
|
||||
#include "chat_helpers/message_field.h"
|
||||
@@ -21,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_photo.h"
|
||||
#include "data/data_user.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_file_origin.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_item.h"
|
||||
#include "lang/lang_keys.h"
|
||||
@@ -31,12 +33,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "styles/style_chat_helpers.h"
|
||||
#include "styles/style_history.h"
|
||||
#include "ui/image/image.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/special_buttons.h"
|
||||
#include "ui/text_options.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "confirm_box.h"
|
||||
#include "facades.h"
|
||||
#include "app.h"
|
||||
|
||||
#include <QtCore/QMimeData>
|
||||
|
||||
@@ -810,10 +815,10 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) {
|
||||
// App::roundRect(p, x, y, w, h, st::msgInBg, MessageInCorners, &st::msgInShadow);
|
||||
|
||||
if (_thumbw) {
|
||||
QRect rthumb(rtlrect(x + 0, y + 0, st::msgFileThumbSize, st::msgFileThumbSize, width()));
|
||||
QRect rthumb(style::rtlrect(x + 0, y + 0, st::msgFileThumbSize, st::msgFileThumbSize, width()));
|
||||
p.drawPixmap(rthumb.topLeft(), _thumb);
|
||||
} else {
|
||||
const QRect inner(rtlrect(x + 0, y + 0, st::msgFileSize, st::msgFileSize, width()));
|
||||
const QRect inner(style::rtlrect(x + 0, y + 0, st::msgFileSize, st::msgFileSize, width()));
|
||||
p.setPen(Qt::NoPen);
|
||||
p.setBrush(st::msgFileInBg);
|
||||
|
||||
@@ -896,7 +901,7 @@ void EditCaptionBox::save() {
|
||||
const auto textWithTags = _field->getTextWithAppliedMarkdown();
|
||||
auto sending = TextWithEntities{
|
||||
textWithTags.text,
|
||||
ConvertTextTagsToEntities(textWithTags.tags)
|
||||
TextUtilities::ConvertTextTagsToEntities(textWithTags.tags)
|
||||
};
|
||||
const auto prepareFlags = Ui::ItemTextOptions(
|
||||
item->history(),
|
||||
@@ -904,9 +909,9 @@ void EditCaptionBox::save() {
|
||||
TextUtilities::PrepareForSending(sending, prepareFlags);
|
||||
TextUtilities::Trim(sending);
|
||||
|
||||
const auto sentEntities = TextUtilities::EntitiesToMTP(
|
||||
const auto sentEntities = Api::EntitiesToMTP(
|
||||
sending.entities,
|
||||
TextUtilities::ConvertOption::SkipLocal);
|
||||
Api::ConvertOption::SkipLocal);
|
||||
if (!sentEntities.v.isEmpty()) {
|
||||
flags |= MTPmessages_EditMessage::Flag::f_entities;
|
||||
}
|
||||
@@ -915,7 +920,7 @@ void EditCaptionBox::save() {
|
||||
const auto textWithTags = _field->getTextWithAppliedMarkdown();
|
||||
auto sending = TextWithEntities{
|
||||
textWithTags.text,
|
||||
ConvertTextTagsToEntities(textWithTags.tags)
|
||||
TextUtilities::ConvertTextTagsToEntities(textWithTags.tags)
|
||||
};
|
||||
item->setText(sending);
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "boxes/abstract_box.h"
|
||||
#include "storage/storage_media_prepare.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include <rpl/event_stream.h>
|
||||
#include "media/clip/media_clip_reader.h"
|
||||
|
||||
namespace ChatHelpers {
|
||||
class TabbedPanel;
|
||||
@@ -35,7 +35,10 @@ namespace Window {
|
||||
class SessionController;
|
||||
} // namespace Window
|
||||
|
||||
class EditCaptionBox : public BoxContent, public RPCSender {
|
||||
class EditCaptionBox
|
||||
: public BoxContent
|
||||
, public RPCSender
|
||||
, private base::Subscriber {
|
||||
public:
|
||||
EditCaptionBox(
|
||||
QWidget*,
|
||||
|
||||
@@ -8,11 +8,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "boxes/edit_color_box.h"
|
||||
|
||||
#include "lang/lang_keys.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "ui/widgets/shadow.h"
|
||||
#include "platform/platform_info.h"
|
||||
#include "styles/style_mediaview.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "platform/platform_info.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_mediaview.h"
|
||||
|
||||
class EditColorBox::Picker : public TWidget {
|
||||
public:
|
||||
@@ -64,8 +66,8 @@ private:
|
||||
};
|
||||
|
||||
QCursor EditColorBox::Picker::generateCursor() {
|
||||
auto diameter = ConvertScale(16);
|
||||
auto line = ConvertScale(1);
|
||||
auto diameter = style::ConvertScale(16);
|
||||
auto line = style::ConvertScale(1);
|
||||
auto size = ((diameter + 2 * line) >= 32) ? 64 : 32;
|
||||
auto cursor = QImage(QSize(size, size) * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied);
|
||||
cursor.setDevicePixelRatio(cRetinaFactor());
|
||||
@@ -873,7 +875,7 @@ void EditColorBox::fieldSubmitted() {
|
||||
}
|
||||
|
||||
void EditColorBox::saveColor() {
|
||||
const auto weak = make_weak(this);
|
||||
const auto weak = Ui::MakeWeak(this);
|
||||
_cancelCallback = nullptr;
|
||||
if (_saveCallback) {
|
||||
_saveCallback(_new.toRgb());
|
||||
|
||||
@@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
#include "boxes/abstract_box.h"
|
||||
|
||||
class EditColorBox : public BoxContent {
|
||||
class EditColorBox : public BoxContent, private base::Subscriber {
|
||||
public:
|
||||
enum class Mode {
|
||||
RGBA,
|
||||
|
||||
@@ -11,10 +11,11 @@ Copyright (C) 2017, Nicholas Guriev <guriev-ns@ya.ru>
|
||||
#include "main/main_session.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_peer.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "ui/special_buttons.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -44,7 +45,7 @@ void MuteSettingsBox::prepare() {
|
||||
icon->moveToLeft(st::boxPadding.left(), y);
|
||||
|
||||
object_ptr<Ui::FlatLabel> title(this, st::muteChatTitle);
|
||||
title->setText(App::peerName(_peer, true));
|
||||
title->setText(_peer->name);
|
||||
title->moveToLeft(
|
||||
st::boxPadding.left() + st::muteChatTitleLeft,
|
||||
y + (icon->height() / 2) - (title->height() / 2));
|
||||
|
||||
@@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/wrap/fade_wrap.h"
|
||||
#include "passport/passport_encryption.h"
|
||||
#include "passport/passport_panel_edit_contact.h"
|
||||
#include "facades.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_passport.h"
|
||||
|
||||
@@ -268,7 +269,7 @@ void PasscodeBox::setPasswordDone(const QByteArray &newPasswordBytes) {
|
||||
}
|
||||
_setRequest = 0;
|
||||
_newPasswordSet.fire_copy(newPasswordBytes);
|
||||
const auto weak = make_weak(this);
|
||||
const auto weak = Ui::MakeWeak(this);
|
||||
const auto text = _reenterPasscode->isHidden()
|
||||
? tr::lng_cloud_password_removed(tr::now)
|
||||
: _oldPasscode->isHidden()
|
||||
@@ -367,7 +368,7 @@ void PasscodeBox::validateEmail(
|
||||
} else if (error.type() == qstr("CODE_INVALID")) {
|
||||
errors->fire(tr::lng_signin_wrong_code(tr::now));
|
||||
} else if (error.type() == qstr("EMAIL_HASH_EXPIRED")) {
|
||||
const auto weak = make_weak(this);
|
||||
const auto weak = Ui::MakeWeak(this);
|
||||
_clearUnconfirmedPassword.fire({});
|
||||
if (weak) {
|
||||
auto box = Box<InformBox>(
|
||||
@@ -408,7 +409,7 @@ void PasscodeBox::validateEmail(
|
||||
box->boxClosing(
|
||||
) | rpl::filter([=] {
|
||||
return !*set;
|
||||
}) | start_with_next([=, weak = make_weak(this)] {
|
||||
}) | start_with_next([=, weak = Ui::MakeWeak(this)] {
|
||||
if (weak) {
|
||||
weak->_clearUnconfirmedPassword.fire({});
|
||||
}
|
||||
@@ -511,7 +512,7 @@ void PasscodeBox::save(bool force) {
|
||||
}
|
||||
} else {
|
||||
closeReplacedBy();
|
||||
const auto weak = make_weak(this);
|
||||
const auto weak = Ui::MakeWeak(this);
|
||||
cSetPasscodeBadTries(0);
|
||||
Local::setPasscode(pwd.toUtf8());
|
||||
_session->localPasscodeChanged();
|
||||
|
||||
@@ -507,14 +507,14 @@ void PeerListRow::paintDisabledCheckUserpic(
|
||||
auto userpicDiameter = st::contactsPhotoCheckbox.imageRadius * 2;
|
||||
auto userpicLeft = x + userpicShift;
|
||||
auto userpicTop = y + userpicShift;
|
||||
auto userpicEllipse = rtlrect(x, y, userpicDiameter, userpicDiameter, outerWidth);
|
||||
auto userpicEllipse = style::rtlrect(x, y, userpicDiameter, userpicDiameter, outerWidth);
|
||||
auto userpicBorderPen = st::contactsPhotoDisabledCheckFg->p;
|
||||
userpicBorderPen.setWidth(st::contactsPhotoCheckbox.selectWidth);
|
||||
|
||||
auto iconDiameter = st::contactsPhotoCheckbox.check.size;
|
||||
auto iconLeft = x + userpicDiameter + st::contactsPhotoCheckbox.selectWidth - iconDiameter;
|
||||
auto iconTop = y + userpicDiameter + st::contactsPhotoCheckbox.selectWidth - iconDiameter;
|
||||
auto iconEllipse = rtlrect(iconLeft, iconTop, iconDiameter, iconDiameter, outerWidth);
|
||||
auto iconEllipse = style::rtlrect(iconLeft, iconTop, iconDiameter, iconDiameter, outerWidth);
|
||||
auto iconBorderPen = st::contactsPhotoCheckbox.check.border->p;
|
||||
iconBorderPen.setWidth(st::contactsPhotoCheckbox.selectWidth);
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "boxes/confirm_box.h"
|
||||
#include "observer_peer.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "main/main_session.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_channel.h"
|
||||
@@ -22,6 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "history/history.h"
|
||||
#include "dialogs/dialogs_main_list.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "facades.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_profile.h"
|
||||
|
||||
@@ -456,7 +458,7 @@ void AddBotToGroupBoxController::shareBotGame(not_null<PeerData*> chat) {
|
||||
});
|
||||
auto confirmText = [chat] {
|
||||
if (chat->isUser()) {
|
||||
return tr::lng_bot_sure_share_game(tr::now, lt_user, App::peerName(chat));
|
||||
return tr::lng_bot_sure_share_game(tr::now, lt_user, chat->name);
|
||||
}
|
||||
return tr::lng_bot_sure_share_game_group(tr::now, lt_group, chat->name);
|
||||
}();
|
||||
|
||||
@@ -28,6 +28,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
//
|
||||
//};
|
||||
|
||||
class History;
|
||||
|
||||
namespace Window {
|
||||
class SessionNavigation;
|
||||
} // namespace Window
|
||||
|
||||
@@ -24,6 +24,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "window/window_session_controller.h"
|
||||
#include "apiwrap.h"
|
||||
#include "observer_peer.h"
|
||||
#include "facades.h"
|
||||
#include "app.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -775,7 +777,7 @@ void AddSpecialBoxController::kickUser(
|
||||
: tr::lng_profile_sure_kick_channel)(
|
||||
tr::now,
|
||||
lt_user,
|
||||
App::peerName(user));
|
||||
user->name);
|
||||
_editBox = Ui::show(
|
||||
Box<ConfirmBox>(text, kickUserSure),
|
||||
LayerOption::KeepOther);
|
||||
|
||||
@@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/toast/toast.h"
|
||||
#include "main/main_session.h"
|
||||
#include "apiwrap.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_info.h"
|
||||
|
||||
@@ -201,7 +202,7 @@ void Controller::initNameFields(
|
||||
return;
|
||||
}
|
||||
SendRequest(
|
||||
make_weak(_box),
|
||||
Ui::MakeWeak(_box),
|
||||
_user,
|
||||
_sharePhone && _sharePhone->checked(),
|
||||
firstValue,
|
||||
|
||||
@@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "boxes/confirm_box.h"
|
||||
#include "boxes/add_contact_box.h"
|
||||
#include "apiwrap.h"
|
||||
#include "facades.h"
|
||||
#include "main/main_session.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_info.h"
|
||||
|
||||
@@ -35,6 +35,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "core/core_cloud_password.h"
|
||||
#include "base/unixtime.h"
|
||||
#include "apiwrap.h"
|
||||
#include "facades.h"
|
||||
#include "main/main_session.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_info.h"
|
||||
@@ -56,7 +57,7 @@ void SetCloudPassword(not_null<GenericBox*> box, not_null<UserData*> user) {
|
||||
user->session().api().passwordState(
|
||||
) | rpl::start_with_next([=] {
|
||||
using namespace Settings;
|
||||
const auto weak = make_weak(box);
|
||||
const auto weak = Ui::MakeWeak(box);
|
||||
if (CheckEditCloudPassword(&user->session())) {
|
||||
box->getDelegate()->show(
|
||||
EditCloudPasswordBox(&user->session()));
|
||||
@@ -160,7 +161,7 @@ EditParticipantBox::Inner::Inner(
|
||||
_userPhoto->setPointerCursor(false);
|
||||
_userName.setText(
|
||||
st::rightsNameStyle,
|
||||
App::peerName(_user),
|
||||
_user->name,
|
||||
Ui::NameTextOptions());
|
||||
}
|
||||
|
||||
@@ -579,7 +580,7 @@ void EditAdminBox::sendTransferRequestFrom(
|
||||
if (_transferRequestId) {
|
||||
return;
|
||||
}
|
||||
const auto weak = make_weak(this);
|
||||
const auto weak = Ui::MakeWeak(this);
|
||||
const auto user = this->user();
|
||||
const auto api = &channel->session().api();
|
||||
_transferRequestId = api->request(MTPchannels_EditCreator(
|
||||
@@ -625,7 +626,7 @@ void EditAdminBox::sendTransferRequestFrom(
|
||||
|| (type == qstr("PASSWORD_TOO_FRESH_XXX"))
|
||||
|| (type == qstr("SESSION_TOO_FRESH_XXX"));
|
||||
}();
|
||||
const auto weak = make_weak(this);
|
||||
const auto weak = Ui::MakeWeak(this);
|
||||
getDelegate()->show(Box<InformBox>(problem));
|
||||
if (box) {
|
||||
box->closeBox();
|
||||
|
||||
@@ -25,8 +25,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_user.h"
|
||||
#include "base/unixtime.h"
|
||||
#include "ui/widgets/popup_menu.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "history/history.h"
|
||||
#include "facades.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -1817,7 +1819,7 @@ void ParticipantsBoxController::refreshCustomStatus(
|
||||
row->setCustomStatus(tr::lng_channel_admin_status_promoted_by(
|
||||
tr::now,
|
||||
lt_user,
|
||||
App::peerName(by)));
|
||||
by->name));
|
||||
} else {
|
||||
if (_additional.isCreator(user)) {
|
||||
row->setCustomStatus(
|
||||
@@ -1834,7 +1836,7 @@ void ParticipantsBoxController::refreshCustomStatus(
|
||||
: tr::lng_channel_banned_status_restricted_by)(
|
||||
tr::now,
|
||||
lt_user,
|
||||
by ? App::peerName(by) : "Unknown"));
|
||||
by ? by->name : "Unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,9 +43,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include <rpl/flatten_latest.h>
|
||||
#include <rpl/range.h>
|
||||
#include "info/profile/info_profile_icon.h"
|
||||
#include "app.h"
|
||||
#include "facades.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "boxes/peers/edit_peer_info_box.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "mainwindow.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_info.h"
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/wrap/padding_wrap.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/special_fields.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include <rpl/flatten_latest.h>
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
#include "lang/lang_keys.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
PhotoCropBox::PhotoCropBox(
|
||||
@@ -259,7 +261,7 @@ void PhotoCropBox::sendPhoto() {
|
||||
tosend = cropped.copy();
|
||||
}
|
||||
|
||||
auto weak = make_weak(this);
|
||||
auto weak = Ui::MakeWeak(this);
|
||||
_readyImages.fire(std::move(tosend));
|
||||
if (weak) {
|
||||
closeBox();
|
||||
|
||||
@@ -34,6 +34,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "api/api_common.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "layout.h"
|
||||
#include "facades.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_history.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_chat_helpers.h"
|
||||
@@ -898,7 +900,7 @@ void SingleFilePreview::paintEvent(QPaintEvent *e) {
|
||||
App::roundRect(p, x, y, w, h, st::msgOutBg, MessageOutCorners, &st::msgOutShadow);
|
||||
|
||||
if (_fileThumb.isNull()) {
|
||||
QRect inner(rtlrect(x + st::msgFilePadding.left(), y + st::msgFilePadding.top(), st::msgFileSize, st::msgFileSize, width()));
|
||||
QRect inner(style::rtlrect(x + st::msgFilePadding.left(), y + st::msgFilePadding.top(), st::msgFileSize, st::msgFileSize, width()));
|
||||
p.setPen(Qt::NoPen);
|
||||
p.setBrush(st::msgFileOutBg);
|
||||
|
||||
@@ -914,7 +916,7 @@ void SingleFilePreview::paintEvent(QPaintEvent *e) {
|
||||
: st::historyFileOutDocument;
|
||||
icon.paintInCenter(p, inner);
|
||||
} else {
|
||||
QRect rthumb(rtlrect(x + st::msgFileThumbPadding.left(), y + st::msgFileThumbPadding.top(), st::msgFileThumbSize, st::msgFileThumbSize, width()));
|
||||
QRect rthumb(style::rtlrect(x + st::msgFileThumbPadding.left(), y + st::msgFileThumbPadding.top(), st::msgFileThumbSize, st::msgFileThumbSize, width()));
|
||||
p.drawPixmap(rthumb.topLeft(), _fileThumb);
|
||||
}
|
||||
p.setFont(st::semiboldFont);
|
||||
@@ -1462,7 +1464,7 @@ void SendFilesBox::setupShadows(
|
||||
bottomShadow->move(
|
||||
geometry.x(),
|
||||
geometry.y() + geometry.height() - st::lineWidth);
|
||||
}, [t = make_weak(topShadow), b = make_weak(bottomShadow)] {
|
||||
}, [t = Ui::MakeWeak(topShadow), b = Ui::MakeWeak(bottomShadow)] {
|
||||
Ui::DestroyChild(t.data());
|
||||
Ui::DestroyChild(b.data());
|
||||
}, topShadow->lifetime());
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
Fn<void(PeerData *peer, bool selected)> callback);
|
||||
void peerUnselected(not_null<PeerData*> peer);
|
||||
|
||||
QVector<PeerData*> selected() const;
|
||||
std::vector<not_null<PeerData*>> selected() const;
|
||||
bool hasSelected() const;
|
||||
|
||||
void peopleReceived(
|
||||
@@ -643,7 +643,7 @@ void ShareBox::Inner::repaintChatAtIndex(int index) {
|
||||
|
||||
auto row = index / _columnCount;
|
||||
auto column = index % _columnCount;
|
||||
update(rtlrect(_rowsLeft + qFloor(column * _rowWidthReal), row * _rowHeight, _rowWidth, _rowHeight, width()));
|
||||
update(style::rtlrect(_rowsLeft + qFloor(column * _rowWidthReal), row * _rowHeight, _rowWidth, _rowHeight, width()));
|
||||
}
|
||||
|
||||
ShareBox::Inner::Chat *ShareBox::Inner::getChatAtIndex(int index) {
|
||||
@@ -1064,8 +1064,8 @@ void ShareBox::Inner::refresh() {
|
||||
update();
|
||||
}
|
||||
|
||||
QVector<PeerData*> ShareBox::Inner::selected() const {
|
||||
auto result = QVector<PeerData*>();
|
||||
std::vector<not_null<PeerData*>> ShareBox::Inner::selected() const {
|
||||
auto result = std::vector<not_null<PeerData*>>();
|
||||
result.reserve(_dataMap.size());
|
||||
for (const auto &[peer, chat] : _dataMap) {
|
||||
if (chat->checkbox.checked()) {
|
||||
|
||||
@@ -56,7 +56,7 @@ class ShareBox : public BoxContent, public RPCSender {
|
||||
public:
|
||||
using CopyCallback = Fn<void()>;
|
||||
using SubmitCallback = Fn<void(
|
||||
QVector<PeerData*>&&,
|
||||
std::vector<not_null<PeerData*>>&&,
|
||||
TextWithTags&&,
|
||||
Api::SendOptions)>;
|
||||
using FilterCallback = Fn<bool(PeerData*)>;
|
||||
|
||||
@@ -38,7 +38,7 @@ void SingleChoiceBox::prepare() {
|
||||
content->add(object_ptr<Ui::FixedHeightWidget>(
|
||||
content,
|
||||
st::boxOptionListPadding.top() + st::autolockButton.margin.top()));
|
||||
auto &&ints = ranges::view::ints(0);
|
||||
auto &&ints = ranges::view::ints(0, ranges::unreachable);
|
||||
for (const auto &[i, text] : ranges::view::zip(ints, _optionTexts)) {
|
||||
content->add(
|
||||
object_ptr<Ui::Radiobutton>(
|
||||
@@ -54,7 +54,7 @@ void SingleChoiceBox::prepare() {
|
||||
st::boxOptionListSkip));
|
||||
}
|
||||
group->setChangedCallback([=](int value) {
|
||||
const auto weak = make_weak(this);
|
||||
const auto weak = Ui::MakeWeak(this);
|
||||
_callback(value);
|
||||
if (weak) {
|
||||
closeBox();
|
||||
|
||||
@@ -29,6 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "apiwrap.h"
|
||||
#include "mainwidget.h"
|
||||
#include "mainwindow.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_chat_helpers.h"
|
||||
|
||||
@@ -440,7 +441,7 @@ void StickerSetBox::Inner::mouseReleaseEvent(QMouseEvent *e) {
|
||||
const auto index = stickerFromGlobalPos(e->globalPos());
|
||||
if (index >= 0 && index < _pack.size() && !isMasksSet()) {
|
||||
const auto sticker = _pack[index];
|
||||
Core::App().postponeCall(crl::guard(App::main(), [=] {
|
||||
Ui::PostponeCall(crl::guard(App::main(), [=] {
|
||||
if (App::main()->onSendSticker(sticker)) {
|
||||
Ui::hideSettingsAndLayer();
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/image/image.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "main/main_session.h"
|
||||
#include "facades.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_chat_helpers.h"
|
||||
|
||||
@@ -877,7 +879,7 @@ void StickersBox::Inner::paintRow(Painter &p, not_null<Row*> set, int index) {
|
||||
|
||||
{
|
||||
PainterHighQualityEnabler hq(p);
|
||||
p.drawEllipse(rtlrect(namex + set->titleWidth + st::stickersFeaturedUnreadSkip, namey + st::stickersFeaturedUnreadTop, st::stickersFeaturedUnreadSize, st::stickersFeaturedUnreadSize, width()));
|
||||
p.drawEllipse(style::rtlrect(namex + set->titleWidth + st::stickersFeaturedUnreadSkip, namey + st::stickersFeaturedUnreadTop, st::stickersFeaturedUnreadSize, st::stickersFeaturedUnreadSize, width()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "mtproto/sender.h"
|
||||
#include "chat_helpers/stickers.h"
|
||||
#include "ui/effects/animations.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
#include "ui/special_fields.h"
|
||||
|
||||
class ConfirmBox;
|
||||
|
||||
@@ -32,7 +32,10 @@ namespace Main {
|
||||
class Session;
|
||||
} // namespace Main
|
||||
|
||||
class StickersBox : public BoxContent, public RPCSender {
|
||||
class StickersBox final
|
||||
: public BoxContent
|
||||
, public RPCSender
|
||||
, private base::Subscriber {
|
||||
public:
|
||||
enum class Section {
|
||||
Installed,
|
||||
|
||||
@@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "lang/lang_keys.h"
|
||||
#include "main/main_session.h"
|
||||
#include "apiwrap.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
void UrlAuthBox::Activate(
|
||||
@@ -176,7 +177,7 @@ not_null<Ui::RpWidget*> UrlAuthBox::setupContent(
|
||||
textcmdStartSemibold() + domain + textcmdStopSemibold(),
|
||||
lt_user,
|
||||
(textcmdStartSemibold()
|
||||
+ App::peerName(session->user())
|
||||
+ session->user()->name
|
||||
+ textcmdStopSemibold())));
|
||||
const auto allow = bot
|
||||
? addCheckbox(tr::lng_url_auth_allow_messages(
|
||||
|
||||
@@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "mainwidget.h"
|
||||
#include "mainwindow.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
#include "ui/special_fields.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "core/application.h"
|
||||
#include "main/main_session.h"
|
||||
|
||||
@@ -21,6 +21,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_media_types.h"
|
||||
#include "data/data_user.h"
|
||||
#include "facades.h"
|
||||
#include "app.h"
|
||||
|
||||
namespace Calls {
|
||||
namespace {
|
||||
@@ -156,7 +158,7 @@ void BoxController::Row::paintAction(
|
||||
_actionRipple.reset();
|
||||
}
|
||||
}
|
||||
st::callReDial.icon.paintInCenter(p, rtlrect(x, y, size.width(), size.height(), outerWidth));
|
||||
st::callReDial.icon.paintInCenter(p, style::rtlrect(x, y, size.width(), size.height(), outerWidth));
|
||||
}
|
||||
|
||||
void BoxController::Row::refreshStatus() {
|
||||
|
||||
@@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "calls/calls_panel.h"
|
||||
#include "data/data_user.h"
|
||||
#include "data/data_session.h"
|
||||
#include "facades.h"
|
||||
|
||||
#ifdef slots
|
||||
#undef slots
|
||||
@@ -871,11 +872,11 @@ void Call::setFailedQueued(int error) {
|
||||
|
||||
void Call::handleRequestError(const RPCError &error) {
|
||||
if (error.type() == qstr("USER_PRIVACY_RESTRICTED")) {
|
||||
Ui::show(Box<InformBox>(tr::lng_call_error_not_available(tr::now, lt_user, App::peerName(_user))));
|
||||
Ui::show(Box<InformBox>(tr::lng_call_error_not_available(tr::now, lt_user, _user->name)));
|
||||
} else if (error.type() == qstr("PARTICIPANT_VERSION_OUTDATED")) {
|
||||
Ui::show(Box<InformBox>(tr::lng_call_error_outdated(tr::now, lt_user, App::peerName(_user))));
|
||||
Ui::show(Box<InformBox>(tr::lng_call_error_outdated(tr::now, lt_user, _user->name)));
|
||||
} else if (error.type() == qstr("CALL_PROTOCOL_LAYER_INVALID")) {
|
||||
Ui::show(Box<InformBox>(Lang::Hard::CallErrorIncompatible().replace("{user}", App::peerName(_user))));
|
||||
Ui::show(Box<InformBox>(Lang::Hard::CallErrorIncompatible().replace("{user}", _user->name)));
|
||||
}
|
||||
finish(FinishType::Failed);
|
||||
}
|
||||
@@ -885,7 +886,7 @@ void Call::handleControllerError(int error) {
|
||||
Ui::show(Box<InformBox>(
|
||||
Lang::Hard::CallErrorIncompatible().replace(
|
||||
"{user}",
|
||||
App::peerName(_user))));
|
||||
_user->name)));
|
||||
} else if (error == tgvoip::ERROR_AUDIO_IO) {
|
||||
Ui::show(Box<InformBox>(tr::lng_call_error_audio_io(tr::now)));
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "base/unixtime.h"
|
||||
#include "mainwidget.h"
|
||||
#include "boxes/rate_call_box.h"
|
||||
#include "facades.h"
|
||||
#include "app.h"
|
||||
|
||||
namespace Calls {
|
||||
namespace {
|
||||
@@ -41,7 +43,7 @@ void Instance::startOutgoingCall(not_null<UserData*> user) {
|
||||
if (user->callsStatus() == UserData::CallsStatus::Private) {
|
||||
// Request full user once more to refresh the setting in case it was changed.
|
||||
_session->api().requestFullPeer(user);
|
||||
Ui::show(Box<InformBox>(tr::lng_call_error_not_available(tr::now, lt_user, App::peerName(user))));
|
||||
Ui::show(Box<InformBox>(tr::lng_call_error_not_available(tr::now, lt_user, user->name)));
|
||||
return;
|
||||
}
|
||||
requestMicrophonePermissionOrFail(crl::guard(this, [=] {
|
||||
|
||||
@@ -10,15 +10,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_photo.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_user.h"
|
||||
#include "data/data_file_origin.h"
|
||||
#include "calls/calls_emoji_fingerprint.h"
|
||||
#include "styles/style_calls.h"
|
||||
#include "styles/style_history.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/widgets/shadow.h"
|
||||
#include "ui/effects/ripple_animation.h"
|
||||
#include "ui/image/image.h"
|
||||
#include "ui/wrap/fade_wrap.h"
|
||||
#include "ui/platform/ui_platform_utility.h"
|
||||
#include "ui/empty_userpic.h"
|
||||
#include "ui/emoji_config.h"
|
||||
#include "core/application.h"
|
||||
@@ -30,6 +30,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "platform/platform_specific.h"
|
||||
#include "window/main_window.h"
|
||||
#include "layout.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_calls.h"
|
||||
#include "styles/style_history.h"
|
||||
|
||||
#include <QtWidgets/QDesktopWidget>
|
||||
#include <QtWidgets/QApplication>
|
||||
@@ -357,7 +360,7 @@ void Panel::initControls() {
|
||||
if (!_call || update.peer != _call->user()) {
|
||||
return;
|
||||
}
|
||||
_name->setText(App::peerName(_call->user()));
|
||||
_name->setText(_call->user()->name);
|
||||
updateControlsGeometry();
|
||||
}));
|
||||
_updateDurationTimer.setCallback([this] {
|
||||
@@ -415,7 +418,7 @@ void Panel::reinitControls() {
|
||||
st::callPanelSignalBars,
|
||||
[=] { rtlupdate(signalBarsRect()); });
|
||||
|
||||
_name->setText(App::peerName(_call->user()));
|
||||
_name->setText(_call->user()->name);
|
||||
updateStatusText(_call->state());
|
||||
}
|
||||
|
||||
@@ -439,7 +442,7 @@ void Panel::initLayout() {
|
||||
});
|
||||
createDefaultCacheImage();
|
||||
|
||||
Platform::InitOnTopPanel(this);
|
||||
Ui::Platform::InitOnTopPanel(this);
|
||||
}
|
||||
|
||||
void Panel::toggleOpacityAnimation(bool visible) {
|
||||
@@ -591,7 +594,7 @@ bool Panel::isGoodUserPhoto(PhotoData *photo) {
|
||||
|
||||
void Panel::initGeometry() {
|
||||
auto center = Core::App().getPointForCallPanelCenter();
|
||||
_useTransparency = Platform::TranslucentWindowsSupported(center);
|
||||
_useTransparency = Ui::Platform::TranslucentWindowsSupported(center);
|
||||
setAttribute(Qt::WA_OpaquePaintEvent, !_useTransparency);
|
||||
_padding = _useTransparency ? st::callShadow.extend : style::margins(st::lineWidth, st::lineWidth, st::lineWidth, st::lineWidth);
|
||||
_contentTop = _padding.top() + st::callWidth;
|
||||
@@ -703,7 +706,7 @@ void Panel::paintEvent(QPaintEvent *e) {
|
||||
finishAnimating();
|
||||
if (!_call || isHidden()) return;
|
||||
} else {
|
||||
Platform::StartTranslucentPaint(p, e);
|
||||
Ui::Platform::StartTranslucentPaint(p, e);
|
||||
p.setOpacity(opacity);
|
||||
|
||||
PainterHighQualityEnabler hq(p);
|
||||
@@ -716,7 +719,7 @@ void Panel::paintEvent(QPaintEvent *e) {
|
||||
}
|
||||
|
||||
if (_useTransparency) {
|
||||
Platform::StartTranslucentPaint(p, e);
|
||||
Ui::Platform::StartTranslucentPaint(p, e);
|
||||
p.drawPixmapLeft(0, 0, width(), _cache);
|
||||
} else {
|
||||
p.drawPixmapLeft(_padding.left(), _padding.top(), width(), _userPhoto);
|
||||
@@ -815,7 +818,7 @@ void Panel::leaveToChildEvent(QEvent *e, QWidget *child) {
|
||||
}
|
||||
|
||||
QString Panel::tooltipText() const {
|
||||
return tr::lng_call_fingerprint_tooltip(tr::now, lt_user, App::peerName(_user));
|
||||
return tr::lng_call_fingerprint_tooltip(tr::now, lt_user, _user->name);
|
||||
}
|
||||
|
||||
QPoint Panel::tooltipPos() const {
|
||||
@@ -863,9 +866,9 @@ void Panel::stateChanged(State state) {
|
||||
if (windowHandle()) {
|
||||
// First stateChanged() is called before the first Platform::InitOnTopPanel(this).
|
||||
if ((state == State::Starting) || (state == State::WaitingIncoming)) {
|
||||
Platform::ReInitOnTopPanel(this);
|
||||
Ui::Platform::ReInitOnTopPanel(this);
|
||||
} else {
|
||||
Platform::DeInitOnTopPanel(this);
|
||||
Ui::Platform::DeInitOnTopPanel(this);
|
||||
}
|
||||
}
|
||||
if (state == State::Established) {
|
||||
|
||||
@@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "boxes/abstract_box.h"
|
||||
#include "base/timer.h"
|
||||
#include "layout.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_calls.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
@@ -133,10 +134,10 @@ void TopBar::updateInfoLabels() {
|
||||
}
|
||||
|
||||
void TopBar::setInfoLabels() {
|
||||
if (auto call = _call.get()) {
|
||||
auto user = call->user();
|
||||
auto fullName = App::peerName(user);
|
||||
auto shortName = user->firstName;
|
||||
if (const auto call = _call.get()) {
|
||||
const auto user = call->user();
|
||||
const auto fullName = user->name;
|
||||
const auto shortName = user->firstName;
|
||||
_fullInfoLabel->setText(fullName.toUpper());
|
||||
_shortInfoLabel->setText(shortName.toUpper());
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
#include "base/weak_ptr.h"
|
||||
#include "base/timer.h"
|
||||
#include "base/object_ptr.h"
|
||||
#include "ui/rp_widget.h"
|
||||
|
||||
namespace Ui {
|
||||
|
||||
@@ -12,6 +12,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_user.h"
|
||||
#include "data/data_session.h"
|
||||
#include "main/main_session.h"
|
||||
#include "facades.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_widgets.h"
|
||||
#include "styles/style_history.h"
|
||||
|
||||
@@ -133,7 +135,7 @@ void BotKeyboard::mouseReleaseEvent(QMouseEvent *e) {
|
||||
updateSelected();
|
||||
|
||||
if (ClickHandlerPtr activated = ClickHandler::unpressed()) {
|
||||
App::activateClickHandler(activated, e->button());
|
||||
ActivateClickHandler(window(), activated, e->button());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,6 +270,10 @@ QPoint BotKeyboard::tooltipPos() const {
|
||||
return _lastMousePos;
|
||||
}
|
||||
|
||||
bool BotKeyboard::tooltipWindowActive() const {
|
||||
return Ui::InFocusChain(window());
|
||||
}
|
||||
|
||||
QString BotKeyboard::tooltipText() const {
|
||||
if (ClickHandlerPtr lnk = ClickHandler::getActive()) {
|
||||
return lnk->tooltip();
|
||||
|
||||
@@ -46,6 +46,7 @@ public:
|
||||
// AbstractTooltipShower interface
|
||||
QString tooltipText() const override;
|
||||
QPoint tooltipPos() const override;
|
||||
bool tooltipWindowActive() const override;
|
||||
|
||||
// ClickHandlerHost interface
|
||||
void clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active) override;
|
||||
|
||||
@@ -168,11 +168,20 @@ void AppendFoundEmoji(
|
||||
std::vector<Result> &result,
|
||||
const QString &label,
|
||||
const std::vector<LangPackEmoji> &list) {
|
||||
// It is important that the 'result' won't relocate while inserting.
|
||||
result.reserve(result.size() + list.size());
|
||||
const auto alreadyBegin = result.data();
|
||||
const auto alreadyEnd = alreadyBegin + result.size();
|
||||
|
||||
auto &&add = ranges::view::all(
|
||||
list
|
||||
) | ranges::view::filter([&](const LangPackEmoji &entry) {
|
||||
const auto i = ranges::find(result, entry.emoji, &Result::emoji);
|
||||
return (i == end(result));
|
||||
const auto i = ranges::find(
|
||||
alreadyBegin,
|
||||
alreadyEnd,
|
||||
entry.emoji,
|
||||
&Result::emoji);
|
||||
return (i == alreadyEnd);
|
||||
}) | ranges::view::transform([&](const LangPackEmoji &entry) {
|
||||
return Result{ entry.emoji, label, entry.text };
|
||||
});
|
||||
@@ -449,7 +458,7 @@ std::vector<Result> EmojiKeywords::LangPack::query(
|
||||
}
|
||||
|
||||
const auto from = _data.emoji.lower_bound(normalized);
|
||||
auto &&chosen = ranges::make_iterator_range(
|
||||
auto &&chosen = ranges::make_subrange(
|
||||
from,
|
||||
end(_data.emoji)
|
||||
) | ranges::view::take_while([&](const auto &pair) {
|
||||
|
||||
@@ -11,11 +11,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/shadow.h"
|
||||
#include "ui/emoji_config.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "emoji_suggestions_data.h"
|
||||
#include "emoji_suggestions_helper.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "facades.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_chat_helpers.h"
|
||||
|
||||
namespace ChatHelpers {
|
||||
@@ -392,7 +394,10 @@ EmojiListWidget::EmojiListWidget(
|
||||
_esize = Ui::Emoji::GetSizeLarge();
|
||||
|
||||
for (auto i = 0; i != kEmojiSectionCount; ++i) {
|
||||
_counts[i] = Ui::Emoji::GetSectionCount(static_cast<Section>(i));
|
||||
const auto section = static_cast<Section>(i);
|
||||
_counts[i] = (section == Section::Recent)
|
||||
? GetRecentEmoji().size()
|
||||
: Ui::Emoji::GetSectionCount(section);
|
||||
}
|
||||
|
||||
_picker->chosen(
|
||||
@@ -487,10 +492,13 @@ int EmojiListWidget::countDesiredHeight(int newWidth) {
|
||||
|
||||
void EmojiListWidget::ensureLoaded(int section) {
|
||||
Expects(section >= 0 && section < kEmojiSectionCount);
|
||||
|
||||
if (!_emoji[section].isEmpty()) {
|
||||
return;
|
||||
}
|
||||
_emoji[section] = Ui::Emoji::GetSection(static_cast<Section>(section));
|
||||
_emoji[section] = (static_cast<Section>(section) == Section::Recent)
|
||||
? GetRecentEmojiSection()
|
||||
: Ui::Emoji::GetSection(static_cast<Section>(section));
|
||||
_counts[section] = _emoji[section].size();
|
||||
if (static_cast<Section>(section) == Section::Recent) {
|
||||
return;
|
||||
@@ -530,7 +538,7 @@ void EmojiListWidget::paintEvent(QPaintEvent *e) {
|
||||
if (info.section > 0 && r.top() < info.rowsTop) {
|
||||
p.setFont(st::emojiPanHeaderFont);
|
||||
p.setPen(st::emojiPanHeaderFg);
|
||||
p.drawTextLeft(st::emojiPanHeaderLeft - st::buttonRadius, info.top + st::emojiPanHeaderTop, width(), Ui::Emoji::CategoryTitle(info.section)(tr::now));
|
||||
p.drawTextLeft(st::emojiPanHeaderLeft - st::buttonRadius, info.top + st::emojiPanHeaderTop, width(), ChatHelpers::EmojiCategoryTitle(info.section)(tr::now));
|
||||
}
|
||||
if (r.top() + r.height() > info.rowsTop) {
|
||||
ensureLoaded(info.section);
|
||||
@@ -639,7 +647,7 @@ void EmojiListWidget::mouseReleaseEvent(QMouseEvent *e) {
|
||||
}
|
||||
|
||||
void EmojiListWidget::selectEmoji(EmojiPtr emoji) {
|
||||
Ui::Emoji::AddRecent(emoji);
|
||||
AddRecentEmoji(emoji);
|
||||
_chosen.fire_copy(emoji);
|
||||
}
|
||||
|
||||
@@ -761,6 +769,10 @@ QPoint EmojiListWidget::tooltipPos() const {
|
||||
return _lastMousePos;
|
||||
}
|
||||
|
||||
bool EmojiListWidget::tooltipWindowActive() const {
|
||||
return Ui::InFocusChain(window());
|
||||
}
|
||||
|
||||
TabbedSelector::InnerFooter *EmojiListWidget::getFooter() const {
|
||||
return _footer;
|
||||
}
|
||||
@@ -775,7 +787,7 @@ void EmojiListWidget::processHideFinished() {
|
||||
|
||||
void EmojiListWidget::refreshRecent() {
|
||||
clearSelection();
|
||||
_emoji[0] = Ui::Emoji::GetSection(Section::Recent);
|
||||
_emoji[0] = GetRecentEmojiSection();
|
||||
_counts[0] = _emoji[0].size();
|
||||
resizeToWidth(width());
|
||||
}
|
||||
@@ -858,4 +870,17 @@ void EmojiListWidget::showEmojiSection(Section section) {
|
||||
update();
|
||||
}
|
||||
|
||||
tr::phrase<> EmojiCategoryTitle(int index) {
|
||||
switch (index) {
|
||||
case 1: return tr::lng_emoji_category1;
|
||||
case 2: return tr::lng_emoji_category2;
|
||||
case 3: return tr::lng_emoji_category3;
|
||||
case 4: return tr::lng_emoji_category4;
|
||||
case 5: return tr::lng_emoji_category5;
|
||||
case 6: return tr::lng_emoji_category6;
|
||||
case 7: return tr::lng_emoji_category7;
|
||||
}
|
||||
Unexpected("Index in CategoryTitle.");
|
||||
}
|
||||
|
||||
} // namespace ChatHelpers
|
||||
|
||||
@@ -11,6 +11,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/widgets/tooltip.h"
|
||||
#include "base/timer.h"
|
||||
|
||||
namespace tr {
|
||||
template <typename ...Tags>
|
||||
struct phrase;
|
||||
} // namespace tr
|
||||
|
||||
namespace Ui {
|
||||
namespace Emoji {
|
||||
enum class Section;
|
||||
@@ -23,7 +28,7 @@ class SessionController;
|
||||
|
||||
namespace ChatHelpers {
|
||||
|
||||
constexpr auto kEmojiSectionCount = 8;
|
||||
inline constexpr auto kEmojiSectionCount = 8;
|
||||
|
||||
class EmojiColorPicker;
|
||||
|
||||
@@ -47,6 +52,7 @@ public:
|
||||
// Ui::AbstractTooltipShower interface.
|
||||
QString tooltipText() const override;
|
||||
QPoint tooltipPos() const override;
|
||||
bool tooltipWindowActive() const override;
|
||||
|
||||
rpl::producer<EmojiPtr> chosen() const;
|
||||
|
||||
@@ -120,4 +126,6 @@ private:
|
||||
|
||||
};
|
||||
|
||||
tr::phrase<> EmojiCategoryTitle(int index);
|
||||
|
||||
} // namespace ChatHelpers
|
||||
|
||||
@@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "core/application.h"
|
||||
#include "main/main_account.h"
|
||||
#include "mainwidget.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_chat_helpers.h"
|
||||
|
||||
@@ -293,7 +294,7 @@ void Loader::setImplementation(
|
||||
|
||||
void Loader::unpack(const QString &path) {
|
||||
const auto folder = internal::SetDataPath(_id);
|
||||
const auto weak = make_weak(this);
|
||||
const auto weak = Ui::MakeWeak(this);
|
||||
crl::async([=] {
|
||||
if (UnpackSet(path, folder)) {
|
||||
QFile(path).remove();
|
||||
@@ -366,7 +367,7 @@ void Row::paintPreview(Painter &p) const {
|
||||
const auto y = st::manageEmojiPreviewPadding.top();
|
||||
const auto width = st::manageEmojiPreviewWidth;
|
||||
const auto height = st::manageEmojiPreviewWidth;
|
||||
auto &&preview = ranges::view::zip(_preview, ranges::view::ints(0));
|
||||
auto &&preview = ranges::view::zip(_preview, ranges::view::ints(0, int(_preview.size())));
|
||||
for (const auto &[pixmap, index] : preview) {
|
||||
const auto row = (index / 2);
|
||||
const auto column = (index % 2);
|
||||
@@ -400,7 +401,7 @@ void Row::paintRadio(Painter &p) {
|
||||
pen.setCapStyle(Qt::RoundCap);
|
||||
p.setPen(pen);
|
||||
p.setBrush(_st->bg);
|
||||
const auto rect = rtlrect(QRectF(
|
||||
const auto rect = style::rtlrect(QRectF(
|
||||
left,
|
||||
top,
|
||||
_st->diameter,
|
||||
@@ -431,7 +432,7 @@ void Row::paintRadio(Painter &p) {
|
||||
const auto skip0 = _st->diameter / 2.;
|
||||
const auto skip1 = _st->skip / 10.;
|
||||
const auto checkSkip = skip0 * (1. - toggled) + skip1 * toggled;
|
||||
p.drawEllipse(rtlrect(QRectF(
|
||||
p.drawEllipse(style::rtlrect(QRectF(
|
||||
left,
|
||||
top,
|
||||
_st->diameter,
|
||||
@@ -569,7 +570,7 @@ void Row::setupPreview(const Set &set) {
|
||||
const auto size = st::manageEmojiPreview * cIntRetinaFactor();
|
||||
const auto original = QImage(set.previewPath);
|
||||
const auto full = original.height();
|
||||
auto &&preview = ranges::view::zip(_preview, ranges::view::ints(0));
|
||||
auto &&preview = ranges::view::zip(_preview, ranges::view::ints(0, int(_preview.size())));
|
||||
for (auto &&[pixmap, index] : preview) {
|
||||
pixmap = App::pixmapFromImageInPlace(original.copy(
|
||||
{ full * index, 0, full, full }
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user