Compare commits
143 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14e4524776 | ||
|
|
7dc9d5c37f | ||
|
|
d827045199 | ||
|
|
76d44172f1 | ||
|
|
afc9eb7cef | ||
|
|
b0bb8b05fd | ||
|
|
6e75668e45 | ||
|
|
f86afc9539 | ||
|
|
74ecd44294 | ||
|
|
273a2809cf | ||
|
|
ebb6b4ab63 | ||
|
|
a8106aa38d | ||
|
|
6abfdd20fa | ||
|
|
4dd1f95fbf | ||
|
|
a1faee285c | ||
|
|
8937d732f6 | ||
|
|
589556442c | ||
|
|
0e6b333bde | ||
|
|
9328f31a65 | ||
|
|
d5c145b707 | ||
|
|
3649cb41e2 | ||
|
|
cd85c4911c | ||
|
|
4db2b83c9b | ||
|
|
a1de77e8d2 | ||
|
|
6bd2be0aee | ||
|
|
1b364f2621 | ||
|
|
0310d9902c | ||
|
|
d55d383627 | ||
|
|
84de08cad6 | ||
|
|
cc0b1b1d54 | ||
|
|
e2205c7251 | ||
|
|
2d6bac5a28 | ||
|
|
7ad26a0fca | ||
|
|
48148a8cc3 | ||
|
|
1be37a10b3 | ||
|
|
4937cea38f | ||
|
|
b775d577a4 | ||
|
|
cb653df0f6 | ||
|
|
2407ac50bc | ||
|
|
fbf3168317 | ||
|
|
fe9cf7ddad | ||
|
|
88b555e907 | ||
|
|
234fdbed4a | ||
|
|
6cb0834d19 | ||
|
|
e26dd4e418 | ||
|
|
a8c230aba3 | ||
|
|
b81868eeba | ||
|
|
b2e9c4ab75 | ||
|
|
a458c89810 | ||
|
|
5df0b08a42 | ||
|
|
c8d273c2a3 | ||
|
|
badebb261b | ||
|
|
beb062dd64 | ||
|
|
33c0c79593 | ||
|
|
1a9c6749ae | ||
|
|
587715a966 | ||
|
|
b5cb2bc9f0 | ||
|
|
a4e4681835 | ||
|
|
8281990bb8 | ||
|
|
2c1e7bfcb6 | ||
|
|
bd8e7fdddd | ||
|
|
037f2bcce2 | ||
|
|
819e1602ef | ||
|
|
fe6ad54836 | ||
|
|
92756f418b | ||
|
|
cbbbcd877c | ||
|
|
34f0aae418 | ||
|
|
f0b8ccbd71 | ||
|
|
c200263f2e | ||
|
|
1ff53eb585 | ||
|
|
32491ead5e | ||
|
|
468d01fc1a | ||
|
|
1c44121db7 | ||
|
|
b561705528 | ||
|
|
eed706f917 | ||
|
|
4bd2091e6e | ||
|
|
22f45bc1fb | ||
|
|
1cc3440fcc | ||
|
|
1cd4cb3baa | ||
|
|
11165abc09 | ||
|
|
f8a17bd9c9 | ||
|
|
47bb04b019 | ||
|
|
8bcb30e84d | ||
|
|
81c48e1b09 | ||
|
|
377ee7df06 | ||
|
|
4fabb3f2a2 | ||
|
|
ad3f8e72a0 | ||
|
|
01139e1b04 | ||
|
|
eaed91263e | ||
|
|
188c6ba64a | ||
|
|
823bbb1b77 | ||
|
|
f324017299 | ||
|
|
76837c6f44 | ||
|
|
5e6a4d9e8d | ||
|
|
01773e5bb1 | ||
|
|
5d8a2bc7b7 | ||
|
|
beaea9c57d | ||
|
|
3c799a5cc1 | ||
|
|
5e20c15c20 | ||
|
|
d0ae07f3c2 | ||
|
|
97fa92de0b | ||
|
|
c481d48865 | ||
|
|
545cf93d82 | ||
|
|
6ff29b8902 | ||
|
|
623176e901 | ||
|
|
03b35457fa | ||
|
|
01748d8aba | ||
|
|
7866013ab6 | ||
|
|
ac3834bfdb | ||
|
|
57af221d39 | ||
|
|
8cd5105813 | ||
|
|
d89573bab5 | ||
|
|
39f9fee22f | ||
|
|
6695d7d503 | ||
|
|
3fdb807a1e | ||
|
|
2acedca6b7 | ||
|
|
22dc7023fc | ||
|
|
9946fbbd89 | ||
|
|
fec7febc8e | ||
|
|
0b86caef67 | ||
|
|
c39b9e9635 | ||
|
|
05524c3f6c | ||
|
|
b9a766387c | ||
|
|
54a0f443b4 | ||
|
|
04a8a9b7ee | ||
|
|
c77f07239f | ||
|
|
b383dad6ac | ||
|
|
f18bf46fb1 | ||
|
|
2bda3c4e2b | ||
|
|
4484edd212 | ||
|
|
ace363f432 | ||
|
|
d6ed23b3dd | ||
|
|
51cd07945b | ||
|
|
9ee4ad95d0 | ||
|
|
4ade80905f | ||
|
|
70b039a6e4 | ||
|
|
4bde87cda4 | ||
|
|
94b4809cdf | ||
|
|
109f6614f0 | ||
|
|
88b0ea70b3 | ||
|
|
c7583e3106 | ||
|
|
b9003202bf | ||
|
|
53c4b511f8 |
8
.github/ISSUE_TEMPLATE/QUESTION.md
vendored
@@ -1,8 +0,0 @@
|
||||
---
|
||||
name: Question
|
||||
about: Ask a question.
|
||||
title: "[Question] "
|
||||
labels: 'question'
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
11
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: API issue
|
||||
url: https://bugs.telegram.org
|
||||
about: Any bug report or feature request affecting more than only Telegram Desktop.
|
||||
- name: Issue of other client
|
||||
url: https://bugs.telegram.org
|
||||
about: Any bug report or feature request not about Telegram Desktop.
|
||||
- name: Question
|
||||
url: https://t.me/TelegramDesktopTalk
|
||||
about: Ask a question.
|
||||
2
.github/workflows/docker.yml
vendored
@@ -31,7 +31,7 @@ jobs:
|
||||
run: |
|
||||
cd Telegram/build/docker/centos_env
|
||||
poetry install
|
||||
DEBUG= LTO= poetry run gen_dockerfile | docker buildx build -t $IMAGE_TAG -
|
||||
DEBUG= LTO= poetry run gen_dockerfile | DOCKER_BUILDKIT=1 docker build -t $IMAGE_TAG -
|
||||
|
||||
- name: Push the Docker image.
|
||||
if: ${{ github.ref_name == github.event.repository.default_branch }}
|
||||
|
||||
2
.github/workflows/linux.yml
vendored
@@ -93,6 +93,8 @@ jobs:
|
||||
fi
|
||||
|
||||
./configure.sh \
|
||||
-D CMAKE_C_FLAGS_DEBUG="" \
|
||||
-D CMAKE_CXX_FLAGS_DEBUG="" \
|
||||
-D CMAKE_C_FLAGS="-Werror" \
|
||||
-D CMAKE_CXX_FLAGS="-Werror" \
|
||||
-D CMAKE_EXE_LINKER_FLAGS="-s" \
|
||||
|
||||
2
.github/workflows/mac.yml
vendored
@@ -119,7 +119,7 @@ jobs:
|
||||
|
||||
cd ../out
|
||||
|
||||
xcoderun='xcodebuild build -project Telegram.xcodeproj -scheme Telegram -destination "platform=macOS,arch=x86_64" -configuration Debug'
|
||||
xcoderun='xcodebuild build -project Telegram.xcodeproj -scheme Telegram -destination "platform=macOS,arch=x86_64" -configuration Debug CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO'
|
||||
bash -c "$xcoderun" || bash -c "$xcoderun" || bash -c "$xcoderun"
|
||||
|
||||
- name: Move artifact.
|
||||
|
||||
@@ -54,7 +54,7 @@ if (NOT DESKTOP_APP_USE_PACKAGED)
|
||||
if (WIN32)
|
||||
set(qt_version 5.15.4)
|
||||
elseif (APPLE)
|
||||
set(qt_version 6.3.1)
|
||||
set(qt_version 6.3.2)
|
||||
else()
|
||||
set(qt_version 6.4.1)
|
||||
endif()
|
||||
|
||||
@@ -980,6 +980,8 @@ PRIVATE
|
||||
media/view/media_view_playback_progress.cpp
|
||||
media/view/media_view_playback_progress.h
|
||||
media/view/media_view_open_common.h
|
||||
menu/menu_antispam_validator.cpp
|
||||
menu/menu_antispam_validator.h
|
||||
menu/menu_item_download_files.cpp
|
||||
menu/menu_item_download_files.h
|
||||
menu/menu_mute.cpp
|
||||
@@ -1173,6 +1175,8 @@ PRIVATE
|
||||
settings/settings_experimental.h
|
||||
settings/settings_folders.cpp
|
||||
settings/settings_folders.h
|
||||
settings/settings_global_ttl.cpp
|
||||
settings/settings_global_ttl.h
|
||||
settings/settings_information.cpp
|
||||
settings/settings_information.h
|
||||
settings/settings_intro.cpp
|
||||
@@ -1269,8 +1273,6 @@ PRIVATE
|
||||
ui/widgets/level_meter.h
|
||||
ui/countryinput.cpp
|
||||
ui/countryinput.h
|
||||
ui/empty_userpic.cpp
|
||||
ui/empty_userpic.h
|
||||
ui/filter_icons.cpp
|
||||
ui/filter_icons.h
|
||||
ui/filter_icon_panel.cpp
|
||||
@@ -1342,8 +1344,6 @@ PRIVATE
|
||||
apiwrap.cpp
|
||||
apiwrap.h
|
||||
config.h
|
||||
facades.cpp
|
||||
facades.h
|
||||
logs.cpp
|
||||
logs.h
|
||||
main.cpp
|
||||
@@ -1601,6 +1601,17 @@ if (WIN32)
|
||||
/DELAYLOAD:wtsapi32.dll
|
||||
/DELAYLOAD:propsys.dll
|
||||
)
|
||||
|
||||
if (NOT build_win64 AND DESKTOP_APP_SPECIAL_TARGET)
|
||||
target_compile_options(Telegram
|
||||
PRIVATE
|
||||
$<IF:$<CONFIG:Debug>,,/GL>
|
||||
)
|
||||
target_link_options(Telegram
|
||||
PRIVATE
|
||||
$<IF:$<CONFIG:Debug>,,/LTCG>
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_prepare_qrc(Telegram)
|
||||
@@ -1685,6 +1696,7 @@ endif()
|
||||
|
||||
if (LINUX AND DESKTOP_APP_USE_PACKAGED)
|
||||
include(GNUInstallDirs)
|
||||
configure_file("../lib/xdg/org.telegram.desktop.desktop" "${CMAKE_CURRENT_BINARY_DIR}/org.telegram.desktop.desktop" @ONLY)
|
||||
configure_file("../lib/xdg/org.telegram.desktop.metainfo.xml" "${CMAKE_CURRENT_BINARY_DIR}/org.telegram.desktop.metainfo.xml" @ONLY)
|
||||
generate_appdata_changelog(Telegram "${CMAKE_SOURCE_DIR}/changelog.txt" "${CMAKE_CURRENT_BINARY_DIR}/org.telegram.desktop.metainfo.xml")
|
||||
install(TARGETS Telegram RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
@@ -1695,6 +1707,6 @@ if (LINUX AND DESKTOP_APP_USE_PACKAGED)
|
||||
install(FILES "Resources/art/icon128.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps" RENAME "telegram.png")
|
||||
install(FILES "Resources/art/icon256.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/256x256/apps" RENAME "telegram.png")
|
||||
install(FILES "Resources/art/icon512.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/512x512/apps" RENAME "telegram.png")
|
||||
install(FILES "../lib/xdg/org.telegram.desktop.desktop" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/org.telegram.desktop.desktop" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/org.telegram.desktop.metainfo.xml" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo")
|
||||
endif()
|
||||
|
||||
BIN
Telegram/Resources/animations/ttl.tgs
Normal file
7
Telegram/Resources/art/topic_icons/general.svg
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>general</title>
|
||||
<g id="general" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<path d="M14.4576257,1.02558449 C15.189053,1.1696007 15.6657078,1.88165413 15.5222641,2.61600035 L14.8818905,5.62412405 L16.6504058,5.62421139 C17.3957661,5.62421139 18,6.23085664 18,6.97919149 C18,7.72752633 17.3957661,8.33417159 16.6504058,8.33417159 L14.3525674,8.33397488 L13.6850637,11.7513347 L15.3008116,11.7515071 C16.0461719,11.7515071 16.6504058,12.3581524 16.6504058,13.1064872 C16.6504058,13.8548221 16.0461719,14.4614673 15.3008116,14.4614673 L13.1557407,14.4614328 L12.4307242,17.9055215 C12.2872804,18.6398677 11.5780573,19.1184247 10.84663,18.9744085 C10.1152028,18.8303923 9.63854794,18.1183389 9.7819917,17.3839927 L10.4051821,14.4614328 L7.75733538,14.4614328 L7.03234733,17.9055215 C6.90989534,18.5324024 6.37514133,18.9728813 5.76623746,18.9987859 L5.71387199,19 C5.62631985,19.0002755 5.53745163,18.9919715 5.44825318,18.9744085 C4.71682589,18.8303923 4.24017107,18.1183389 4.38361482,17.3839927 L5.00702313,14.4614328 L3.34959422,14.4614673 C2.60423391,14.4614673 2,13.8548221 2,13.1064872 C2,12.3581524 2.60423391,11.7515071 3.34959422,11.7515071 L5.53634616,11.7513347 L6.20384986,8.33397488 L4.69918844,8.33417159 C3.95382813,8.33417159 3.34959422,7.72752633 3.34959422,6.97919149 C3.34959422,6.23085664 3.95382813,5.62421139 4.69918844,5.62421139 L6.73317289,5.62412405 L7.4751547,2.09447154 C7.60110532,1.44967974 8.16325465,1.00209364 8.79363004,1 L8.84631136,1.00087004 C8.91674267,1.00340951 8.98789009,1.01153413 9.05924885,1.02558449 C9.79067614,1.1696007 10.267331,1.88165413 10.1238872,2.61600035 L9.48348515,5.62412405 L12.1315782,5.62412405 L12.8735316,2.09447154 C13.0169753,1.36012532 13.7261984,0.881568286 14.4576257,1.02558449 Z M10.9345052,11.7513347 L11.6020089,8.33397488 L8.95416211,8.33397488 L8.28665842,11.7513347 L10.9345052,11.7513347 Z" id="Combined-Shape-Copy-6" fill="#FFFFFF"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
BIN
Telegram/Resources/icons/info/edit/antispam.png
Normal file
|
After Width: | Height: | Size: 552 B |
BIN
Telegram/Resources/icons/info/edit/antispam@2x.png
Normal file
|
After Width: | Height: | Size: 986 B |
BIN
Telegram/Resources/icons/info/edit/antispam@3x.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Telegram/Resources/icons/menu/false_positive.png
Normal file
|
After Width: | Height: | Size: 670 B |
BIN
Telegram/Resources/icons/menu/false_positive@2x.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
Telegram/Resources/icons/menu/false_positive@3x.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
Telegram/Resources/icons/settings/ttl.png
Normal file
|
After Width: | Height: | Size: 591 B |
BIN
Telegram/Resources/icons/settings/ttl/autodelete_off.png
Normal file
|
After Width: | Height: | Size: 454 B |
BIN
Telegram/Resources/icons/settings/ttl/autodelete_off@2x.png
Normal file
|
After Width: | Height: | Size: 757 B |
BIN
Telegram/Resources/icons/settings/ttl/autodelete_off@3x.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
Telegram/Resources/icons/settings/ttl/autodelete_on.png
Normal file
|
After Width: | Height: | Size: 414 B |
BIN
Telegram/Resources/icons/settings/ttl/autodelete_on@2x.png
Normal file
|
After Width: | Height: | Size: 670 B |
BIN
Telegram/Resources/icons/settings/ttl/autodelete_on@3x.png
Normal file
|
After Width: | Height: | Size: 966 B |
BIN
Telegram/Resources/icons/settings/ttl@2x.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
Telegram/Resources/icons/settings/ttl@3x.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
@@ -402,6 +402,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_username_invalid" = "This username is invalid.";
|
||||
"lng_username_occupied" = "This username is already occupied.";
|
||||
"lng_username_too_short" = "This username is too short.";
|
||||
"lng_username_purchase_available" = "Sorry, this link is occupied by someone. But it's available for purchase through\nofficial {link}.";
|
||||
"lng_username_bad_symbols" = "Only a-z, 0-9, and underscores allowed.";
|
||||
"lng_username_available" = "This username is available.";
|
||||
"lng_username_not_found" = "User @{user} not found.";
|
||||
@@ -666,6 +667,37 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_settings_cloud_password_email_confirm" = "Confirm and Finish";
|
||||
"lng_settings_cloud_password_reset_in" = "You can reset your password in {duration}.";
|
||||
|
||||
"lng_settings_ttl_title" = "Auto-Delete Messages";
|
||||
"lng_settings_ttl_about" = "Automatically delete messages for everyone after a period of time in all new chats you start.";
|
||||
"lng_settings_ttl_after" = "After {after_duration}";
|
||||
"lng_settings_ttl_after_hours#one" = "{count} hour";
|
||||
"lng_settings_ttl_after_hours#other" = "{count} hours";
|
||||
"lng_settings_ttl_after_days#one" = "{count} day";
|
||||
"lng_settings_ttl_after_days#other" = "{count} days";
|
||||
"lng_settings_ttl_after_weeks#one" = "{count} week";
|
||||
"lng_settings_ttl_after_weeks#other" = "{count} weeks";
|
||||
"lng_settings_ttl_after_months#one" = "{count} month";
|
||||
"lng_settings_ttl_after_months#other" = "{count} months";
|
||||
"lng_settings_ttl_after_years#one" = "{count} year";
|
||||
"lng_settings_ttl_after_years#other" = "{count} years";
|
||||
"lng_settings_ttl_after_off" = "Off";
|
||||
"lng_settings_ttl_after_custom" = "Set Custom Time";
|
||||
"lng_settings_ttl_after_about" = "If enabled, all new messages in chats you start will be automatically deleted for everyone at some point after they have been sent. You can also {link}.";
|
||||
"lng_settings_ttl_after_about_link" = "apply this setting for your existing chats";
|
||||
"lng_settings_ttl_after_subtitle" = "Self-destruct timer";
|
||||
"lng_settings_ttl_after_sure" = "Are you sure you want all messages in new chats started by you to be automatically deleted for everyone {after_duration} after they have been sent?";
|
||||
"lng_settings_ttl_after_toast" = "Messages in all new chats you start will be automatically deleted after {after_duration}.";
|
||||
|
||||
"lng_settings_ttl_select_chats_title" = "Select Chats";
|
||||
"lng_settings_ttl_select_chats_subtitle" = "to apply the self-destruct timer";
|
||||
"lng_settings_ttl_select_chats_subtitle_chosen" = "will have the self-destruct timer";
|
||||
"lng_settings_ttl_select_chats_status" = "auto-delete after {after_duration}";
|
||||
"lng_settings_ttl_select_chats_status_disabled" = "auto-deletion disabled";
|
||||
"lng_settings_ttl_select_chats_toast#one" = "Self-destruct timer for {duration} has been enabled in {count} selected chat.";
|
||||
"lng_settings_ttl_select_chats_toast#other" = "Self-destruct timer for {duration} has been enabled in {count} selected chats.";
|
||||
"lng_settings_ttl_select_chats_disabled_toast#one" = "Self-destruct timer has been disabled in {count} selected chat.";
|
||||
"lng_settings_ttl_select_chats_disabled_toast#other" = "Self-destruct timer has been disabled in {count} selected chats.";
|
||||
|
||||
"lng_clear_payment_info_title" = "Clear payment info";
|
||||
"lng_clear_payment_info_sure" = "Are you sure you want to clear your payment and shipping info?";
|
||||
"lng_clear_payment_info_shipping" = "Shipping info";
|
||||
@@ -1237,6 +1269,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_manage_peer_reactions_some_title" = "Only allow these reactions";
|
||||
"lng_manage_peer_reactions_available" = "Available reactions";
|
||||
|
||||
"lng_manage_peer_antispam" = "Aggressive Anti-Spam";
|
||||
"lng_manage_peer_antispam_about" = "Telegram will filter more spam but may occasionally affect ordinary messages. You can report False Positives in Recent Actions.";
|
||||
"lng_manage_peer_antispam_not_enough#one" = "Aggressive filtering can be enabled only in groups with more than **{count} member**.";
|
||||
"lng_manage_peer_antispam_not_enough#other" = "Aggressive filtering can be enabled only in groups with more than **{count} members**.";
|
||||
|
||||
"lng_manage_peer_group_type" = "Group type";
|
||||
"lng_manage_peer_channel_type" = "Channel type";
|
||||
"lng_manage_peer_link_type" = "Link type";
|
||||
@@ -1296,6 +1333,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_ttl_edit_about" = "Automatically delete new messages after a certain period of time for you and {user}.";
|
||||
"lng_ttl_edit_about_group" = "Automatically delete new messages sent in this chat after a certain period of time.";
|
||||
"lng_ttl_edit_about_channel" = "Automatically delete new messages sent in this channel after a certain period of time.";
|
||||
"lng_ttl_edit_about2" = "You can also set your default {link} for all chats in Settings.";
|
||||
"lng_ttl_edit_about2_link" = "self-destruct timer";
|
||||
"lng_ttl_edit_save" = "Confirm";
|
||||
"lng_ttl_about_tooltip" = "New messages in this chat will be automatically deleted in {duration}.";
|
||||
"lng_ttl_about_tooltip_channel" = "New messages in this chat will be automatically deleted in {duration}.";
|
||||
@@ -1363,6 +1402,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_create_group_next" = "Next";
|
||||
"lng_create_group_create" = "Create";
|
||||
"lng_create_group_title" = "New Group";
|
||||
"lng_create_group_ttl_about" = "Automatically delete messages in this group for everyone after a period of time.";
|
||||
"lng_create_channel_title" = "New Channel";
|
||||
"lng_create_public_channel_title" = "Public Channel";
|
||||
"lng_create_public_channel_about" = "Anyone can find the channel in search and join";
|
||||
@@ -1385,6 +1425,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_create_channel_link_too_short" = "Sorry, this link is too short";
|
||||
"lng_create_channel_link_bad_symbols" = "Only 0-9, a-z, and underscores allowed.";
|
||||
"lng_create_channel_link_available" = "This link is available";
|
||||
"lng_create_channel_link_pending" = "Checking name...";
|
||||
"lng_create_channel_link_copied" = "Link copied to clipboard";
|
||||
|
||||
"lng_create_group_crop" = "Select an area for group photo";
|
||||
@@ -1456,6 +1497,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_action_ttl_changed" = "{from} has set messages to auto-delete in {duration}";
|
||||
"lng_action_ttl_changed_you" = "You set messages to auto-delete in {duration}";
|
||||
"lng_action_ttl_changed_channel" = "New messages will auto-delete in {duration}";
|
||||
"lng_action_ttl_global" = "{from} uses a self-destruct timer for all chats. All new messages in this chat will be automatically deleted after {duration} they've been sent.";
|
||||
"lng_action_ttl_removed" = "{from} has set messages not to auto-delete";
|
||||
"lng_action_ttl_removed_you" = "You disabled the auto-delete timer";
|
||||
"lng_action_ttl_removed_channel" = "New messages will not auto-delete";
|
||||
@@ -2199,6 +2241,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_context_copy_link" = "Copy Link";
|
||||
"lng_context_copy_message_link" = "Copy Message Link";
|
||||
"lng_context_copy_post_link" = "Copy Post Link";
|
||||
"lng_context_copy_topic_link" = "Copy Topic Link";
|
||||
"lng_context_copy_email" = "Copy Email Address";
|
||||
"lng_context_copy_hashtag" = "Copy Hashtag";
|
||||
"lng_context_copy_mention" = "Copy Username";
|
||||
@@ -3096,6 +3139,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_admin_log_disallowed_unmute_self_channel" = "{from} started muting new live stream members";
|
||||
"lng_admin_log_participant_volume" = "{from} changed voice chat volume for {user} to {percent}";
|
||||
"lng_admin_log_participant_volume_channel" = "{from} changed live stream volume for {user} to {percent}";
|
||||
"lng_admin_log_antispam_enabled" = "{from} enabled aggressive anti-spam";
|
||||
"lng_admin_log_antispam_disabled" = "{from} disabled aggressive anti-spam";
|
||||
"lng_admin_log_user_with_username" = "{name} ({mention})";
|
||||
"lng_admin_log_messages_ttl_set" = "{from} enabled messages auto-delete after {duration}";
|
||||
"lng_admin_log_messages_ttl_changed" = "{from} changed messages auto-delete period from {previous} to {duration}";
|
||||
@@ -3141,6 +3186,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_admin_log_admin_manage_calls_channel" = "Manage live streams";
|
||||
"lng_admin_log_admin_add_admins" = "Add new admins";
|
||||
|
||||
"lng_admin_log_antispam_menu_report" = "Report False Positive";
|
||||
"lng_admin_log_antispam_menu_report_toast" = "You can manage anti-spam settings in {link}.";
|
||||
"lng_admin_log_antispam_menu_report_toast_link" = "Group Info > Administrators";
|
||||
|
||||
"lng_terms_signup" = "By signing up,\nyou agree to the {link}.";
|
||||
"lng_terms_signup_link" = "Terms of Service";
|
||||
"lng_terms_header" = "Terms of Service";
|
||||
|
||||
@@ -8,5 +8,6 @@
|
||||
<file alias="cloud_password/password_input.tgs">../../animations/cloud_password/password_input.tgs</file>
|
||||
<file alias="cloud_password/hint.tgs">../../animations/cloud_password/hint.tgs</file>
|
||||
<file alias="cloud_password/email.tgs">../../animations/cloud_password/email.tgs</file>
|
||||
<file alias="ttl.tgs">../../animations/ttl.tgs</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
<file alias="topic_icons/rose.svg">../../art/topic_icons/rose.svg</file>
|
||||
<file alias="topic_icons/red.svg">../../art/topic_icons/red.svg</file>
|
||||
<file alias="topic_icons/gray.svg">../../art/topic_icons/gray.svg</file>
|
||||
<file alias="topic_icons/general.svg">../../art/topic_icons/general.svg</file>
|
||||
</qresource>
|
||||
<qresource prefix="/icons">
|
||||
<file alias="calls/hands.lottie">../../icons/calls/hands.lottie</file>
|
||||
|
||||
@@ -129,7 +129,7 @@ channel#83259464 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.
|
||||
channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true id:long access_hash:long title:string until_date:flags.16?int = Chat;
|
||||
|
||||
chatFull#c9d31138 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector<long> available_reactions:flags.18?ChatReactions = ChatFull;
|
||||
channelFull#f2355507 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector<long> default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions = ChatFull;
|
||||
channelFull#f2355507 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector<long> default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions = ChatFull;
|
||||
|
||||
chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant;
|
||||
chatParticipantCreator#e46bcee4 user_id:long = ChatParticipant;
|
||||
@@ -185,7 +185,7 @@ messageActionContactSignUp#f3f25f76 = MessageAction;
|
||||
messageActionGeoProximityReached#98e0d697 from_id:Peer to_id:Peer distance:int = MessageAction;
|
||||
messageActionGroupCall#7a0d7f42 flags:# call:InputGroupCall duration:flags.0?int = MessageAction;
|
||||
messageActionInviteToGroupCall#502f92f7 call:InputGroupCall users:Vector<long> = MessageAction;
|
||||
messageActionSetMessagesTTL#aa1afbfd period:int = MessageAction;
|
||||
messageActionSetMessagesTTL#3c134d7b flags:# period:int auto_setting_from:flags.0?long = MessageAction;
|
||||
messageActionGroupCallScheduled#b3a07661 call:InputGroupCall schedule_date:int = MessageAction;
|
||||
messageActionSetChatTheme#aa786345 emoticon:string = MessageAction;
|
||||
messageActionChatJoinedByRequest#ebbca3cb = MessageAction;
|
||||
@@ -193,9 +193,9 @@ messageActionWebViewDataSentMe#47dd8079 text:string data:string = MessageAction;
|
||||
messageActionWebViewDataSent#b4c38cb5 text:string = MessageAction;
|
||||
messageActionGiftPremium#aba0f5c6 currency:string amount:long months:int = MessageAction;
|
||||
messageActionTopicCreate#d999256 flags:# title:string icon_color:int icon_emoji_id:flags.0?long = MessageAction;
|
||||
messageActionTopicEdit#b18a431c flags:# title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool = MessageAction;
|
||||
messageActionTopicEdit#c0944820 flags:# title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool hidden:flags.3?Bool = MessageAction;
|
||||
|
||||
dialog#a8edd0f5 flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int = Dialog;
|
||||
dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog;
|
||||
dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog;
|
||||
|
||||
photoEmpty#2331b22d id:long = Photo;
|
||||
@@ -724,6 +724,7 @@ auth.codeTypeSms#72a3158c = auth.CodeType;
|
||||
auth.codeTypeCall#741cd3e3 = auth.CodeType;
|
||||
auth.codeTypeFlashCall#226ccefb = auth.CodeType;
|
||||
auth.codeTypeMissedCall#d61ad6ee = auth.CodeType;
|
||||
auth.codeTypeFragmentSms#6ed998c = auth.CodeType;
|
||||
|
||||
auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType;
|
||||
auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType;
|
||||
@@ -732,6 +733,7 @@ auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType;
|
||||
auth.sentCodeTypeMissedCall#82006484 prefix:string length:int = auth.SentCodeType;
|
||||
auth.sentCodeTypeEmailCode#5a159841 flags:# apple_signin_allowed:flags.0?true google_signin_allowed:flags.1?true email_pattern:string length:int next_phone_login_date:flags.2?int = auth.SentCodeType;
|
||||
auth.sentCodeTypeSetUpEmailRequired#a5491dea flags:# apple_signin_allowed:flags.0?true google_signin_allowed:flags.1?true = auth.SentCodeType;
|
||||
auth.sentCodeTypeFragmentSms#d9565c39 url:string length:int = auth.SentCodeType;
|
||||
|
||||
messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer;
|
||||
|
||||
@@ -965,6 +967,7 @@ channelAdminLogEventActionCreateTopic#58707d28 topic:ForumTopic = ChannelAdminLo
|
||||
channelAdminLogEventActionEditTopic#f06fe208 prev_topic:ForumTopic new_topic:ForumTopic = ChannelAdminLogEventAction;
|
||||
channelAdminLogEventActionDeleteTopic#ae168909 topic:ForumTopic = ChannelAdminLogEventAction;
|
||||
channelAdminLogEventActionPinTopic#5d8d353b flags:# prev_topic:flags.0?ForumTopic new_topic:flags.1?ForumTopic = ChannelAdminLogEventAction;
|
||||
channelAdminLogEventActionToggleAntiSpam#64f36dfc new_value:Bool = ChannelAdminLogEventAction;
|
||||
|
||||
channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent;
|
||||
|
||||
@@ -1467,10 +1470,14 @@ stickerKeyword#fcfeb29c document_id:long keyword:Vector<string> = StickerKeyword
|
||||
username#b4073647 flags:# editable:flags.0?true active:flags.1?true username:string = Username;
|
||||
|
||||
forumTopicDeleted#23f109b id:int = ForumTopic;
|
||||
forumTopic#71701da9 flags:# my:flags.1?true closed:flags.2?true pinned:flags.3?true short:flags.5?true id:int date:int title:string icon_color:int icon_emoji_id:flags.0?long top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int from_id:Peer notify_settings:PeerNotifySettings draft:flags.4?DraftMessage = ForumTopic;
|
||||
forumTopic#71701da9 flags:# my:flags.1?true closed:flags.2?true pinned:flags.3?true short:flags.5?true hidden:flags.6?true id:int date:int title:string icon_color:int icon_emoji_id:flags.0?long top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int from_id:Peer notify_settings:PeerNotifySettings draft:flags.4?DraftMessage = ForumTopic;
|
||||
|
||||
messages.forumTopics#367617d3 flags:# order_by_create_date:flags.0?true count:int topics:Vector<ForumTopic> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> pts:int = messages.ForumTopics;
|
||||
|
||||
defaultHistoryTTL#43b46b20 period:int = DefaultHistoryTTL;
|
||||
|
||||
exportedContactToken#41bf109b url:string expires:int = ExportedContactToken;
|
||||
|
||||
---functions---
|
||||
|
||||
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
||||
@@ -1500,6 +1507,7 @@ auth.exportLoginToken#b7e085fe api_id:int api_hash:string except_ids:Vector<long
|
||||
auth.importLoginToken#95ac5ce4 token:bytes = auth.LoginToken;
|
||||
auth.acceptLoginToken#e894ad4d token:bytes = Authorization;
|
||||
auth.checkRecoveryPassword#d36bf79 code:string = Bool;
|
||||
auth.importWebTokenAuthorization#2db873a9 api_id:int api_hash:string web_auth_token:string = auth.Authorization;
|
||||
|
||||
account.registerDevice#ec86017a flags:# no_muted:flags.0?true token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector<long> = Bool;
|
||||
account.unregisterDevice#6a0d3206 token_type:int token:string other_uids:Vector<long> = Bool;
|
||||
@@ -1609,6 +1617,8 @@ contacts.acceptContact#f831a20f id:InputUser = Updates;
|
||||
contacts.getLocated#d348bc44 flags:# background:flags.1?true geo_point:InputGeoPoint self_expires:flags.0?int = Updates;
|
||||
contacts.blockFromReplies#29a8962c flags:# delete_message:flags.0?true delete_history:flags.1?true report_spam:flags.2?true msg_id:int = Updates;
|
||||
contacts.resolvePhone#8af94344 phone:string = contacts.ResolvedPeer;
|
||||
contacts.exportContactToken#f8654027 = ExportedContactToken;
|
||||
contacts.importContactToken#13005788 token:string = User;
|
||||
|
||||
messages.getMessages#63c66506 id:Vector<InputMessage> = messages.Messages;
|
||||
messages.getDialogs#a0f4cb4f flags:# exclude_pinned:flags.0?true folder_id:flags.1?int offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:long = messages.Dialogs;
|
||||
@@ -1631,7 +1641,7 @@ messages.editChatTitle#73783ffd chat_id:long title:string = Updates;
|
||||
messages.editChatPhoto#35ddd674 chat_id:long photo:InputChatPhoto = Updates;
|
||||
messages.addChatUser#f24753e3 chat_id:long user_id:InputUser fwd_limit:int = Updates;
|
||||
messages.deleteChatUser#a2185cab flags:# revoke_history:flags.0?true chat_id:long user_id:InputUser = Updates;
|
||||
messages.createChat#9cb126e users:Vector<InputUser> title:string = Updates;
|
||||
messages.createChat#34a818 flags:# users:Vector<InputUser> title:string ttl_period:flags.0?int = Updates;
|
||||
messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig;
|
||||
messages.requestEncryption#f64daf43 user_id:InputUser random_id:int g_a:bytes = EncryptedChat;
|
||||
messages.acceptEncryption#3dbc0415 peer:InputEncryptedChat g_b:bytes key_fingerprint:long = EncryptedChat;
|
||||
@@ -1787,6 +1797,8 @@ messages.getTopReactions#bb8125ba limit:int hash:long = messages.Reactions;
|
||||
messages.getRecentReactions#39461db2 limit:int hash:long = messages.Reactions;
|
||||
messages.clearRecentReactions#9dfeefb4 = Bool;
|
||||
messages.getExtendedMedia#84f80814 peer:InputPeer id:Vector<int> = Updates;
|
||||
messages.setDefaultHistoryTTL#9eb51445 period:int = Bool;
|
||||
messages.getDefaultHistoryTTL#658b7188 = DefaultHistoryTTL;
|
||||
|
||||
updates.getState#edd4882a = updates.State;
|
||||
updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference;
|
||||
@@ -1838,7 +1850,7 @@ channels.getParticipants#77ced9d0 channel:InputChannel filter:ChannelParticipant
|
||||
channels.getParticipant#a0ab6cc6 channel:InputChannel participant:InputPeer = channels.ChannelParticipant;
|
||||
channels.getChannels#a7f6bbb id:Vector<InputChannel> = messages.Chats;
|
||||
channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull;
|
||||
channels.createChannel#3d5fb10f flags:# broadcast:flags.0?true megagroup:flags.1?true for_import:flags.3?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string = Updates;
|
||||
channels.createChannel#91006707 flags:# broadcast:flags.0?true megagroup:flags.1?true for_import:flags.3?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string ttl_period:flags.4?int = Updates;
|
||||
channels.editAdmin#d33c8902 channel:InputChannel user_id:InputUser admin_rights:ChatAdminRights rank:string = Updates;
|
||||
channels.editTitle#566decd0 channel:InputChannel title:string = Updates;
|
||||
channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates;
|
||||
@@ -1878,10 +1890,12 @@ channels.toggleForum#a4298b29 channel:InputChannel enabled:Bool = Updates;
|
||||
channels.createForumTopic#f40c0224 flags:# channel:InputChannel title:string icon_color:flags.0?int icon_emoji_id:flags.3?long random_id:long send_as:flags.2?InputPeer = Updates;
|
||||
channels.getForumTopics#de560d1 flags:# channel:InputChannel q:flags.0?string offset_date:int offset_id:int offset_topic:int limit:int = messages.ForumTopics;
|
||||
channels.getForumTopicsByID#b0831eb9 channel:InputChannel topics:Vector<int> = messages.ForumTopics;
|
||||
channels.editForumTopic#6c883e2d flags:# channel:InputChannel topic_id:int title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool = Updates;
|
||||
channels.editForumTopic#f4dfa185 flags:# channel:InputChannel topic_id:int title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool hidden:flags.3?Bool = Updates;
|
||||
channels.updatePinnedForumTopic#6c2d9026 channel:InputChannel topic_id:int pinned:Bool = Updates;
|
||||
channels.deleteTopicHistory#34435f2d channel:InputChannel top_msg_id:int = messages.AffectedHistory;
|
||||
channels.reorderPinnedForumTopics#2950a18f flags:# force:flags.0?true channel:InputChannel order:Vector<int> = Updates;
|
||||
channels.toggleAntiSpam#68f3e4eb channel:InputChannel enabled:Bool = Updates;
|
||||
channels.reportAntiSpamFalsePositive#a850a693 channel:InputChannel msg_id:int = Bool;
|
||||
|
||||
bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON;
|
||||
bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool;
|
||||
@@ -1960,4 +1974,4 @@ stats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel
|
||||
stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;
|
||||
stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats;
|
||||
|
||||
// LAYER 149
|
||||
// LAYER 150
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
|
||||
ProcessorArchitecture="ARCHITECTURE"
|
||||
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
|
||||
Version="4.3.4.0" />
|
||||
Version="4.4.0.0" />
|
||||
<Properties>
|
||||
<DisplayName>Telegram Desktop</DisplayName>
|
||||
<PublisherDisplayName>Telegram Messenger LLP</PublisherDisplayName>
|
||||
|
||||
@@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 4,3,4,0
|
||||
PRODUCTVERSION 4,3,4,0
|
||||
FILEVERSION 4,4,0,0
|
||||
PRODUCTVERSION 4,4,0,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -62,10 +62,10 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Telegram FZ-LLC"
|
||||
VALUE "FileDescription", "Telegram Desktop"
|
||||
VALUE "FileVersion", "4.3.4.0"
|
||||
VALUE "FileVersion", "4.4.0.0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2014-2022"
|
||||
VALUE "ProductName", "Telegram Desktop"
|
||||
VALUE "ProductVersion", "4.3.4.0"
|
||||
VALUE "ProductVersion", "4.4.0.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 4,3,4,0
|
||||
PRODUCTVERSION 4,3,4,0
|
||||
FILEVERSION 4,4,0,0
|
||||
PRODUCTVERSION 4,4,0,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -53,10 +53,10 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Telegram FZ-LLC"
|
||||
VALUE "FileDescription", "Telegram Desktop Updater"
|
||||
VALUE "FileVersion", "4.3.4.0"
|
||||
VALUE "FileVersion", "4.4.0.0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2014-2022"
|
||||
VALUE "ProductName", "Telegram Desktop"
|
||||
VALUE "ProductVersion", "4.3.4.0"
|
||||
VALUE "ProductVersion", "4.4.0.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -34,8 +34,8 @@ Authorizations::Entry ParseEntry(const MTPDauthorization &data) {
|
||||
|| isTest;
|
||||
|
||||
const auto appName = isDesktop
|
||||
? QString("Telegram Desktop%1").arg(isTest ? " (GitHub)" : QString())
|
||||
: qs(data.vapp_name());// +qsl(" for ") + qs(d.vplatform());
|
||||
? u"Telegram Desktop%1"_q.arg(isTest ? " (GitHub)" : QString())
|
||||
: qs(data.vapp_name());// + u" for "_q + qs(d.vplatform());
|
||||
const auto appVer = [&] {
|
||||
const auto version = qs(data.vapp_version());
|
||||
if (isDesktop) {
|
||||
|
||||
@@ -426,10 +426,19 @@ void ActivateBotCommand(ClickHandlerContext context, int row, int column) {
|
||||
return false;
|
||||
}();
|
||||
if (!fastSwitchDone) {
|
||||
controller->content()->inlineSwitchLayer('@'
|
||||
const auto botAndQuery = '@'
|
||||
+ bot->username()
|
||||
+ ' '
|
||||
+ QString::fromUtf8(button->data));
|
||||
+ QString::fromUtf8(button->data);
|
||||
const auto chosen = [=](not_null<Data::Thread*> thread) {
|
||||
return controller->content()->inlineSwitchChosen(
|
||||
thread,
|
||||
botAndQuery);
|
||||
};
|
||||
Window::ShowChooseRecipientBox(
|
||||
controller,
|
||||
chosen,
|
||||
tr::lng_inline_switch_choose());
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
||||
@@ -116,14 +116,11 @@ void CheckChatInvite(
|
||||
}
|
||||
Core::App().hideMediaView();
|
||||
const auto show = [&](not_null<PeerData*> chat) {
|
||||
const auto way = Window::SectionShow::Way::Forward;
|
||||
if (const auto forum = chat->forum()) {
|
||||
strong->openForum(
|
||||
forum->channel(),
|
||||
Window::SectionShow::Way::Forward);
|
||||
strong->showForum(forum, way);
|
||||
} else {
|
||||
strong->showPeerHistory(
|
||||
chat,
|
||||
Window::SectionShow::Way::Forward);
|
||||
strong->showPeerHistory(chat, way);
|
||||
}
|
||||
};
|
||||
result.match([=](const MTPDchatInvite &data) {
|
||||
@@ -174,6 +171,11 @@ void CheckChatInvite(
|
||||
|
||||
} // namespace Api
|
||||
|
||||
struct ConfirmInviteBox::Participant {
|
||||
not_null<UserData*> user;
|
||||
Ui::PeerUserpicView userpic;
|
||||
};
|
||||
|
||||
ConfirmInviteBox::ConfirmInviteBox(
|
||||
QWidget*,
|
||||
not_null<Main::Session*> session,
|
||||
@@ -244,7 +246,7 @@ ConfirmInviteBox::ConfirmInviteBox(
|
||||
}
|
||||
} else {
|
||||
_photoEmpty = std::make_unique<Ui::EmptyUserpic>(
|
||||
Data::PeerUserpicColor(0),
|
||||
Ui::EmptyUserpic::UserpicColor(0),
|
||||
invite.title);
|
||||
}
|
||||
}
|
||||
@@ -359,7 +361,7 @@ void ConfirmInviteBox::paintEvent(QPaintEvent *e) {
|
||||
{ .options = Images::Option::RoundCircle }));
|
||||
}
|
||||
} else if (_photoEmpty) {
|
||||
_photoEmpty->paint(
|
||||
_photoEmpty->paintCircle(
|
||||
p,
|
||||
(width() - st::confirmInvitePhotoSize) / 2,
|
||||
st::confirmInvitePhotoTop,
|
||||
|
||||
@@ -21,7 +21,6 @@ class SessionController;
|
||||
} // namespace Window
|
||||
|
||||
namespace Data {
|
||||
class CloudImageView;
|
||||
class PhotoMedia;
|
||||
} // namespace Data
|
||||
|
||||
@@ -55,10 +54,7 @@ protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
||||
private:
|
||||
struct Participant {
|
||||
not_null<UserData*> user;
|
||||
std::shared_ptr<Data::CloudImageView> userpic;
|
||||
};
|
||||
struct Participant;
|
||||
struct ChatInvite {
|
||||
QString title;
|
||||
QString about;
|
||||
|
||||
@@ -598,7 +598,7 @@ void ChatParticipants::requestSelf(not_null<ChannelData*> channel) {
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_selfParticipantRequests.erase(channel);
|
||||
if (error.type() == qstr("CHANNEL_PRIVATE")) {
|
||||
if (error.type() == u"CHANNEL_PRIVATE"_q) {
|
||||
channel->privateErrorReceived();
|
||||
}
|
||||
finalize();
|
||||
|
||||
@@ -45,6 +45,8 @@ void ConfirmPhone::resolve(
|
||||
return 0;
|
||||
}, [&](const MTPDauth_sentCodeTypeSms &data) {
|
||||
return data.vlength().v;
|
||||
}, [&](const MTPDauth_sentCodeTypeFragmentSms &data) {
|
||||
return data.vlength().v;
|
||||
}, [&](const MTPDauth_sentCodeTypeCall &data) {
|
||||
return data.vlength().v;
|
||||
}, [&](const MTPDauth_sentCodeTypeFlashCall &) {
|
||||
|
||||
@@ -23,7 +23,7 @@ MTPVector<MTPDocumentAttribute> ComposeSendingDocumentAttributes(
|
||||
auto attributes = QVector<MTPDocumentAttribute>(1, filenameAttribute);
|
||||
if (dimensions.width() > 0 && dimensions.height() > 0) {
|
||||
const auto duration = document->getDuration();
|
||||
if (duration >= 0 && !document->hasMimeType(qstr("image/gif"))) {
|
||||
if (duration >= 0 && !document->hasMimeType(u"image/gif"_q)) {
|
||||
auto flags = MTPDdocumentAttributeVideo::Flags(0);
|
||||
using VideoFlag = MTPDdocumentAttributeVideo::Flag;
|
||||
if (document->isVideoMessage()) {
|
||||
|
||||
@@ -16,36 +16,61 @@ SelfDestruct::SelfDestruct(not_null<ApiWrap*> api)
|
||||
}
|
||||
|
||||
void SelfDestruct::reload() {
|
||||
if (_requestId) {
|
||||
return;
|
||||
if (!_accountTTL.requestId) {
|
||||
_accountTTL.requestId = _api.request(MTPaccount_GetAccountTTL(
|
||||
)).done([=](const MTPAccountDaysTTL &result) {
|
||||
_accountTTL.requestId = 0;
|
||||
_accountTTL.days = result.data().vdays().v;
|
||||
}).fail([=] {
|
||||
_accountTTL.requestId = 0;
|
||||
}).send();
|
||||
}
|
||||
if (!_defaultHistoryTTL.requestId) {
|
||||
_defaultHistoryTTL.requestId = _api.request(
|
||||
MTPmessages_GetDefaultHistoryTTL()
|
||||
).done([=](const MTPDefaultHistoryTTL &result) {
|
||||
_defaultHistoryTTL.requestId = 0;
|
||||
_defaultHistoryTTL.period = result.data().vperiod().v;
|
||||
}).fail([=] {
|
||||
_defaultHistoryTTL.requestId = 0;
|
||||
}).send();
|
||||
}
|
||||
_requestId = _api.request(MTPaccount_GetAccountTTL(
|
||||
)).done([=](const MTPAccountDaysTTL &result) {
|
||||
_requestId = 0;
|
||||
result.match([&](const MTPDaccountDaysTTL &data) {
|
||||
_days = data.vdays().v;
|
||||
});
|
||||
}).fail([=] {
|
||||
_requestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
||||
rpl::producer<int> SelfDestruct::days() const {
|
||||
using namespace rpl::mappers;
|
||||
|
||||
return _days.value() | rpl::filter(_1 != 0);
|
||||
rpl::producer<int> SelfDestruct::daysAccountTTL() const {
|
||||
return _accountTTL.days.value() | rpl::filter(rpl::mappers::_1 != 0);
|
||||
}
|
||||
|
||||
void SelfDestruct::update(int days) {
|
||||
_api.request(_requestId).cancel();
|
||||
_requestId = _api.request(MTPaccount_SetAccountTTL(
|
||||
rpl::producer<TimeId> SelfDestruct::periodDefaultHistoryTTL() const {
|
||||
return _defaultHistoryTTL.period.value();
|
||||
}
|
||||
|
||||
TimeId SelfDestruct::periodDefaultHistoryTTLCurrent() const {
|
||||
return _defaultHistoryTTL.period.current();
|
||||
}
|
||||
|
||||
void SelfDestruct::updateAccountTTL(int days) {
|
||||
_api.request(_accountTTL.requestId).cancel();
|
||||
_accountTTL.requestId = _api.request(MTPaccount_SetAccountTTL(
|
||||
MTP_accountDaysTTL(MTP_int(days))
|
||||
)).done([=] {
|
||||
_requestId = 0;
|
||||
_accountTTL.requestId = 0;
|
||||
}).fail([=] {
|
||||
_requestId = 0;
|
||||
_accountTTL.requestId = 0;
|
||||
}).send();
|
||||
_days = days;
|
||||
_accountTTL.days = days;
|
||||
}
|
||||
|
||||
void SelfDestruct::updateDefaultHistoryTTL(TimeId period) {
|
||||
_api.request(_defaultHistoryTTL.requestId).cancel();
|
||||
_defaultHistoryTTL.requestId = _api.request(
|
||||
MTPmessages_SetDefaultHistoryTTL(MTP_int(period))
|
||||
).done([=] {
|
||||
_defaultHistoryTTL.requestId = 0;
|
||||
}).fail([=] {
|
||||
_defaultHistoryTTL.requestId = 0;
|
||||
}).send();
|
||||
_defaultHistoryTTL.period = period;
|
||||
}
|
||||
|
||||
} // namespace Api
|
||||
|
||||
@@ -18,14 +18,24 @@ public:
|
||||
explicit SelfDestruct(not_null<ApiWrap*> api);
|
||||
|
||||
void reload();
|
||||
void update(int days);
|
||||
void updateAccountTTL(int days);
|
||||
void updateDefaultHistoryTTL(TimeId period);
|
||||
|
||||
rpl::producer<int> days() const;
|
||||
[[nodiscard]] rpl::producer<int> daysAccountTTL() const;
|
||||
[[nodiscard]] rpl::producer<TimeId> periodDefaultHistoryTTL() const;
|
||||
[[nodiscard]] TimeId periodDefaultHistoryTTLCurrent() const;
|
||||
|
||||
private:
|
||||
MTP::Sender _api;
|
||||
mtpRequestId _requestId = 0;
|
||||
rpl::variable<int> _days = 0;
|
||||
struct {
|
||||
mtpRequestId requestId = 0;
|
||||
rpl::variable<int> days = 0;
|
||||
} _accountTTL;
|
||||
|
||||
struct {
|
||||
mtpRequestId requestId = 0;
|
||||
rpl::variable<TimeId> period = 0;
|
||||
} _defaultHistoryTTL;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ void SendExistingMedia(
|
||||
), [=](const MTPUpdates &result, const MTP::Response &response) {
|
||||
}, [=](const MTP::Error &error, const MTP::Response &response) {
|
||||
if (error.code() == 400
|
||||
&& error.type().startsWith(qstr("FILE_REFERENCE_"))) {
|
||||
&& error.type().startsWith(u"FILE_REFERENCE_"_q)) {
|
||||
api->refreshFileReference(origin, [=](const auto &result) {
|
||||
if (media->fileReference() != usedFileReference) {
|
||||
repeatRequest(repeatRequest);
|
||||
|
||||
@@ -33,12 +33,12 @@ Key ExtractKey(const QString &query) {
|
||||
qthelp::UrlParamNameTransform::ToLower)
|
||||
: QMap<QString, QString>();
|
||||
};
|
||||
if (check.startsWith(qstr("tg://privatepost"), Qt::CaseInsensitive)) {
|
||||
if (check.startsWith(u"tg://privatepost"_q, Qt::CaseInsensitive)) {
|
||||
const auto params = parse();
|
||||
const auto channel = params.value("channel");
|
||||
const auto post = params.value("post").toInt();
|
||||
return (channel.toULongLong() && post) ? Key{ channel, post } : Key();
|
||||
} else if (check.startsWith(qstr("tg://resolve"), Qt::CaseInsensitive)) {
|
||||
} else if (check.startsWith(u"tg://resolve"_q, Qt::CaseInsensitive)) {
|
||||
const auto params = parse();
|
||||
const auto domain = params.value("domain");
|
||||
const auto post = params.value("post").toInt();
|
||||
@@ -220,7 +220,7 @@ QString ConvertPeerSearchQuery(const QString &query) {
|
||||
const auto trimmed = query.trimmed();
|
||||
const auto local = Core::TryConvertUrlToLocal(trimmed);
|
||||
const auto check = local.isEmpty() ? trimmed : local;
|
||||
if (!check.startsWith(qstr("tg://resolve"), Qt::CaseInsensitive)) {
|
||||
if (!check.startsWith(u"tg://resolve"_q, Qt::CaseInsensitive)) {
|
||||
return query;
|
||||
}
|
||||
const auto delimeter = check.indexOf('?');
|
||||
|
||||
@@ -95,7 +95,7 @@ void ProcessScheduledMessageWithElapsedTime(
|
||||
}
|
||||
|
||||
bool IsForceLogoutNotification(const MTPDupdateServiceNotification &data) {
|
||||
return qs(data.vtype()).startsWith(qstr("AUTH_KEY_DROP_"));
|
||||
return qs(data.vtype()).startsWith(u"AUTH_KEY_DROP_"_q);
|
||||
}
|
||||
|
||||
bool HasForceLogoutNotification(const MTPUpdates &updates) {
|
||||
@@ -2213,7 +2213,7 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
||||
history->requestChatListMessage();
|
||||
if (!history->folderKnown()
|
||||
|| (!history->unreadCountKnown()
|
||||
&& !history->peer->isForum())) {
|
||||
&& !history->isForum())) {
|
||||
history->owner().histories().requestDialogEntry(history);
|
||||
}
|
||||
if (!channel->amCreator()) {
|
||||
|
||||
@@ -114,7 +114,7 @@ struct Context {
|
||||
struct Userpic {
|
||||
not_null<PeerData*> peer;
|
||||
QString customEntityData;
|
||||
mutable std::shared_ptr<Data::CloudImageView> view;
|
||||
mutable Ui::PeerUserpicView view;
|
||||
mutable InMemoryKey uniqueKey;
|
||||
};
|
||||
|
||||
@@ -380,7 +380,7 @@ bool UpdateUserpics(
|
||||
const auto peer = not_null{ resolved.peer };
|
||||
const auto &data = ReactionEntityData(resolved.reaction);
|
||||
const auto i = ranges::find(was, peer, &Userpic::peer);
|
||||
if (i != end(was) && i->view) {
|
||||
if (i != end(was) && i->view.cloud) {
|
||||
now.push_back(std::move(*i));
|
||||
now.back().customEntityData = data;
|
||||
continue;
|
||||
|
||||
@@ -96,7 +96,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "storage/storage_shared_media.h"
|
||||
#include "storage/storage_media_prepare.h"
|
||||
#include "storage/storage_account.h"
|
||||
#include "facades.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -479,15 +478,15 @@ void ApiWrap::sendMessageFail(
|
||||
FullMsgId itemId) {
|
||||
const auto show = ShowForPeer(peer);
|
||||
|
||||
if (error == qstr("PEER_FLOOD")) {
|
||||
if (error == u"PEER_FLOOD"_q) {
|
||||
show->showBox(
|
||||
Ui::MakeInformBox(
|
||||
PeerFloodErrorText(&session(), PeerFloodType::Send)),
|
||||
Ui::LayerOption::CloseOther);
|
||||
} else if (error == qstr("USER_BANNED_IN_CHANNEL")) {
|
||||
} else if (error == u"USER_BANNED_IN_CHANNEL"_q) {
|
||||
const auto link = Ui::Text::Link(
|
||||
tr::lng_cant_more_info(tr::now),
|
||||
session().createInternalLinkFull(qsl("spambot")));
|
||||
session().createInternalLinkFull(u"spambot"_q));
|
||||
show->showBox(
|
||||
Ui::MakeInformBox(
|
||||
tr::lng_error_public_groups_denied(
|
||||
@@ -496,8 +495,8 @@ void ApiWrap::sendMessageFail(
|
||||
link,
|
||||
Ui::Text::WithEntities)),
|
||||
Ui::LayerOption::CloseOther);
|
||||
} else if (error.startsWith(qstr("SLOWMODE_WAIT_"))) {
|
||||
const auto chop = qstr("SLOWMODE_WAIT_").size();
|
||||
} else if (error.startsWith(u"SLOWMODE_WAIT_"_q)) {
|
||||
const auto chop = u"SLOWMODE_WAIT_"_q.size();
|
||||
const auto left = base::StringViewMid(error, chop).toInt();
|
||||
if (const auto channel = peer->asChannel()) {
|
||||
const auto seconds = channel->slowmodeSeconds();
|
||||
@@ -508,7 +507,7 @@ void ApiWrap::sendMessageFail(
|
||||
requestFullPeer(peer);
|
||||
}
|
||||
}
|
||||
} else if (error == qstr("SCHEDULE_STATUS_PRIVATE")) {
|
||||
} else if (error == u"SCHEDULE_STATUS_PRIVATE"_q) {
|
||||
auto &scheduled = _session->data().scheduledMessages();
|
||||
Assert(peer->isUser());
|
||||
if (const auto item = scheduled.lookupItem(peer->id, itemId.msg)) {
|
||||
@@ -517,7 +516,7 @@ void ApiWrap::sendMessageFail(
|
||||
Ui::MakeInformBox(tr::lng_cant_do_this()),
|
||||
Ui::LayerOption::CloseOther);
|
||||
}
|
||||
} else if (error == qstr("CHAT_FORWARDS_RESTRICTED")) {
|
||||
} else if (error == u"CHAT_FORWARDS_RESTRICTED"_q) {
|
||||
if (show->valid()) {
|
||||
Ui::ShowMultilineToast({
|
||||
.parentOverride = show->toastParent(),
|
||||
@@ -528,7 +527,7 @@ void ApiWrap::sendMessageFail(
|
||||
.duration = kJoinErrorDuration
|
||||
});
|
||||
}
|
||||
} else if (error == qstr("PREMIUM_ACCOUNT_REQUIRED")) {
|
||||
} else if (error == u"PREMIUM_ACCOUNT_REQUIRED"_q) {
|
||||
Settings::ShowPremium(&session(), "premium_stickers");
|
||||
}
|
||||
if (const auto item = _session->data().message(itemId)) {
|
||||
@@ -689,7 +688,7 @@ QString ApiWrap::exportDirectMessageLink(
|
||||
auto linkItemId = item->id;
|
||||
auto linkCommentId = MsgId();
|
||||
auto linkThreadId = MsgId();
|
||||
//auto linkThreadIsTopic = false;
|
||||
auto linkThreadIsTopic = false;
|
||||
if (inRepliesContext) {
|
||||
if (const auto rootId = item->replyToTop()) {
|
||||
const auto root = item->history()->owner().message(
|
||||
@@ -711,7 +710,7 @@ QString ApiWrap::exportDirectMessageLink(
|
||||
} else {
|
||||
// Reply in a thread, maybe comment in a private channel.
|
||||
linkThreadId = rootId;
|
||||
//linkThreadIsTopic = (item->topicRootId() == rootId);
|
||||
linkThreadIsTopic = (item->topicRootId() == rootId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -723,7 +722,7 @@ QString ApiWrap::exportDirectMessageLink(
|
||||
+ '/'
|
||||
+ (linkCommentId
|
||||
? (post + "?comment=" + QString::number(linkCommentId.bare))
|
||||
: (linkThreadId/* && !linkThreadIsTopic*/)
|
||||
: (linkThreadId && !linkThreadIsTopic)
|
||||
? (post + "?thread=" + QString::number(linkThreadId.bare))
|
||||
: linkThreadId
|
||||
? (QString::number(linkThreadId.bare) + '/' + post)
|
||||
@@ -735,7 +734,7 @@ QString ApiWrap::exportDirectMessageLink(
|
||||
if (const auto media = item->media()) {
|
||||
if (const auto document = media->document()) {
|
||||
if (document->isVideoMessage()) {
|
||||
return qsl("https://telesco.pe/") + query;
|
||||
return u"https://telesco.pe/"_q + query;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2134,6 +2133,7 @@ void ApiWrap::saveDraftsToCloud() {
|
||||
if (const auto cloudDraft = history->cloudDraft(topicRootId)) {
|
||||
if (cloudDraft->saveRequestId == requestId) {
|
||||
history->clearCloudDraft(topicRootId);
|
||||
history->applyCloudDraft(topicRootId);
|
||||
}
|
||||
}
|
||||
const auto i = _draftsSaveRequestIds.find(weak);
|
||||
@@ -3489,10 +3489,12 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
||||
const auto replyTo = replyToId
|
||||
? peer->owner().message(peer, replyToId)
|
||||
: nullptr;
|
||||
const auto topicRootId = replyTo ? replyTo->topicRootId() : replyToId;
|
||||
const auto topic = topicRootId
|
||||
? peer->forumTopicFor(topicRootId)
|
||||
: nullptr;
|
||||
const auto topicRootId = replyTo
|
||||
? replyTo->topicRootId()
|
||||
: action.topicRootId
|
||||
? action.topicRootId
|
||||
: Data::ForumTopic::kGeneralId;
|
||||
const auto topic = peer->forumTopicFor(topicRootId);
|
||||
if (!(topic ? topic->canWrite() : peer->canWrite())
|
||||
|| Api::SendDice(message)) {
|
||||
return;
|
||||
@@ -3616,7 +3618,7 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
||||
UnixtimeFromMsgId(response.outerMsgId));
|
||||
}
|
||||
}, [=](const MTP::Error &error, const MTP::Response &response) {
|
||||
if (error.type() == qstr("MESSAGE_EMPTY")) {
|
||||
if (error.type() == u"MESSAGE_EMPTY"_q) {
|
||||
lastMessage->destroy();
|
||||
} else {
|
||||
sendMessageFail(error, peer, randomId, newId);
|
||||
|
||||
@@ -64,7 +64,7 @@ AboutBox::AboutBox(QWidget *parent)
|
||||
}
|
||||
|
||||
void AboutBox::prepare() {
|
||||
setTitle(rpl::single(qsl("Telegram Desktop")));
|
||||
setTitle(rpl::single(u"Telegram Desktop"_q));
|
||||
|
||||
addButton(tr::lng_close(), [this] { closeBox(); });
|
||||
|
||||
@@ -94,19 +94,19 @@ void AboutBox::resizeEvent(QResizeEvent *e) {
|
||||
|
||||
void AboutBox::showVersionHistory() {
|
||||
if (cRealAlphaVersion()) {
|
||||
auto url = qsl("https://tdesktop.com/");
|
||||
auto url = u"https://tdesktop.com/"_q;
|
||||
if (Platform::IsWindows32Bit()) {
|
||||
url += qsl("win/%1.zip");
|
||||
url += u"win/%1.zip"_q;
|
||||
} else if (Platform::IsWindows64Bit()) {
|
||||
url += qsl("win64/%1.zip");
|
||||
url += u"win64/%1.zip"_q;
|
||||
} else if (Platform::IsMac()) {
|
||||
url += qsl("mac/%1.zip");
|
||||
url += u"mac/%1.zip"_q;
|
||||
} else if (Platform::IsLinux()) {
|
||||
url += qsl("linux/%1.tar.xz");
|
||||
url += u"linux/%1.tar.xz"_q;
|
||||
} else {
|
||||
Unexpected("Platform value.");
|
||||
}
|
||||
url = url.arg(qsl("talpha%1_%2").arg(cRealAlphaVersion()).arg(Core::countAlphaVersionSignature(cRealAlphaVersion())));
|
||||
url = url.arg(u"talpha%1_%2"_q.arg(cRealAlphaVersion()).arg(Core::countAlphaVersionSignature(cRealAlphaVersion())));
|
||||
|
||||
QGuiApplication::clipboard()->setText(url);
|
||||
|
||||
@@ -129,7 +129,7 @@ void AboutBox::keyPressEvent(QKeyEvent *e) {
|
||||
}
|
||||
|
||||
QString telegramFaqLink() {
|
||||
const auto result = qsl("https://telegram.org/faq");
|
||||
const auto result = u"https://telegram.org/faq"_q;
|
||||
const auto langpacked = [&](const char *language) {
|
||||
return result + '/' + language;
|
||||
};
|
||||
@@ -139,7 +139,7 @@ QString telegramFaqLink() {
|
||||
return langpacked(language);
|
||||
}
|
||||
}
|
||||
if (current.startsWith(qstr("pt-br"))) {
|
||||
if (current.startsWith(u"pt-br"_q)) {
|
||||
return langpacked("br");
|
||||
}
|
||||
return result;
|
||||
@@ -148,7 +148,7 @@ QString telegramFaqLink() {
|
||||
QString currentVersionText() {
|
||||
auto result = QString::fromLatin1(AppVersionStr);
|
||||
if (cAlphaVersion()) {
|
||||
result += qsl(" alpha %1").arg(cAlphaVersion() % 1000);
|
||||
result += u" alpha %1"_q.arg(cAlphaVersion() % 1000);
|
||||
} else if (AppBetaVersion) {
|
||||
result += " beta";
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "boxes/abstract_box.h"
|
||||
|
||||
#include "core/application.h"
|
||||
#include "window/window_controller.h"
|
||||
#include "mainwidget.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
@@ -17,25 +19,30 @@ void showBox(
|
||||
object_ptr<BoxContent> content,
|
||||
LayerOptions options,
|
||||
anim::type animated) {
|
||||
if (auto w = App::wnd()) {
|
||||
w->ui_showBox(std::move(content), options, animated);
|
||||
const auto window = Core::IsAppLaunched()
|
||||
? Core::App().primaryWindow()
|
||||
: nullptr;
|
||||
if (window) {
|
||||
window->show(std::move(content), options, animated);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
||||
void hideLayer(anim::type animated) {
|
||||
if (auto w = App::wnd()) {
|
||||
w->ui_showBox(
|
||||
{ nullptr },
|
||||
LayerOption::CloseOther,
|
||||
animated);
|
||||
const auto window = Core::IsAppLaunched()
|
||||
? Core::App().primaryWindow()
|
||||
: nullptr;
|
||||
if (window) {
|
||||
window->hideLayer(animated);
|
||||
}
|
||||
}
|
||||
|
||||
bool isLayerShown() {
|
||||
if (auto w = App::wnd()) return w->ui_isLayerShown();
|
||||
return false;
|
||||
const auto window = Core::IsAppLaunched()
|
||||
? Core::App().primaryWindow()
|
||||
: nullptr;
|
||||
return window && window->isLayerShown();
|
||||
}
|
||||
|
||||
} // namespace Ui
|
||||
|
||||
@@ -47,6 +47,5 @@ QPointer<BoxType> show(
|
||||
}
|
||||
|
||||
void hideLayer(anim::type animated = anim::type::normal);
|
||||
bool isLayerShown();
|
||||
|
||||
} // namespace Ui
|
||||
|
||||
@@ -21,12 +21,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "chat_helpers/emoji_suggestions_widget.h"
|
||||
#include "countries/countries_instance.h" // Countries::ExtractPhoneCode.
|
||||
#include "window/window_session_controller.h"
|
||||
#include "menu/menu_ttl.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "ui/special_buttons.h"
|
||||
#include "ui/widgets/fields/special_fields.h"
|
||||
#include "ui/widgets/popup_menu.h"
|
||||
#include "ui/text/format_values.h"
|
||||
#include "ui/text/text_options.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/unread_badge.h"
|
||||
@@ -42,8 +45,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "api/api_invite_links.h"
|
||||
#include "api/api_peer_photo.h"
|
||||
#include "main/main_session.h"
|
||||
#include "facades.h"
|
||||
#include "styles/style_info.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_menu_icons.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
#include "styles/style_widgets.h"
|
||||
@@ -54,19 +58,20 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
namespace {
|
||||
|
||||
bool IsValidPhone(QString phone) {
|
||||
phone = phone.replace(QRegularExpression(qsl("[^\\d]")), QString());
|
||||
phone = phone.replace(QRegularExpression(u"[^\\d]"_q), QString());
|
||||
return (phone.length() >= 8)
|
||||
|| (phone == qsl("333"))
|
||||
|| (phone.startsWith(qsl("42"))
|
||||
|| (phone == u"333"_q)
|
||||
|| (phone.startsWith(u"42"_q)
|
||||
&& (phone.length() == 2
|
||||
|| phone.length() == 5
|
||||
|| phone.length() == 6
|
||||
|| phone == qsl("4242")));
|
||||
|| phone == u"4242"_q));
|
||||
}
|
||||
|
||||
void ChatCreateDone(
|
||||
not_null<Window::SessionNavigation*> navigation,
|
||||
QImage image,
|
||||
TimeId ttlPeriod,
|
||||
const MTPUpdates &updates) {
|
||||
navigation->session().api().applyUpdates(updates);
|
||||
|
||||
@@ -98,7 +103,10 @@ void ChatCreateDone(
|
||||
chat,
|
||||
std::move(image));
|
||||
}
|
||||
Ui::showPeerHistory(chat, ShowAtUnreadMsgId);
|
||||
if (ttlPeriod) {
|
||||
chat->setMessagesTTL(ttlPeriod);
|
||||
}
|
||||
navigation->showPeerHistory(chat);
|
||||
};
|
||||
if (!success) {
|
||||
LOG(("API Error: chat not found in updates "
|
||||
@@ -113,7 +121,7 @@ TextWithEntities PeerFloodErrorText(
|
||||
PeerFloodType type) {
|
||||
const auto link = Ui::Text::Link(
|
||||
tr::lng_cant_more_info(tr::now),
|
||||
session->createInternalLinkFull(qsl("spambot")));
|
||||
session->createInternalLinkFull(u"spambot"_q));
|
||||
return ((type == PeerFloodType::InviteGroup)
|
||||
? tr::lng_cant_invite_not_contact
|
||||
: tr::lng_cant_send_to_not_contact)(
|
||||
@@ -398,7 +406,9 @@ void AddContactBox::save() {
|
||||
: extractUser(list.front());
|
||||
if (user) {
|
||||
if (user->isContact() || user->session().supportMode()) {
|
||||
Ui::showPeerHistory(user, ShowAtTheEndMsgId);
|
||||
if (const auto window = user->session().tryResolveWindow()) {
|
||||
window->showPeerHistory(user);
|
||||
}
|
||||
}
|
||||
if (weak) { // showPeerHistory could close the box.
|
||||
getDelegate()->hideLayer();
|
||||
@@ -515,6 +525,39 @@ void GroupInfoBox::prepare() {
|
||||
[=] { submit(); });
|
||||
addButton(tr::lng_cancel(), [this] { closeBox(); });
|
||||
|
||||
if (_type == Type::Group) {
|
||||
const auto top = addTopButton(st::infoTopBarMenu);
|
||||
const auto menu =
|
||||
top->lifetime().make_state<base::unique_qptr<Ui::PopupMenu>>();
|
||||
top->setClickedCallback([=] {
|
||||
*menu = base::make_unique_q<Ui::PopupMenu>(
|
||||
top,
|
||||
st::popupMenuWithIcons);
|
||||
|
||||
const auto text = tr::lng_manage_messages_ttl_menu(tr::now)
|
||||
+ (_ttlPeriod
|
||||
? ('\t' + Ui::FormatTTLTiny(_ttlPeriod))
|
||||
: QString());
|
||||
(*menu)->addAction(
|
||||
text,
|
||||
[=, show = std::make_shared<Ui::BoxShow>(this)] {
|
||||
show->showBox(Box(TTLMenu::TTLBox, TTLMenu::Args{
|
||||
.show = show,
|
||||
.startTtl = _ttlPeriod,
|
||||
.about = nullptr,
|
||||
.callback = crl::guard(this, [=](
|
||||
TimeId t,
|
||||
Fn<void()> close) {
|
||||
_ttlPeriod = t;
|
||||
close();
|
||||
}),
|
||||
}));
|
||||
}, &st::menuIconTTL);
|
||||
(*menu)->popup(QCursor::pos());
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
updateMaxHeight();
|
||||
}
|
||||
|
||||
@@ -592,14 +635,18 @@ void GroupInfoBox::createGroup(
|
||||
return;
|
||||
}
|
||||
_creationRequestId = _api.request(MTPmessages_CreateChat(
|
||||
MTP_flags(_ttlPeriod
|
||||
? MTPmessages_CreateChat::Flag::f_ttl_period
|
||||
: MTPmessages_CreateChat::Flags(0)),
|
||||
MTP_vector<TLUsers>(inputs),
|
||||
MTP_string(title)
|
||||
MTP_string(title),
|
||||
MTP_int(_ttlPeriod)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
auto image = _photo->takeResultImage();
|
||||
const auto navigation = _navigation;
|
||||
|
||||
getDelegate()->hideLayer(); // Destroys 'this'.
|
||||
ChatCreateDone(navigation, std::move(image), result);
|
||||
ChatCreateDone(navigation, std::move(image), _ttlPeriod, result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
const auto &type = error.type();
|
||||
_creationRequestId = 0;
|
||||
@@ -675,15 +722,19 @@ void GroupInfoBox::createChannel(
|
||||
const QString &description) {
|
||||
Expects(!_creationRequestId);
|
||||
|
||||
const auto flags = (_type == Type::Megagroup)
|
||||
? MTPchannels_CreateChannel::Flag::f_megagroup
|
||||
: MTPchannels_CreateChannel::Flag::f_broadcast;
|
||||
const auto flags = ((_type == Type::Megagroup)
|
||||
? MTPchannels_CreateChannel::Flag::f_megagroup
|
||||
: MTPchannels_CreateChannel::Flag::f_broadcast)
|
||||
| (_ttlPeriod
|
||||
? MTPchannels_CreateChannel::Flag::f_ttl_period
|
||||
: MTPchannels_CreateChannel::Flags(0));
|
||||
_creationRequestId = _api.request(MTPchannels_CreateChannel(
|
||||
MTP_flags(flags),
|
||||
MTP_string(title),
|
||||
MTP_string(description),
|
||||
MTPInputGeoPoint(), // geo_point
|
||||
MTPstring() // address
|
||||
MTPstring(), // address
|
||||
MTP_int((_type == Type::Megagroup) ? _ttlPeriod : 0)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
_navigation->session().api().applyUpdates(result);
|
||||
|
||||
@@ -716,6 +767,9 @@ void GroupInfoBox::createChannel(
|
||||
channel,
|
||||
std::move(image));
|
||||
}
|
||||
if (_ttlPeriod && channel->isMegagroup()) {
|
||||
channel->setMessagesTTL(_ttlPeriod);
|
||||
}
|
||||
channel->session().api().requestFullPeer(channel);
|
||||
_createdChannel = channel;
|
||||
checkInviteLink();
|
||||
@@ -1225,6 +1279,8 @@ SetupChannelBox::UsernameResult SetupChannelBox::parseError(
|
||||
return UsernameResult::Invalid;
|
||||
} else if (error == u"USERNAME_OCCUPIED"_q) {
|
||||
return UsernameResult::Occupied;
|
||||
} else if (error == u"USERNAME_PURCHASE_AVAILABLE"_q) {
|
||||
return UsernameResult::Occupied;
|
||||
} else if (error == u"USERNAMES_UNAVAILABLE"_q) {
|
||||
return UsernameResult::Occupied;
|
||||
} else if (error == u"CHANNEL_PUBLIC_GROUP_NA"_q) {
|
||||
|
||||
@@ -139,6 +139,7 @@ private:
|
||||
mtpRequestId _creationRequestId = 0;
|
||||
bool _creatingInviteLink = false;
|
||||
ChannelData *_createdChannel = nullptr;
|
||||
TimeId _ttlPeriod = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -273,7 +273,7 @@ notificationsSampleMargin: 2px;
|
||||
notificationSampleOpacity: 0.5;
|
||||
notificationSampleSize: size(64px, 16px);
|
||||
|
||||
membersAboutLimitPadding: margins(0px, 12px, 0px, 12px);
|
||||
membersAboutLimitPadding: margins(0px, 16px, 0px, 16px);
|
||||
membersAbout: FlatLabel(defaultFlatLabel) {
|
||||
minWidth: 240px;
|
||||
textFg: membersAboutLimitFg;
|
||||
|
||||
@@ -229,6 +229,9 @@ void ChangePhone::EnterPhone::sendPhoneDone(
|
||||
}, [&](const MTPDauth_sentCodeTypeSms &typeData) {
|
||||
codeLength = typeData.vlength().v;
|
||||
return true;
|
||||
}, [&](const MTPDauth_sentCodeTypeFragmentSms &typeData) {
|
||||
codeLength = typeData.vlength().v;
|
||||
return true;
|
||||
}, [&](const MTPDauth_sentCodeTypeCall &typeData) {
|
||||
codeLength = typeData.vlength().v;
|
||||
return true;
|
||||
@@ -270,11 +273,11 @@ void ChangePhone::EnterPhone::sendPhoneFail(
|
||||
const QString &phoneNumber) {
|
||||
if (MTP::IsFloodError(error)) {
|
||||
showError(tr::lng_flood_error(tr::now));
|
||||
} else if (error.type() == qstr("PHONE_NUMBER_INVALID")) {
|
||||
} else if (error.type() == u"PHONE_NUMBER_INVALID"_q) {
|
||||
showError(tr::lng_bad_phone(tr::now));
|
||||
} else if (error.type() == qstr("PHONE_NUMBER_BANNED")) {
|
||||
} else if (error.type() == u"PHONE_NUMBER_BANNED"_q) {
|
||||
Ui::ShowPhoneBannedError(&_controller->window(), phoneNumber);
|
||||
} else if (error.type() == qstr("PHONE_NUMBER_OCCUPIED")) {
|
||||
} else if (error.type() == u"PHONE_NUMBER_OCCUPIED"_q) {
|
||||
_controller->show(
|
||||
Ui::MakeInformBox(
|
||||
tr::lng_change_phone_occupied(
|
||||
@@ -428,13 +431,13 @@ void ChangePhone::EnterCode::showError(const QString &text) {
|
||||
void ChangePhone::EnterCode::sendCodeFail(const MTP::Error &error) {
|
||||
if (MTP::IsFloodError(error)) {
|
||||
showError(tr::lng_flood_error(tr::now));
|
||||
} else if (error.type() == qstr("PHONE_CODE_EMPTY")
|
||||
|| error.type() == qstr("PHONE_CODE_INVALID")) {
|
||||
} else if (error.type() == u"PHONE_CODE_EMPTY"_q
|
||||
|| error.type() == u"PHONE_CODE_INVALID"_q) {
|
||||
showError(tr::lng_bad_code(tr::now));
|
||||
} else if (error.type() == qstr("PHONE_CODE_EXPIRED")
|
||||
|| error.type() == qstr("PHONE_NUMBER_BANNED")) {
|
||||
} else if (error.type() == u"PHONE_CODE_EXPIRED"_q
|
||||
|| error.type() == u"PHONE_NUMBER_BANNED"_q) {
|
||||
closeBox(); // Go back to phone input.
|
||||
} else if (error.type() == qstr("PHONE_NUMBER_INVALID")) {
|
||||
} else if (error.type() == u"PHONE_NUMBER_INVALID"_q) {
|
||||
showError(tr::lng_bad_phone(tr::now));
|
||||
} else {
|
||||
showError(Lang::Hard::ServerError());
|
||||
|
||||
@@ -1092,17 +1092,17 @@ ProxiesBoxController::ProxiesBoxController(not_null<Main::Account*> account)
|
||||
void ProxiesBoxController::ShowApplyConfirmation(
|
||||
Type type,
|
||||
const QMap<QString, QString> &fields) {
|
||||
const auto server = fields.value(qsl("server"));
|
||||
const auto port = fields.value(qsl("port")).toUInt();
|
||||
const auto server = fields.value(u"server"_q);
|
||||
const auto port = fields.value(u"port"_q).toUInt();
|
||||
auto proxy = ProxyData();
|
||||
proxy.type = type;
|
||||
proxy.host = server;
|
||||
proxy.port = port;
|
||||
if (type == Type::Socks5) {
|
||||
proxy.user = fields.value(qsl("user"));
|
||||
proxy.password = fields.value(qsl("pass"));
|
||||
proxy.user = fields.value(u"user"_q);
|
||||
proxy.password = fields.value(u"pass"_q);
|
||||
} else if (type == Type::Mtproto) {
|
||||
proxy.password = fields.value(qsl("secret"));
|
||||
proxy.password = fields.value(u"secret"_q);
|
||||
}
|
||||
if (proxy) {
|
||||
const auto displayed = "https://" + server + "/";
|
||||
@@ -1504,12 +1504,9 @@ void ProxiesBoxController::updateView(const Item &item) {
|
||||
const auto deleted = item.deleted;
|
||||
const auto type = [&] {
|
||||
switch (item.data.type) {
|
||||
case Type::Http:
|
||||
return qsl("HTTP");
|
||||
case Type::Socks5:
|
||||
return qsl("SOCKS5");
|
||||
case Type::Mtproto:
|
||||
return qsl("MTPROTO");
|
||||
case Type::Http: return u"HTTP"_q;
|
||||
case Type::Socks5: return u"SOCKS5"_q;
|
||||
case Type::Mtproto: return u"MTPROTO"_q;
|
||||
}
|
||||
Unexpected("Proxy type in ProxiesBoxController::updateView.");
|
||||
}();
|
||||
@@ -1541,7 +1538,7 @@ void ProxiesBoxController::share(const ProxyData &proxy) {
|
||||
if (proxy.type == Type::Http) {
|
||||
return;
|
||||
}
|
||||
const auto link = qsl("https://t.me/")
|
||||
const auto link = u"https://t.me/"_q
|
||||
+ (proxy.type == Type::Socks5 ? "socks" : "proxy")
|
||||
+ "?server=" + proxy.host + "&port=" + QString::number(proxy.port)
|
||||
+ ((proxy.type == Type::Socks5 && !proxy.user.isEmpty())
|
||||
|
||||
@@ -79,7 +79,7 @@ DeleteMessagesBox::DeleteMessagesBox(
|
||||
void DeleteMessagesBox::prepare() {
|
||||
auto details = TextWithEntities();
|
||||
const auto appendDetails = [&](TextWithEntities &&text) {
|
||||
details.append(qstr("\n\n")).append(std::move(text));
|
||||
details.append(u"\n\n"_q).append(std::move(text));
|
||||
};
|
||||
auto deleteText = lifetime().make_state<rpl::variable<QString>>();
|
||||
*deleteText = tr::lng_box_delete();
|
||||
|
||||
@@ -40,7 +40,7 @@ void DownloadPathBox::prepare() {
|
||||
_group->setChangedCallback([this](Directory value) { radioChanged(value); });
|
||||
|
||||
_pathLink->addClickHandler([=] { editPath(); });
|
||||
if (!_path.isEmpty() && _path != qsl("tmp")) {
|
||||
if (!_path.isEmpty() && _path != FileDialog::Tmp()) {
|
||||
setPathText(QDir::toNativeSeparators(_path));
|
||||
}
|
||||
updateControlsVisibility();
|
||||
@@ -73,14 +73,14 @@ void DownloadPathBox::resizeEvent(QResizeEvent *e) {
|
||||
|
||||
void DownloadPathBox::radioChanged(Directory value) {
|
||||
if (value == Directory::Custom) {
|
||||
if (_path.isEmpty() || _path == qsl("tmp")) {
|
||||
if (_path.isEmpty() || _path == FileDialog::Tmp()) {
|
||||
_group->setValue(_path.isEmpty() ? Directory::Downloads : Directory::Temp);
|
||||
editPath();
|
||||
} else {
|
||||
setPathText(QDir::toNativeSeparators(_path));
|
||||
}
|
||||
} else if (value == Directory::Temp) {
|
||||
_path = qsl("tmp");
|
||||
_path = FileDialog::Tmp();
|
||||
} else {
|
||||
_path = QString();
|
||||
}
|
||||
@@ -91,7 +91,7 @@ void DownloadPathBox::radioChanged(Directory value) {
|
||||
void DownloadPathBox::editPath() {
|
||||
const auto initialPath = [] {
|
||||
const auto path = Core::App().settings().downloadPath();
|
||||
if (!path.isEmpty() && path != qstr("tmp")) {
|
||||
if (!path.isEmpty() && path != FileDialog::Tmp()) {
|
||||
return path.left(path.size() - (path.endsWith('/') ? 1 : 0));
|
||||
}
|
||||
return QString();
|
||||
@@ -118,7 +118,7 @@ void DownloadPathBox::save() {
|
||||
if (value == Directory::Custom) {
|
||||
return _path;
|
||||
} else if (value == Directory::Temp) {
|
||||
return qsl("tmp");
|
||||
return FileDialog::Tmp();
|
||||
}
|
||||
return QString();
|
||||
};
|
||||
@@ -134,3 +134,13 @@ void DownloadPathBox::setPathText(const QString &text) {
|
||||
auto availw = st::boxWideWidth - st::boxPadding.left() - st::defaultCheck.diameter - st::defaultBoxCheckbox.textPosition.x() - st::boxPadding.right();
|
||||
_pathLink->setText(st::boxTextFont->elided(text, availw));
|
||||
}
|
||||
|
||||
DownloadPathBox::Directory DownloadPathBox::typeFromPath(
|
||||
const QString &path) {
|
||||
if (path.isEmpty()) {
|
||||
return Directory::Downloads;
|
||||
} else if (path == FileDialog::Tmp()) {
|
||||
return Directory::Temp;
|
||||
}
|
||||
return Directory::Custom;
|
||||
}
|
||||
|
||||
@@ -39,14 +39,7 @@ private:
|
||||
Custom,
|
||||
};
|
||||
void radioChanged(Directory value);
|
||||
Directory typeFromPath(const QString &path) {
|
||||
if (path.isEmpty()) {
|
||||
return Directory::Downloads;
|
||||
} else if (path == qsl("tmp")) {
|
||||
return Directory::Temp;
|
||||
}
|
||||
return Directory::Custom;
|
||||
}
|
||||
Directory typeFromPath(const QString &path);
|
||||
|
||||
void save();
|
||||
void updateControlsVisibility();
|
||||
|
||||
@@ -84,7 +84,7 @@ private:
|
||||
};
|
||||
struct PeerButton {
|
||||
not_null<History*> history;
|
||||
std::shared_ptr<Data::CloudImageView> userpic;
|
||||
Ui::PeerUserpicView userpic;
|
||||
Ui::Text::String name;
|
||||
Button button;
|
||||
};
|
||||
|
||||
@@ -49,7 +49,8 @@ public:
|
||||
|
||||
QString generateName() override;
|
||||
QString generateShortName() override;
|
||||
PaintRoundImageCallback generatePaintUserpicCallback() override;
|
||||
PaintRoundImageCallback generatePaintUserpicCallback(
|
||||
bool forceRound) override;
|
||||
|
||||
private:
|
||||
[[nodiscard]] Flag flag() const;
|
||||
@@ -62,7 +63,8 @@ public:
|
||||
|
||||
QString generateName() override;
|
||||
QString generateShortName() override;
|
||||
PaintRoundImageCallback generatePaintUserpicCallback() override;
|
||||
PaintRoundImageCallback generatePaintUserpicCallback(
|
||||
bool forceRound) override;
|
||||
|
||||
};
|
||||
|
||||
@@ -124,7 +126,8 @@ QString TypeRow::generateShortName() {
|
||||
return generateName();
|
||||
}
|
||||
|
||||
PaintRoundImageCallback TypeRow::generatePaintUserpicCallback() {
|
||||
PaintRoundImageCallback TypeRow::generatePaintUserpicCallback(
|
||||
bool forceRound) {
|
||||
const auto flag = this->flag();
|
||||
return [=](QPainter &p, int x, int y, int outerWidth, int size) {
|
||||
PaintFilterChatsTypeIcon(p, flag, x, y, outerWidth, size);
|
||||
@@ -153,11 +156,15 @@ QString ExceptionRow::generateShortName() {
|
||||
return generateName();
|
||||
}
|
||||
|
||||
PaintRoundImageCallback ExceptionRow::generatePaintUserpicCallback() {
|
||||
PaintRoundImageCallback ExceptionRow::generatePaintUserpicCallback(
|
||||
bool forceRound) {
|
||||
const auto peer = this->peer();
|
||||
const auto saved = peer->isSelf();
|
||||
const auto replies = peer->isRepliesChat();
|
||||
auto userpic = saved ? nullptr : ensureUserpicView();
|
||||
auto userpic = saved ? Ui::PeerUserpicView() : ensureUserpicView();
|
||||
if (forceRound && peer->isForum()) {
|
||||
return ForceRoundUserpicCallback(peer);
|
||||
}
|
||||
return [=](Painter &p, int x, int y, int outerWidth, int size) mutable {
|
||||
if (saved) {
|
||||
Ui::EmptyUserpic::PaintSavedMessages(p, x, y, outerWidth, size);
|
||||
@@ -248,7 +255,7 @@ void PaintFilterChatsTypeIcon(
|
||||
int y,
|
||||
int outerWidth,
|
||||
int size) {
|
||||
const auto &color = [&]() -> const style::color& {
|
||||
const auto &color1 = [&]() -> const style::color& {
|
||||
switch (flag) {
|
||||
case Flag::Contacts: return st::historyPeer4UserpicBg;
|
||||
case Flag::NonContacts: return st::historyPeer7UserpicBg;
|
||||
@@ -261,6 +268,19 @@ void PaintFilterChatsTypeIcon(
|
||||
}
|
||||
Unexpected("Flag in color paintFlagIcon.");
|
||||
}();
|
||||
const auto &color2 = [&]() -> const style::color& {
|
||||
switch (flag) {
|
||||
case Flag::Contacts: return st::historyPeer4UserpicBg2;
|
||||
case Flag::NonContacts: return st::historyPeer7UserpicBg2;
|
||||
case Flag::Groups: return st::historyPeer2UserpicBg2;
|
||||
case Flag::Channels: return st::historyPeer1UserpicBg2;
|
||||
case Flag::Bots: return st::historyPeer6UserpicBg2;
|
||||
case Flag::NoMuted: return st::historyPeer6UserpicBg2;
|
||||
case Flag::NoArchived: return st::historyPeer4UserpicBg2;
|
||||
case Flag::NoRead: return st::historyPeer7UserpicBg2;
|
||||
}
|
||||
Unexpected("Flag in color paintFlagIcon.");
|
||||
}();
|
||||
const auto &icon = [&]() -> const style::icon& {
|
||||
switch (flag) {
|
||||
case Flag::Contacts: return st::windowFilterTypeContacts;
|
||||
@@ -276,7 +296,9 @@ void PaintFilterChatsTypeIcon(
|
||||
}();
|
||||
const auto rect = style::rtlrect(x, y, size, size, outerWidth);
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
p.setBrush(color->b);
|
||||
auto bg = QLinearGradient(x, y, x, y + size);
|
||||
bg.setStops({ { 0., color1->c }, { 1., color2->c } });
|
||||
p.setBrush(bg);
|
||||
p.setPen(Qt::NoPen);
|
||||
p.drawEllipse(rect);
|
||||
icon.paintInCenter(p, rect);
|
||||
@@ -463,6 +485,6 @@ auto EditFilterChatsListController::createRow(not_null<History*> history)
|
||||
void EditFilterChatsListController::updateTitle() {
|
||||
const auto count = delegate()->peerListSelectedRowsCount()
|
||||
- selectedTypesCount();
|
||||
const auto additional = qsl("%1 / %2").arg(count).arg(_limit);
|
||||
const auto additional = u"%1 / %2"_q.arg(count).arg(_limit);
|
||||
delegate()->peerListSetAdditionalTitle(rpl::single(additional));
|
||||
}
|
||||
|
||||
@@ -416,7 +416,7 @@ bool Rows::hasMenu(not_null<const Row*> row) const {
|
||||
}
|
||||
|
||||
void Rows::share(not_null<const Row*> row) const {
|
||||
const auto link = qsl("https://t.me/setlanguage/") + row->data.id;
|
||||
const auto link = u"https://t.me/setlanguage/"_q + row->data.id;
|
||||
QGuiApplication::clipboard()->setText(link);
|
||||
Ui::Toast::Show(tr::lng_username_copied(tr::now));
|
||||
}
|
||||
@@ -1118,8 +1118,16 @@ void LanguageBox::prepare() {
|
||||
}, translateEnabled->lifetime());
|
||||
|
||||
const auto label = lifetime().make_state<rpl::event_stream<QLocale>>();
|
||||
const auto translateSkipWrap = topContainer->add(
|
||||
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||
topContainer,
|
||||
object_ptr<Ui::VerticalLayout>(topContainer)));
|
||||
translateSkipWrap->toggle(
|
||||
translateEnabled->toggled(),
|
||||
anim::type::normal);
|
||||
translateSkipWrap->toggleOn(translateEnabled->toggledValue());
|
||||
const auto translateSkip = Settings::AddButtonWithLabel(
|
||||
topContainer,
|
||||
translateSkipWrap->entity(),
|
||||
tr::lng_translate_settings_choose(),
|
||||
label->events() | rpl::map(Ui::LanguageName),
|
||||
st::settingsButtonNoIcon);
|
||||
@@ -1177,6 +1185,10 @@ void LanguageBox::prepare() {
|
||||
accumulate_max(*max, height);
|
||||
setDimensions(st::boxWidth, qMin(*max, st::boxMaxListHeight));
|
||||
}, inner->lifetime());
|
||||
topContainer->heightValue(
|
||||
) | rpl::start_with_next([=](int height) {
|
||||
setInnerTopSkip(height);
|
||||
}, inner->lifetime());
|
||||
|
||||
select->setSubmittedCallback([=](Qt::KeyboardModifiers) {
|
||||
inner->activateBySubmit();
|
||||
|
||||
@@ -495,19 +495,19 @@ void PasscodeBox::setPasswordFail(const QString &type) {
|
||||
|
||||
closeReplacedBy();
|
||||
_setRequest = 0;
|
||||
if (type == qstr("PASSWORD_HASH_INVALID")
|
||||
|| type == qstr("SRP_PASSWORD_CHANGED")) {
|
||||
if (type == u"PASSWORD_HASH_INVALID"_q
|
||||
|| type == u"SRP_PASSWORD_CHANGED"_q) {
|
||||
if (_oldPasscode->isHidden()) {
|
||||
_passwordReloadNeeded.fire({});
|
||||
closeBox();
|
||||
} else {
|
||||
badOldPasscode();
|
||||
}
|
||||
} else if (type == qstr("SRP_ID_INVALID")) {
|
||||
} else if (type == u"SRP_ID_INVALID"_q) {
|
||||
handleSrpIdInvalid();
|
||||
//} else if (type == qstr("NEW_PASSWORD_BAD")) {
|
||||
//} else if (type == qstr("NEW_SALT_INVALID")) {
|
||||
} else if (type == qstr("EMAIL_INVALID")) {
|
||||
//} else if (type == u"NEW_PASSWORD_BAD"_q) {
|
||||
//} else if (type == u"NEW_SALT_INVALID"_q) {
|
||||
} else if (type == u"EMAIL_INVALID"_q) {
|
||||
_emailError = tr::lng_cloud_password_bad_email(tr::now);
|
||||
_recoverEmail->setFocus();
|
||||
_recoverEmail->showError();
|
||||
@@ -519,7 +519,7 @@ void PasscodeBox::setPasswordFail(
|
||||
const QByteArray &newPasswordBytes,
|
||||
const QString &email,
|
||||
const MTP::Error &error) {
|
||||
const auto prefix = qstr("EMAIL_UNCONFIRMED_");
|
||||
const auto prefix = u"EMAIL_UNCONFIRMED_"_q;
|
||||
if (error.type().startsWith(prefix)) {
|
||||
const auto codeLength = base::StringViewMid(error.type(), prefix.size()).toInt();
|
||||
|
||||
@@ -552,9 +552,9 @@ void PasscodeBox::validateEmail(
|
||||
_setRequest = 0;
|
||||
if (MTP::IsFloodError(error)) {
|
||||
errors->fire(tr::lng_flood_error(tr::now));
|
||||
} else if (error.type() == qstr("CODE_INVALID")) {
|
||||
} else if (error.type() == u"CODE_INVALID"_q) {
|
||||
errors->fire(tr::lng_signin_wrong_code(tr::now));
|
||||
} else if (error.type() == qstr("EMAIL_HASH_EXPIRED")) {
|
||||
} else if (error.type() == u"EMAIL_HASH_EXPIRED"_q) {
|
||||
const auto weak = Ui::MakeWeak(this);
|
||||
_clearUnconfirmedPassword.fire({});
|
||||
if (weak) {
|
||||
@@ -801,9 +801,9 @@ bool PasscodeBox::handleCustomCheckError(const MTP::Error &error) {
|
||||
|
||||
bool PasscodeBox::handleCustomCheckError(const QString &type) {
|
||||
if (MTP::IsFloodError(type)
|
||||
|| type == qstr("PASSWORD_HASH_INVALID")
|
||||
|| type == qstr("SRP_PASSWORD_CHANGED")
|
||||
|| type == qstr("SRP_ID_INVALID")) {
|
||||
|| type == u"PASSWORD_HASH_INVALID"_q
|
||||
|| type == u"SRP_PASSWORD_CHANGED"_q
|
||||
|| type == u"SRP_ID_INVALID"_q) {
|
||||
setPasswordFail(type);
|
||||
return true;
|
||||
}
|
||||
@@ -979,7 +979,7 @@ void PasscodeBox::resetSecret(
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_setRequest = 0;
|
||||
if (error.type() == qstr("SRP_ID_INVALID")) {
|
||||
if (error.type() == u"SRP_ID_INVALID"_q) {
|
||||
handleSrpIdInvalid();
|
||||
}
|
||||
}).send();
|
||||
@@ -1330,17 +1330,17 @@ void RecoverBox::checkSubmitFail(const MTP::Error &error) {
|
||||
_submitRequest = 0;
|
||||
|
||||
const QString &err = error.type();
|
||||
if (err == qstr("PASSWORD_EMPTY")) {
|
||||
if (err == u"PASSWORD_EMPTY"_q) {
|
||||
_newPasswordSet.fire(QByteArray());
|
||||
getDelegate()->show(
|
||||
Ui::MakeInformBox(tr::lng_cloud_password_removed()),
|
||||
Ui::LayerOption::CloseOther);
|
||||
} else if (err == qstr("PASSWORD_RECOVERY_NA")) {
|
||||
} else if (err == u"PASSWORD_RECOVERY_NA"_q) {
|
||||
closeBox();
|
||||
} else if (err == qstr("PASSWORD_RECOVERY_EXPIRED")) {
|
||||
} else if (err == u"PASSWORD_RECOVERY_EXPIRED"_q) {
|
||||
_recoveryExpired.fire({});
|
||||
closeBox();
|
||||
} else if (err == qstr("CODE_INVALID")) {
|
||||
} else if (err == u"CODE_INVALID"_q) {
|
||||
setError(tr::lng_signin_wrong_code(tr::now));
|
||||
_recoverCode->selectAll();
|
||||
_recoverCode->setFocus();
|
||||
@@ -1381,9 +1381,9 @@ RecoveryEmailValidation ConfirmRecoveryEmail(
|
||||
*requestId = 0;
|
||||
if (MTP::IsFloodError(error)) {
|
||||
errors->fire(tr::lng_flood_error(tr::now));
|
||||
} else if (error.type() == qstr("CODE_INVALID")) {
|
||||
} else if (error.type() == u"CODE_INVALID"_q) {
|
||||
errors->fire(tr::lng_signin_wrong_code(tr::now));
|
||||
} else if (error.type() == qstr("EMAIL_HASH_EXPIRED")) {
|
||||
} else if (error.type() == u"EMAIL_HASH_EXPIRED"_q) {
|
||||
cancels->fire({});
|
||||
if (*weak) {
|
||||
auto box = Ui::MakeInformBox(
|
||||
|
||||
@@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/widgets/scroll_area.h"
|
||||
#include "ui/widgets/popup_menu.h"
|
||||
#include "ui/effects/loading_element.h"
|
||||
#include "ui/effects/round_checkbox.h"
|
||||
#include "ui/effects/ripple_animation.h"
|
||||
#include "ui/empty_userpic.h"
|
||||
@@ -47,12 +48,31 @@ PaintRoundImageCallback PaintUserpicCallback(
|
||||
};
|
||||
}
|
||||
}
|
||||
auto userpic = std::shared_ptr<Data::CloudImageView>();
|
||||
auto userpic = Ui::PeerUserpicView();
|
||||
return [=](Painter &p, int x, int y, int outerWidth, int size) mutable {
|
||||
peer->paintUserpicLeft(p, userpic, x, y, outerWidth, size);
|
||||
};
|
||||
}
|
||||
|
||||
PaintRoundImageCallback ForceRoundUserpicCallback(not_null<PeerData*> peer) {
|
||||
auto userpic = Ui::PeerUserpicView();
|
||||
auto cache = std::make_shared<QImage>();
|
||||
return [=](Painter &p, int x, int y, int outerWidth, int size) mutable {
|
||||
const auto ratio = style::DevicePixelRatio();
|
||||
const auto cacheSize = QSize(size, size) * ratio;
|
||||
if (cache->size() != cacheSize) {
|
||||
*cache = QImage(cacheSize, QImage::Format_ARGB32_Premultiplied);
|
||||
cache->setDevicePixelRatio(ratio);
|
||||
}
|
||||
auto q = Painter(cache.get());
|
||||
peer->paintUserpicLeft(q, userpic, 0, 0, outerWidth, size);
|
||||
q.end();
|
||||
|
||||
*cache = Images::Circle(std::move(*cache));
|
||||
p.drawImage(x, y, *cache);
|
||||
};
|
||||
}
|
||||
|
||||
PeerListContentDelegateShow::PeerListContentDelegateShow(
|
||||
std::shared_ptr<Ui::Show> show)
|
||||
: _show(show) {
|
||||
@@ -355,14 +375,6 @@ void PeerListController::setDescriptionText(const QString &text) {
|
||||
}
|
||||
}
|
||||
|
||||
void PeerListController::setSearchLoadingText(const QString &text) {
|
||||
if (text.isEmpty()) {
|
||||
setSearchLoading(nullptr);
|
||||
} else {
|
||||
setSearchLoading(object_ptr<Ui::FlatLabel>(nullptr, text, st::membersAbout));
|
||||
}
|
||||
}
|
||||
|
||||
void PeerListController::setSearchNoResultsText(const QString &text) {
|
||||
if (text.isEmpty()) {
|
||||
setSearchNoResults(nullptr);
|
||||
@@ -419,7 +431,9 @@ void PeerListBox::addSelectItem(
|
||||
addSelectItem(
|
||||
peer->id.value,
|
||||
text,
|
||||
PaintUserpicCallback(peer, respect),
|
||||
(peer->isForum()
|
||||
? ForceRoundUserpicCallback(peer)
|
||||
: PaintUserpicCallback(peer, respect)),
|
||||
animated);
|
||||
}
|
||||
|
||||
@@ -429,7 +443,7 @@ void PeerListBox::addSelectItem(
|
||||
addSelectItem(
|
||||
row->id(),
|
||||
row->generateShortName(),
|
||||
row->generatePaintUserpicCallback(),
|
||||
row->generatePaintUserpicCallback(true),
|
||||
animated);
|
||||
}
|
||||
|
||||
@@ -642,18 +656,22 @@ QString PeerListRow::generateShortName() {
|
||||
: peer()->shortName();
|
||||
}
|
||||
|
||||
std::shared_ptr<Data::CloudImageView> &PeerListRow::ensureUserpicView() {
|
||||
if (!_userpic) {
|
||||
Ui::PeerUserpicView &PeerListRow::ensureUserpicView() {
|
||||
if (!_userpic.cloud && peer()->hasUserpic()) {
|
||||
_userpic = peer()->createUserpicView();
|
||||
}
|
||||
return _userpic;
|
||||
}
|
||||
|
||||
PaintRoundImageCallback PeerListRow::generatePaintUserpicCallback() {
|
||||
PaintRoundImageCallback PeerListRow::generatePaintUserpicCallback(
|
||||
bool forceRound) {
|
||||
const auto saved = _isSavedMessagesChat;
|
||||
const auto replies = _isRepliesMessagesChat;
|
||||
const auto peer = this->peer();
|
||||
auto userpic = saved ? nullptr : ensureUserpicView();
|
||||
auto userpic = saved ? Ui::PeerUserpicView() : ensureUserpicView();
|
||||
if (forceRound && peer->isForum()) {
|
||||
return ForceRoundUserpicCallback(peer);
|
||||
}
|
||||
return [=](Painter &p, int x, int y, int outerWidth, int size) mutable {
|
||||
if (saved) {
|
||||
Ui::EmptyUserpic::PaintSavedMessages(p, x, y, outerWidth, size);
|
||||
@@ -776,7 +794,7 @@ void PeerListRow::paintUserpic(
|
||||
paintDisabledCheckUserpic(p, st, x, y, outerWidth);
|
||||
} else if (_checkbox) {
|
||||
_checkbox->paint(p, x, y, outerWidth);
|
||||
} else if (const auto callback = generatePaintUserpicCallback()) {
|
||||
} else if (const auto callback = generatePaintUserpicCallback(false)) {
|
||||
callback(p, x, y, outerWidth, st.photoSize);
|
||||
}
|
||||
}
|
||||
@@ -847,15 +865,15 @@ void PeerListRow::lazyInitialize(const style::PeerListItem &st) {
|
||||
void PeerListRow::createCheckbox(
|
||||
const style::RoundImageCheckbox &st,
|
||||
Fn<void()> updateCallback) {
|
||||
const auto generateRadius = [=] {
|
||||
const auto generateRadius = [=](int size) {
|
||||
return (!special() && peer()->isForum())
|
||||
? ImageRoundRadius::Large
|
||||
: ImageRoundRadius::Ellipse;
|
||||
? int(size * Ui::ForumUserpicRadiusMultiplier())
|
||||
: std::optional<int>();
|
||||
};
|
||||
_checkbox = std::make_unique<Ui::RoundImageCheckbox>(
|
||||
st,
|
||||
std::move(updateCallback),
|
||||
generatePaintUserpicCallback(),
|
||||
generatePaintUserpicCallback(false),
|
||||
generateRadius);
|
||||
}
|
||||
|
||||
@@ -1243,7 +1261,7 @@ int PeerListContent::labelHeight() const {
|
||||
if (!_filterResults.empty()) {
|
||||
return 0;
|
||||
}
|
||||
if (_controller->isSearchLoading()) {
|
||||
if (_controller->isSearchLoading() && _searchLoading) {
|
||||
return computeLabelHeight(_searchLoading);
|
||||
}
|
||||
return computeLabelHeight(_searchNoResults);
|
||||
@@ -1279,11 +1297,20 @@ void PeerListContent::setSearchMode(PeerListSearchMode mode) {
|
||||
}
|
||||
_searchMode = mode;
|
||||
if (_controller->hasComplexSearch()) {
|
||||
if (!_searchLoading) {
|
||||
setSearchLoading(object_ptr<Ui::FlatLabel>(
|
||||
this,
|
||||
tr::lng_contacts_loading(tr::now),
|
||||
st::membersAbout));
|
||||
if (_mode == Mode::Custom) {
|
||||
if (!_searchLoading) {
|
||||
setSearchLoading(object_ptr<Ui::FlatLabel>(
|
||||
this,
|
||||
tr::lng_contacts_loading(tr::now),
|
||||
st::membersAbout));
|
||||
}
|
||||
} else {
|
||||
if (!_loadingAnimation) {
|
||||
_loadingAnimation = Ui::CreateLoadingPeerListItemWidget(
|
||||
this,
|
||||
_st.item,
|
||||
2);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
clearSearchRows();
|
||||
@@ -1378,6 +1405,14 @@ int PeerListContent::resizeGetHeight(int newWidth) {
|
||||
_searchLoading->moveToLeft(st::contactsPadding.left(), labelTop + st::membersAboutLimitPadding.top(), newWidth);
|
||||
_searchLoading->setVisible(!hideAll && showingSearch() && _filterResults.empty() && _controller->isSearchLoading());
|
||||
}
|
||||
if (_loadingAnimation) {
|
||||
_loadingAnimation->resizeToWidth(newWidth);
|
||||
_loadingAnimation->moveToLeft(0, rowsTop(), newWidth);
|
||||
_loadingAnimation->setVisible(!hideAll
|
||||
&& showingSearch()
|
||||
&& _filterResults.empty()
|
||||
&& _controller->isSearchLoading());
|
||||
}
|
||||
const auto label = labelHeight();
|
||||
const auto belowTop = (label > 0 || rowsCount > 0)
|
||||
? (labelTop + label + _st.padding.bottom())
|
||||
|
||||
@@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/rp_widget.h"
|
||||
#include "ui/empty_userpic.h"
|
||||
#include "ui/unread_badge.h"
|
||||
#include "ui/userpic_view.h"
|
||||
#include "boxes/abstract_box.h"
|
||||
#include "mtproto/sender.h"
|
||||
#include "data/data_cloud_file.h"
|
||||
@@ -46,6 +47,8 @@ using PaintRoundImageCallback = Fn<void(
|
||||
[[nodiscard]] PaintRoundImageCallback PaintUserpicCallback(
|
||||
not_null<PeerData*> peer,
|
||||
bool respectSavedMessagesChat);
|
||||
[[nodiscard]] PaintRoundImageCallback ForceRoundUserpicCallback(
|
||||
not_null<PeerData*> peer);
|
||||
|
||||
using PeerListRowId = uint64;
|
||||
|
||||
@@ -84,12 +87,12 @@ public:
|
||||
return _id;
|
||||
}
|
||||
|
||||
[[nodiscard]] std::shared_ptr<Data::CloudImageView> &ensureUserpicView();
|
||||
[[nodiscard]] Ui::PeerUserpicView &ensureUserpicView();
|
||||
|
||||
[[nodiscard]] virtual QString generateName();
|
||||
[[nodiscard]] virtual QString generateShortName();
|
||||
[[nodiscard]] virtual auto generatePaintUserpicCallback()
|
||||
-> PaintRoundImageCallback;
|
||||
[[nodiscard]] virtual auto generatePaintUserpicCallback(
|
||||
bool forceRound) -> PaintRoundImageCallback;
|
||||
|
||||
[[nodiscard]] virtual auto generateNameFirstLetters() const
|
||||
-> const base::flat_set<QChar> &;
|
||||
@@ -262,7 +265,7 @@ private:
|
||||
|
||||
PeerListRowId _id = 0;
|
||||
PeerData *_peer = nullptr;
|
||||
mutable std::shared_ptr<Data::CloudImageView> _userpic;
|
||||
mutable Ui::PeerUserpicView _userpic;
|
||||
std::unique_ptr<Ui::RippleAnimation> _ripple;
|
||||
std::unique_ptr<Ui::RoundImageCheckbox> _checkbox;
|
||||
Ui::Text::String _name;
|
||||
@@ -294,7 +297,6 @@ public:
|
||||
virtual void peerListSetAdditionalTitle(rpl::producer<QString> title) = 0;
|
||||
virtual void peerListSetHideEmpty(bool hide) = 0;
|
||||
virtual void peerListSetDescription(object_ptr<Ui::FlatLabel> description) = 0;
|
||||
virtual void peerListSetSearchLoading(object_ptr<Ui::FlatLabel> loading) = 0;
|
||||
virtual void peerListSetSearchNoResults(object_ptr<Ui::FlatLabel> noResults) = 0;
|
||||
virtual void peerListSetAboveWidget(object_ptr<TWidget> aboveWidget) = 0;
|
||||
virtual void peerListSetAboveSearchWidget(object_ptr<TWidget> aboveWidget) = 0;
|
||||
@@ -541,14 +543,10 @@ protected:
|
||||
}
|
||||
|
||||
void setDescriptionText(const QString &text);
|
||||
void setSearchLoadingText(const QString &text);
|
||||
void setSearchNoResultsText(const QString &text);
|
||||
void setDescription(object_ptr<Ui::FlatLabel> description) {
|
||||
delegate()->peerListSetDescription(std::move(description));
|
||||
}
|
||||
void setSearchLoading(object_ptr<Ui::FlatLabel> loading) {
|
||||
delegate()->peerListSetSearchLoading(std::move(loading));
|
||||
}
|
||||
void setSearchNoResults(object_ptr<Ui::FlatLabel> noResults) {
|
||||
delegate()->peerListSetSearchNoResults(std::move(noResults));
|
||||
}
|
||||
@@ -822,6 +820,7 @@ private:
|
||||
object_ptr<Ui::FlatLabel> _description = { nullptr };
|
||||
object_ptr<Ui::FlatLabel> _searchNoResults = { nullptr };
|
||||
object_ptr<Ui::FlatLabel> _searchLoading = { nullptr };
|
||||
object_ptr<Ui::RpWidget> _loadingAnimation = { nullptr };
|
||||
|
||||
std::vector<std::unique_ptr<PeerListRow>> _searchRows;
|
||||
base::Timer _repaintByStatus;
|
||||
@@ -898,9 +897,6 @@ public:
|
||||
void peerListSetDescription(object_ptr<Ui::FlatLabel> description) override {
|
||||
_content->setDescription(std::move(description));
|
||||
}
|
||||
void peerListSetSearchLoading(object_ptr<Ui::FlatLabel> loading) override {
|
||||
_content->setSearchLoading(std::move(loading));
|
||||
}
|
||||
void peerListSetSearchNoResults(object_ptr<Ui::FlatLabel> noResults) override {
|
||||
_content->setSearchNoResults(std::move(noResults));
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "dialogs/dialogs_main_list.h"
|
||||
#include "window/window_session_controller.h" // showAddContact()
|
||||
#include "base/unixtime.h"
|
||||
#include "facades.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_profile.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
@@ -378,7 +377,10 @@ std::unique_ptr<PeerListRow> ContactsBoxController::createSearchRow(
|
||||
}
|
||||
|
||||
void ContactsBoxController::rowClicked(not_null<PeerListRow*> row) {
|
||||
Ui::showPeerHistory(row->peer(), ShowAtUnreadMsgId);
|
||||
const auto peer = row->peer();
|
||||
if (const auto window = peer->session().tryResolveWindow()) {
|
||||
window->showPeerHistory(row->peer());
|
||||
}
|
||||
}
|
||||
|
||||
void ContactsBoxController::setSortMode(SortMode mode) {
|
||||
@@ -622,7 +624,8 @@ QString ChooseTopicBoxController::Row::generateShortName() {
|
||||
return _topic->title();
|
||||
}
|
||||
|
||||
auto ChooseTopicBoxController::Row::generatePaintUserpicCallback()
|
||||
auto ChooseTopicBoxController::Row::generatePaintUserpicCallback(
|
||||
bool forceRound)
|
||||
-> PaintRoundImageCallback {
|
||||
return [=](
|
||||
Painter &p,
|
||||
@@ -630,10 +633,11 @@ auto ChooseTopicBoxController::Row::generatePaintUserpicCallback()
|
||||
int y,
|
||||
int outerWidth,
|
||||
int size) {
|
||||
auto view = std::shared_ptr<Data::CloudImageView>();
|
||||
auto view = Ui::PeerUserpicView();
|
||||
p.translate(x, y);
|
||||
_topic->paintUserpic(p, view, {
|
||||
.st = &st::forumTopicRow,
|
||||
.currentBg = st::windowBg,
|
||||
.now = crl::now(),
|
||||
.width = outerWidth,
|
||||
.paused = false,
|
||||
|
||||
@@ -235,7 +235,8 @@ private:
|
||||
|
||||
QString generateName() override;
|
||||
QString generateShortName() override;
|
||||
PaintRoundImageCallback generatePaintUserpicCallback() override;
|
||||
PaintRoundImageCallback generatePaintUserpicCallback(
|
||||
bool forceRound) override;
|
||||
|
||||
auto generateNameFirstLetters() const
|
||||
-> const base::flat_set<QChar> & override;
|
||||
|
||||
@@ -402,7 +402,9 @@ void PeerListsBox::addSelectItem(
|
||||
addSelectItem(
|
||||
peer->id.value,
|
||||
peer->shortName(),
|
||||
PaintUserpicCallback(peer, false),
|
||||
(peer->isForum()
|
||||
? ForceRoundUserpicCallback(peer)
|
||||
: PaintUserpicCallback(peer, false)),
|
||||
animated);
|
||||
}
|
||||
|
||||
@@ -412,7 +414,7 @@ void PeerListsBox::addSelectItem(
|
||||
addSelectItem(
|
||||
row->id(),
|
||||
row->generateShortName(),
|
||||
row->generatePaintUserpicCallback(),
|
||||
row->generatePaintUserpicCallback(true),
|
||||
animated);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "api/api_chat_participants.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "apiwrap.h"
|
||||
#include "facades.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
namespace {
|
||||
@@ -406,5 +405,7 @@ void AddBotToGroup(
|
||||
} else {
|
||||
chat->session().api().chatParticipants().add(chat, { 1, bot });
|
||||
}
|
||||
Ui::showPeerHistory(chat, ShowAtUnreadMsgId);
|
||||
if (const auto window = chat->session().tryResolveWindow()) {
|
||||
window->showPeerHistory(chat);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ void AddParticipantsBoxController::updateTitle() {
|
||||
&& _peer->isChannel()
|
||||
&& !_peer->isMegagroup())
|
||||
? QString()
|
||||
: qsl("%1 / %2"
|
||||
: (u"%1 / %2"_q
|
||||
).arg(fullCount()
|
||||
).arg(session().serverConfig().megagroupSizeMax);
|
||||
delegate()->peerListSetTitle(tr::lng_profile_add_participant());
|
||||
|
||||
@@ -194,6 +194,38 @@ bool DefaultIconEmoji::readyInDefaultState() {
|
||||
return result;
|
||||
}
|
||||
|
||||
[[nodiscard]] not_null<Ui::AbstractButton*> GeneralIconPreview(
|
||||
not_null<QWidget*> parent) {
|
||||
using namespace Info::Profile;
|
||||
struct State {
|
||||
QImage frame;
|
||||
};
|
||||
const auto size = EditIconSize();
|
||||
const auto result = Ui::CreateChild<Ui::AbstractButton>(parent.get());
|
||||
result->show();
|
||||
result->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
const auto state = result->lifetime().make_state<State>();
|
||||
|
||||
rpl::single(rpl::empty) | rpl::then(
|
||||
style::PaletteChanged()
|
||||
) | rpl::start_with_next([=] {
|
||||
state->frame = Data::ForumTopicGeneralIconFrame(
|
||||
st::largeForumTopicIcon.size,
|
||||
st::windowSubTextFg);
|
||||
result->update();
|
||||
}, result->lifetime());
|
||||
|
||||
result->resize(size, size);
|
||||
result->paintRequest(
|
||||
) | rpl::start_with_next([=](QRect clip) {
|
||||
auto p = QPainter(result);
|
||||
const auto skip = (size - st::largeForumTopicIcon.size) / 2;
|
||||
p.drawImage(skip, skip, state->frame);
|
||||
}, result->lifetime());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
struct IconSelector {
|
||||
Fn<bool(not_null<Ui::RpWidget*>)> paintIconFrame;
|
||||
rpl::producer<DocumentId> iconIdValue;
|
||||
@@ -404,14 +436,16 @@ void EditForumTopicBox(
|
||||
});
|
||||
|
||||
const auto paintIconFrame = [=](not_null<Ui::RpWidget*> widget) {
|
||||
return state->paintIconFrame(widget);
|
||||
return state->paintIconFrame && state->paintIconFrame(widget);
|
||||
};
|
||||
const auto icon = EditIconButton(
|
||||
title->parentWidget(),
|
||||
controller,
|
||||
state->defaultIcon.value(),
|
||||
state->iconId.value(),
|
||||
paintIconFrame);
|
||||
const auto icon = (topic && topic->isGeneral())
|
||||
? GeneralIconPreview(title->parentWidget())
|
||||
: EditIconButton(
|
||||
title->parentWidget(),
|
||||
controller,
|
||||
state->defaultIcon.value(),
|
||||
state->iconId.value(),
|
||||
paintIconFrame);
|
||||
|
||||
title->geometryValue(
|
||||
) | rpl::start_with_next([=](QRect geometry) {
|
||||
@@ -444,27 +478,29 @@ void EditForumTopicBox(
|
||||
};
|
||||
}, box->lifetime());
|
||||
|
||||
Settings::AddDividerText(
|
||||
top,
|
||||
tr::lng_forum_choose_title_and_icon());
|
||||
if (!topic || !topic->isGeneral()) {
|
||||
Settings::AddDividerText(
|
||||
top,
|
||||
tr::lng_forum_choose_title_and_icon());
|
||||
|
||||
box->setScrollStyle(st::reactPanelScroll);
|
||||
box->setScrollStyle(st::reactPanelScroll);
|
||||
|
||||
auto selector = AddIconSelector(
|
||||
box,
|
||||
icon,
|
||||
controller,
|
||||
state->defaultIcon.value(),
|
||||
top->heightValue(),
|
||||
state->iconId.current(),
|
||||
[&](object_ptr<Ui::RpWidget> footer) {
|
||||
top->add(std::move(footer)); });
|
||||
state->paintIconFrame = std::move(selector.paintIconFrame);
|
||||
std::move(
|
||||
selector.iconIdValue
|
||||
) | rpl::start_with_next([=](DocumentId iconId) {
|
||||
state->iconId = (iconId != kDefaultIconId) ? iconId : 0;
|
||||
}, box->lifetime());
|
||||
auto selector = AddIconSelector(
|
||||
box,
|
||||
icon,
|
||||
controller,
|
||||
state->defaultIcon.value(),
|
||||
top->heightValue(),
|
||||
state->iconId.current(),
|
||||
[&](object_ptr<Ui::RpWidget> footer) {
|
||||
top->add(std::move(footer)); });
|
||||
state->paintIconFrame = std::move(selector.paintIconFrame);
|
||||
std::move(
|
||||
selector.iconIdValue
|
||||
) | rpl::start_with_next([=](DocumentId iconId) {
|
||||
state->iconId = (iconId != kDefaultIconId) ? iconId : 0;
|
||||
}, box->lifetime());
|
||||
}
|
||||
|
||||
const auto create = [=] {
|
||||
const auto channel = forum->peer->asChannel();
|
||||
@@ -508,12 +544,14 @@ void EditForumTopicBox(
|
||||
const auto api = &forum->session().api();
|
||||
const auto weak = Ui::MakeWeak(box.get());
|
||||
state->requestId = api->request(MTPchannels_EditForumTopic(
|
||||
MTP_flags(Flag::f_title | Flag::f_icon_emoji_id),
|
||||
MTP_flags(Flag::f_title
|
||||
| (topic->isGeneral() ? Flag() : Flag::f_icon_emoji_id)),
|
||||
topic->channel()->inputChannel,
|
||||
MTP_int(rootId),
|
||||
MTP_string(title->getLastText().trimmed()),
|
||||
MTP_long(state->iconId.current()),
|
||||
MTPBool() // closed
|
||||
MTPBool(), // closed
|
||||
MTPBool() // hidden
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
api->applyUpdates(result);
|
||||
if (const auto strong = weak.data()) {
|
||||
|
||||
@@ -647,15 +647,15 @@ void EditAdminBox::sendTransferRequestFrom(
|
||||
|
||||
const auto &type = error.type();
|
||||
const auto problem = [&] {
|
||||
if (type == qstr("CHANNELS_ADMIN_PUBLIC_TOO_MUCH")) {
|
||||
if (type == u"CHANNELS_ADMIN_PUBLIC_TOO_MUCH"_q) {
|
||||
return tr::lng_channels_too_much_public_other(tr::now);
|
||||
} else if (type == qstr("CHANNELS_ADMIN_LOCATED_TOO_MUCH")) {
|
||||
} else if (type == u"CHANNELS_ADMIN_LOCATED_TOO_MUCH"_q) {
|
||||
return tr::lng_channels_too_much_located_other(tr::now);
|
||||
} else if (type == qstr("ADMINS_TOO_MUCH")) {
|
||||
} else if (type == u"ADMINS_TOO_MUCH"_q) {
|
||||
return (channel->isBroadcast()
|
||||
? tr::lng_error_admin_limit_channel
|
||||
: tr::lng_error_admin_limit)(tr::now);
|
||||
} else if (type == qstr("CHANNEL_INVALID")) {
|
||||
} else if (type == u"CHANNEL_INVALID"_q) {
|
||||
return (channel->isBroadcast()
|
||||
? tr::lng_channel_not_accessible
|
||||
: tr::lng_group_not_accessible)(tr::now);
|
||||
@@ -663,9 +663,9 @@ void EditAdminBox::sendTransferRequestFrom(
|
||||
return Lang::Hard::ServerError();
|
||||
}();
|
||||
const auto recoverable = [&] {
|
||||
return (type == qstr("PASSWORD_MISSING"))
|
||||
|| (type == qstr("PASSWORD_TOO_FRESH_XXX"))
|
||||
|| (type == qstr("SESSION_TOO_FRESH_XXX"));
|
||||
return (type == u"PASSWORD_MISSING"_q)
|
||||
|| (type == u"PASSWORD_TOO_FRESH_XXX"_q)
|
||||
|| (type == u"SESSION_TOO_FRESH_XXX"_q);
|
||||
}();
|
||||
const auto weak = Ui::MakeWeak(this);
|
||||
getDelegate()->show(Ui::MakeInformBox(problem));
|
||||
|
||||
@@ -16,6 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "boxes/max_invite_box.h"
|
||||
#include "boxes/add_contact_box.h"
|
||||
#include "main/main_session.h"
|
||||
#include "menu/menu_antispam_validator.h"
|
||||
#include "mtproto/mtproto_config.h"
|
||||
#include "apiwrap.h"
|
||||
#include "lang/lang_keys.h"
|
||||
@@ -112,7 +113,7 @@ void SaveChatAdmin(
|
||||
const auto &type = error.type();
|
||||
if (retryOnNotParticipant
|
||||
&& isAdmin
|
||||
&& (type == qstr("USER_NOT_PARTICIPANT"))) {
|
||||
&& (type == u"USER_NOT_PARTICIPANT"_q)) {
|
||||
AddChatParticipant(chat, user, [=] {
|
||||
SaveChatAdmin(chat, user, isAdmin, onDone, onFail, false);
|
||||
}, onFail);
|
||||
@@ -1186,6 +1187,15 @@ void ParticipantsBoxController::prepare() {
|
||||
}
|
||||
Unexpected("Role in ParticipantsBoxController::prepare()");
|
||||
}();
|
||||
if (const auto megagroup = _peer->asMegagroup()) {
|
||||
if ((_role == Role::Admins)
|
||||
&& (megagroup->amCreator() || megagroup->hasAdminRights())) {
|
||||
const auto validator = AntiSpamMenu::AntiSpamValidator(
|
||||
_navigation->parentController(),
|
||||
_peer->asChannel());
|
||||
delegate()->peerListSetAboveWidget(validator.createButton());
|
||||
}
|
||||
}
|
||||
delegate()->peerListSetSearchMode(PeerListSearchMode::Enabled);
|
||||
delegate()->peerListSetTitle(std::move(title));
|
||||
setDescriptionText(tr::lng_contacts_loading(tr::now));
|
||||
|
||||
@@ -154,7 +154,7 @@ void SaveDefaultRestrictions(
|
||||
done();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
api->clearModifyRequest(key);
|
||||
if (error.type() != qstr("CHAT_NOT_MODIFIED")) {
|
||||
if (error.type() != u"CHAT_NOT_MODIFIED"_q) {
|
||||
return;
|
||||
}
|
||||
if (const auto chat = peer->asChat()) {
|
||||
@@ -187,7 +187,7 @@ void SaveSlowmodeSeconds(
|
||||
done();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
api->clearModifyRequest(key);
|
||||
if (error.type() != qstr("CHAT_NOT_MODIFIED")) {
|
||||
if (error.type() != u"CHAT_NOT_MODIFIED"_q) {
|
||||
return;
|
||||
}
|
||||
channel->setSlowmodeSeconds(seconds);
|
||||
@@ -863,8 +863,7 @@ void Controller::fillForumButton() {
|
||||
ShowForumForDiscussionError(_navigation);
|
||||
} else {
|
||||
Ui::ShowMultilineToast({
|
||||
.parentOverride = Window::Show(
|
||||
_navigation).toastParent(),
|
||||
.parentOverride = Window::Show(_navigation).toastParent(),
|
||||
.text = tr::lng_forum_topics_not_enough(
|
||||
tr::now,
|
||||
lt_count,
|
||||
@@ -1568,7 +1567,7 @@ void Controller::saveUsername() {
|
||||
continueSave();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
const auto &type = error.type();
|
||||
if (type == qstr("USERNAME_NOT_MODIFIED")) {
|
||||
if (type == u"USERNAME_NOT_MODIFIED"_q) {
|
||||
channel->setName(
|
||||
TextUtilities::SingleLine(channel->name()),
|
||||
TextUtilities::SingleLine(*_savingData.username));
|
||||
@@ -1578,10 +1577,10 @@ void Controller::saveUsername() {
|
||||
|
||||
// Very rare case.
|
||||
showEditPeerTypeBox([&] {
|
||||
if (type == qstr("USERNAME_INVALID")) {
|
||||
if (type == u"USERNAME_INVALID"_q) {
|
||||
return tr::lng_create_channel_link_invalid();
|
||||
} else if (type == qstr("USERNAME_OCCUPIED")
|
||||
|| type == qstr("USERNAMES_UNAVAILABLE")) {
|
||||
} else if (type == u"USERNAME_OCCUPIED"_q
|
||||
|| type == u"USERNAMES_UNAVAILABLE"_q) {
|
||||
return tr::lng_create_channel_link_occupied();
|
||||
}
|
||||
return tr::lng_create_channel_link_invalid();
|
||||
@@ -1635,8 +1634,8 @@ void Controller::saveTitle() {
|
||||
};
|
||||
const auto onFail = [=](const MTP::Error &error) {
|
||||
const auto &type = error.type();
|
||||
if (type == qstr("CHAT_NOT_MODIFIED")
|
||||
|| type == qstr("CHAT_TITLE_NOT_MODIFIED")) {
|
||||
if (type == u"CHAT_NOT_MODIFIED"_q
|
||||
|| type == u"CHAT_TITLE_NOT_MODIFIED"_q) {
|
||||
if (const auto channel = _peer->asChannel()) {
|
||||
channel->setName(
|
||||
*_savingData.title,
|
||||
@@ -1648,7 +1647,7 @@ void Controller::saveTitle() {
|
||||
return;
|
||||
}
|
||||
_controls.title->showError();
|
||||
if (type == qstr("NO_CHAT_TITLE")) {
|
||||
if (type == u"NO_CHAT_TITLE"_q) {
|
||||
_box->scrollToWidget(_controls.title);
|
||||
}
|
||||
cancelSave();
|
||||
@@ -1689,7 +1688,7 @@ void Controller::saveDescription() {
|
||||
successCallback();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
const auto &type = error.type();
|
||||
if (type == qstr("CHAT_ABOUT_NOT_MODIFIED")) {
|
||||
if (type == u"CHAT_ABOUT_NOT_MODIFIED"_q) {
|
||||
successCallback();
|
||||
return;
|
||||
}
|
||||
@@ -1746,7 +1745,7 @@ void Controller::togglePreHistoryHidden(
|
||||
channel->session().api().applyUpdates(result);
|
||||
apply();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (error.type() == qstr("CHAT_NOT_MODIFIED")) {
|
||||
if (error.type() == u"CHAT_NOT_MODIFIED"_q) {
|
||||
apply();
|
||||
} else {
|
||||
fail();
|
||||
@@ -1779,7 +1778,7 @@ void Controller::saveForum() {
|
||||
channel->session().api().applyUpdates(result);
|
||||
continueSave();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (error.type() == qstr("CHAT_NOT_MODIFIED")) {
|
||||
if (error.type() == u"CHAT_NOT_MODIFIED"_q) {
|
||||
continueSave();
|
||||
} else {
|
||||
cancelSave();
|
||||
@@ -1801,7 +1800,7 @@ void Controller::saveSignatures() {
|
||||
channel->session().api().applyUpdates(result);
|
||||
continueSave();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (error.type() == qstr("CHAT_NOT_MODIFIED")) {
|
||||
if (error.type() == u"CHAT_NOT_MODIFIED"_q) {
|
||||
continueSave();
|
||||
} else {
|
||||
cancelSave();
|
||||
@@ -1821,7 +1820,7 @@ void Controller::saveForwards() {
|
||||
_peer->session().api().applyUpdates(result);
|
||||
continueSave();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (error.type() == qstr("CHAT_NOT_MODIFIED")) {
|
||||
if (error.type() == u"CHAT_NOT_MODIFIED"_q) {
|
||||
continueSave();
|
||||
} else {
|
||||
cancelSave();
|
||||
@@ -1843,7 +1842,7 @@ void Controller::saveJoinToWrite() {
|
||||
_peer->session().api().applyUpdates(result);
|
||||
continueSave();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (error.type() == qstr("CHAT_NOT_MODIFIED")) {
|
||||
if (error.type() == u"CHAT_NOT_MODIFIED"_q) {
|
||||
continueSave();
|
||||
} else {
|
||||
cancelSave();
|
||||
@@ -1865,7 +1864,7 @@ void Controller::saveRequestToJoin() {
|
||||
_peer->session().api().applyUpdates(result);
|
||||
continueSave();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (error.type() == qstr("CHAT_NOT_MODIFIED")) {
|
||||
if (error.type() == u"CHAT_NOT_MODIFIED"_q) {
|
||||
continueSave();
|
||||
} else {
|
||||
cancelSave();
|
||||
@@ -1921,7 +1920,7 @@ void Controller::deleteChannel() {
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
session->api().applyUpdates(result);
|
||||
//}).fail([=](const MTP::Error &error) {
|
||||
// if (error.type() == qstr("CHANNEL_TOO_LARGE")) {
|
||||
// if (error.type() == u"CHANNEL_TOO_LARGE"_q) {
|
||||
// Ui::show(Box<Ui::InformBox>(tr::lng_cant_delete_channel(tr::now)));
|
||||
// }
|
||||
}).send();
|
||||
|
||||
@@ -409,7 +409,7 @@ void Controller::addHeaderBlock(not_null<Ui::VerticalLayout*> container) {
|
||||
return result;
|
||||
};
|
||||
|
||||
const auto prefix = qstr("https://");
|
||||
const auto prefix = u"https://"_q;
|
||||
const auto label = container->lifetime().make_state<Ui::InviteLinkLabel>(
|
||||
container,
|
||||
rpl::single(link.startsWith(prefix)
|
||||
@@ -982,7 +982,7 @@ void AddPermanentLinkBlock(
|
||||
|
||||
auto link = value->value(
|
||||
) | rpl::map([=](const LinkData &data) {
|
||||
const auto prefix = qstr("https://");
|
||||
const auto prefix = u"https://"_q;
|
||||
return data.link.startsWith(prefix)
|
||||
? data.link.mid(prefix.size())
|
||||
: data.link;
|
||||
@@ -1042,11 +1042,12 @@ void AddPermanentLinkBlock(
|
||||
state->allUserpicsLoaded = ranges::all_of(
|
||||
state->list,
|
||||
[](const HistoryView::UserpicInRow &element) {
|
||||
return !element.peer->hasUserpic() || element.view->image();
|
||||
return !element.peer->hasUserpic()
|
||||
|| !Ui::PeerUserpicLoading(element.view);
|
||||
});
|
||||
state->content = Ui::JoinedCountContent{
|
||||
.count = state->count,
|
||||
.userpics = state->cachedUserpics
|
||||
.userpics = state->cachedUserpics,
|
||||
};
|
||||
};
|
||||
value->value(
|
||||
@@ -1087,7 +1088,7 @@ void AddPermanentLinkBlock(
|
||||
} else if (element.peer->userpicUniqueKey(element.view)
|
||||
!= element.uniqueKey) {
|
||||
pushing = true;
|
||||
} else if (!element.view->image()) {
|
||||
} else if (Ui::PeerUserpicLoading(element.view)) {
|
||||
state->allUserpicsLoaded = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,8 @@ public:
|
||||
|
||||
QString generateName() override;
|
||||
QString generateShortName() override;
|
||||
PaintRoundImageCallback generatePaintUserpicCallback() override;
|
||||
PaintRoundImageCallback generatePaintUserpicCallback(
|
||||
bool forceRound) override;
|
||||
|
||||
QSize rightActionSize() const override;
|
||||
QMargins rightActionMargins() const override;
|
||||
@@ -312,13 +313,13 @@ QString Row::generateName() {
|
||||
}
|
||||
auto result = _data.link;
|
||||
return result.replace(
|
||||
qstr("https://"),
|
||||
u"https://"_q,
|
||||
QString()
|
||||
).replace(
|
||||
qstr("t.me/+"),
|
||||
u"t.me/+"_q,
|
||||
QString()
|
||||
).replace(
|
||||
qstr("t.me/joinchat/"),
|
||||
u"t.me/joinchat/"_q,
|
||||
QString()
|
||||
);
|
||||
}
|
||||
@@ -327,7 +328,7 @@ QString Row::generateShortName() {
|
||||
return generateName();
|
||||
}
|
||||
|
||||
PaintRoundImageCallback Row::generatePaintUserpicCallback() {
|
||||
PaintRoundImageCallback Row::generatePaintUserpicCallback(bool forceRound) {
|
||||
return [=](
|
||||
QPainter &p,
|
||||
int x,
|
||||
|
||||
@@ -282,7 +282,7 @@ void SaveAllowedReactions(
|
||||
Unexpected("Invalid peer type in SaveAllowedReactions.");
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (error.type() == qstr("REACTION_INVALID")) {
|
||||
if (error.type() == u"REACTION_INVALID"_q) {
|
||||
peer->updateFullForced();
|
||||
peer->owner().reactions().refreshDefault();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "boxes/peers/edit_peer_invite_link.h"
|
||||
#include "boxes/peers/edit_peer_invite_links.h"
|
||||
#include "boxes/peers/edit_peer_usernames_list.h"
|
||||
#include "boxes/username_box.h"
|
||||
#include "chat_helpers/emoji_suggestions_widget.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat.h"
|
||||
@@ -103,8 +104,7 @@ private:
|
||||
Ui::SlideWrap<Ui::RpWidget> *usernameWrap = nullptr;
|
||||
Ui::UsernameInput *usernameInput = nullptr;
|
||||
UsernamesList *usernamesList = nullptr;
|
||||
base::unique_qptr<Ui::FlatLabel> usernameResult;
|
||||
const style::FlatLabel *usernameResultStyle = nullptr;
|
||||
base::unique_qptr<Ui::FlatLabel> usernameCheckResult;
|
||||
|
||||
Ui::SlideWrap<> *inviteLinkWrap = nullptr;
|
||||
Ui::FlatLabel *inviteLink = nullptr;
|
||||
@@ -127,9 +127,8 @@ private:
|
||||
void usernameChanged();
|
||||
void showUsernameError(rpl::producer<QString> &&error);
|
||||
void showUsernameGood();
|
||||
void showUsernameResult(
|
||||
rpl::producer<QString> &&text,
|
||||
not_null<const style::FlatLabel*> st);
|
||||
void showUsernamePending();
|
||||
void showUsernameEmpty();
|
||||
|
||||
void fillPrivaciesButtons(
|
||||
not_null<Ui::VerticalLayout*> parent,
|
||||
@@ -157,7 +156,9 @@ private:
|
||||
base::Timer _checkUsernameTimer;
|
||||
mtpRequestId _checkUsernameRequestId = 0;
|
||||
UsernameState _usernameState = UsernameState::Normal;
|
||||
rpl::event_stream<rpl::producer<QString>> _usernameResultTexts;
|
||||
|
||||
rpl::event_stream<UsernameCheckInfo> _usernameCheckInfo;
|
||||
rpl::lifetime _usernameCheckInfoLifetime;
|
||||
|
||||
rpl::event_stream<int> _scrollToRequests;
|
||||
|
||||
@@ -450,6 +451,8 @@ object_ptr<Ui::RpWidget> Controller::createUsernameEdit() {
|
||||
}, placeholder->lifetime());
|
||||
_controls.usernameInput->move(placeholder->pos());
|
||||
|
||||
AddUsernameCheckLabel(container, _usernameCheckInfo.events());
|
||||
|
||||
AddDividerText(
|
||||
container,
|
||||
tr::lng_create_channel_link_about());
|
||||
@@ -506,7 +509,7 @@ void Controller::privacyChanged(Privacy value) {
|
||||
toggleEditUsername();
|
||||
toggleWhoSendWrap();
|
||||
|
||||
_controls.usernameResult = nullptr;
|
||||
showUsernameEmpty();
|
||||
checkUsernameAvailability();
|
||||
} else {
|
||||
toggleWhoSendWrap();
|
||||
@@ -538,7 +541,7 @@ void Controller::checkUsernameAvailability() {
|
||||
}
|
||||
const auto initial = (_controls.privacy->value() != Privacy::HasUsername);
|
||||
const auto checking = initial
|
||||
? qsl(".bad.")
|
||||
? u".bad."_q
|
||||
: getUsernameInput();
|
||||
if (checking.size() < Ui::EditPeer::kMinUsernameLength) {
|
||||
return;
|
||||
@@ -565,23 +568,27 @@ void Controller::checkUsernameAvailability() {
|
||||
_checkUsernameRequestId = 0;
|
||||
const auto &type = error.type();
|
||||
_usernameState = UsernameState::Normal;
|
||||
if (type == qstr("CHANNEL_PUBLIC_GROUP_NA")) {
|
||||
if (type == u"CHANNEL_PUBLIC_GROUP_NA"_q) {
|
||||
_usernameState = UsernameState::NotAvailable;
|
||||
_controls.privacy->setValue(Privacy::NoUsername);
|
||||
} else if (type == qstr("CHANNELS_ADMIN_PUBLIC_TOO_MUCH")) {
|
||||
} else if (type == u"CHANNELS_ADMIN_PUBLIC_TOO_MUCH"_q) {
|
||||
_usernameState = UsernameState::TooMany;
|
||||
if (_controls.privacy->value() == Privacy::HasUsername) {
|
||||
askUsernameRevoke();
|
||||
}
|
||||
} else if (initial) {
|
||||
if (_controls.privacy->value() == Privacy::HasUsername) {
|
||||
_controls.usernameResult = nullptr;
|
||||
showUsernameEmpty();
|
||||
setFocusUsername();
|
||||
}
|
||||
} else if (type == qstr("USERNAME_INVALID")) {
|
||||
} else if (type == u"USERNAME_INVALID"_q) {
|
||||
showUsernameError(tr::lng_create_channel_link_invalid());
|
||||
} else if (type == qstr("USERNAME_OCCUPIED")
|
||||
&& checking != username) {
|
||||
} else if (type == u"USERNAME_PURCHASE_AVAILABLE"_q) {
|
||||
_goodUsername = false;
|
||||
_usernameCheckInfo.fire({
|
||||
.type = UsernameCheckInfo::Type::PurchaseAvailable,
|
||||
});
|
||||
} else if (type == u"USERNAME_OCCUPIED"_q && checking != username) {
|
||||
showUsernameError(tr::lng_create_channel_link_occupied());
|
||||
}
|
||||
}).send();
|
||||
@@ -603,7 +610,7 @@ void Controller::usernameChanged() {
|
||||
_goodUsername = false;
|
||||
const auto username = getUsernameInput();
|
||||
if (username.isEmpty()) {
|
||||
_controls.usernameResult = nullptr;
|
||||
showUsernameEmpty();
|
||||
_checkUsernameTimer.cancel();
|
||||
return;
|
||||
}
|
||||
@@ -618,43 +625,44 @@ void Controller::usernameChanged() {
|
||||
} else if (username.size() < Ui::EditPeer::kMinUsernameLength) {
|
||||
showUsernameError(tr::lng_create_channel_link_too_short());
|
||||
} else {
|
||||
_controls.usernameResult = nullptr;
|
||||
showUsernamePending();
|
||||
_checkUsernameTimer.callOnce(Ui::EditPeer::kUsernameCheckTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
void Controller::showUsernameError(rpl::producer<QString> &&error) {
|
||||
_goodUsername = false;
|
||||
showUsernameResult(std::move(error), &st::editPeerUsernameError);
|
||||
_usernameCheckInfoLifetime.destroy();
|
||||
std::move(
|
||||
error
|
||||
) | rpl::map([](QString s) {
|
||||
return UsernameCheckInfo{
|
||||
.type = UsernameCheckInfo::Type::Error,
|
||||
.text = { std::move(s) },
|
||||
};
|
||||
}) | rpl::start_to_stream(_usernameCheckInfo, _usernameCheckInfoLifetime);
|
||||
}
|
||||
|
||||
void Controller::showUsernameGood() {
|
||||
_goodUsername = true;
|
||||
showUsernameResult(
|
||||
tr::lng_create_channel_link_available(),
|
||||
&st::editPeerUsernameGood);
|
||||
_usernameCheckInfoLifetime.destroy();
|
||||
_usernameCheckInfo.fire({
|
||||
.type = UsernameCheckInfo::Type::Good,
|
||||
.text = { tr::lng_create_channel_link_available(tr::now) },
|
||||
});
|
||||
}
|
||||
|
||||
void Controller::showUsernameResult(
|
||||
rpl::producer<QString> &&text,
|
||||
not_null<const style::FlatLabel*> st) {
|
||||
if (!_controls.usernameResult
|
||||
|| _controls.usernameResultStyle != st) {
|
||||
_controls.usernameResultStyle = st;
|
||||
_controls.usernameResult = base::make_unique_q<Ui::FlatLabel>(
|
||||
_controls.usernameWrap,
|
||||
_usernameResultTexts.events() | rpl::flatten_latest(),
|
||||
*st);
|
||||
const auto label = _controls.usernameResult.get();
|
||||
label->show();
|
||||
label->widthValue(
|
||||
) | rpl::start_with_next([label] {
|
||||
label->moveToRight(
|
||||
st::editPeerUsernamePosition.x(),
|
||||
st::editPeerUsernamePosition.y());
|
||||
}, label->lifetime());
|
||||
}
|
||||
_usernameResultTexts.fire(std::move(text));
|
||||
void Controller::showUsernamePending() {
|
||||
_usernameCheckInfoLifetime.destroy();
|
||||
_usernameCheckInfo.fire({
|
||||
.type = UsernameCheckInfo::Type::Default,
|
||||
.text = { .text = tr::lng_create_channel_link_pending(tr::now) },
|
||||
});
|
||||
}
|
||||
|
||||
void Controller::showUsernameEmpty() {
|
||||
_usernameCheckInfoLifetime.destroy();
|
||||
_usernameCheckInfo.fire({ .type = UsernameCheckInfo::Type::Default });
|
||||
}
|
||||
|
||||
object_ptr<Ui::RpWidget> Controller::createInviteLinkBlock() {
|
||||
|
||||
@@ -36,7 +36,7 @@ struct UserpicState {
|
||||
PeerShortInfoUserpic current;
|
||||
std::optional<UserPhotosSlice> userSlice;
|
||||
PhotoId userpicPhotoId = PeerData::kUnknownPhotoId;
|
||||
std::shared_ptr<Data::CloudImageView> userpicView;
|
||||
Ui::PeerUserpicView userpicView;
|
||||
std::shared_ptr<Data::PhotoMedia> photoView;
|
||||
std::vector<std::shared_ptr<Data::PhotoMedia>> photoPreloads;
|
||||
InMemoryKey userpicKey;
|
||||
@@ -76,27 +76,26 @@ void ProcessUserpic(
|
||||
not_null<UserpicState*> state) {
|
||||
state->current.videoDocument = nullptr;
|
||||
state->userpicKey = peer->userpicUniqueKey(state->userpicView);
|
||||
if (!state->userpicView) {
|
||||
if (!state->userpicView.cloud) {
|
||||
GenerateImage(
|
||||
state,
|
||||
peer->generateUserpicImage(
|
||||
state->userpicView,
|
||||
st::shortInfoWidth * style::DevicePixelRatio(),
|
||||
ImageRoundRadius::None),
|
||||
0),
|
||||
false);
|
||||
state->current.photoLoadingProgress = 1.;
|
||||
state->photoView = nullptr;
|
||||
return;
|
||||
}
|
||||
peer->loadUserpic();
|
||||
const auto image = state->userpicView->image();
|
||||
if (!image) {
|
||||
if (Ui::PeerUserpicLoading(state->userpicView)) {
|
||||
state->current.photoLoadingProgress = 0.;
|
||||
state->current.photo = QImage();
|
||||
state->waitingLoad = true;
|
||||
return;
|
||||
}
|
||||
GenerateImage(state, image, true);
|
||||
GenerateImage(state, *state->userpicView.cloud, true);
|
||||
state->current.photoLoadingProgress = peer->userpicPhotoId() ? 0. : 1.;
|
||||
state->photoView = nullptr;
|
||||
}
|
||||
@@ -411,7 +410,7 @@ bool ProcessCurrent(
|
||||
return state->waitingLoad
|
||||
&& (state->photoView
|
||||
? (!!state->photoView->image(Data::PhotoSize::Large))
|
||||
: (state->userpicView && state->userpicView->image()));
|
||||
: (!Ui::PeerUserpicLoading(state->userpicView)));
|
||||
}) | rpl::start_with_next([=] {
|
||||
push();
|
||||
}, lifetime);
|
||||
|
||||
@@ -95,12 +95,13 @@ void SelfDestructionBox::showContent() {
|
||||
|
||||
clearButtons();
|
||||
addButton(tr::lng_settings_save(), [=] {
|
||||
const auto value = _ttlGroup->value();
|
||||
switch (_type) {
|
||||
case Type::Account:
|
||||
_session->api().selfDestruct().update(_ttlGroup->value());
|
||||
_session->api().selfDestruct().updateAccountTTL(value);
|
||||
break;
|
||||
case Type::Sessions:
|
||||
_session->api().authorizations().updateTTL(_ttlGroup->value());
|
||||
_session->api().authorizations().updateTTL(value);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "core/file_utilities.h"
|
||||
#include "core/mime_type.h"
|
||||
#include "base/event_filter.h"
|
||||
#include "base/call_delayed.h"
|
||||
#include "boxes/premium_limits_box.h"
|
||||
#include "boxes/premium_preview_box.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
@@ -57,7 +58,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "window/window_session_controller.h"
|
||||
#include "core/application.h"
|
||||
#include "core/core_settings.h"
|
||||
#include "facades.h" // App::LambdaDelayed.
|
||||
#include "styles/style_chat.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
@@ -353,7 +353,7 @@ void SendFilesBox::prepare() {
|
||||
|
||||
_addFile = addLeftButton(
|
||||
tr::lng_stickers_featured_add(),
|
||||
App::LambdaDelayed(st::historyAttach.ripple.hideDuration, this, [=] {
|
||||
base::fn_delayed(st::historyAttach.ripple.hideDuration, this, [=] {
|
||||
openDialogToAddFileToAlbum();
|
||||
}));
|
||||
setupDragArea();
|
||||
|
||||
@@ -77,7 +77,8 @@ public:
|
||||
|
||||
QString generateName() override;
|
||||
QString generateShortName() override;
|
||||
PaintRoundImageCallback generatePaintUserpicCallback() override;
|
||||
PaintRoundImageCallback generatePaintUserpicCallback(
|
||||
bool forceRound) override;
|
||||
|
||||
int elementsCount() const override;
|
||||
QRect elementGeometry(int element, int outerWidth) const override;
|
||||
@@ -520,7 +521,7 @@ QString Row::generateShortName() {
|
||||
return generateName();
|
||||
}
|
||||
|
||||
PaintRoundImageCallback Row::generatePaintUserpicCallback() {
|
||||
PaintRoundImageCallback Row::generatePaintUserpicCallback(bool forceRound) {
|
||||
return [=](
|
||||
QPainter &p,
|
||||
int x,
|
||||
|
||||
@@ -210,8 +210,6 @@ ShareBox::ShareBox(QWidget*, Descriptor &&descriptor)
|
||||
}
|
||||
|
||||
void ShareBox::prepareCommentField() {
|
||||
using namespace rpl::mappers;
|
||||
|
||||
_comment->hide(anim::type::instant);
|
||||
|
||||
rpl::combine(
|
||||
@@ -476,7 +474,7 @@ void ShareBox::showMenu(not_null<Ui::RpWidget*> parent) {
|
||||
auto item = base::make_unique_q<Menu::ItemWithCheck>(
|
||||
_menu->menu(),
|
||||
st::popupMenuWithIcons.menu,
|
||||
new QAction(QString(), _menu->menu()),
|
||||
Ui::CreateChild<QAction>(_menu->menu().get()),
|
||||
nullptr,
|
||||
nullptr);
|
||||
std::move(
|
||||
@@ -537,25 +535,6 @@ void ShareBox::applyFilterUpdate(const QString &query) {
|
||||
_inner->updateFilter(query);
|
||||
}
|
||||
|
||||
PaintRoundImageCallback ForceRoundUserpicCallback(not_null<PeerData*> peer) {
|
||||
auto userpic = std::shared_ptr<Data::CloudImageView>();
|
||||
auto cache = std::make_shared<QImage>();
|
||||
return [=](Painter &p, int x, int y, int outerWidth, int size) mutable {
|
||||
const auto ratio = style::DevicePixelRatio();
|
||||
const auto cacheSize = QSize(size, size) * ratio;
|
||||
if (cache->size() != cacheSize) {
|
||||
*cache = QImage(cacheSize, QImage::Format_ARGB32_Premultiplied);
|
||||
cache->setDevicePixelRatio(ratio);
|
||||
}
|
||||
auto q = Painter(cache.get());
|
||||
peer->paintUserpicLeft(q, userpic, 0, 0, outerWidth, size);
|
||||
q.end();
|
||||
|
||||
*cache = Images::Circle(std::move(*cache));
|
||||
p.drawImage(x, y, *cache);
|
||||
};
|
||||
}
|
||||
|
||||
void ShareBox::addPeerToMultiSelect(not_null<Data::Thread*> thread) {
|
||||
auto addItemWay = Ui::MultiSelect::AddItemWay::Default;
|
||||
const auto peer = thread->peer();
|
||||
@@ -693,7 +672,7 @@ ShareBox::Inner::Inner(
|
||||
}
|
||||
addList(_descriptor.session->data().contactsNoChatsList());
|
||||
|
||||
_filter = qsl("a");
|
||||
_filter = u"a"_q;
|
||||
updateFilter();
|
||||
|
||||
_descriptor.session->changes().peerUpdates(
|
||||
@@ -958,9 +937,9 @@ ShareBox::Inner::Chat::Chat(
|
||||
st.checkbox,
|
||||
updateCallback,
|
||||
PaintUserpicCallback(peer, true),
|
||||
[=] { return peer->isForum()
|
||||
? ImageRoundRadius::Large
|
||||
: ImageRoundRadius::Ellipse; })
|
||||
[=](int size) { return peer->isForum()
|
||||
? int(size * Ui::ForumUserpicRadiusMultiplier())
|
||||
: std::optional<int>(); })
|
||||
, name(st.checkbox.imageRadius * 2) {
|
||||
}
|
||||
|
||||
@@ -1325,9 +1304,9 @@ QString AppendShareGameScoreUrl(
|
||||
}
|
||||
|
||||
auto shareHash = shareHashEncrypted.toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals);
|
||||
auto shareUrl = qsl("tg://share_game_score?hash=") + QString::fromLatin1(shareHash);
|
||||
auto shareUrl = u"tg://share_game_score?hash="_q + QString::fromLatin1(shareHash);
|
||||
|
||||
auto shareComponent = qsl("tgShareScoreUrl=") + qthelp::url_encode(shareUrl);
|
||||
auto shareComponent = u"tgShareScoreUrl="_q + qthelp::url_encode(shareUrl);
|
||||
|
||||
auto hashPosition = url.indexOf('#');
|
||||
if (hashPosition < 0) {
|
||||
@@ -1343,75 +1322,23 @@ QString AppendShareGameScoreUrl(
|
||||
return url + shareComponent;
|
||||
}
|
||||
|
||||
void FastShareMessage(
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<HistoryItem*> item) {
|
||||
struct ShareData {
|
||||
ShareData(not_null<PeerData*> peer, MessageIdsList &&ids)
|
||||
: peer(peer)
|
||||
, msgIds(std::move(ids)) {
|
||||
}
|
||||
not_null<PeerData*> peer;
|
||||
MessageIdsList msgIds;
|
||||
ShareBox::SubmitCallback ShareBox::DefaultForwardCallback(
|
||||
std::shared_ptr<Ui::Show> show,
|
||||
not_null<History*> history,
|
||||
MessageIdsList msgIds) {
|
||||
struct State final {
|
||||
base::flat_set<mtpRequestId> requests;
|
||||
};
|
||||
const auto show = std::make_shared<Window::Show>(controller);
|
||||
const auto history = item->history();
|
||||
const auto owner = &history->owner();
|
||||
const auto session = &history->session();
|
||||
const auto data = std::make_shared<ShareData>(
|
||||
history->peer,
|
||||
owner->itemOrItsGroup(item));
|
||||
const auto isGame = item->getMessageBot()
|
||||
&& item->media()
|
||||
&& (item->media()->game() != nullptr);
|
||||
const auto canCopyLink = item->hasDirectLink() || isGame;
|
||||
|
||||
const auto items = owner->idsToItems(data->msgIds);
|
||||
const auto hasCaptions = ranges::any_of(items, [](auto item) {
|
||||
return item->media()
|
||||
&& !item->originalText().text.isEmpty()
|
||||
&& item->media()->allowsEditCaption();
|
||||
});
|
||||
const auto hasOnlyForcedForwardedInfo = hasCaptions
|
||||
? false
|
||||
: ranges::all_of(items, [](auto item) {
|
||||
return item->media() && item->media()->forceForwardedInfo();
|
||||
});
|
||||
|
||||
auto copyCallback = [=, toastParent = show->toastParent()] {
|
||||
const auto item = owner->message(data->msgIds[0]);
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
if (item->hasDirectLink()) {
|
||||
using namespace HistoryView;
|
||||
CopyPostLink(controller, item->fullId(), Context::History);
|
||||
} else if (const auto bot = item->getMessageBot()) {
|
||||
if (const auto media = item->media()) {
|
||||
if (const auto game = media->game()) {
|
||||
const auto link = session->createInternalLinkFull(
|
||||
bot->username() + qsl("?game=") + game->shortName);
|
||||
|
||||
QGuiApplication::clipboard()->setText(link);
|
||||
|
||||
Ui::Toast::Show(
|
||||
toastParent,
|
||||
tr::lng_share_game_link_copied(tr::now));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
auto submitCallback = [=](
|
||||
const auto state = std::make_shared<State>();
|
||||
return [=](
|
||||
std::vector<not_null<Data::Thread*>> &&result,
|
||||
TextWithTags &&comment,
|
||||
Api::SendOptions options,
|
||||
Data::ForwardOptions forwardOptions) {
|
||||
if (!data->requests.empty()) {
|
||||
if (!state->requests.empty()) {
|
||||
return; // Share clicked already.
|
||||
}
|
||||
auto items = history->owner().idsToItems(data->msgIds);
|
||||
auto items = history->owner().idsToItems(msgIds);
|
||||
if (items.empty() || result.empty()) {
|
||||
return;
|
||||
}
|
||||
@@ -1451,20 +1378,20 @@ void FastShareMessage(
|
||||
| ((forwardOptions == Data::ForwardOptions::NoNamesAndCaptions)
|
||||
? Flag::f_drop_media_captions
|
||||
: Flag(0));
|
||||
auto msgIds = QVector<MTPint>();
|
||||
msgIds.reserve(data->msgIds.size());
|
||||
for (const auto &fullId : data->msgIds) {
|
||||
msgIds.push_back(MTP_int(fullId.msg));
|
||||
auto mtpMsgIds = QVector<MTPint>();
|
||||
mtpMsgIds.reserve(msgIds.size());
|
||||
for (const auto &fullId : msgIds) {
|
||||
mtpMsgIds.push_back(MTP_int(fullId.msg));
|
||||
}
|
||||
const auto generateRandom = [&] {
|
||||
auto result = QVector<MTPlong>(data->msgIds.size());
|
||||
auto result = QVector<MTPlong>(msgIds.size());
|
||||
for (auto &value : result) {
|
||||
value = base::RandomValue<MTPlong>();
|
||||
}
|
||||
return result;
|
||||
};
|
||||
auto &api = owner->session().api();
|
||||
auto &histories = owner->histories();
|
||||
auto &api = history->owner().session().api();
|
||||
auto &histories = history->owner().histories();
|
||||
const auto requestType = Data::Histories::RequestType::Send;
|
||||
for (const auto thread : result) {
|
||||
if (!comment.text.isEmpty()) {
|
||||
@@ -1486,8 +1413,8 @@ void FastShareMessage(
|
||||
history->sendRequestId = api.request(
|
||||
MTPmessages_ForwardMessages(
|
||||
MTP_flags(sendFlags),
|
||||
data->peer->input,
|
||||
MTP_vector<MTPint>(msgIds),
|
||||
history->peer->input,
|
||||
MTP_vector<MTPint>(mtpMsgIds),
|
||||
MTP_vector<MTPlong>(generateRandom()),
|
||||
peer->input,
|
||||
MTP_int(topicRootId),
|
||||
@@ -1495,8 +1422,8 @@ void FastShareMessage(
|
||||
MTP_inputPeerEmpty() // send_as
|
||||
)).done([=](const MTPUpdates &updates, mtpRequestId reqId) {
|
||||
history->session().api().applyUpdates(updates);
|
||||
data->requests.remove(reqId);
|
||||
if (data->requests.empty()) {
|
||||
state->requests.remove(reqId);
|
||||
if (state->requests.empty()) {
|
||||
if (show->valid()) {
|
||||
Ui::Toast::Show(
|
||||
show->toastParent(),
|
||||
@@ -1520,9 +1447,60 @@ void FastShareMessage(
|
||||
}).afterRequest(history->sendRequestId).send();
|
||||
return history->sendRequestId;
|
||||
});
|
||||
data->requests.insert(history->sendRequestId);
|
||||
state->requests.insert(history->sendRequestId);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void FastShareMessage(
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<HistoryItem*> item) {
|
||||
const auto show = std::make_shared<Window::Show>(controller);
|
||||
const auto history = item->history();
|
||||
const auto owner = &history->owner();
|
||||
const auto session = &history->session();
|
||||
const auto msgIds = owner->itemOrItsGroup(item);
|
||||
const auto isGame = item->getMessageBot()
|
||||
&& item->media()
|
||||
&& (item->media()->game() != nullptr);
|
||||
const auto canCopyLink = item->hasDirectLink() || isGame;
|
||||
|
||||
const auto items = owner->idsToItems(msgIds);
|
||||
const auto hasCaptions = ranges::any_of(items, [](auto item) {
|
||||
return item->media()
|
||||
&& !item->originalText().text.isEmpty()
|
||||
&& item->media()->allowsEditCaption();
|
||||
});
|
||||
const auto hasOnlyForcedForwardedInfo = hasCaptions
|
||||
? false
|
||||
: ranges::all_of(items, [](auto item) {
|
||||
return item->media() && item->media()->forceForwardedInfo();
|
||||
});
|
||||
|
||||
auto copyCallback = [=, toastParent = show->toastParent()] {
|
||||
const auto item = owner->message(msgIds[0]);
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
if (item->hasDirectLink()) {
|
||||
using namespace HistoryView;
|
||||
CopyPostLink(controller, item->fullId(), Context::History);
|
||||
} else if (const auto bot = item->getMessageBot()) {
|
||||
if (const auto media = item->media()) {
|
||||
if (const auto game = media->game()) {
|
||||
const auto link = session->createInternalLinkFull(
|
||||
bot->username() + u"?game="_q + game->shortName);
|
||||
|
||||
QGuiApplication::clipboard()->setText(link);
|
||||
|
||||
Ui::Toast::Show(
|
||||
toastParent,
|
||||
tr::lng_share_game_link_copied(tr::now));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
auto filterCallback = [isGame](not_null<Data::Thread*> thread) {
|
||||
return thread->canWrite()
|
||||
&& (!isGame || !thread->peer()->isBroadcast());
|
||||
@@ -1534,10 +1512,13 @@ void FastShareMessage(
|
||||
Box<ShareBox>(ShareBox::Descriptor{
|
||||
.session = session,
|
||||
.copyCallback = std::move(copyLinkCallback),
|
||||
.submitCallback = std::move(submitCallback),
|
||||
.submitCallback = ShareBox::DefaultForwardCallback(
|
||||
show,
|
||||
history,
|
||||
msgIds),
|
||||
.filterCallback = std::move(filterCallback),
|
||||
.forwardOptions = {
|
||||
.messagesCount = int(data->msgIds.size()),
|
||||
.messagesCount = int(msgIds.size()),
|
||||
.show = !hasOnlyForcedForwardedInfo,
|
||||
.hasCaptions = hasCaptions,
|
||||
},
|
||||
|
||||
@@ -15,6 +15,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/effects/round_checkbox.h"
|
||||
#include "mtproto/sender.h"
|
||||
|
||||
class History;
|
||||
|
||||
namespace style {
|
||||
struct MultiSelect;
|
||||
struct InputField;
|
||||
@@ -74,9 +76,14 @@ public:
|
||||
std::vector<not_null<Data::Thread*>>&&,
|
||||
TextWithTags&&,
|
||||
Api::SendOptions,
|
||||
Data::ForwardOptions option)>;
|
||||
Data::ForwardOptions)>;
|
||||
using FilterCallback = Fn<bool(not_null<Data::Thread*>)>;
|
||||
|
||||
[[nodiscard]] static SubmitCallback DefaultForwardCallback(
|
||||
std::shared_ptr<Ui::Show> show,
|
||||
not_null<History*> history,
|
||||
MessageIdsList msgIds);
|
||||
|
||||
struct Descriptor {
|
||||
not_null<Main::Session*> session;
|
||||
CopyCallback copyCallback;
|
||||
|
||||
@@ -1179,13 +1179,13 @@ StickersBox::Inner::Inner(
|
||||
, _megagroupSetField(
|
||||
this,
|
||||
st::groupStickersField,
|
||||
rpl::single(qsl("stickerset")),
|
||||
rpl::single(u"stickerset"_q),
|
||||
QString(),
|
||||
_controller->session().createInternalLink(QString()))
|
||||
, _megagroupDivider(this)
|
||||
, _megagroupSubTitle(this, tr::lng_stickers_group_from_your(tr::now), st::boxTitle) {
|
||||
_megagroupSetField->setLinkPlaceholder(
|
||||
_controller->session().createInternalLink(qsl("addstickers/")));
|
||||
_controller->session().createInternalLink(u"addstickers/"_q));
|
||||
_megagroupSetField->setPlaceholderHidden(false);
|
||||
_megagroupSetAddressChangedTimer.setCallback([this] { handleMegagroupSetAddressChange(); });
|
||||
connect(
|
||||
@@ -1993,15 +1993,15 @@ void StickersBox::Inner::AddressField::correctValue(
|
||||
auto newText = now;
|
||||
auto newCursor = nowCursor;
|
||||
auto removeFromBeginning = {
|
||||
qstr("http://"),
|
||||
qstr("https://"),
|
||||
qstr("www.t.me/"),
|
||||
qstr("www.telegram.me/"),
|
||||
qstr("www.telegram.dog/"),
|
||||
qstr("t.me/"),
|
||||
qstr("telegram.me/"),
|
||||
qstr("telegram.dog/"),
|
||||
qstr("addstickers/"),
|
||||
u"http://"_q,
|
||||
u"https://"_q,
|
||||
u"www.t.me/"_q,
|
||||
u"www.telegram.me/"_q,
|
||||
u"www.telegram.dog/"_q,
|
||||
u"t.me/"_q,
|
||||
u"telegram.me/"_q,
|
||||
u"telegram.dog/"_q,
|
||||
u"addstickers/"_q,
|
||||
};
|
||||
for (auto &removePhrase : removeFromBeginning) {
|
||||
if (newText.startsWith(removePhrase)) {
|
||||
|
||||
@@ -140,7 +140,8 @@ void TranslateBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
not_null<PeerData*> peer,
|
||||
MsgId msgId,
|
||||
TextWithEntities text) {
|
||||
TextWithEntities text,
|
||||
bool hasCopyRestriction) {
|
||||
box->setWidth(st::boxWideWidth);
|
||||
box->addButton(tr::lng_box_ok(), [=] { box->closeBox(); });
|
||||
const auto container = box->verticalLayout();
|
||||
@@ -159,6 +160,12 @@ void TranslateBox(
|
||||
};
|
||||
const auto state = box->lifetime().make_state<State>();
|
||||
|
||||
text.entities = ranges::views::all(
|
||||
text.entities
|
||||
) | ranges::views::filter([](const EntityInText &e) {
|
||||
return e.type() != EntityType::Spoiler;
|
||||
}) | ranges::to<EntitiesInText>();
|
||||
|
||||
if (!IsServerMsgId(msgId)) {
|
||||
msgId = 0;
|
||||
}
|
||||
@@ -182,6 +189,10 @@ void TranslateBox(
|
||||
box,
|
||||
object_ptr<FlatLabel>(box, stLabel)));
|
||||
{
|
||||
if (hasCopyRestriction) {
|
||||
original->entity()->setContextMenuHook([](auto&&) {
|
||||
});
|
||||
}
|
||||
original->entity()->setMarkedText(text);
|
||||
original->setMinimalHeight(lineHeight);
|
||||
original->hide(anim::type::instant);
|
||||
@@ -232,7 +243,7 @@ void TranslateBox(
|
||||
const auto translated = box->addRow(object_ptr<SlideWrap<FlatLabel>>(
|
||||
box,
|
||||
object_ptr<FlatLabel>(box, stLabel)));
|
||||
translated->entity()->setSelectable(true);
|
||||
translated->entity()->setSelectable(!hasCopyRestriction);
|
||||
translated->hide(anim::type::instant);
|
||||
|
||||
constexpr auto kMaxLines = 3;
|
||||
|
||||
@@ -19,7 +19,8 @@ void TranslateBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
not_null<PeerData*> peer,
|
||||
MsgId msgId,
|
||||
TextWithEntities text);
|
||||
TextWithEntities text,
|
||||
bool hasCopyRestriction);
|
||||
|
||||
[[nodiscard]] bool SkipTranslate(TextWithEntities textWithEntities);
|
||||
|
||||
|
||||
@@ -19,40 +19,56 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/layers/generic_box.h"
|
||||
#include "ui/painter.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/text/text_variant.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/fields/special_fields.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/wrap/follow_slide_wrap.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_settings.h"
|
||||
|
||||
namespace {
|
||||
|
||||
[[nodiscard]] TextWithEntities PurchaseAvailableText() {
|
||||
constexpr auto kUsernameAuction = "auction";
|
||||
return tr::lng_username_purchase_available(
|
||||
tr::now,
|
||||
lt_link,
|
||||
Ui::Text::Link(
|
||||
'@' + QString(kUsernameAuction),
|
||||
u"https://t.me/"_q + kUsernameAuction),
|
||||
Ui::Text::RichLangValue);
|
||||
}
|
||||
|
||||
class UsernameEditor final : public Ui::RpWidget {
|
||||
public:
|
||||
UsernameEditor(not_null<Ui::RpWidget*>, not_null<Main::Session*> session);
|
||||
|
||||
void setInnerFocus();
|
||||
rpl::producer<> submitted() const;
|
||||
rpl::producer<> save();
|
||||
[[nodiscard]] rpl::producer<> submitted() const;
|
||||
[[nodiscard]] rpl::producer<> save();
|
||||
[[nodiscard]] rpl::producer<UsernameCheckInfo> checkInfoChanged() const;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
private:
|
||||
void updateFail(const QString &error);
|
||||
void checkFail(const QString &error);
|
||||
|
||||
void checkInfoPurchaseAvailable();
|
||||
|
||||
void check();
|
||||
void changed();
|
||||
|
||||
void checkInfoChange();
|
||||
|
||||
QString getName() const;
|
||||
|
||||
const not_null<Main::Session*> _session;
|
||||
const style::font &_font;
|
||||
const style::margins &_padding;
|
||||
MTP::Sender _api;
|
||||
|
||||
@@ -65,6 +81,7 @@ private:
|
||||
base::Timer _checkTimer;
|
||||
|
||||
rpl::event_stream<> _saved;
|
||||
rpl::event_stream<UsernameCheckInfo> _checkInfoChanged;
|
||||
|
||||
};
|
||||
|
||||
@@ -72,13 +89,12 @@ UsernameEditor::UsernameEditor(
|
||||
not_null<Ui::RpWidget*>,
|
||||
not_null<Main::Session*> session)
|
||||
: _session(session)
|
||||
, _font(st::normalFont)
|
||||
, _padding(st::usernamePadding)
|
||||
, _api(&_session->mtp())
|
||||
, _username(
|
||||
this,
|
||||
st::defaultInputField,
|
||||
rpl::single(qsl("@username")),
|
||||
rpl::single(u"@username"_q),
|
||||
session->user()->editableUsername(),
|
||||
QString())
|
||||
, _checkTimer([=] { check(); }) {
|
||||
@@ -88,11 +104,7 @@ UsernameEditor::UsernameEditor(
|
||||
|
||||
connect(_username, &Ui::MaskedInputField::changed, [=] { changed(); });
|
||||
|
||||
resize(
|
||||
width(),
|
||||
(_padding.top()
|
||||
+ _username->height()
|
||||
+ st::usernameSkip));
|
||||
resize(width(), (_padding.top() + _username->height()));
|
||||
}
|
||||
|
||||
rpl::producer<> UsernameEditor::submitted() const {
|
||||
@@ -110,39 +122,6 @@ void UsernameEditor::setInnerFocus() {
|
||||
_username->setFocusFast();
|
||||
}
|
||||
|
||||
void UsernameEditor::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
|
||||
const auto textTop = _username->y()
|
||||
+ _username->height()
|
||||
+ ((st::usernameSkip - _font->height) / 2);
|
||||
|
||||
p.setFont(_font);
|
||||
if (!_errorText.isEmpty()) {
|
||||
p.setPen(st::boxTextFgError);
|
||||
p.drawTextLeft(
|
||||
_padding.left(),
|
||||
textTop,
|
||||
width(),
|
||||
_errorText);
|
||||
} else if (!_goodText.isEmpty()) {
|
||||
p.setPen(st::boxTextFgGood);
|
||||
p.drawTextLeft(
|
||||
_padding.left(),
|
||||
textTop,
|
||||
width(),
|
||||
_goodText);
|
||||
} else {
|
||||
p.setPen(st::usernameDefaultFg);
|
||||
p.drawTextLeft(
|
||||
_padding.left(),
|
||||
textTop,
|
||||
width(),
|
||||
tr::lng_username_choose(tr::now));
|
||||
}
|
||||
p.setPen(st::boxTextFg);
|
||||
}
|
||||
|
||||
void UsernameEditor::resizeEvent(QResizeEvent *e) {
|
||||
_username->resize(
|
||||
width() - _padding.left() - _padding.right(),
|
||||
@@ -169,6 +148,10 @@ rpl::producer<> UsernameEditor::save() {
|
||||
return _saved.events();
|
||||
}
|
||||
|
||||
rpl::producer<UsernameCheckInfo> UsernameEditor::checkInfoChanged() const {
|
||||
return _checkInfoChanged.events();
|
||||
}
|
||||
|
||||
void UsernameEditor::check() {
|
||||
_api.request(base::take(_checkRequestId)).cancel();
|
||||
|
||||
@@ -190,7 +173,7 @@ void UsernameEditor::check() {
|
||||
? tr::lng_username_available(tr::now)
|
||||
: QString();
|
||||
|
||||
update();
|
||||
checkInfoChange();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_checkRequestId = 0;
|
||||
checkFail(error.type());
|
||||
@@ -202,7 +185,7 @@ void UsernameEditor::changed() {
|
||||
if (name.isEmpty()) {
|
||||
if (!_errorText.isEmpty() || !_goodText.isEmpty()) {
|
||||
_errorText = _goodText = QString();
|
||||
update();
|
||||
_checkInfoChanged.fire({ UsernameCheckInfo::Type::Default });
|
||||
}
|
||||
_checkTimer.cancel();
|
||||
} else {
|
||||
@@ -216,7 +199,7 @@ void UsernameEditor::changed() {
|
||||
&& (ch != '@' || i > 0)) {
|
||||
if (_errorText != tr::lng_username_bad_symbols(tr::now)) {
|
||||
_errorText = tr::lng_username_bad_symbols(tr::now);
|
||||
update();
|
||||
checkInfoChange();
|
||||
}
|
||||
_checkTimer.cancel();
|
||||
return;
|
||||
@@ -225,22 +208,51 @@ void UsernameEditor::changed() {
|
||||
if (name.size() < Ui::EditPeer::kMinUsernameLength) {
|
||||
if (_errorText != tr::lng_username_too_short(tr::now)) {
|
||||
_errorText = tr::lng_username_too_short(tr::now);
|
||||
update();
|
||||
checkInfoChange();
|
||||
}
|
||||
_checkTimer.cancel();
|
||||
} else {
|
||||
if (!_errorText.isEmpty() || !_goodText.isEmpty()) {
|
||||
_errorText = _goodText = QString();
|
||||
update();
|
||||
checkInfoChange();
|
||||
}
|
||||
_checkTimer.callOnce(Ui::EditPeer::kUsernameCheckTimeout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UsernameEditor::checkInfoChange() {
|
||||
if (!_errorText.isEmpty()) {
|
||||
_checkInfoChanged.fire({
|
||||
.type = UsernameCheckInfo::Type::Error,
|
||||
.text = { _errorText },
|
||||
});
|
||||
} else if (!_goodText.isEmpty()) {
|
||||
_checkInfoChanged.fire({
|
||||
.type = UsernameCheckInfo::Type::Good,
|
||||
.text = { _goodText },
|
||||
});
|
||||
} else {
|
||||
_checkInfoChanged.fire({
|
||||
.type = UsernameCheckInfo::Type::Default,
|
||||
.text = { tr::lng_username_choose(tr::now) },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void UsernameEditor::checkInfoPurchaseAvailable() {
|
||||
_username->setFocus();
|
||||
_username->showError();
|
||||
_errorText = u".bad."_q;
|
||||
|
||||
_checkInfoChanged.fire({
|
||||
.type = UsernameCheckInfo::Type::PurchaseAvailable,
|
||||
});
|
||||
}
|
||||
|
||||
void UsernameEditor::updateFail(const QString &error) {
|
||||
const auto self = _session->user();
|
||||
if ((error == qstr("USERNAME_NOT_MODIFIED"))
|
||||
if ((error == u"USERNAME_NOT_MODIFIED"_q)
|
||||
|| (_sentUsername == self->editableUsername())) {
|
||||
self->setName(
|
||||
TextUtilities::SingleLine(self->firstName),
|
||||
@@ -248,30 +260,34 @@ void UsernameEditor::updateFail(const QString &error) {
|
||||
TextUtilities::SingleLine(self->nameOrPhone),
|
||||
TextUtilities::SingleLine(_sentUsername));
|
||||
_saved.fire_done();
|
||||
} else if (error == qstr("USERNAME_INVALID")) {
|
||||
} else if (error == u"USERNAME_INVALID"_q) {
|
||||
_username->setFocus();
|
||||
_username->showError();
|
||||
_errorText = tr::lng_username_invalid(tr::now);
|
||||
update();
|
||||
} else if ((error == qstr("USERNAME_OCCUPIED"))
|
||||
|| (error == qstr("USERNAMES_UNAVAILABLE"))) {
|
||||
checkInfoChange();
|
||||
} else if ((error == u"USERNAME_OCCUPIED"_q)
|
||||
|| (error == u"USERNAMES_UNAVAILABLE"_q)) {
|
||||
_username->setFocus();
|
||||
_username->showError();
|
||||
_errorText = tr::lng_username_occupied(tr::now);
|
||||
update();
|
||||
checkInfoChange();
|
||||
} else if (error == u"USERNAME_PURCHASE_AVAILABLE"_q) {
|
||||
checkInfoPurchaseAvailable();
|
||||
} else {
|
||||
_username->setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void UsernameEditor::checkFail(const QString &error) {
|
||||
if (error == qstr("USERNAME_INVALID")) {
|
||||
if (error == u"USERNAME_INVALID"_q) {
|
||||
_errorText = tr::lng_username_invalid(tr::now);
|
||||
update();
|
||||
} else if ((error == qstr("USERNAME_OCCUPIED"))
|
||||
checkInfoChange();
|
||||
} else if ((error == u"USERNAME_OCCUPIED"_q)
|
||||
&& (_checkUsername != _session->user()->editableUsername())) {
|
||||
_errorText = tr::lng_username_occupied(tr::now);
|
||||
update();
|
||||
checkInfoChange();
|
||||
} else if (error == u"USERNAME_PURCHASE_AVAILABLE"_q) {
|
||||
checkInfoPurchaseAvailable();
|
||||
} else {
|
||||
_goodText = QString();
|
||||
_username->setFocus();
|
||||
@@ -296,6 +312,8 @@ void UsernamesBox(
|
||||
{});
|
||||
box->setFocusCallback([=] { editor->setInnerFocus(); });
|
||||
|
||||
AddUsernameCheckLabel(container, editor->checkInfoChanged());
|
||||
|
||||
container->add(object_ptr<Ui::DividerLabel>(
|
||||
container,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
@@ -330,3 +348,41 @@ void UsernamesBox(
|
||||
box->addButton(tr::lng_settings_save(), finish);
|
||||
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
||||
}
|
||||
|
||||
void AddUsernameCheckLabel(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<UsernameCheckInfo> checkInfo) {
|
||||
const auto padding = st::boxRowPadding;
|
||||
const auto &st = st::aboutRevokePublicLabel;
|
||||
const auto skip = (st::usernameSkip - st.style.font->height) / 4;
|
||||
|
||||
auto wrapped = object_ptr<Ui::VerticalLayout>(container);
|
||||
Settings::AddSkip(wrapped, skip);
|
||||
const auto label = wrapped->add(object_ptr<Ui::FlatLabel>(wrapped, st));
|
||||
Settings::AddSkip(wrapped, skip);
|
||||
|
||||
Settings::AddSkip(container, skip);
|
||||
container->add(
|
||||
object_ptr<Ui::FollowSlideWrap<Ui::VerticalLayout>>(
|
||||
container,
|
||||
std::move(wrapped)),
|
||||
padding);
|
||||
|
||||
rpl::combine(
|
||||
std::move(checkInfo),
|
||||
container->widthValue()
|
||||
) | rpl::start_with_next([=](const UsernameCheckInfo &info, int w) {
|
||||
using Type = UsernameCheckInfo::Type;
|
||||
label->setMarkedText((info.type == Type::PurchaseAvailable)
|
||||
? PurchaseAvailableText()
|
||||
: info.text);
|
||||
const auto &color = (info.type == Type::Good)
|
||||
? st::boxTextFgGood
|
||||
: (info.type == Type::Error)
|
||||
? st::boxTextFgError
|
||||
: st::usernameDefaultFg;
|
||||
label->setTextColorOverride(color->c);
|
||||
label->resizeToWidth(w - padding.left() - padding.right());
|
||||
}, label->lifetime());
|
||||
Settings::AddSkip(container, skip);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
namespace Ui {
|
||||
class GenericBox;
|
||||
class VerticalLayout;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Main {
|
||||
@@ -18,3 +19,18 @@ class Session;
|
||||
void UsernamesBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
not_null<Main::Session*> session);
|
||||
|
||||
struct UsernameCheckInfo final {
|
||||
enum class Type {
|
||||
Good,
|
||||
Error,
|
||||
Default,
|
||||
PurchaseAvailable,
|
||||
};
|
||||
Type type;
|
||||
TextWithEntities text;
|
||||
};
|
||||
|
||||
void AddUsernameCheckLabel(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<UsernameCheckInfo> checkInfo);
|
||||
|
||||
@@ -500,8 +500,8 @@ void Call::startWaitingTrack() {
|
||||
_waitingTrack = Media::Audio::Current().createTrack();
|
||||
const auto trackFileName = Core::App().settings().getSoundPath(
|
||||
(_type == Type::Outgoing)
|
||||
? qsl("call_outgoing")
|
||||
: qsl("call_incoming"));
|
||||
? u"call_outgoing"_q
|
||||
: u"call_incoming"_q);
|
||||
_waitingTrack->samplePeakEach(kSoundSampleMs);
|
||||
_waitingTrack->fillFromFile(trackFileName);
|
||||
_waitingTrack->playInLoop();
|
||||
@@ -893,8 +893,8 @@ void Call::createAndStartController(const MTPDphoneCall &call) {
|
||||
settings.callAudioBackend()),
|
||||
};
|
||||
if (Logs::DebugEnabled()) {
|
||||
const auto callLogFolder = cWorkingDir() + qsl("DebugLogs");
|
||||
const auto callLogPath = callLogFolder + qsl("/last_call_log.txt");
|
||||
const auto callLogFolder = cWorkingDir() + u"DebugLogs"_q;
|
||||
const auto callLogPath = callLogFolder + u"/last_call_log.txt"_q;
|
||||
const auto callLogNative = QDir::toNativeSeparators(callLogPath);
|
||||
#ifdef Q_OS_WIN
|
||||
descriptor.config.logPath.data = callLogNative.toStdWString();
|
||||
|
||||
@@ -25,7 +25,6 @@ class PowerSaveBlocker;
|
||||
|
||||
namespace Data {
|
||||
class PhotoMedia;
|
||||
class CloudImageView;
|
||||
} // namespace Data
|
||||
|
||||
namespace Ui {
|
||||
|
||||
@@ -147,7 +147,7 @@ DebugInfoBox::DebugInfoBox(QWidget*, base::weak_ptr<Call> call)
|
||||
}
|
||||
|
||||
void DebugInfoBox::prepare() {
|
||||
setTitle(rpl::single(qsl("Call Debug")));
|
||||
setTitle(rpl::single(u"Call Debug"_q));
|
||||
|
||||
addButton(tr::lng_close(), [this] { closeBox(); });
|
||||
_text = setInnerWidget(
|
||||
|
||||
@@ -159,7 +159,12 @@ void Userpic::refreshPhoto() {
|
||||
_userPhotoFull = true;
|
||||
createCache(_photo->image(Data::PhotoSize::Thumbnail));
|
||||
} else if (_userPhoto.isNull()) {
|
||||
createCache(_userpic ? _userpic->image() : nullptr);
|
||||
if (const auto cloud = _peer->userpicCloudImage(_userpic)) {
|
||||
auto image = Image(base::duplicate(*cloud));
|
||||
createCache(&image);
|
||||
} else {
|
||||
createCache(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,9 +202,10 @@ void Userpic::createCache(Image *image) {
|
||||
{
|
||||
auto p = QPainter(&filled);
|
||||
Ui::EmptyUserpic(
|
||||
Data::PeerUserpicColor(_peer->id),
|
||||
Ui::EmptyUserpic::UserpicColor(
|
||||
Data::PeerColorIndex(_peer->id)),
|
||||
_peer->name()
|
||||
).paint(p, 0, 0, size, size);
|
||||
).paintCircle(p, 0, 0, size, size);
|
||||
}
|
||||
//_userPhoto = Images::PixmapFast(Images::Round(
|
||||
// std::move(filled),
|
||||
|
||||
@@ -8,13 +8,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#pragma once
|
||||
|
||||
#include "ui/rp_widget.h"
|
||||
#include "ui/userpic_view.h"
|
||||
#include "ui/effects/animations.h"
|
||||
|
||||
class PeerData;
|
||||
class Image;
|
||||
|
||||
namespace Data {
|
||||
class CloudImageView;
|
||||
class PhotoMedia;
|
||||
} // namespace Data
|
||||
|
||||
@@ -51,7 +51,7 @@ private:
|
||||
Ui::RpWidget _content;
|
||||
|
||||
not_null<PeerData*> _peer;
|
||||
std::shared_ptr<Data::CloudImageView> _userpic;
|
||||
Ui::PeerUserpicView _userpic;
|
||||
std::shared_ptr<Data::PhotoMedia> _photo;
|
||||
Ui::Animations::Simple _mutedAnimation;
|
||||
QPixmap _userPhoto;
|
||||
|
||||
@@ -2427,8 +2427,8 @@ bool GroupCall::tryCreateController() {
|
||||
},
|
||||
};
|
||||
if (Logs::DebugEnabled()) {
|
||||
auto callLogFolder = cWorkingDir() + qsl("DebugLogs");
|
||||
auto callLogPath = callLogFolder + qsl("/last_group_call_log.txt");
|
||||
auto callLogFolder = cWorkingDir() + u"DebugLogs"_q;
|
||||
auto callLogPath = callLogFolder + u"/last_group_call_log.txt"_q;
|
||||
auto callLogNative = QDir::toNativeSeparators(callLogPath);
|
||||
descriptor.config.need_log = true;
|
||||
#ifdef Q_OS_WIN
|
||||
|
||||
@@ -350,7 +350,7 @@ void MembersRow::updateBlobAnimation(crl::time now) {
|
||||
}
|
||||
|
||||
void MembersRow::ensureUserpicCache(
|
||||
std::shared_ptr<Data::CloudImageView> &view,
|
||||
Ui::PeerUserpicView &view,
|
||||
int size) {
|
||||
Expects(_blobsAnimation != nullptr);
|
||||
|
||||
@@ -401,7 +401,7 @@ void MembersRow::paintBlobs(
|
||||
|
||||
void MembersRow::paintScaledUserpic(
|
||||
Painter &p,
|
||||
std::shared_ptr<Data::CloudImageView> &userpic,
|
||||
Ui::PeerUserpicView &userpic,
|
||||
int x,
|
||||
int y,
|
||||
int outerWidth,
|
||||
@@ -448,7 +448,8 @@ void MembersRow::paintMuteIcon(
|
||||
_delegate->rowPaintIcon(p, iconRect, computeIconState(style));
|
||||
}
|
||||
|
||||
auto MembersRow::generatePaintUserpicCallback() -> PaintRoundImageCallback {
|
||||
auto MembersRow::generatePaintUserpicCallback(bool forceRound)
|
||||
-> PaintRoundImageCallback {
|
||||
return [=](Painter &p, int x, int y, int outerWidth, int size) {
|
||||
const auto outer = outerWidth;
|
||||
paintComplexUserpic(p, x, y, outer, size, size, PanelMode::Default);
|
||||
|
||||
@@ -19,6 +19,7 @@ struct GroupCallParticipant;
|
||||
|
||||
namespace Ui {
|
||||
class RippleAnimation;
|
||||
struct PeerUserpicView;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Calls::Group {
|
||||
@@ -121,7 +122,8 @@ public:
|
||||
bool selected,
|
||||
bool actionSelected) override;
|
||||
|
||||
PaintRoundImageCallback generatePaintUserpicCallback() override;
|
||||
PaintRoundImageCallback generatePaintUserpicCallback(
|
||||
bool forceRound) override;
|
||||
void paintComplexUserpic(
|
||||
Painter &p,
|
||||
int x,
|
||||
@@ -180,7 +182,7 @@ private:
|
||||
void setVolume(int volume);
|
||||
|
||||
void ensureUserpicCache(
|
||||
std::shared_ptr<Data::CloudImageView> &view,
|
||||
Ui::PeerUserpicView &view,
|
||||
int size);
|
||||
void paintBlobs(
|
||||
Painter &p,
|
||||
@@ -190,7 +192,7 @@ private:
|
||||
int sizeh, PanelMode mode);
|
||||
void paintScaledUserpic(
|
||||
Painter &p,
|
||||
std::shared_ptr<Data::CloudImageView> &userpic,
|
||||
Ui::PeerUserpicView &userpic,
|
||||
int x,
|
||||
int y,
|
||||
int outerWidth,
|
||||
|
||||
@@ -59,7 +59,7 @@ private:
|
||||
const not_null<QAction*> _dummyAction;
|
||||
const style::Menu &_st;
|
||||
const not_null<PeerData*> _peer;
|
||||
std::shared_ptr<Data::CloudImageView> _userpicView;
|
||||
Ui::PeerUserpicView _userpicView;
|
||||
|
||||
Ui::Text::String _text;
|
||||
Ui::Text::String _name;
|
||||
|
||||