Compare commits
72 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2364dec9dd | ||
|
|
87fdb5d0f9 | ||
|
|
a96e90003b | ||
|
|
77b35891d4 | ||
|
|
917b1b86ea | ||
|
|
f143cec54e | ||
|
|
9048dd7fc4 | ||
|
|
7170a0e5c0 | ||
|
|
99d0d6defa | ||
|
|
a7a43e4031 | ||
|
|
e91f93bfed | ||
|
|
7b693013aa | ||
|
|
0f414c1d5a | ||
|
|
27de201bda | ||
|
|
03c8de6195 | ||
|
|
7a600e03d0 | ||
|
|
4a60a6e248 | ||
|
|
39d0b7c5cf | ||
|
|
1979f9ea2c | ||
|
|
14e2229503 | ||
|
|
9d0f1c4e43 | ||
|
|
5aecf2d3a3 | ||
|
|
d62d5908d1 | ||
|
|
074b825414 | ||
|
|
ecc6899b42 | ||
|
|
d01ef02c14 | ||
|
|
14d0b36f1b | ||
|
|
fc04717d96 | ||
|
|
7efb5df35c | ||
|
|
47a91e5d5f | ||
|
|
33aa925aa0 | ||
|
|
e145a0ccd0 | ||
|
|
6ab586c33e | ||
|
|
f9a9063e54 | ||
|
|
8b743ae751 | ||
|
|
9e1d5da5a1 | ||
|
|
e97cc9f172 | ||
|
|
3ce8d9f0b7 | ||
|
|
b23ffe6c94 | ||
|
|
276ef42c8f | ||
|
|
79a41d541d | ||
|
|
61e3f9000b | ||
|
|
a4c13e0720 | ||
|
|
a09460dc84 | ||
|
|
4bcfee22ef | ||
|
|
880c2697d1 | ||
|
|
188e1b61c5 | ||
|
|
696c5df092 | ||
|
|
408b38b41f | ||
|
|
4a6b6fad77 | ||
|
|
f7fa13899f | ||
|
|
f370e2b85d | ||
|
|
5d649f750b | ||
|
|
cfcf4d2336 | ||
|
|
922ab40c75 | ||
|
|
2532245413 | ||
|
|
85ca7e0f05 | ||
|
|
28c8d125cf | ||
|
|
799a81966a | ||
|
|
6333bc59b1 | ||
|
|
d953f894a1 | ||
|
|
868b9843b0 | ||
|
|
c89f13bb53 | ||
|
|
722c801f8a | ||
|
|
269e588ad0 | ||
|
|
4ee33d3bd9 | ||
|
|
85285d9862 | ||
|
|
84226635b2 | ||
|
|
8ed0cb7bf1 | ||
|
|
55649ad6c4 | ||
|
|
379c5f75e7 | ||
|
|
a75f57beb8 |
2
MSVC.md
@@ -137,7 +137,7 @@ There go to Qt directory
|
||||
|
||||
and after that run configure
|
||||
|
||||
configure -debug-and-release -opensource -confirm-license -static -opengl desktop -mp -nomake examples -platform win32-msvc2013
|
||||
configure -debug-and-release -opensource -confirm-license -static -I "D:\TBuild\Libraries\OpenSSL-Win32\include" -L "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib" -l Gdi32 -opengl desktop -openssl-linked OPENSSL_LIBS_DEBUG="D:\TBuild\Libraries\OpenSSL-Win32\lib\VC\static\ssleay32MTd.lib D:\TBuild\Libraries\OpenSSL-Win32\lib\VC\static\libeay32MTd.lib" OPENSSL_LIBS_RELEASE="D:\TBuild\Libraries\OpenSSL-Win32\lib\VC\static\ssleay32MT.lib D:\TBuild\Libraries\OpenSSL-Win32\lib\VC\static\libeay32MT.lib" -mp -nomake examples -platform win32-msvc2013
|
||||
|
||||
to configure Qt build. After configuration is complete run
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## [Telegram D](https://tdesktop.com) – Unofficial Telegram Desktop App
|
||||
## [Telegram Desktop](https://tdesktop.com) – Official Telegram Messenger app
|
||||
|
||||
This is complete source code and build instructions for alpha version of unofficial desktop client for [Telegram](https://telegram.org) messenger, based on [Telegram API](https://core.telegram.org/) and [MTProto](https://core.telegram.org/mtproto) secure protocol.
|
||||
This is complete source code and build instructions for alpha version of official desktop client for [Telegram](https://telegram.org) messenger, based on [Telegram API](https://core.telegram.org/) and [MTProto](https://core.telegram.org/mtproto) secure protocol.
|
||||
|
||||
Source code is published under GPL v3, license is available [here](https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE).
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
AppVersionStr=0.6.7
|
||||
AppVersion=6007
|
||||
AppVersion=`./Version.sh | awk -F " " '{print $1}'`
|
||||
AppVersionStr=`./Version.sh | awk -F " " '{print $2}'`
|
||||
|
||||
if [ ! -f "./../Linux/Release/deploy/$AppVersionStr/tlinuxupd$AppVersion" ]; then
|
||||
echo "tlinuxupd$AppVersion not found!";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
AppVersionStr=0.6.7
|
||||
AppVersion=6007
|
||||
AppVersion=`./Version.sh | awk -F " " '{print $1}'`
|
||||
AppVersionStr=`./Version.sh | awk -F " " '{print $2}'`
|
||||
|
||||
if [ ! -f "./../Linux/Release/deploy/$AppVersionStr/tlinux32upd$AppVersion" ]; then
|
||||
echo "tlinux32upd$AppVersion not found!"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
AppVersionStr=0.6.7
|
||||
AppVersion=6007
|
||||
AppVersion=`./Version.sh | awk -F " " '{print $1}'`
|
||||
AppVersionStr=`./Version.sh | awk -F " " '{print $2}'`
|
||||
|
||||
if [ ! -f "./../Mac/Release/deploy/$AppVersionStr/tmacupd$AppVersion" ]; then
|
||||
echo "tmacupd$AppVersion not found!"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
AppVersionStr=0.6.7
|
||||
AppVersion=6007
|
||||
AppVersion=`./Version.sh | awk -F " " '{print $1}'`
|
||||
AppVersionStr=`./Version.sh | awk -F " " '{print $2}'`
|
||||
|
||||
if [ ! -f "./../Win32/Deploy/deploy/$AppVersionStr/tupdate$AppVersion" ]; then
|
||||
echo "tupdate$AppVersion not found!"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
AppVersionStr=0.6.7
|
||||
AppVersion=6007
|
||||
AppVersion=`./Version.sh | awk -F " " '{print $1}'`
|
||||
AppVersionStr=`./Version.sh | awk -F " " '{print $2}'`
|
||||
|
||||
if [ -d "./../Linux/Release/deploy/$AppVersionStr" ]; then
|
||||
echo "Deploy folder for version $AppVersionStr already exists!"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
AppVersionStr=0.6.7
|
||||
AppVersion=6007
|
||||
AppVersion=`./Version.sh | awk -F " " '{print $1}'`
|
||||
AppVersionStr=`./Version.sh | awk -F " " '{print $2}'`
|
||||
|
||||
if [ -d "./../Linux/Release/deploy/$AppVersionStr" ]; then
|
||||
echo "Deploy folder for version $AppVersionStr already exists!"
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
AppVersionStr=0.6.7
|
||||
AppVersion=6007
|
||||
AppVersion=`./Version.sh | awk -F " " '{print $1}'`
|
||||
AppVersionStr=`./Version.sh | awk -F " " '{print $2}'`
|
||||
|
||||
echo ""
|
||||
echo "Preparing version $AppVersionStr.."
|
||||
echo ""
|
||||
|
||||
if [ -d "./../Mac/Release/deploy/$AppVersionStr" ]; then
|
||||
echo "Deploy folder for version $AppVersionStr already exists!"
|
||||
@@ -16,11 +20,6 @@ if [ ! -d "./../Mac/Release/Telegram.app" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "./../Mac/Release/Telegram.app/Contents/_CodeSignature" ]; then
|
||||
echo "Telegram signature not found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "./../Mac/Release/Telegram.app/Contents/Resources/Icon.icns" ]; then
|
||||
echo "Icon.icns not found in Resources!"
|
||||
exit 1
|
||||
@@ -36,25 +35,32 @@ if [ ! -f "./../Mac/Release/Telegram.app/Contents/Frameworks/Updater" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "./../Mac/Release/Telegram.app.dmg" ]; then
|
||||
echo "Telegram.app.dmg not found!"
|
||||
if [ ! -d "./../Mac/Release/Telegram.app/Contents/_CodeSignature" ]; then
|
||||
echo "Telegram signature not found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Preparing version $AppVersionStr, executing Packer.."
|
||||
cd ./../Mac/Release
|
||||
temppath=`hdiutil attach -readwrite tsetup.dmg | awk -F "\t" 'END {print $3}'`
|
||||
cp -R ./Telegram.app "$temppath/"
|
||||
bless --folder "$temppath/" --openfolder "$temppath/"
|
||||
hdiutil detach "$temppath"
|
||||
hdiutil convert tsetup.dmg -format UDZO -imagekey zlib-level=9 -ov -o tsetup.$AppVersionStr.dmg
|
||||
cd ./../../Telegram
|
||||
cd ./../Mac/Release && ./Packer.app/Contents/MacOS/Packer -path Telegram.app -version $AppVersion && cd ./../../Telegram
|
||||
echo "Packer done!"
|
||||
|
||||
if [ ! -d "./../Mac/Release/deploy/" ]; then
|
||||
mkdir "./../Mac/Release/deploy"
|
||||
fi
|
||||
|
||||
echo "Copying Telegram.app and tmacupd$AppVersion to deploy/$AppVersionStr..";
|
||||
mkdir "./../Mac/Release/deploy/$AppVersionStr"
|
||||
mkdir "./../Mac/Release/deploy/$AppVersionStr/Telegram"
|
||||
cp -r ./../Mac/Release/Telegram.app ./../Mac/Release/deploy/$AppVersionStr/Telegram/
|
||||
rm ./../Mac/Release/Telegram.app/Contents/MacOS/Telegram
|
||||
rm ./../Mac/Release/Telegram.app/Contents/Frameworks/Updater
|
||||
rm -rf ./../Mac/Release/Telegram.app/Contents/_CodeSignature
|
||||
mv ./../Mac/Release/tmacupd$AppVersion ./../Mac/Release/deploy/$AppVersionStr/
|
||||
mv ./../Mac/Release/Telegram.app.dmg ./../Mac/Release/deploy/$AppVersionStr/tsetup.$AppVersionStr.dmg
|
||||
mv ./../Mac/Release/tsetup.$AppVersionStr.dmg ./../Mac/Release/deploy/$AppVersionStr/tsetup.$AppVersionStr.dmg
|
||||
echo "Version $AppVersionStr prepared!";
|
||||
|
||||
|
||||
@@ -1,6 +1,49 @@
|
||||
@echo OFF
|
||||
|
||||
set "AppVersionStrSmall=0.6.17"
|
||||
set "AppVersionStr=0.6.17"
|
||||
set "AppVersionStrFull=0.6.17.0"
|
||||
|
||||
echo.
|
||||
echo Preparing version %AppVersionStr%..
|
||||
echo.
|
||||
|
||||
set "PATH=%PATH%;C:\Program Files\7-Zip;C:\Program Files (x86)\Inno Setup 5"
|
||||
cd ..\Win32\Deploy
|
||||
call ..\..\..\TelegramPrivate\Sign.bat tsetup.0.6.7.exe
|
||||
|
||||
call ..\..\..\TelegramPrivate\Sign.bat Telegram.exe
|
||||
if %errorlevel% neq 0 goto error1
|
||||
|
||||
call ..\..\..\TelegramPrivate\Sign.bat Updater.exe
|
||||
if %errorlevel% neq 0 goto error1
|
||||
|
||||
iscc /dMyAppVersion=%AppVersionStrSmall% /dMyAppVersionZero=%AppVersionStr% /dMyAppFullVersion=%AppVersionStrFull% ..\..\Telegram\Setup.iss
|
||||
if %errorlevel% neq 0 goto error1
|
||||
|
||||
call ..\..\..\TelegramPrivate\Sign.bat tsetup.%AppVersionStr%.exe
|
||||
if %errorlevel% neq 0 goto error1
|
||||
|
||||
call Prepare.exe -path Telegram.exe -path Updater.exe
|
||||
mkdir deploy\0.6.7\Telegram
|
||||
move deploy\0.6.7\Telegram.exe deploy\0.6.7\Telegram\
|
||||
if %errorlevel% neq 0 goto error1
|
||||
|
||||
cd deploy\%AppVersionStr%
|
||||
mkdir Telegram
|
||||
move Telegram.exe Telegram\
|
||||
7z a -mx9 tportable.%AppVersionStr%.zip Telegram\
|
||||
if %errorlevel% neq 0 goto error2
|
||||
|
||||
echo .
|
||||
echo Version %AppVersionStr% is ready for deploy!
|
||||
echo .
|
||||
|
||||
cd ..\..\..\..\Telegram
|
||||
goto eof
|
||||
|
||||
:error2
|
||||
cd ..\..
|
||||
:error1
|
||||
cd ..\..\Telegram
|
||||
echo ERROR occured!
|
||||
exit /b %errorlevel%
|
||||
|
||||
:eof
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,15 +13,17 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
direction: "LTR";
|
||||
|
||||
lng_maintitle: "Telegram D";
|
||||
lng_maintitle: "Telegram Desktop";
|
||||
|
||||
lng_menu_contacts: "Contacts";
|
||||
lng_menu_settings: "Settings";
|
||||
lng_menu_about: "About";
|
||||
lng_menu_update: "Update";
|
||||
lng_menu_restart: "Restart";
|
||||
|
||||
lng_open_from_tray: "Open Telegram";
|
||||
lng_minimize_to_tray: "Minimize to tray";
|
||||
@@ -57,11 +59,16 @@ lng_month_day: "{month} {day}";
|
||||
|
||||
lng_cancel: "Cancel";
|
||||
lng_continue: "Continue";
|
||||
lng_close: "Close";
|
||||
lng_connecting: "Connecting..";
|
||||
lng_reconnecting: "Reconnect in %1 s..";
|
||||
lng_reconnecting_try_now: "Try now";
|
||||
|
||||
lng_status_offline: "offline";
|
||||
lng_status_service_notifications: "service notifications";
|
||||
lng_status_offline: "last seen a long time ago";
|
||||
lng_status_recently: "last seen recently";
|
||||
lng_status_last_week: "last seen within a week";
|
||||
lng_status_last_month: "last seen within a month";
|
||||
lng_status_invisible: "invisible";
|
||||
lng_status_lastseen: "last seen {when}";
|
||||
lng_status_lastseen_now: "just now";
|
||||
@@ -84,14 +91,12 @@ lng_server_error: "Internal server error.";
|
||||
lng_flood_error: "Too much tries. Please try again later.";
|
||||
lng_deleted: "Unknown";
|
||||
|
||||
lng_intro1: "Welcome to an unofficial [b]desktop[/b] client
|
||||
of [b]Telegram[/b] mobile messenger.";
|
||||
lng_intro2: "Visit [a href=\"https://telegram.org/\"]telegram.org[/a] to learn more.";
|
||||
lng_start_msgs: "Start Messaging";
|
||||
lng_intro: "Welcome to the official [a href=\"https://telegram.org/\"]Telegram[/a] desktop app.
|
||||
It's [b]fast[/b] and [b]secure[/b].";
|
||||
lng_start_msgs: "START MESSAGING";
|
||||
|
||||
lng_intro_back: "Back";
|
||||
lng_intro_next: "Next";
|
||||
lng_intro_finish: "Finish";
|
||||
lng_intro_next: "NEXT";
|
||||
lng_intro_finish: "SIGN UP";
|
||||
|
||||
lng_phone_ph: "Your phone number";
|
||||
lng_phone_title: "Your Phone";
|
||||
@@ -107,7 +112,7 @@ lng_country_none: "Country not found";
|
||||
lng_country_select: "Select Country";
|
||||
|
||||
lng_code_ph: "Your code";
|
||||
lng_code_desc: "We have sent you an SMS with activation
|
||||
lng_code_desc: "We have sent you a message with activation
|
||||
code to your phone. Please enter it below.";
|
||||
lng_code_call: "Telegram will dial your number in %1:%2";
|
||||
lng_code_calling: "Requesting a call from Telegram..";
|
||||
@@ -121,6 +126,8 @@ lng_bad_chat_title: "Please enter new chat title.";
|
||||
lng_bad_photo: "Bad image selected.";
|
||||
|
||||
lng_signup_title: "Information and photo";
|
||||
lng_signup_desc: "Please enter your name and
|
||||
upload a photo.";
|
||||
lng_signup_firstname: "First Name";
|
||||
lng_signup_lastname: "Last Name";
|
||||
|
||||
@@ -129,6 +136,9 @@ lng_dlg_conversations: "Conversations";
|
||||
lng_dlg_messages: "Messages";
|
||||
lng_dlg_new_group_name: "Group name";
|
||||
lng_dlg_create_group: "Create";
|
||||
lng_no_contacts: "You have no contacts";
|
||||
lng_contacts_loading: "Loading..";
|
||||
lng_contacts_not_found: "No contacts found";
|
||||
|
||||
lng_settings_profile: "Profile";
|
||||
lng_settings_edit: "Edit";
|
||||
@@ -150,6 +160,9 @@ Minimum length is 5 characters.";
|
||||
lng_username_invalid: "This name is invalid.";
|
||||
lng_username_occupied: "This name is already occupied.";
|
||||
lng_username_too_short: "This name is too short.";
|
||||
lng_username_bad_symbols: "This name has bad symbols.";
|
||||
lng_username_available: "This name is available.";
|
||||
lng_username_not_found: "User @{user} not found.";
|
||||
|
||||
lng_settings_section_contact_info: "Contact info";
|
||||
lng_settings_phone_number: "Phone number:";
|
||||
@@ -215,6 +228,15 @@ lng_download_path_clearing: "Clearing..";
|
||||
lng_download_path_cleared: "Cleared!";
|
||||
lng_download_path_clear_failed: "Clear failed :(";
|
||||
|
||||
lng_settings_section_cache: "Local storage";
|
||||
lng_settings_no_images_cached: "No cached images found!";
|
||||
lng_settings_image_cached: "Cached: {count} image, {size}";
|
||||
lng_settings_images_cached: "Cached: {count} images, {size}";
|
||||
lng_local_images_clear: "Clear All";
|
||||
lng_local_images_clearing: "Clearing..";
|
||||
lng_local_images_cleared: "Cleared!";
|
||||
lng_local_images_clear_failed: "Clear failed :(";
|
||||
|
||||
lng_settings_section_advanced: "Advanced";
|
||||
lng_connection_type: "Connection type:";
|
||||
lng_connection_auto_connecting: "Default (connecting..)";
|
||||
@@ -233,6 +255,7 @@ lng_connection_save: "Save";
|
||||
lng_settings_reset: "Reset other sessions";
|
||||
lng_settings_reset_done: "Sessions reset done";
|
||||
lng_settings_logout: "Log Out";
|
||||
lng_sure_logout: "Are you sure you want to log out?";
|
||||
|
||||
lng_settings_need_restart: "You need to restart for applying
|
||||
some of the new settings. Restart now?";
|
||||
@@ -439,7 +462,7 @@ lng_selected_delete_confirm: "Delete";
|
||||
lng_emoji_no_recent: "Recent emojis will be here";
|
||||
|
||||
lng_about_version: "Version {version}";
|
||||
lng_about_text: "Unofficial free messaging app based on [a href=\"https://core.telegram.org/mtproto\"]MTProto[/a] and
|
||||
lng_about_text: "Official free messaging app based on [a href=\"https://core.telegram.org/mtproto\"]MTProto[/a] and
|
||||
[a href=\"https://core.telegram.org/api\"]Telegram API[/a] for speed and security
|
||||
|
||||
This software is licensed under [a href=\"https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\"]GNU GPL[/a] version 3,
|
||||
@@ -473,5 +496,22 @@ lng_mac_always_open_with: "Always Open With";
|
||||
lng_mac_this_app_can_open: "This application can open \"{file}\".";
|
||||
lng_mac_not_known_app: "It's not known if this application can open \"{file}\".";
|
||||
|
||||
// Keys finished
|
||||
lng_mac_menu_about: "About Telegram";
|
||||
lng_mac_menu_preferences: "Preferences...";
|
||||
lng_mac_menu_file: "File";
|
||||
lng_mac_menu_logout: "Log Out";
|
||||
lng_mac_menu_edit: "Edit";
|
||||
lng_mac_menu_undo: "Undo";
|
||||
lng_mac_menu_redo: "Redo";
|
||||
lng_mac_menu_cut: "Cut";
|
||||
lng_mac_menu_copy: "Copy";
|
||||
lng_mac_menu_paste: "Paste";
|
||||
lng_mac_menu_delete: "Delete";
|
||||
lng_mac_menu_select_all: "Select All";
|
||||
lng_mac_menu_window: "Window";
|
||||
lng_mac_menu_contacts: "Contacts";
|
||||
lng_mac_menu_add_contact: "Add Contact";
|
||||
lng_mac_menu_new_group: "New Group";
|
||||
lng_mac_menu_show: "Show Telegram";
|
||||
|
||||
// Keys finished
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
defaultFontFamily: 'Open Sans';
|
||||
semibold: 'Open Sans Semibold';
|
||||
@@ -29,7 +29,7 @@ emojiPadding: 0px;
|
||||
counterBG: #f23c34;
|
||||
counterMuteBG: #888;
|
||||
counterColor: #fff;
|
||||
counterMacInvColor: #045fd5;
|
||||
counterMacInvColor: #ffffff01;
|
||||
|
||||
lineWidth: 1px;
|
||||
|
||||
@@ -86,6 +86,7 @@ sysUpd: sysButton {
|
||||
overColor: white;
|
||||
duration: 150;
|
||||
}
|
||||
updateBlinkDuration: 500;
|
||||
sysMin: sysButton(sysUpd) {
|
||||
img: sprite(207px, 1px, 19px, 19px);
|
||||
}
|
||||
@@ -305,20 +306,18 @@ labelDefFlat: flatLabel {
|
||||
align: align(left);
|
||||
}
|
||||
|
||||
introSkip: 20px;
|
||||
introBtnTop: 288px;
|
||||
introSkip: 45px;
|
||||
introFinishSkip: 15px;
|
||||
introHeaderFont: font(28px);
|
||||
introPhotoSize: 98px;
|
||||
introHeaderFont: font(24px);
|
||||
introHeaderSkip: 14px;
|
||||
introFont: font(17px);
|
||||
introVersionFont: introFont;
|
||||
introVersionColor: #9b9b9b;
|
||||
introVersionSkip: 10px;
|
||||
intro2Skip: 60px;
|
||||
intro1Skip: 14px;
|
||||
introIconSkip: 54px;
|
||||
introFont: font(16px);
|
||||
introColor: black;
|
||||
|
||||
introLabel: flatLabel(labelDefFlat) {
|
||||
font: introFont;
|
||||
align: align(center);
|
||||
}
|
||||
|
||||
introPointsTop: -30px; // intro steps bottom points
|
||||
@@ -349,31 +348,28 @@ introHideFunc: transition(easeInCirc);
|
||||
introShowFunc: transition(easeOutCirc);
|
||||
introAlphaHideFunc: transition(easeOutCirc);
|
||||
introAlphaShowFunc: transition(easeInCirc);
|
||||
introTextSize: size(400px, 97px);
|
||||
|
||||
introTitleFont: font(24px);
|
||||
introDescFont: font(18px);
|
||||
introTextTop: 22px;
|
||||
introTextSize: size(400px, 93px);
|
||||
introCallSkip: 15px;
|
||||
|
||||
btnIntroSep: 12px;
|
||||
btnIntroNext: flatButton(btnDefNext, btnDefBig) {
|
||||
width: 144px;
|
||||
}
|
||||
btnIntroBack: flatButton(btnIntroNext, btnDefBack) {
|
||||
}
|
||||
textTop: 16px;
|
||||
overTextTop: 16px;
|
||||
downTextTop: 17px;
|
||||
|
||||
font: font(17px);
|
||||
overFont: font(17px);
|
||||
|
||||
btnIntroStart: flatButton(btnIntroNext) {
|
||||
width: 300px;
|
||||
}
|
||||
btnIntroFinish: flatButton(btnIntroNext) {
|
||||
width: 240px;
|
||||
}
|
||||
|
||||
boxShadow: sprite(240px, 21px, 9px, 9px);
|
||||
|
||||
introCountry: countryInput {
|
||||
width: 300px;
|
||||
height: 41px;
|
||||
top: 24px;
|
||||
top: 33px;
|
||||
bgColor: #f2f2f2;
|
||||
ptrSize: size(15px, 8px);
|
||||
textMrg: margins(16px, 5px, 16px, 15px);
|
||||
@@ -396,13 +392,14 @@ inpIntroCode: flatInput(inpDefGray) {
|
||||
textMrg: margins(12px, 5px, 12px, 6px);
|
||||
width: 106px;
|
||||
height: 41px;
|
||||
align: align(center);
|
||||
|
||||
phPos: point(0px, 0px);
|
||||
phAlign: align(center);
|
||||
phShift: 0px;
|
||||
}
|
||||
inpIntroName: flatInput(inpIntroPhone) {
|
||||
width: 240px;
|
||||
width: 192px;
|
||||
}
|
||||
|
||||
introSelectDelta: 30px;
|
||||
@@ -464,8 +461,6 @@ countriesBackShowFunc: transition(linear);
|
||||
countriesAlphaHideFunc: transition(easeOutCirc);
|
||||
countriesAlphaShowFunc: transition(easeInCirc);
|
||||
|
||||
introBtnTop: 244px;
|
||||
|
||||
introErrWidth: 450px;
|
||||
introErrDuration: 200;
|
||||
introErrFunc: transition(linear);
|
||||
@@ -477,6 +472,7 @@ introErrFont: font(16px);
|
||||
|
||||
introErrLabel: flatLabel(labelDefFlat) {
|
||||
font: introErrFont;
|
||||
align: align(center);
|
||||
}
|
||||
|
||||
setWidth: 356px;
|
||||
@@ -505,15 +501,17 @@ setScroll: flatScroll(scrollDef) {
|
||||
topsh: 0px;
|
||||
}
|
||||
setClose: iconedButton(btnDefIconed) {
|
||||
icon: sprite(245px, 221px, 43px, 43px);
|
||||
icon: sprite(245px, 221px, 40px, 40px);
|
||||
iconPos: point(0px, 0px);
|
||||
downIcon: sprite(245px, 221px, 43px, 43px);
|
||||
downIcon: sprite(245px, 221px, 40px, 40px);
|
||||
downIconPos: point(0px, 0px);
|
||||
|
||||
opacity: 0.71;
|
||||
|
||||
width: 43px;
|
||||
height: 43px;
|
||||
}
|
||||
setClosePos: point(18px, 18px);
|
||||
setClosePos: point(32px, 32px);
|
||||
setPhotoImg: sprite(0px, 220px, 120px, 120px);
|
||||
setOverPhotoImg: sprite(122px, 220px, 120px, 120px);
|
||||
setPhotoDuration: 150;
|
||||
@@ -534,6 +532,7 @@ setErrBG: #ffa5a5;
|
||||
setErrColor: #800000;
|
||||
setErrHeight: 30px;
|
||||
setErrFont: font(fsize);
|
||||
setGoodColor: #008000;
|
||||
|
||||
btnSetUpload: flatButton(btnDefNext, btnDefBig) {
|
||||
width: 206px;
|
||||
@@ -597,22 +596,9 @@ dlgPaddingVer: 8px;
|
||||
dlgHeight: 62px;
|
||||
dlgPhotoPadding: 12px;
|
||||
|
||||
dlgState: switcher {
|
||||
border: 2px;
|
||||
borderColor: btnNextBG;
|
||||
|
||||
bgColor: #fff;
|
||||
bgHovered: btnWhiteHover;
|
||||
bgActive: btnNextBG;
|
||||
|
||||
height: 34px;
|
||||
|
||||
font: font(fsize);
|
||||
textColor: btnYesColor;
|
||||
activeColor: #fff;
|
||||
|
||||
duration: 200;
|
||||
}
|
||||
noContactsHeight: 100px;
|
||||
noContactsFont: font(fsize);
|
||||
noContactsColor: #777;
|
||||
|
||||
dlgSep: 8px;
|
||||
|
||||
@@ -855,6 +841,12 @@ dlgActiveTextStyle: textStyle(defaultTextStyle) {
|
||||
lnkDownColor: dlgActiveColor;
|
||||
lnkOverFlags: font(fsize);
|
||||
}
|
||||
introLabelTextStyle: textStyle(defaultTextStyle) {
|
||||
lineHeight: 30px;
|
||||
}
|
||||
introErrLabelTextStyle: textStyle(defaultTextStyle) {
|
||||
lineHeight: 27px;
|
||||
}
|
||||
|
||||
mediaMaxWidth: 250px;
|
||||
mediaFont: font(fsize);
|
||||
@@ -1280,6 +1272,9 @@ aboutCloseButton: flatButton(contactsClose) {
|
||||
overTextTop: 15px;
|
||||
downTextTop: 16px;
|
||||
}
|
||||
btnInfoClose: flatButton(aboutCloseButton) {
|
||||
width: confirmWidth;
|
||||
}
|
||||
|
||||
emojiTextFont: font(16px);
|
||||
emojiReplaceWidth: 56px;
|
||||
@@ -1572,10 +1567,13 @@ medviewPhotoSpritePos: point(14px, 14px);
|
||||
|
||||
overviewPhotoSkip: 10px;
|
||||
overviewPhotoMinSize: 100px;
|
||||
overviewPhotoCheck: sprite(245px, 308px, 32px, 32px);
|
||||
overviewPhotoChecked: sprite(278px, 308px, 32px, 32px);
|
||||
overviewPhotoSelectOverlay: #0a7bb03f;
|
||||
|
||||
// Mac specific
|
||||
|
||||
macAccessoryHeight: 90;
|
||||
macAccessory: size(450, 90);
|
||||
macEnableFilterAdd: 2;
|
||||
macEnableFilterTop: 5;
|
||||
macSelectorTop: 6;
|
||||
@@ -1621,6 +1619,7 @@ mediaviewLoaderSkip: 9px;
|
||||
|
||||
minPhotoWidth: 90px;
|
||||
minPhotoHeight: 90px;
|
||||
maxMediaSize: 420px;
|
||||
|
||||
usernameFont: font(14px);
|
||||
usernameColor: #777;
|
||||
@@ -1635,3 +1634,7 @@ usernameDone: flatButton(btnSelectDone) {
|
||||
usernameCancel: flatButton(btnSelectCancel) {
|
||||
width: 167px;
|
||||
}
|
||||
|
||||
youtubeIcon: sprite(336px, 221px, 60px, 60px);
|
||||
vimeoIcon: sprite(336px, 283px, 60px, 60px);
|
||||
locationSize: size(320, 240);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
textStyle {
|
||||
lnkFlags: font;
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
|
||||
#define MyAppShortName "Telegram"
|
||||
#define MyAppName "Telegram Desktop"
|
||||
#define MyAppVersion "0.6.7"
|
||||
#define MyAppVersionZero "0.6.7"
|
||||
#define MyAppFullVersion "0.6.7.0"
|
||||
#define MyAppPublisher "Telegram Messenger LLP"
|
||||
#define MyAppURL "https://tdesktop.com"
|
||||
#define MyAppExeName "Telegram.exe"
|
||||
@@ -28,7 +25,7 @@ DefaultGroupName={#MyAppName}
|
||||
AllowNoIcons=yes
|
||||
OutputDir=.\..\Win32\Deploy
|
||||
OutputBaseFilename=tsetup.{#MyAppVersionZero}
|
||||
SetupIconFile=.\SourceFiles\art\iconround256.ico
|
||||
SetupIconFile=.\SourceFiles\art\icon256.ico
|
||||
UninstallDisplayIcon={app}\Telegram.exe
|
||||
Compression=lzma
|
||||
SolidCompression=yes
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
codesign --force --deep --sign "Developer ID Application: John Preston" ./../Mac/Release/Telegram.app
|
||||
@@ -1,4 +0,0 @@
|
||||
cd ..\Win32\Deploy
|
||||
call ..\..\..\TelegramPrivate\Sign.bat Telegram.exe
|
||||
call ..\..\..\TelegramPrivate\Sign.bat Updater.exe
|
||||
cd ..\..\Telegram
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "genemoji.h"
|
||||
|
||||
@@ -78,11 +78,11 @@ EmojiReplace replaces[] = {
|
||||
{0xD83DDE37U, ":X"},
|
||||
{0xD83DDE1AU, ":-*"},
|
||||
{0xD83DDE08U, "}:)"},
|
||||
{0x2764FE0FU, "<3"},
|
||||
{0x2764U, "<3"},
|
||||
{0xD83DDC4DU, ":like:"},
|
||||
{0xD83DDC4EU, ":dislike:"},
|
||||
{0x261DFE0FU, ":up:"},
|
||||
{0x270CFE0FU, ":v:"},
|
||||
{0x261DU, ":up:"},
|
||||
{0x270CU, ":v:"},
|
||||
{0xD83DDC4CU, ":ok:"}
|
||||
};
|
||||
const uint32 replacesCount = sizeof(replaces) / sizeof(EmojiReplace);
|
||||
@@ -102,7 +102,7 @@ uint64 emojiCategory0[] = {
|
||||
0xD83DDE03LLU,
|
||||
0xD83DDE00LLU,
|
||||
0xD83DDE0ALLU,
|
||||
0x263AFE0FLLU,
|
||||
0x263ALLU,
|
||||
0xD83DDE09LLU,
|
||||
0xD83DDE0DLLU,
|
||||
0xD83DDE18LLU,
|
||||
@@ -208,7 +208,7 @@ uint64 emojiCategory0[] = {
|
||||
0xD83DDC4CLLU,
|
||||
0xD83DDC4ALLU,
|
||||
0x270ALLU,
|
||||
0x270CFE0FLLU,
|
||||
0x270CLLU,
|
||||
0xD83DDC4BLLU,
|
||||
0x270BLLU,
|
||||
0xD83DDC50LLU,
|
||||
@@ -218,7 +218,7 @@ uint64 emojiCategory0[] = {
|
||||
0xD83DDC48LLU,
|
||||
0xD83DDE4CLLU,
|
||||
0xD83DDE4FLLU,
|
||||
0x261DFE0FLLU,
|
||||
0x261DLLU,
|
||||
0xD83DDC4FLLU,
|
||||
0xD83DDCAALLU,
|
||||
0xD83DDEB6LLU,
|
||||
@@ -270,7 +270,7 @@ uint64 emojiCategory0[] = {
|
||||
0xD83DDC99LLU,
|
||||
0xD83DDC9CLLU,
|
||||
0xD83DDC9ALLU,
|
||||
0x2764FE0FLLU,
|
||||
0x2764LLU,
|
||||
0xD83DDC94LLU,
|
||||
0xD83DDC97LLU,
|
||||
0xD83DDC93LLU,
|
||||
@@ -395,12 +395,12 @@ uint64 emojiCategory1[] = {
|
||||
0xD83CDF0CLLU,
|
||||
0xD83CDF20LLU,
|
||||
0x2B50LLU,
|
||||
0x2600FE0FLLU,
|
||||
0x2600LLU,
|
||||
0x26C5LLU,
|
||||
0x2601FE0FLLU,
|
||||
0x2601LLU,
|
||||
0x26A1LLU,
|
||||
0x2614LLU,
|
||||
0x2744FE0FLLU,
|
||||
0x2744LLU,
|
||||
0x26C4LLU,
|
||||
0xD83CDF00LLU,
|
||||
0xD83CDF01LLU,
|
||||
@@ -440,7 +440,7 @@ uint64 emojiCategory2[] = {
|
||||
0xD83DDCBELLU,
|
||||
0xD83DDCBBLLU,
|
||||
0xD83DDCF1LLU,
|
||||
0x260EFE0FLLU,
|
||||
0x260ELLU,
|
||||
0xD83DDCDELLU,
|
||||
0xD83DDCDFLLU,
|
||||
0xD83DDCE0LLU,
|
||||
@@ -497,7 +497,7 @@ uint64 emojiCategory2[] = {
|
||||
0xD83DDCE7LLU,
|
||||
0xD83DDCE5LLU,
|
||||
0xD83DDCE4LLU,
|
||||
0x2709FE0FLLU,
|
||||
0x2709LLU,
|
||||
0xD83DDCE9LLU,
|
||||
0xD83DDCE8LLU,
|
||||
0xD83DDCEFLLU,
|
||||
@@ -521,11 +521,11 @@ uint64 emojiCategory2[] = {
|
||||
0xD83DDCC7LLU,
|
||||
0xD83DDCC1LLU,
|
||||
0xD83DDCC2LLU,
|
||||
0x2702FE0FLLU,
|
||||
0x2702LLU,
|
||||
0xD83DDCCCLLU,
|
||||
0xD83DDCCELLU,
|
||||
0x2712FE0FLLU,
|
||||
0x270FFE0FLLU,
|
||||
0x2712LLU,
|
||||
0x270FLLU,
|
||||
0xD83DDCCFLLU,
|
||||
0xD83DDCD0LLU,
|
||||
0xD83DDCD5LLU,
|
||||
@@ -564,7 +564,7 @@ uint64 emojiCategory2[] = {
|
||||
0xD83CDFC8LLU,
|
||||
0xD83CDFC0LLU,
|
||||
0x26BDLLU,
|
||||
0x26BEFE0FLLU,
|
||||
0x26BELLU,
|
||||
0xD83CDFBELLU,
|
||||
0xD83CDFB1LLU,
|
||||
0xD83CDFC9LLU,
|
||||
@@ -680,7 +680,7 @@ uint64 emojiCategory3[] = {
|
||||
0xD83DDEA3LLU,
|
||||
0x2693LLU,
|
||||
0xD83DDE80LLU,
|
||||
0x2708FE0FLLU,
|
||||
0x2708LLU,
|
||||
0xD83DDCBALLU,
|
||||
0xD83DDE81LLU,
|
||||
0xD83DDE82LLU,
|
||||
@@ -721,13 +721,13 @@ uint64 emojiCategory3[] = {
|
||||
0xD83CDFABLLU,
|
||||
0xD83DDEA6LLU,
|
||||
0xD83DDEA5LLU,
|
||||
0x26A0FE0FLLU,
|
||||
0x26A0LLU,
|
||||
0xD83DDEA7LLU,
|
||||
0xD83DDD30LLU,
|
||||
0x26FDLLU,
|
||||
0xD83CDFEELLU,
|
||||
0xD83CDFB0LLU,
|
||||
0x2668FE0FLLU,
|
||||
0x2668LLU,
|
||||
0xD83DDDFFLLU,
|
||||
0xD83CDFAALLU,
|
||||
0xD83CDFADLLU,
|
||||
@@ -760,33 +760,33 @@ uint64 emojiCategory4[] = {
|
||||
0xD83DDD22LLU,
|
||||
0x2320E3LLU,
|
||||
0xD83DDD23LLU,
|
||||
0x2B06FE0FLLU,
|
||||
0x2B07FE0FLLU,
|
||||
0x2B05FE0FLLU,
|
||||
0x27A1FE0FLLU,
|
||||
0x2B06LLU,
|
||||
0x2B07LLU,
|
||||
0x2B05LLU,
|
||||
0x27A1LLU,
|
||||
0xD83DDD20LLU,
|
||||
0xD83DDD21LLU,
|
||||
0xD83DDD24LLU,
|
||||
0x2197FE0FLLU,
|
||||
0x2196FE0FLLU,
|
||||
0x2198FE0FLLU,
|
||||
0x2199FE0FLLU,
|
||||
0x2194FE0FLLU,
|
||||
0x2195FE0FLLU,
|
||||
0x2197LLU,
|
||||
0x2196LLU,
|
||||
0x2198LLU,
|
||||
0x2199LLU,
|
||||
0x2194LLU,
|
||||
0x2195LLU,
|
||||
0xD83DDD04LLU,
|
||||
0x25C0FE0FLLU,
|
||||
0x25B6FE0FLLU,
|
||||
0x25C0LLU,
|
||||
0x25B6LLU,
|
||||
0xD83DDD3CLLU,
|
||||
0xD83DDD3DLLU,
|
||||
0x21A9FE0FLLU,
|
||||
0x21AAFE0FLLU,
|
||||
0x2139FE0FLLU,
|
||||
0x21A9LLU,
|
||||
0x21AALLU,
|
||||
0x2139LLU,
|
||||
0x23EALLU,
|
||||
0x23E9LLU,
|
||||
0x23EBLLU,
|
||||
0x23ECLLU,
|
||||
0x2935FE0FLLU,
|
||||
0x2934FE0FLLU,
|
||||
0x2935LLU,
|
||||
0x2934LLU,
|
||||
0xD83CDD97LLU,
|
||||
0xD83DDD00LLU,
|
||||
0xD83DDD01LLU,
|
||||
@@ -802,8 +802,8 @@ uint64 emojiCategory4[] = {
|
||||
0xD83CDE2FLLU,
|
||||
0xD83CDE33LLU,
|
||||
0xD83CDE35LLU,
|
||||
0xD83CDE32LLU,
|
||||
0xD83CDE34LLU,
|
||||
0xD83CDE32LLU,
|
||||
0xD83CDE50LLU,
|
||||
0xD83CDE39LLU,
|
||||
0xD83CDE3ALLU,
|
||||
@@ -822,14 +822,14 @@ uint64 emojiCategory4[] = {
|
||||
0xD83CDE37LLU,
|
||||
0xD83CDE38LLU,
|
||||
0xD83CDE02LLU,
|
||||
0x24C2FE0FLLU,
|
||||
0x24C2LLU,
|
||||
0xD83DDEC2LLU,
|
||||
0xD83DDEC4LLU,
|
||||
0xD83DDEC5LLU,
|
||||
0xD83DDEC3LLU,
|
||||
0xD83CDE51LLU,
|
||||
0x3299FE0FLLU,
|
||||
0x3297FE0FLLU,
|
||||
0x3299LLU,
|
||||
0x3297LLU,
|
||||
0xD83CDD91LLU,
|
||||
0xD83CDD98LLU,
|
||||
0xD83CDD94LLU,
|
||||
@@ -842,11 +842,11 @@ uint64 emojiCategory4[] = {
|
||||
0xD83DDEB7LLU,
|
||||
0xD83DDEB8LLU,
|
||||
0x26D4LLU,
|
||||
0x2733FE0FLLU,
|
||||
0x2747FE0FLLU,
|
||||
0x2733LLU,
|
||||
0x2747LLU,
|
||||
0x274ELLU,
|
||||
0x2705LLU,
|
||||
0x2734FE0FLLU,
|
||||
0x2734LLU,
|
||||
0xD83DDC9FLLU,
|
||||
0xD83CDD9ALLU,
|
||||
0xD83DDCF3LLU,
|
||||
@@ -857,7 +857,7 @@ uint64 emojiCategory4[] = {
|
||||
0xD83CDD7ELLU,
|
||||
0xD83DDCA0LLU,
|
||||
0x27BFLLU,
|
||||
0x267BFE0FLLU,
|
||||
0x267BLLU,
|
||||
0x2648LLU,
|
||||
0x2649LLU,
|
||||
0x264ALLU,
|
||||
@@ -880,8 +880,8 @@ uint64 emojiCategory4[] = {
|
||||
0xAELLU,
|
||||
0x2122LLU,
|
||||
0x274CLLU,
|
||||
0x203CFE0FLLU,
|
||||
0x2049FE0FLLU,
|
||||
0x203CLLU,
|
||||
0x2049LLU,
|
||||
0x2757LLU,
|
||||
0x2753LLU,
|
||||
0x2755LLU,
|
||||
@@ -921,26 +921,26 @@ uint64 emojiCategory4[] = {
|
||||
0x2795LLU,
|
||||
0x2796LLU,
|
||||
0x2797LLU,
|
||||
0x2660FE0FLLU,
|
||||
0x2665FE0FLLU,
|
||||
0x2663FE0FLLU,
|
||||
0x2666FE0FLLU,
|
||||
0x2660LLU,
|
||||
0x2665LLU,
|
||||
0x2663LLU,
|
||||
0x2666LLU,
|
||||
0xD83DDCAELLU,
|
||||
0xD83DDCAFLLU,
|
||||
0x2714FE0FLLU,
|
||||
0x2611FE0FLLU,
|
||||
0x2714LLU,
|
||||
0x2611LLU,
|
||||
0xD83DDD18LLU,
|
||||
0xD83DDD17LLU,
|
||||
0x27B0LLU,
|
||||
0x3030LLU,
|
||||
0x303DFE0FLLU,
|
||||
0x303DLLU,
|
||||
0xD83DDD31LLU,
|
||||
0x25FCFE0FLLU,
|
||||
0x25FBFE0FLLU,
|
||||
0x25FCLLU,
|
||||
0x25FBLLU,
|
||||
0x25FELLU,
|
||||
0x25FDLLU,
|
||||
0x25AAFE0FLLU,
|
||||
0x25ABFE0FLLU,
|
||||
0x25AALLU,
|
||||
0x25ABLLU,
|
||||
0xD83DDD3ALLU,
|
||||
0xD83DDD32LLU,
|
||||
0xD83DDD33LLU,
|
||||
@@ -957,61 +957,105 @@ uint64 emojiCategory4[] = {
|
||||
0xD83DDD39LLU,
|
||||
};
|
||||
|
||||
uint64 emojiClones[] = {
|
||||
0x263ALLU,
|
||||
0x270CLLU,
|
||||
0x261DLLU,
|
||||
0x2764LLU,
|
||||
0x2600LLU,
|
||||
0x2601LLU,
|
||||
0x2744LLU,
|
||||
0x260ELLU,
|
||||
0x2709LLU,
|
||||
0x2702LLU,
|
||||
0x2712LLU,
|
||||
0x270FLLU,
|
||||
0x26BELLU,
|
||||
0x2708LLU,
|
||||
0x26A0LLU,
|
||||
0x2668LLU,
|
||||
0x2B06LLU,
|
||||
0x2B07LLU,
|
||||
0x2B05LLU,
|
||||
0x27A1LLU,
|
||||
0x2197LLU,
|
||||
0x2196LLU,
|
||||
0x2198LLU,
|
||||
0x2199LLU,
|
||||
0x2194LLU,
|
||||
0x2195LLU,
|
||||
0x25C0LLU,
|
||||
0x25B6LLU,
|
||||
0x21A9LLU,
|
||||
0x21AALLU,
|
||||
0x2139LLU,
|
||||
0x2935LLU,
|
||||
0x2934LLU,
|
||||
0x24C2LLU,
|
||||
0x3299LLU,
|
||||
0x3297LLU,
|
||||
0x2733LLU,
|
||||
0x2747LLU,
|
||||
0x2734LLU,
|
||||
0x267BLLU,
|
||||
uint64 emojiPostfixed[] = {
|
||||
0x203CLLU,
|
||||
0x2049LLU,
|
||||
0x2660LLU,
|
||||
0x2665LLU,
|
||||
0x2663LLU,
|
||||
0x2666LLU,
|
||||
0x2714LLU,
|
||||
0x2611LLU,
|
||||
0x303DLLU,
|
||||
0x25FCLLU,
|
||||
0x25FBLLU,
|
||||
0x2139LLU,
|
||||
0x2194LLU,
|
||||
0x2195LLU,
|
||||
0x2196LLU,
|
||||
0x2197LLU,
|
||||
0x2198LLU,
|
||||
0x2199LLU,
|
||||
0x21A9LLU,
|
||||
0x21AALLU,
|
||||
0x231ALLU,
|
||||
0x231BLLU,
|
||||
0x24C2LLU,
|
||||
0x25AALLU,
|
||||
0x25ABLLU,
|
||||
0x25B6LLU,
|
||||
0x25C0LLU,
|
||||
0x25FBLLU,
|
||||
0x25FCLLU,
|
||||
0x25FDLLU,
|
||||
0x25FELLU,
|
||||
0x2600LLU,
|
||||
0x2601LLU,
|
||||
0x260ELLU,
|
||||
0x2611LLU,
|
||||
0x2614LLU,
|
||||
0x2615LLU,
|
||||
0x261DLLU,
|
||||
0x263ALLU,
|
||||
0x2648LLU,
|
||||
0x2649LLU,
|
||||
0x264ALLU,
|
||||
0x264BLLU,
|
||||
0x264CLLU,
|
||||
0x264DLLU,
|
||||
0x264ELLU,
|
||||
0x264FLLU,
|
||||
0x2650LLU,
|
||||
0x2651LLU,
|
||||
0x2652LLU,
|
||||
0x2653LLU,
|
||||
0x2660LLU,
|
||||
0x2663LLU,
|
||||
0x2665LLU,
|
||||
0x2666LLU,
|
||||
0x2668LLU,
|
||||
0x267BLLU,
|
||||
0x267FLLU,
|
||||
0x2693LLU,
|
||||
0x26A0LLU,
|
||||
0x26A1LLU,
|
||||
0x26AALLU,
|
||||
0x26ABLLU,
|
||||
0x26BDLLU,
|
||||
0x26BELLU,
|
||||
0x26C4LLU,
|
||||
0x26C5LLU,
|
||||
0x26D4LLU,
|
||||
0x26EALLU,
|
||||
0x26F2LLU,
|
||||
0x26F3LLU,
|
||||
0x26F5LLU,
|
||||
0x26FALLU,
|
||||
0x26FDLLU,
|
||||
0x2702LLU,
|
||||
0x2708LLU,
|
||||
0x2709LLU,
|
||||
0x270CLLU,
|
||||
0x270FLLU,
|
||||
0x2712LLU,
|
||||
0x2714LLU,
|
||||
0x2716LLU,
|
||||
0x2733LLU,
|
||||
0x2734LLU,
|
||||
0x2744LLU,
|
||||
0x2747LLU,
|
||||
0x2757LLU,
|
||||
0x2764LLU,
|
||||
0x27A1LLU,
|
||||
0x2934LLU,
|
||||
0x2935LLU,
|
||||
0x2B05LLU,
|
||||
0x2B06LLU,
|
||||
0x2B07LLU,
|
||||
0x2B50LLU,
|
||||
0x2B55LLU,
|
||||
0x2B1BLLU,
|
||||
0x2B1CLLU,
|
||||
0x303DLLU,
|
||||
0x3297LLU,
|
||||
0x3299LLU,
|
||||
0xD83CDC04LLU,
|
||||
0xD83CDD7FLLU,
|
||||
0xD83CDE1ALLU,
|
||||
0xD83CDE2FLLU,
|
||||
};
|
||||
QMap<uint64, bool> emojiWithPostfixes;
|
||||
|
||||
uint32 firstCode(uint64 fullCode) {
|
||||
return (fullCode > 0xFFFFFFFFLLU) ? uint32(fullCode >> 32) : (fullCode & 0xFFFFFFFFU);
|
||||
@@ -1046,7 +1090,7 @@ void writeEmojiCategory(QTextStream &tcpp, uint64 *emojiCategory, uint32 size, c
|
||||
|
||||
bool genEmoji(QString emoji_in, const QString &emoji_out, const QString &emoji_png) {
|
||||
int currentRow = 0, currentColumn = 0;
|
||||
uint32 min1 = 0xFFFFFFFFU, max1 = 0, min2 = 0xFFFFFFFFU, max2 = 0, min3 = 0xFFFFFFFFU, max3 = 0;
|
||||
uint32 min1 = 0xFFFFFFFFU, max1 = 0, min2 = 0xFFFFFFFFU, max2 = 0;
|
||||
|
||||
QImage sprites[5];
|
||||
int emojisInRow[] = { 27, 29, 33, 34, 34 }; // [[7,27],[4,29],[7,33],[3,34],[6,34]]
|
||||
@@ -1100,13 +1144,8 @@ bool genEmoji(QString emoji_in, const QString &emoji_out, const QString &emoji_p
|
||||
}
|
||||
} else if (high == 35 || (high >= 48 && high < 58)) { // digits
|
||||
} else {
|
||||
if (high < 0xD000) {
|
||||
if (data.code < min2) min2 = data.code;
|
||||
if (data.code > max2) max2 = data.code;
|
||||
} else {
|
||||
if (data.code < min3) min3 = data.code;
|
||||
if (data.code > max3) max3 = data.code;
|
||||
}
|
||||
if (data.code < min2) min2 = data.code;
|
||||
if (data.code > max2) max2 = data.code;
|
||||
}
|
||||
EmojisData::const_iterator k = emojisData.constFind(data.code);
|
||||
if (k != emojisData.cend()) {
|
||||
@@ -1170,23 +1209,8 @@ bool genEmoji(QString emoji_in, const QString &emoji_out, const QString &emoji_p
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0, l = sizeof(emojiClones) / sizeof(emojiClones[0]); i < l; ++i) {
|
||||
uint64 cloneCode = emojiClones[i], originalCode = (cloneCode << 16) | 0xFE0F;
|
||||
EmojisData::const_iterator j = emojisData.constFind(originalCode);
|
||||
if (j == emojisData.cend()) {
|
||||
cout << "Could not find data for emoji clone 0x" << QString::number(cloneCode, 16).toUpper().toUtf8().constData() << "!\n";
|
||||
return false;
|
||||
}
|
||||
EmojiData clone;
|
||||
clone.code = firstCode(cloneCode);
|
||||
clone.code2 = secondCode(cloneCode);
|
||||
clone.category = -1;
|
||||
clone.index = -1;
|
||||
clone.x = j->x;
|
||||
clone.y = j->y;
|
||||
emojisData.insert(cloneCode, clone);
|
||||
if (clone.code < min1) min1 = clone.code;
|
||||
if (clone.code > max1) max1 = clone.code;
|
||||
for (int i = 0, l = sizeof(emojiPostfixed) / sizeof(emojiPostfixed[0]); i < l; ++i) {
|
||||
emojiWithPostfixes.insert(emojiPostfixed[i], true);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -1201,7 +1225,7 @@ Created from emoji config by \'/MetaEmoji\' project\n\
|
||||
WARNING! All changes made in this file will be lost!\n\
|
||||
\n\
|
||||
This file is part of Telegram Desktop, \n\
|
||||
an unofficial desktop messaging app, see https://telegram.org\n\
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org\n\
|
||||
\n\
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify\n\
|
||||
it under the terms of the GNU General Public License as published by\n\
|
||||
@@ -1214,7 +1238,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
|
||||
GNU General Public License for more details.\n\
|
||||
\n\
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com\n\
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\
|
||||
*/\n";
|
||||
tcpp << "#include \"stdafx.h\"\n#include \"gui/emoji_config.h\"\n\n";
|
||||
|
||||
@@ -1229,7 +1253,8 @@ Copyright (c) 2014 John Preston, https://tdesktop.com\n\
|
||||
tcpp << "\tEmojiData *toFill = emojis = (EmojiData*)emojisData;\n\n";
|
||||
for (EmojisData::const_iterator i = emojisData.cbegin(), e = emojisData.cend(); i != e; ++i) {
|
||||
int len = i->code2 ? 4 : ((i->code >> 16) ? 2 : 1);
|
||||
tcpp << "\tnew (toFill++) EmojiData(" << (i->x * imSize) << ", " << (i->y * imSize) << ", 0x" << QString("%1").arg(i->code, 0, 16).toUpper().toUtf8().constData() << "U, 0x" << QString("%1").arg(i->code2, 0, 16).toUpper().toUtf8().constData() << "U, " << len << ");\n";
|
||||
bool withPostfix = emojiWithPostfixes.constFind(i->code) != emojiWithPostfixes.constEnd();
|
||||
tcpp << "\tnew (toFill++) EmojiData(" << (i->x * imSize) << ", " << (i->y * imSize) << ", 0x" << QString("%1").arg(i->code, 0, 16).toUpper().toUtf8().constData() << "U, 0x" << QString("%1").arg(i->code2, 0, 16).toUpper().toUtf8().constData() << "U, " << len << (withPostfix ? ", 0xFE0F" : "") << ");\n";
|
||||
}
|
||||
tcpp << "}\n\n";
|
||||
}
|
||||
@@ -1283,18 +1308,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com\n\
|
||||
tcpp << "\t\treturn 0;\n";
|
||||
tcpp << "\t}\n\n";
|
||||
|
||||
tcpp << "\tif (code >= 0x" << QString("%1").arg(min2, 0, 16).toUpper().toUtf8().constData() << "U && code <= 0x" << QString("%1").arg(max2, 0, 16).toUpper().toUtf8().constData() << "U) {\n";
|
||||
tcpp << "\t\tif ((code & 0xFFFFU) != 0xFE0F) return 0;\n\n";
|
||||
tcpp << "\t\tswitch (code) {\n";
|
||||
for (; i != e; ++i) {
|
||||
if (i->code2 || ((i->code >> 16) >= 0xD000)) break;
|
||||
tcpp << "\t\t\tcase 0x" << QString("%1").arg(i->code, 0, 16).toUpper().toUtf8().constData() << "U: return &emojis[" << (index++) << "];\n";
|
||||
}
|
||||
tcpp << "\t\t}\n\n";
|
||||
tcpp << "\t\treturn 0;\n";
|
||||
tcpp << "\t}\n\n";
|
||||
|
||||
tcpp << "\tif (code < 0x" << QString("%1").arg(min3, 0, 16).toUpper().toUtf8().constData() << "U || code > 0x" << QString("%1").arg(max3, 0, 16).toUpper().toUtf8().constData() << "U) return 0;\n\n";
|
||||
tcpp << "\tif (code < 0x" << QString("%1").arg(min2, 0, 16).toUpper().toUtf8().constData() << "U || code > 0x" << QString("%1").arg(max2, 0, 16).toUpper().toUtf8().constData() << "U) return 0;\n\n";
|
||||
tcpp << "\tswitch (code) {\n";
|
||||
for (; i != e; ++i) {
|
||||
tcpp << "\tcase 0x" << QString("%1").arg(i->code, 0, 16).toUpper().toUtf8().constData() << "U: return &emojis[" << (index++) << "];\n";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QVector>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "genlang.h"
|
||||
|
||||
@@ -220,7 +220,7 @@ Created from \'/Resources/lang.txt\' by \'/MetaLang\' project\n\
|
||||
WARNING! All changes made in this file will be lost!\n\
|
||||
\n\
|
||||
This file is part of Telegram Desktop,\n\
|
||||
an unofficial desktop messaging app, see https://telegram.org\n\
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org\n\
|
||||
\n\
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify\n\
|
||||
it under the terms of the GNU General Public License as published by\n\
|
||||
@@ -233,7 +233,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
|
||||
GNU General Public License for more details.\n\
|
||||
\n\
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com\n\
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\
|
||||
*/\n";
|
||||
th << "#pragma once\n\n";
|
||||
th << "enum LangKey {\n";
|
||||
@@ -283,7 +283,7 @@ Created from \'/Resources/lang.txt\' by \'/MetaLang\' project\n\
|
||||
WARNING! All changes made in this file will be lost!\n\
|
||||
\n\
|
||||
This file is part of Telegram Desktop,\n\
|
||||
an unofficial desktop messaging app, see https://telegram.org\n\
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org\n\
|
||||
\n\
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify\n\
|
||||
it under the terms of the GNU General Public License as published by\n\
|
||||
@@ -296,7 +296,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
|
||||
GNU General Public License for more details.\n\
|
||||
\n\
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com\n\
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\
|
||||
*/\n";
|
||||
tcpp << "#include \"stdafx.h\"\n#include \"lang.h\"\n\n";
|
||||
tcpp << "namespace {\n";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QVector>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "genstyles.h"
|
||||
|
||||
@@ -361,7 +361,7 @@ Created from \'/Resources/style_classes.txt\' by \'/MetaStyle\' project\n\
|
||||
WARNING! All changes made in this file will be lost!\n\
|
||||
\n\
|
||||
This file is part of Telegram Desktop,\n\
|
||||
an unofficial desktop messaging app, see https://telegram.org\n\
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org\n\
|
||||
\n\
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify\n\
|
||||
it under the terms of the GNU General Public License as published by\n\
|
||||
@@ -374,7 +374,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
|
||||
GNU General Public License for more details.\n\
|
||||
\n\
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com\n\
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\
|
||||
*/\n";
|
||||
tout << "#pragma once\n\n#include \"style.h\"\n\nnamespace style {\n";
|
||||
for (int i = 0, l = byIndex.size(); i < l; ++i) {
|
||||
@@ -1498,7 +1498,7 @@ Created from \'/Resources/style.txt\' by \'/MetaStyle\' project\n\
|
||||
WARNING! All changes made in this file will be lost!\n\
|
||||
\n\
|
||||
This file is part of Telegram Desktop,\n\
|
||||
an unofficial desktop messaging app, see https://telegram.org\n\
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org\n\
|
||||
\n\
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify\n\
|
||||
it under the terms of the GNU General Public License as published by\n\
|
||||
@@ -1511,7 +1511,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
|
||||
GNU General Public License for more details.\n\
|
||||
\n\
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com\n\
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\
|
||||
*/\n";
|
||||
tout << "#pragma once\n\n#include \"style.h\"\n\nnamespace st {\n";
|
||||
tcpp << "\
|
||||
@@ -1521,7 +1521,7 @@ Created from \'/Resources/style.txt\' by \'/MetaStyle\' project\n\
|
||||
WARNING! All changes made in this file will be lost!\n\
|
||||
\n\
|
||||
This file is part of Telegram Desktop,\n\
|
||||
an unofficial desktop messaging app, see https://telegram.org\n\
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org\n\
|
||||
\n\
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify\n\
|
||||
it under the terms of the GNU General Public License as published by\n\
|
||||
@@ -1534,7 +1534,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
|
||||
GNU General Public License for more details.\n\
|
||||
\n\
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com\n\
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\
|
||||
*/\n";
|
||||
tcpp << "#include \"stdafx.h\"\n#include \"style_auto.h\"\n\nnamespace {\n";
|
||||
for (int i = 0, l = scalars.size(); i < l; ++i) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QVector>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "memain.h"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "mlmain.h"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "msmain.h"
|
||||
#include <QtCore/QDir>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "packer.h"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "prepare.h"
|
||||
|
||||
@@ -94,6 +94,5 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
int res = prepare(f, paths);
|
||||
system("PAUSE");
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,13 +13,13 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "updater.h"
|
||||
|
||||
bool _debug = false;
|
||||
|
||||
wstring exeName, exeDir;
|
||||
wstring exeName, exeDir, updateTo;
|
||||
|
||||
bool equal(const wstring &a, const wstring &b) {
|
||||
return !_wcsicmp(a.c_str(), b.c_str());
|
||||
@@ -133,7 +133,7 @@ bool update() {
|
||||
wstring dir = dirs.front();
|
||||
dirs.pop_front();
|
||||
|
||||
wstring toDir = exeDir;
|
||||
wstring toDir = updateTo;
|
||||
if (dir.size() > updDir.size() + 1) {
|
||||
toDir += (dir.substr(updDir.size() + 1) + L"\\");
|
||||
forcedirs.push_back(toDir);
|
||||
@@ -161,7 +161,7 @@ bool update() {
|
||||
}
|
||||
} else {
|
||||
wstring fname = dir + L"\\" + findData.cFileName;
|
||||
wstring tofname = exeDir + fname.substr(updDir.size() + 1);
|
||||
wstring tofname = updateTo + fname.substr(updDir.size() + 1);
|
||||
if (equal(tofname, exeName)) { // bad update - has Updater.exe - delete all dir
|
||||
writeLog(L"Error: bad update, has Updater.exe! '" + tofname + L"' equal '" + exeName + L"'");
|
||||
delFolder();
|
||||
@@ -230,10 +230,9 @@ bool update() {
|
||||
}
|
||||
|
||||
void updateRegistry() {
|
||||
writeLog(L"Updating registry..");
|
||||
|
||||
HANDLE versionFile = CreateFile(L"tdata\\version", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
|
||||
HANDLE versionFile = CreateFile((updateTo + L"tdata\\version").c_str(), GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
|
||||
if (versionFile != INVALID_HANDLE_VALUE) {
|
||||
writeLog(L"Updating registry..");
|
||||
DWORD versionNum = 0, versionLen = 0, readLen = 0;
|
||||
WCHAR versionStr[32];
|
||||
if (ReadFile(versionFile, &versionNum, sizeof(DWORD), &readLen, NULL) != TRUE || readLen != sizeof(DWORD)) {
|
||||
@@ -284,7 +283,7 @@ void updateRegistry() {
|
||||
wsprintf(dateStr, L"%04d%02d%02d", stLocalTime.wYear, stLocalTime.wMonth, stLocalTime.wDay);
|
||||
RegSetValueEx(rkey, L"InstallDate", 0, REG_SZ, (BYTE*)dateStr, (wcslen(dateStr) + 1) * sizeof(WCHAR));
|
||||
|
||||
WCHAR *appURL = L"https://tdesktop.com";
|
||||
WCHAR *appURL = L"https://desktop.telegram.org";
|
||||
RegSetValueEx(rkey, L"HelpLink", 0, REG_SZ, (BYTE*)appURL, (wcslen(appURL) + 1) * sizeof(WCHAR));
|
||||
RegSetValueEx(rkey, L"URLInfoAbout", 0, REG_SZ, (BYTE*)appURL, (wcslen(appURL) + 1) * sizeof(WCHAR));
|
||||
RegSetValueEx(rkey, L"URLUpdateInfo", 0, REG_SZ, (BYTE*)appURL, (wcslen(appURL) + 1) * sizeof(WCHAR));
|
||||
@@ -296,6 +295,8 @@ void updateRegistry() {
|
||||
RegCloseKey(rkey);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
writeLog(L"Could not open version file to update registry :(");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,7 +314,7 @@ int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParama
|
||||
LPWSTR *args;
|
||||
int argsCount;
|
||||
|
||||
bool needupdate = false, autostart = false, debug = false;
|
||||
bool needupdate = false, autostart = false, debug = false, writeprotected = false;
|
||||
args = CommandLineToArgvW(GetCommandLine(), &argsCount);
|
||||
if (args) {
|
||||
for (int i = 1; i < argsCount; ++i) {
|
||||
@@ -324,10 +325,19 @@ int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParama
|
||||
} else if (equal(args[i], L"-debug")) {
|
||||
debug = _debug = true;
|
||||
openLog();
|
||||
} else if (equal(args[i], L"-writeprotected") && ++i < argsCount) {
|
||||
writeprotected = true;
|
||||
updateTo = args[i];
|
||||
for (int i = 0, l = updateTo.size(); i < l; ++i) {
|
||||
if (updateTo[i] == L'/') {
|
||||
updateTo[i] = L'\\';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (needupdate) writeLog(L"Need to update!");
|
||||
if (autostart) writeLog(L"From autostart!");
|
||||
if (writeprotected) writeLog(L"Write Protected folder!");
|
||||
|
||||
exeName = args[0];
|
||||
writeLog(L"Exe name is: " + exeName);
|
||||
@@ -335,9 +345,20 @@ int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParama
|
||||
if (equal(exeName.substr(exeName.size() - 11), L"Updater.exe")) {
|
||||
exeDir = exeName.substr(0, exeName.size() - 11);
|
||||
writeLog(L"Exe dir is: " + exeDir);
|
||||
if (!writeprotected) {
|
||||
updateTo = exeDir;
|
||||
}
|
||||
writeLog(L"Update to: " + updateTo);
|
||||
if (needupdate && update()) {
|
||||
updateRegistry();
|
||||
}
|
||||
if (writeprotected) { // if we can't clear all tupdates\ready (Updater.exe is there) - clear only version
|
||||
if (DeleteFile(L"tupdates\\ready\\tdata\\version")) {
|
||||
writeLog(L"Version file deleted!");
|
||||
} else {
|
||||
writeLog(L"Error: could not delete version file");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
writeLog(L"Error: bad exe name!");
|
||||
}
|
||||
@@ -349,11 +370,56 @@ int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParama
|
||||
writeLog(L"Error: No command line arguments!");
|
||||
}
|
||||
|
||||
wstring targs = L"-noupdate";
|
||||
wstring targs;
|
||||
if (autostart) targs += L" -autostart";
|
||||
if (debug) targs += L" -debug";
|
||||
|
||||
ShellExecute(0, 0, (exeDir + L"Telegram.exe").c_str(), targs.c_str(), 0, SW_SHOWNORMAL);
|
||||
bool executed = false;
|
||||
if (writeprotected) { // run un-elevated
|
||||
writeLog(L"Trying to run un-elevated by temp.lnk");
|
||||
|
||||
HRESULT hres = CoInitialize(0);
|
||||
if (SUCCEEDED(hres)) {
|
||||
wstring lnk = L"tupdates\\ready\\temp.lnk";
|
||||
IShellLink* psl;
|
||||
HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*)&psl);
|
||||
if (SUCCEEDED(hres)) {
|
||||
IPersistFile* ppf;
|
||||
|
||||
wstring exe = updateTo + L"Telegram.exe", dir = updateTo;
|
||||
psl->SetArguments((targs.size() ? targs.substr(1) : targs).c_str());
|
||||
psl->SetPath(exe.c_str());
|
||||
psl->SetWorkingDirectory(dir.c_str());
|
||||
psl->SetDescription(L"");
|
||||
|
||||
hres = psl->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf);
|
||||
|
||||
if (SUCCEEDED(hres)) {
|
||||
hres = ppf->Save(lnk.c_str(), TRUE);
|
||||
ppf->Release();
|
||||
|
||||
if (SUCCEEDED(hres)) {
|
||||
writeLog(L"Executing un-elevated through link..");
|
||||
ShellExecute(0, 0, L"explorer.exe", lnk.c_str(), 0, SW_SHOWNORMAL);
|
||||
executed = true;
|
||||
} else {
|
||||
writeLog(L"Error: ppf->Save failed");
|
||||
}
|
||||
} else {
|
||||
writeLog(L"Error: Could not create interface IID_IPersistFile");
|
||||
}
|
||||
psl->Release();
|
||||
} else {
|
||||
writeLog(L"Error: could not create instance of IID_IShellLink");
|
||||
}
|
||||
CoUninitialize();
|
||||
} else {
|
||||
writeLog(L"Error: Could not initialize COM");
|
||||
}
|
||||
}
|
||||
if (!executed) {
|
||||
ShellExecute(0, 0, (updateTo + L"Telegram.exe").c_str(), (L"-noupdate" + targs).c_str(), 0, SW_SHOWNORMAL);
|
||||
}
|
||||
|
||||
writeLog(L"Executed Telegram.exe, closing log and quiting..");
|
||||
closeLog();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include <cstdio>
|
||||
#include <sys/stat.h>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@@ -64,11 +64,17 @@ int main(int argc, const char * argv[]) {
|
||||
if (!path) {
|
||||
return -1;
|
||||
}
|
||||
NSRange range = [path rangeOfString:appName options:NSBackwardsSearch];
|
||||
NSRange range = [path rangeOfString:@".app/" options:NSBackwardsSearch];
|
||||
if (range.location == NSNotFound) {
|
||||
return -1;
|
||||
}
|
||||
appDir = [path substringToIndex:range.location > 0 ? range.location : 0];
|
||||
path = [path substringToIndex:range.location > 0 ? range.location : 0];
|
||||
|
||||
range = [path rangeOfString:@"/" options:NSBackwardsSearch];
|
||||
NSString *appRealName = (range.location == NSNotFound) ? path : [path substringFromIndex:range.location + 1];
|
||||
appRealName = [[NSArray arrayWithObjects:appRealName, @".app", nil] componentsJoinedByString:@""];
|
||||
appDir = (range.location == NSNotFound) ? @"" : [path substringToIndex:range.location + 1];
|
||||
NSString *appDirFull = [appDir stringByAppendingString:appRealName];
|
||||
|
||||
openLog();
|
||||
pid_t procId = 0;
|
||||
@@ -144,11 +150,12 @@ int main(int argc, const char * argv[]) {
|
||||
break;
|
||||
}
|
||||
NSString *pathPart = [srcPath substringFromIndex:r.length];
|
||||
if ([pathPart rangeOfString:appName].location != 0) {
|
||||
r = [pathPart rangeOfString:appName];
|
||||
if (r.location != 0) {
|
||||
writeLog([@"Skipping not app file " stringByAppendingString:srcPath]);
|
||||
continue;
|
||||
}
|
||||
NSString *dstPath = [appDir stringByAppendingString:pathPart];
|
||||
NSString *dstPath = [appDirFull stringByAppendingString:[pathPart substringFromIndex:r.length]];
|
||||
NSError *error;
|
||||
NSNumber *isDirectory = nil;
|
||||
writeLog([[NSArray arrayWithObjects: @"Copying file ", srcPath, @" to ", dstPath, nil] componentsJoinedByString:@""]);
|
||||
@@ -180,7 +187,7 @@ int main(int argc, const char * argv[]) {
|
||||
delFolder();
|
||||
}
|
||||
|
||||
NSString *appPath = [[NSArray arrayWithObjects:appDir, appName, nil] componentsJoinedByString:@""];
|
||||
NSString *appPath = [[NSArray arrayWithObjects:appDir, appRealName, nil] componentsJoinedByString:@""];
|
||||
NSMutableArray *args = [[NSMutableArray alloc] initWithObjects:@"-noupdate", nil];
|
||||
if (toSettings) [args addObject:@"-tosettings"];
|
||||
if (_debug) [args addObject:@"-debug"];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "lang.h"
|
||||
@@ -26,6 +26,8 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
#include "mainwidget.h"
|
||||
#include <libexif/exif-data.h>
|
||||
|
||||
#include "localstorage.h"
|
||||
|
||||
namespace {
|
||||
bool quiting = false;
|
||||
|
||||
@@ -43,6 +45,9 @@ namespace {
|
||||
typedef QHash<AudioId, AudioData*> AudiosData;
|
||||
AudiosData audiosData;
|
||||
|
||||
typedef QHash<QString, ImageLinkData*> ImageLinksData;
|
||||
ImageLinksData imageLinksData;
|
||||
|
||||
typedef QHash<DocumentId, DocumentData*> DocumentsData;
|
||||
DocumentsData documentsData;
|
||||
|
||||
@@ -111,7 +116,7 @@ namespace App {
|
||||
bool loggedOut() {
|
||||
Window *w(wnd());
|
||||
if (w) {
|
||||
w->tempDirDelete();
|
||||
w->tempDirDelete(Local::ClearManagerAll);
|
||||
w->notifyClearFast();
|
||||
w->setupIntro(true);
|
||||
}
|
||||
@@ -162,6 +167,31 @@ namespace App {
|
||||
return (peer_id & 0x100000000L) ? int32(peer_id & 0xFFFFFFFFL) : 0;
|
||||
}
|
||||
|
||||
int32 onlineForSort(int32 online, int32 now) {
|
||||
if (online <= 0) {
|
||||
switch (online) {
|
||||
case -2: {
|
||||
QDate yesterday(date(now).date());
|
||||
yesterday.addDays(-3);
|
||||
return int32(QDateTime(yesterday).toTime_t());
|
||||
} break;
|
||||
|
||||
case -3: {
|
||||
QDate weekago(date(now).date());
|
||||
weekago.addDays(-7);
|
||||
return int32(QDateTime(weekago).toTime_t());
|
||||
} break;
|
||||
|
||||
case -4: {
|
||||
QDate monthago(date(now).date());
|
||||
monthago.addDays(-30);
|
||||
return int32(QDateTime(monthago).toTime_t());
|
||||
} break;
|
||||
}
|
||||
}
|
||||
return online;
|
||||
}
|
||||
|
||||
int32 onlineWillChangeIn(int32 online, int32 now) {
|
||||
if (online <= 0) return 86400;
|
||||
if (online > now) {
|
||||
@@ -179,9 +209,20 @@ namespace App {
|
||||
return dNow.secsTo(dTomorrow);
|
||||
}
|
||||
|
||||
QString onlineText(int32 online, int32 now, bool precise) {
|
||||
if (!online) return lang(lng_status_offline);
|
||||
if (online < 0) return lang(lng_status_invisible);
|
||||
QString onlineText(UserData *user, int32 now, bool precise) {
|
||||
if (isServiceUser(user->id)) {
|
||||
return lang(lng_status_service_notifications);
|
||||
}
|
||||
int32 online = user->onlineTill;
|
||||
if (online <= 0) {
|
||||
switch (online) {
|
||||
case 0: return lang(lng_status_offline);
|
||||
case -2: return lang(lng_status_recently);
|
||||
case -3: return lang(lng_status_last_week);
|
||||
case -4: return lang(lng_status_last_month);
|
||||
}
|
||||
return lang(lng_status_invisible);
|
||||
}
|
||||
if (online > now) {
|
||||
return lang(lng_status_online);
|
||||
}
|
||||
@@ -224,11 +265,12 @@ namespace App {
|
||||
return lang(lng_status_lastseen).replace(qsl("{when}"), when);
|
||||
}
|
||||
|
||||
void feedUsers(const MTPVector<MTPUser> &users) {
|
||||
UserData *feedUsers(const MTPVector<MTPUser> &users) {
|
||||
UserData *data = 0;
|
||||
const QVector<MTPUser> &v(users.c_vector().v);
|
||||
for (QVector<MTPUser>::const_iterator i = v.cbegin(), e = v.cend(); i != e; ++i) {
|
||||
const MTPuser &user(*i);
|
||||
UserData *data = 0;
|
||||
data = 0;
|
||||
bool wasContact = false;
|
||||
const MTPUserStatus *status = 0;
|
||||
|
||||
@@ -274,7 +316,10 @@ namespace App {
|
||||
data->contact = -1;
|
||||
status = &d.vstatus;
|
||||
|
||||
::self = data;
|
||||
if (::self != data) {
|
||||
::self = data;
|
||||
if (App::wnd()) App::wnd()->updateGlobalMenu();
|
||||
}
|
||||
} break;
|
||||
case mtpc_userContact: {
|
||||
const MTPDuserContact &d(user.c_userContact());
|
||||
@@ -299,7 +344,7 @@ namespace App {
|
||||
data->input = MTP_inputPeerForeign(d.vid, d.vaccess_hash);
|
||||
data->inputUser = MTP_inputUserForeign(d.vid, d.vaccess_hash);
|
||||
data->setPhone(qs(d.vphone));
|
||||
data->setName(textOneLine(qs(d.vfirst_name)), textOneLine(qs(d.vlast_name)), (data->id != 333000 && !data->phone.isEmpty()) ? formatPhone(data->phone) : QString(), textOneLine(qs(d.vusername)));
|
||||
data->setName(textOneLine(qs(d.vfirst_name)), textOneLine(qs(d.vlast_name)), (!isServiceUser(data->id) && !data->phone.isEmpty()) ? formatPhone(data->phone) : QString(), textOneLine(qs(d.vusername)));
|
||||
data->setPhoto(d.vphoto);
|
||||
data->access = d.vaccess_hash.v;
|
||||
wasContact = (data->contact > 0);
|
||||
@@ -326,6 +371,10 @@ namespace App {
|
||||
|
||||
data->loaded = true;
|
||||
if (status) switch (status->type()) {
|
||||
case mtpc_userStatusEmpty: data->onlineTill = 0; break;
|
||||
case mtpc_userStatusRecently: data->onlineTill = -2; break;
|
||||
case mtpc_userStatusLastWeek: data->onlineTill = -3; break;
|
||||
case mtpc_userStatusLastMonth: data->onlineTill = -4; break;
|
||||
case mtpc_userStatusOffline: data->onlineTill = status->c_userStatusOffline().vwas_online.v; break;
|
||||
case mtpc_userStatusOnline: data->onlineTill = status->c_userStatusOnline().vexpires.v; break;
|
||||
}
|
||||
@@ -341,6 +390,8 @@ namespace App {
|
||||
|
||||
if (App::main()) App::main()->peerUpdated(data);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void feedChats(const MTPVector<MTPChat> &chats) {
|
||||
@@ -405,7 +456,7 @@ namespace App {
|
||||
if (!data) continue;
|
||||
|
||||
data->loaded = true;
|
||||
data->updateName(title.trimmed(), QString());
|
||||
data->updateName(title.trimmed(), QString(), QString());
|
||||
|
||||
if (App::main()) App::main()->peerUpdated(data);
|
||||
}
|
||||
@@ -561,13 +612,20 @@ namespace App {
|
||||
}
|
||||
|
||||
void feedWereDeleted(const QVector<MTPint> &msgsIds) {
|
||||
bool resized = false;
|
||||
for (QVector<MTPint>::const_iterator i = msgsIds.cbegin(), e = msgsIds.cend(); i != e; ++i) {
|
||||
MsgsData::const_iterator j = msgsData.constFind(i->v);
|
||||
if (j != msgsData.cend()) {
|
||||
History *h = (*j)->history();
|
||||
(*j)->destroy();
|
||||
if (App::main() && h->peer == App::main()->peer()) {
|
||||
resized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (resized) {
|
||||
App::main()->itemResized(0);
|
||||
}
|
||||
}
|
||||
|
||||
void feedUserLinks(const MTPVector<MTPcontacts_Link> &links) {
|
||||
@@ -634,7 +692,7 @@ namespace App {
|
||||
App::main()->removeContact(user);
|
||||
}
|
||||
}
|
||||
user->setName(textOneLine(user->firstName), textOneLine(user->lastName), (user->contact || user->id == 333000 || user->phone.isEmpty()) ? QString() : App::formatPhone(user->phone), textOneLine(user->username));
|
||||
user->setName(textOneLine(user->firstName), textOneLine(user->lastName), (user->contact || isServiceUser(user->id) || user->phone.isEmpty()) ? QString() : App::formatPhone(user->phone), textOneLine(user->username));
|
||||
if (App::main()) App::main()->peerUpdated(user);
|
||||
}
|
||||
}
|
||||
@@ -848,6 +906,15 @@ namespace App {
|
||||
return ::self;
|
||||
}
|
||||
|
||||
UserData *userByName(const QString &username) {
|
||||
for (PeersData::const_iterator i = peersData.cbegin(), e = peersData.cend(); i != e; ++i) {
|
||||
if (!i.value()->chat && !i.value()->asUser()->username.compare(username.trimmed(), Qt::CaseInsensitive)) {
|
||||
return i.value()->asUser();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
ChatData *chat(const PeerId &peer) {
|
||||
PeerData *d = App::peer(peer);
|
||||
return d->asChat();
|
||||
@@ -911,14 +978,6 @@ namespace App {
|
||||
return result;
|
||||
}
|
||||
|
||||
void forgetPhotos() {
|
||||
lastPhotos.clear();
|
||||
lastPhotosMap.clear();
|
||||
for (PhotosData::const_iterator i = photosData.cbegin(), e = photosData.cend(); i != e; ++i) {
|
||||
i.value()->forget();
|
||||
}
|
||||
}
|
||||
|
||||
VideoData *video(const VideoId &video, VideoData *convert, const uint64 &access, int32 user, int32 date, int32 duration, int32 w, int32 h, const ImagePtr &thumb, int32 dc, int32 size) {
|
||||
if (convert) {
|
||||
if (convert->id != video) {
|
||||
@@ -967,12 +1026,6 @@ namespace App {
|
||||
return result;
|
||||
}
|
||||
|
||||
void forgetVideos() {
|
||||
for (VideosData::const_iterator i = videosData.cbegin(), e = videosData.cend(); i != e; ++i) {
|
||||
i.value()->forget();
|
||||
}
|
||||
}
|
||||
|
||||
AudioData *audio(const AudioId &audio, AudioData *convert, const uint64 &access, int32 user, int32 date, int32 duration, int32 dc, int32 size) {
|
||||
if (convert) {
|
||||
if (convert->id != audio) {
|
||||
@@ -1015,12 +1068,6 @@ namespace App {
|
||||
return result;
|
||||
}
|
||||
|
||||
void forgetAudios() {
|
||||
for (AudiosData::const_iterator i = audiosData.cbegin(), e = audiosData.cend(); i != e; ++i) {
|
||||
i.value()->forget();
|
||||
}
|
||||
}
|
||||
|
||||
DocumentData *document(const DocumentId &document, DocumentData *convert, const uint64 &access, int32 user, int32 date, const QString &name, const QString &mime, const ImagePtr &thumb, int32 dc, int32 size) {
|
||||
if (convert) {
|
||||
if (convert->id != document) {
|
||||
@@ -1041,6 +1088,10 @@ namespace App {
|
||||
convert->dc = dc;
|
||||
convert->size = size;
|
||||
}
|
||||
|
||||
if (convert->location.check()) {
|
||||
Local::writeFileLocation(mediaKey(mtpc_inputDocumentFileLocation, convert->dc, convert->id), convert->location);
|
||||
}
|
||||
}
|
||||
DocumentsData::const_iterator i = documentsData.constFind(document);
|
||||
DocumentData *result;
|
||||
@@ -1067,10 +1118,37 @@ namespace App {
|
||||
return result;
|
||||
}
|
||||
|
||||
void forgetDocuments() {
|
||||
ImageLinkData *imageLink(const QString &imageLink, ImageLinkType type, const QString &url) {
|
||||
ImageLinksData::const_iterator i = imageLinksData.constFind(imageLink);
|
||||
ImageLinkData *result;
|
||||
if (i == imageLinksData.cend()) {
|
||||
result = new ImageLinkData(imageLink);
|
||||
imageLinksData.insert(imageLink, result);
|
||||
result->type = type;
|
||||
} else {
|
||||
result = i.value();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void forgetMedia() {
|
||||
lastPhotos.clear();
|
||||
lastPhotosMap.clear();
|
||||
for (PhotosData::const_iterator i = photosData.cbegin(), e = photosData.cend(); i != e; ++i) {
|
||||
i.value()->forget();
|
||||
}
|
||||
for (VideosData::const_iterator i = videosData.cbegin(), e = videosData.cend(); i != e; ++i) {
|
||||
i.value()->forget();
|
||||
}
|
||||
for (AudiosData::const_iterator i = audiosData.cbegin(), e = audiosData.cend(); i != e; ++i) {
|
||||
i.value()->forget();
|
||||
}
|
||||
for (DocumentsData::const_iterator i = documentsData.cbegin(), e = documentsData.cend(); i != e; ++i) {
|
||||
i.value()->forget();
|
||||
}
|
||||
for (ImageLinksData::const_iterator i = imageLinksData.cbegin(), e = imageLinksData.cend(); i != e; ++i) {
|
||||
i.value()->thumb->forget();
|
||||
}
|
||||
}
|
||||
|
||||
MTPPhoto photoFromUserPhoto(MTPint userId, MTPint date, const MTPUserProfilePhoto &photo) {
|
||||
@@ -1224,6 +1302,7 @@ namespace App {
|
||||
lastPhotos.clear();
|
||||
lastPhotosMap.clear();
|
||||
::self = 0;
|
||||
if (App::wnd()) App::wnd()->updateGlobalMenu();
|
||||
}
|
||||
/* // don't delete history without deleting its' peerdata
|
||||
void deleteHistory(const PeerId &peer) {
|
||||
@@ -1597,7 +1676,7 @@ namespace App {
|
||||
}
|
||||
QByteArray encrypted(16 + fullSize, Qt::Uninitialized); // 128bit of sha1 - key128, sizeof(data), data
|
||||
hashSha1(toEncrypt.constData(), toEncrypt.size(), encrypted.data());
|
||||
aesEncryptLocal(toEncrypt.constData(), encrypted.data() + 16, fullSize, &MTP::localKey(), encrypted.constData());
|
||||
aesEncryptLocal(toEncrypt.constData(), encrypted.data() + 16, fullSize, &Local::oldKey(), encrypted.constData());
|
||||
|
||||
DEBUG_LOG(("App Info: writing user config file"));
|
||||
QDataStream configStream(&configFile);
|
||||
@@ -1648,7 +1727,7 @@ namespace App {
|
||||
}
|
||||
|
||||
cSetLocalSalt(salt);
|
||||
MTP::createLocalKey(QByteArray(), &salt);
|
||||
Local::createOldKey(&salt);
|
||||
|
||||
if (data.size() <= 16 || (data.size() & 0x0F)) {
|
||||
LOG(("App Error: bad encrypted part size: %1").arg(data.size()));
|
||||
@@ -1657,7 +1736,7 @@ namespace App {
|
||||
uint32 fullDataLen = data.size() - 16;
|
||||
decrypted.resize(fullDataLen);
|
||||
const char *dataKey = data.constData(), *encrypted = data.constData() + 16;
|
||||
aesDecryptLocal(encrypted, decrypted.data(), fullDataLen, &MTP::localKey(), dataKey);
|
||||
aesDecryptLocal(encrypted, decrypted.data(), fullDataLen, &Local::oldKey(), dataKey);
|
||||
uchar sha1Buffer[20];
|
||||
if (memcmp(hashSha1(decrypted.constData(), decrypted.size(), sha1Buffer), dataKey, 16)) {
|
||||
LOG(("App Error: bad decrypt key, data from user-config not decrypted"));
|
||||
@@ -1854,10 +1933,7 @@ namespace App {
|
||||
void checkImageCacheSize() {
|
||||
int64 nowImageCacheSize = imageCacheSize();
|
||||
if (nowImageCacheSize > serviceImageCacheSize + MemoryForImageCache) {
|
||||
App::forgetPhotos();
|
||||
App::forgetVideos();
|
||||
App::forgetAudios();
|
||||
App::forgetDocuments();
|
||||
App::forgetMedia();
|
||||
serviceImageCacheSize = imageCacheSize();
|
||||
}
|
||||
}
|
||||
@@ -1887,7 +1963,6 @@ namespace App {
|
||||
::quiting = true;
|
||||
}
|
||||
|
||||
|
||||
QImage readImage(QByteArray data, QByteArray *format) {
|
||||
QByteArray tmpFormat;
|
||||
QImage result;
|
||||
@@ -2003,4 +2078,16 @@ namespace App {
|
||||
}
|
||||
}
|
||||
|
||||
void openUserByName(const QString &username) {
|
||||
if (App::main()) {
|
||||
App::main()->openUserByName(username);
|
||||
}
|
||||
}
|
||||
|
||||
void openLocalUrl(const QString &url) {
|
||||
if (App::main()) {
|
||||
App::main()->openLocalUrl(url);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
@@ -63,10 +63,11 @@ namespace App {
|
||||
int32 userFromPeer(const PeerId &peer_id);
|
||||
int32 chatFromPeer(const PeerId &peer_id);
|
||||
|
||||
int32 onlineForSort(int32 online, int32 now);
|
||||
int32 onlineWillChangeIn(int32 onlineOnServer, int32 nowOnServer);
|
||||
QString onlineText(int32 onlineOnServer, int32 nowOnServer, bool precise = false);
|
||||
QString onlineText(UserData *user, int32 nowOnServer, bool precise = false);
|
||||
|
||||
void feedUsers(const MTPVector<MTPUser> &users);
|
||||
UserData *feedUsers(const MTPVector<MTPUser> &users); // returnes last user
|
||||
void feedChats(const MTPVector<MTPChat> &chats);
|
||||
void feedParticipants(const MTPChatParticipants &p);
|
||||
void feedParticipantAdd(const MTPDupdateChatParticipantAdd &d);
|
||||
@@ -98,17 +99,16 @@ namespace App {
|
||||
UserData *user(const PeerId &peer);
|
||||
UserData *user(int32 user);
|
||||
UserData *self();
|
||||
UserData *userByName(const QString &username);
|
||||
ChatData *chat(const PeerId &peer);
|
||||
ChatData *chat(int32 chat);
|
||||
QString peerName(const PeerData *peer, bool forDialogs = false);
|
||||
PhotoData *photo(const PhotoId &photo, PhotoData *convert = 0, const uint64 &access = 0, int32 user = 0, int32 date = 0, const ImagePtr &thumb = ImagePtr(), const ImagePtr &medium = ImagePtr(), const ImagePtr &full = ImagePtr());
|
||||
void forgetPhotos();
|
||||
VideoData *video(const VideoId &video, VideoData *convert = 0, const uint64 &access = 0, int32 user = 0, int32 date = 0, int32 duration = 0, int32 w = 0, int32 h = 0, const ImagePtr &thumb = ImagePtr(), int32 dc = 0, int32 size = 0);
|
||||
void forgetVideos();
|
||||
AudioData *audio(const AudioId &audio, AudioData *convert = 0, const uint64 &access = 0, int32 user = 0, int32 date = 0, int32 duration = 0, int32 dc = 0, int32 size = 0);
|
||||
void forgetAudios();
|
||||
DocumentData *document(const DocumentId &document, DocumentData *convert = 0, const uint64 &access = 0, int32 user = 0, int32 date = 0, const QString &name = QString(), const QString &mime = QString(), const ImagePtr &thumb = ImagePtr(), int32 dc = 0, int32 size = 0);
|
||||
void forgetDocuments();
|
||||
ImageLinkData *imageLink(const QString &imageLink, ImageLinkType type = InvalidImageLink, const QString &url = QString());
|
||||
void forgetMedia();
|
||||
|
||||
MTPPhoto photoFromUserPhoto(MTPint userId, MTPint date, const MTPUserProfilePhoto &photo);
|
||||
|
||||
@@ -188,5 +188,7 @@ namespace App {
|
||||
void setProxySettings(QTcpSocket &socket);
|
||||
|
||||
void searchByHashtag(const QString &tag);
|
||||
void openUserByName(const QString &username);
|
||||
void openLocalUrl(const QString &url);
|
||||
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "application.h"
|
||||
@@ -28,6 +28,8 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
#include "boxes/confirmbox.h"
|
||||
#include "langloaderplain.h"
|
||||
|
||||
#include "localstorage.h"
|
||||
|
||||
namespace {
|
||||
Application *mainApp = 0;
|
||||
FileUploader *uploader = 0;
|
||||
@@ -87,6 +89,8 @@ Application::Application(int &argc, char **argv) : PsApplication(argc, argv),
|
||||
serverName(psServerPrefix() + cGUIDStr()), closing(false),
|
||||
updateRequestId(0), updateReply(0), updateThread(0), updateDownloader(0) {
|
||||
|
||||
DEBUG_LOG(("Application Info: creation.."));
|
||||
|
||||
QByteArray d(QDir((cPlatform() == dbipWindows ? cExeDir() : cWorkingDir()).toLower()).absolutePath().toUtf8());
|
||||
char h[33] = { 0 };
|
||||
hashMd5Hex(d.constData(), d.size(), h);
|
||||
@@ -131,15 +135,16 @@ Application::Application(int &argc, char **argv) : PsApplication(argc, argv),
|
||||
}
|
||||
}
|
||||
|
||||
Local::start();
|
||||
style::startManager();
|
||||
anim::startManager();
|
||||
historyInit();
|
||||
|
||||
DEBUG_LOG(("Application Info: inited.."));
|
||||
|
||||
window = new Window();
|
||||
|
||||
psInstallEventFilter();
|
||||
|
||||
updateCheckTimer.setSingleShot(true);
|
||||
psInstallEventFilter();
|
||||
|
||||
connect(&socket, SIGNAL(connected()), this, SLOT(socketConnected()));
|
||||
connect(&socket, SIGNAL(disconnected()), this, SLOT(socketDisconnected()));
|
||||
@@ -151,13 +156,13 @@ Application::Application(int &argc, char **argv) : PsApplication(argc, argv),
|
||||
connect(&updateCheckTimer, SIGNAL(timeout()), this, SLOT(startUpdateCheck()));
|
||||
connect(this, SIGNAL(updateFailed()), this, SLOT(onUpdateFailed()));
|
||||
connect(this, SIGNAL(updateReady()), this, SLOT(onUpdateReady()));
|
||||
connect(this, SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(onAppStateChanged(Qt::ApplicationState)));
|
||||
connect(&writeUserConfigTimer, SIGNAL(timeout()), this, SLOT(onWriteUserConfig()));
|
||||
writeUserConfigTimer.setSingleShot(true);
|
||||
|
||||
killDownloadSessionsTimer.setSingleShot(true);
|
||||
connect(&killDownloadSessionsTimer, SIGNAL(timeout()), this, SLOT(killDownloadSessions()));
|
||||
|
||||
if (cManyInstance()) {
|
||||
if (cManyInstance()) {
|
||||
startApp();
|
||||
} else {
|
||||
DEBUG_LOG(("Application Info: connecting local socket to %1..").arg(serverName));
|
||||
@@ -174,6 +179,7 @@ void Application::onAppUpdate(const MTPhelp_AppUpdate &response) {
|
||||
startUpdateCheck();
|
||||
} else {
|
||||
updateThread = new QThread();
|
||||
connect(updateThread, SIGNAL(finished()), updateThread, SLOT(deleteLater()));
|
||||
updateDownloader = new PsUpdateDownloader(updateThread, response.c_help_appUpdate());
|
||||
updateThread->start();
|
||||
}
|
||||
@@ -196,6 +202,7 @@ void Application::updateGotCurrent() {
|
||||
int32 currentVersion = m.captured(1).toInt();
|
||||
if (currentVersion > AppVersion) {
|
||||
updateThread = new QThread();
|
||||
connect(updateThread, SIGNAL(finished()), updateThread, SLOT(deleteLater()));
|
||||
updateDownloader = new PsUpdateDownloader(updateThread, m.captured(2));
|
||||
updateThread->start();
|
||||
}
|
||||
@@ -242,7 +249,7 @@ void Application::onUpdateFailed() {
|
||||
if (updateDownloader) {
|
||||
updateDownloader->deleteLater();
|
||||
updateDownloader = 0;
|
||||
if (updateThread) updateThread->deleteLater();
|
||||
if (updateThread) updateThread->quit();
|
||||
updateThread = 0;
|
||||
}
|
||||
|
||||
@@ -345,16 +352,24 @@ void Application::killDownloadSessionsStop(int32 dc) {
|
||||
}
|
||||
}
|
||||
|
||||
void Application::checkLocalTime() {
|
||||
if (App::main()) App::main()->checkLastUpdate(checkms());
|
||||
}
|
||||
|
||||
void Application::onWriteUserConfig() {
|
||||
App::writeUserConfig();
|
||||
}
|
||||
|
||||
void Application::onAppStateChanged(Qt::ApplicationState state) {
|
||||
checkLocalTime();
|
||||
}
|
||||
|
||||
void Application::killDownloadSessions() {
|
||||
uint64 ms = getms(), left = MTPAckSendWaiting + MTPKillFileSessionTimeout;
|
||||
for (QMap<int32, uint64>::iterator i = killDownloadSessionTimes.begin(); i != killDownloadSessionTimes.end(); ) {
|
||||
if (i.value() <= ms) {
|
||||
for (int j = 1; j < MTPDownloadSessionsCount; ++j) {
|
||||
MTP::killSession(MTP::dld[j] + i.key());
|
||||
for (int j = 0; j < MTPDownloadSessionsCount; ++j) {
|
||||
MTP::stopSession(MTP::dld[j] + i.key());
|
||||
}
|
||||
i = killDownloadSessionTimes.erase(i);
|
||||
} else {
|
||||
@@ -464,7 +479,7 @@ void Application::stopUpdate() {
|
||||
if (updateDownloader) {
|
||||
updateDownloader->deleteLater();
|
||||
updateDownloader = 0;
|
||||
if (updateThread) updateThread->deleteLater();
|
||||
if (updateThread) updateThread->quit();
|
||||
updateThread = 0;
|
||||
}
|
||||
}
|
||||
@@ -551,6 +566,9 @@ void Application::socketConnected() {
|
||||
for (QStringList::const_iterator i = lst.cbegin(), e = lst.cend(); i != e; ++i) {
|
||||
commands += qsl("SEND:") + _escapeTo7bit(*i) + ';';
|
||||
}
|
||||
if (!cStartUrl().isEmpty()) {
|
||||
commands += qsl("OPEN:") + _escapeTo7bit(cStartUrl()) + ';';
|
||||
}
|
||||
commands += qsl("CMD:show;");
|
||||
DEBUG_LOG(("Application Info: writing commands %1").arg(commands));
|
||||
socket.write(commands.toLocal8Bit());
|
||||
@@ -611,9 +629,14 @@ void Application::socketError(QLocalSocket::LocalSocketError e) {
|
||||
}
|
||||
|
||||
void Application::startApp() {
|
||||
DEBUG_LOG(("Application Info: starting app.."));
|
||||
|
||||
Local::ReadMapState state = Local::readMap(QByteArray());
|
||||
|
||||
DEBUG_LOG(("Application Info: local map read.."));
|
||||
App::readUserConfig();
|
||||
if (!MTP::localKey().created()) {
|
||||
MTP::createLocalKey(QByteArray());
|
||||
if (!Local::oldKey().created()) {
|
||||
Local::createOldKey();
|
||||
cSetNeedConfigResave(true);
|
||||
}
|
||||
if (cNeedConfigResave()) {
|
||||
@@ -621,20 +644,26 @@ void Application::startApp() {
|
||||
App::writeUserConfig();
|
||||
cSetNeedConfigResave(false);
|
||||
}
|
||||
DEBUG_LOG(("Application Info: user config read.."));
|
||||
|
||||
window->createWinId();
|
||||
window->init();
|
||||
|
||||
DEBUG_LOG(("Application Info: window created.."));
|
||||
readSupportTemplates();
|
||||
|
||||
MTP::setLayer(mtpLayerMax);
|
||||
MTP::start();
|
||||
|
||||
MTP::setStateChangedHandler(mtpStateChanged);
|
||||
MTP::setSessionResetHandler(mtpSessionReset);
|
||||
|
||||
DEBUG_LOG(("Application Info: MTP started.."));
|
||||
|
||||
initImageLinkManager();
|
||||
App::initMedia();
|
||||
|
||||
DEBUG_LOG(("Application Info: showing."));
|
||||
|
||||
if (MTP::authedId()) {
|
||||
window->setupMain(false);
|
||||
} else {
|
||||
@@ -648,6 +677,9 @@ void Application::startApp() {
|
||||
}
|
||||
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||
if (Local::oldMapVersion() < AppVersion) {
|
||||
psRegisterCustomScheme();
|
||||
}
|
||||
}
|
||||
|
||||
void Application::socketDisconnected() {
|
||||
@@ -667,6 +699,7 @@ void Application::newInstanceConnected() {
|
||||
}
|
||||
|
||||
void Application::readClients() {
|
||||
QString startUrl;
|
||||
QStringList toSend;
|
||||
for (ClientSockets::iterator i = clients.begin(), e = clients.end(); i != e; ++i) {
|
||||
i->second.append(i->first->readAll());
|
||||
@@ -683,6 +716,10 @@ void Application::readClients() {
|
||||
if (cSendPaths().isEmpty()) {
|
||||
toSend.append(_escapeFrom7bit(cmds.mid(from + 5, to - from - 5)));
|
||||
}
|
||||
} else if (cmd.startsWith(qsl("OPEN:"))) {
|
||||
if (cStartUrl().isEmpty()) {
|
||||
startUrl = _escapeFrom7bit(cmds.mid(from + 5, to - from - 5));
|
||||
}
|
||||
} else {
|
||||
LOG(("Application Error: unknown command %1 passed in local socket").arg(QString(cmd.constData(), cmd.length())));
|
||||
}
|
||||
@@ -703,6 +740,13 @@ void Application::readClients() {
|
||||
App::wnd()->sendPaths();
|
||||
}
|
||||
}
|
||||
if (!startUrl.isEmpty()) {
|
||||
cSetStartUrl(startUrl);
|
||||
}
|
||||
if (!cStartUrl().isEmpty() && App::main() && App::self()) {
|
||||
App::main()->openLocalUrl(cStartUrl());
|
||||
cSetStartUrl(QString());
|
||||
}
|
||||
}
|
||||
|
||||
void Application::removeClients() {
|
||||
@@ -746,18 +790,20 @@ Application::~Application() {
|
||||
socket.close();
|
||||
closeApplication();
|
||||
App::deinitMedia();
|
||||
deinitImageLinkManager();
|
||||
mainApp = 0;
|
||||
delete updateReply;
|
||||
delete ::uploader;
|
||||
updateReply = 0;
|
||||
delete updateDownloader;
|
||||
if (updateDownloader) updateDownloader->deleteLater();
|
||||
updateDownloader = 0;
|
||||
delete updateThread;
|
||||
if (updateThread) updateThread->quit();
|
||||
updateThread = 0;
|
||||
|
||||
delete window;
|
||||
|
||||
style::stopManager();
|
||||
Local::stop();
|
||||
}
|
||||
|
||||
Application *Application::app() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
@@ -73,11 +73,15 @@ public:
|
||||
void killDownloadSessionsStart(int32 dc);
|
||||
void killDownloadSessionsStop(int32 dc);
|
||||
|
||||
void checkLocalTime();
|
||||
|
||||
signals:
|
||||
|
||||
void peerPhotoDone(PeerId peer);
|
||||
void peerPhotoFail(PeerId peer);
|
||||
|
||||
void adjustSingleTimers();
|
||||
|
||||
public slots:
|
||||
|
||||
void startUpdateCheck(bool forceWait = false);
|
||||
@@ -104,13 +108,14 @@ public slots:
|
||||
void onWriteUserConfig();
|
||||
|
||||
void killDownloadSessions();
|
||||
void onAppStateChanged(Qt::ApplicationState state);
|
||||
|
||||
private:
|
||||
|
||||
QMap<MsgId, PeerId> photoUpdates;
|
||||
|
||||
QMap<int32, uint64> killDownloadSessionTimes;
|
||||
QTimer killDownloadSessionsTimer;
|
||||
SingleTimer killDownloadSessionsTimer;
|
||||
|
||||
void startApp();
|
||||
|
||||
@@ -131,10 +136,10 @@ private:
|
||||
mtpRequestId updateRequestId;
|
||||
QNetworkAccessManager updateManager;
|
||||
QNetworkReply *updateReply;
|
||||
QTimer updateCheckTimer;
|
||||
SingleTimer updateCheckTimer;
|
||||
QThread *updateThread;
|
||||
PsUpdateDownloader *updateDownloader;
|
||||
|
||||
QTimer writeUserConfigTimer;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 35 KiB |
BIN
Telegram/SourceFiles/art/icon128.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
Telegram/SourceFiles/art/icon128@2x.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
Telegram/SourceFiles/art/icon16.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Telegram/SourceFiles/art/icon16@2x.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
Telegram/SourceFiles/art/icon256.ico
Normal file
|
After Width: | Height: | Size: 361 KiB |
BIN
Telegram/SourceFiles/art/icon256.png
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
Telegram/SourceFiles/art/icon256@2x.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
Telegram/SourceFiles/art/icon32.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
Telegram/SourceFiles/art/icon32@2x.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
Telegram/SourceFiles/art/icon48.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
Telegram/SourceFiles/art/icon48@2x.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
Telegram/SourceFiles/art/icon512.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
Telegram/SourceFiles/art/icon512@2x.png
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
Telegram/SourceFiles/art/icon64.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
Telegram/SourceFiles/art/icon64@2x.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
Telegram/SourceFiles/art/icon_green.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 41 KiB |
BIN
Telegram/SourceFiles/art/iconbig256.png
Normal file
|
After Width: | Height: | Size: 8.7 KiB |
BIN
Telegram/SourceFiles/art/iconbig_green.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 655 B |
|
Before Width: | Height: | Size: 361 KiB |
|
Before Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 361 KiB |
|
Before Width: | Height: | Size: 181 KiB |
|
Before Width: | Height: | Size: 192 KiB |
|
Before Width: | Height: | Size: 183 KiB |
BIN
Telegram/SourceFiles/art/osxsetup.tif
Normal file
BIN
Telegram/SourceFiles/art/osxsetup.tiff
Normal file
BIN
Telegram/SourceFiles/art/osxsetup@2x.tif
Normal file
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 97 KiB |
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "audio.h"
|
||||
@@ -348,7 +348,6 @@ void VoiceMessagesFader::onTimer() {
|
||||
VoiceMessages *voice = audioVoice();
|
||||
if (!voice) return;
|
||||
|
||||
uint64 ms = getms();
|
||||
for (int32 i = 0; i < AudioVoiceMsgSimultaneously; ++i) {
|
||||
VoiceMessages::Msg &m(voice->_data[i]);
|
||||
if (m.state == VoiceMessageStopped || m.state == VoiceMessagePaused || !m.source) continue;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "lang.h"
|
||||
@@ -24,7 +24,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
|
||||
AboutBox::AboutBox() :
|
||||
_done(this, lang(lng_about_done), st::aboutCloseButton),
|
||||
_version(this, qsl("[a href=\"https://tdesktop.com/#version_history\"]") + textClean(lang(lng_about_version).replace(qsl("{version}"), QString::fromWCharArray(AppVersionStr))) + qsl("[/a]"), st::aboutVersion, st::defaultTextStyle),
|
||||
_version(this, qsl("[a href=\"https://desktop.telegram.org/#changelog\"]") + textClean(lang(lng_about_version).replace(qsl("{version}"), QString::fromWCharArray(AppVersionStr))) + qsl("[/a]"), st::aboutVersion, st::defaultTextStyle),
|
||||
_text(this, lang(lng_about_text), st::aboutLabel, st::aboutTextStyle),
|
||||
_hiding(false), a_opacity(0, 1) {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "lang.h"
|
||||
@@ -260,7 +260,7 @@ bool AddContactBox::onSaveSelfFail(const RPCError &error) {
|
||||
QString err(error.type());
|
||||
QString firstName = textOneLine(_firstInput.text()), lastName = textOneLine(_lastInput.text());
|
||||
if (err == "NAME_NOT_MODIFIED") {
|
||||
App::self()->setName(firstName, lastName, firstName + ' ' + lastName, textOneLine(App::self()->username));
|
||||
App::self()->setName(firstName, lastName, QString(), textOneLine(App::self()->username));
|
||||
emit closed();
|
||||
return true;
|
||||
} else if (err == "FIRSTNAME_INVALID") {
|
||||
@@ -281,7 +281,7 @@ bool AddContactBox::onSaveFail(const RPCError &error) {
|
||||
QString err(error.type());
|
||||
QString firstName = _firstInput.text().trimmed(), lastName = _lastInput.text().trimmed();
|
||||
if (err == "CHAT_TITLE_NOT_MODIFIED") {
|
||||
_peer->updateName(firstName, QString());
|
||||
_peer->updateName(firstName, QString(), QString());
|
||||
emit closed();
|
||||
return true;
|
||||
} else if (err == "NO_CHAT_TITLE") {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "lang.h"
|
||||
@@ -23,19 +23,26 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
#include "window.h"
|
||||
|
||||
AddParticipantInner::AddParticipantInner(ChatData *chat) : _chat(chat),
|
||||
_contacts(&App::main()->contactsList()), _sel(0), _filteredSel(-1), _mouseSel(false), _selCount(0) {
|
||||
|
||||
_filter = qsl("a");
|
||||
updateFilter();
|
||||
_contacts(&App::main()->contactsList()),
|
||||
_sel(0),
|
||||
_filteredSel(-1),
|
||||
_mouseSel(false),
|
||||
_selCount(0),
|
||||
_addContactLnk(this, lang(lng_add_contact_button)) {
|
||||
|
||||
connect(&_addContactLnk, SIGNAL(clicked()), App::wnd(), SLOT(onShowAddContact()));
|
||||
|
||||
for (DialogRow *r = _contacts->list.begin; r != _contacts->list.end; r = r->next) {
|
||||
r->attached = 0;
|
||||
}
|
||||
|
||||
connect(App::main(), SIGNAL(dialogRowReplaced(DialogRow *, DialogRow *)), this, SLOT(onDialogRowReplaced(DialogRow *, DialogRow *)));
|
||||
connect(App::main(), SIGNAL(peerUpdated(PeerData*)), this, SLOT(peerUpdated(PeerData *)));
|
||||
connect(App::main(), SIGNAL(peerNameChanged(PeerData *, const PeerData::Names &, const PeerData::NameFirstChars &)), this, SLOT(peerUpdated(PeerData *)));
|
||||
connect(App::main(), SIGNAL(peerPhotoChanged(PeerData *)), this, SLOT(peerUpdated(PeerData *)));
|
||||
_filter = qsl("a");
|
||||
updateFilter();
|
||||
|
||||
connect(App::main(), SIGNAL(dialogRowReplaced(DialogRow*,DialogRow*)), this, SLOT(onDialogRowReplaced(DialogRow*,DialogRow*)));
|
||||
connect(App::main(), SIGNAL(peerUpdated(PeerData*)), this, SLOT(peerUpdated(PeerData*)));
|
||||
connect(App::main(), SIGNAL(peerNameChanged(PeerData*,const PeerData::Names&,const PeerData::NameFirstChars&)), this, SLOT(peerUpdated(PeerData*)));
|
||||
connect(App::main(), SIGNAL(peerPhotoChanged(PeerData*)), this, SLOT(peerUpdated(PeerData*)));
|
||||
}
|
||||
|
||||
void AddParticipantInner::peerUpdated(PeerData *peer) {
|
||||
@@ -118,7 +125,7 @@ AddParticipantInner::ContactData *AddParticipantInner::contactData(DialogRow *ro
|
||||
data->inchat = _chat->participants.constFind(user) != _chat->participants.cend();
|
||||
data->check = false;
|
||||
data->name.setText(st::profileListNameFont, user->name, _textNameOptions);
|
||||
data->online = App::onlineText(user->onlineTill, _time);
|
||||
data->online = App::onlineText(user, _time);
|
||||
} else {
|
||||
data = i.value();
|
||||
}
|
||||
@@ -184,11 +191,15 @@ void AddParticipantInner::paintEvent(QPaintEvent *e) {
|
||||
drawFrom = drawFrom->next;
|
||||
}
|
||||
} else {
|
||||
// ..
|
||||
p.setFont(st::noContactsFont->f);
|
||||
p.setPen(st::noContactsColor->p);
|
||||
p.drawText(QRect(0, 0, width(), st::noContactsHeight - (cContactsReceived() ? st::noContactsFont->height : 0)), lang(cContactsReceived() ? lng_no_contacts : lng_contacts_loading), style::al_center);
|
||||
}
|
||||
} else {
|
||||
if (_filtered.isEmpty()) {
|
||||
// ..
|
||||
p.setFont(st::noContactsFont->f);
|
||||
p.setPen(st::noContactsColor->p);
|
||||
p.drawText(QRect(0, 0, width(), st::noContactsHeight), lang(lng_contacts_not_found), style::al_center);
|
||||
} else {
|
||||
int32 from = yFrom / rh;
|
||||
if (from < 0) from = 0;
|
||||
@@ -231,6 +242,7 @@ void AddParticipantInner::mousePressEvent(QMouseEvent *e) {
|
||||
}
|
||||
|
||||
void AddParticipantInner::chooseParticipant() {
|
||||
_time = unixtime();
|
||||
int32 rh = st::profileListPhotoSize + st::profileListPadding.height() * 2, from;
|
||||
if (_filter.isEmpty()) {
|
||||
if (!_sel || contactData(_sel)->inchat) return;
|
||||
@@ -293,6 +305,9 @@ void AddParticipantInner::updateSel() {
|
||||
}
|
||||
|
||||
void AddParticipantInner::updateFilter(QString filter) {
|
||||
filter = textSearchKey(filter);
|
||||
|
||||
_time = unixtime();
|
||||
QStringList f;
|
||||
if (!filter.isEmpty()) {
|
||||
QStringList filterList = filter.split(cWordSplit(), QString::SkipEmptyParts);
|
||||
@@ -310,14 +325,23 @@ void AddParticipantInner::updateFilter(QString filter) {
|
||||
int32 rh = (st::profileListPhotoSize + st::profileListPadding.height() * 2);
|
||||
_filter = filter;
|
||||
if (_filter.isEmpty()) {
|
||||
resize(width(), _contacts->list.count * rh);
|
||||
if (_contacts->list.count) {
|
||||
if (!_addContactLnk.isHidden()) _addContactLnk.hide();
|
||||
resize(width(), _contacts->list.count * rh);
|
||||
_sel = _contacts->list.begin;
|
||||
while (_sel->next->next &&& contactData(_sel)->inchat) {
|
||||
_sel = _sel->next;
|
||||
}
|
||||
} else {
|
||||
resize(width(), st::noContactsHeight);
|
||||
if (cContactsReceived()) {
|
||||
if (_addContactLnk.isHidden()) _addContactLnk.show();
|
||||
} else {
|
||||
if (!_addContactLnk.isHidden()) _addContactLnk.hide();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!_addContactLnk.isHidden()) _addContactLnk.hide();
|
||||
QStringList::const_iterator fb = f.cbegin(), fe = f.cend(), fi;
|
||||
|
||||
_filtered.clear();
|
||||
@@ -363,7 +387,11 @@ void AddParticipantInner::updateFilter(QString filter) {
|
||||
++_filteredSel;
|
||||
}
|
||||
|
||||
resize(width(), _filtered.size() * rh);
|
||||
if (!_filtered.isEmpty()) {
|
||||
resize(width(), _filtered.size() * rh);
|
||||
} else {
|
||||
resize(width(), st::noContactsHeight);
|
||||
}
|
||||
}
|
||||
if (parentWidget()) parentWidget()->update();
|
||||
loadProfilePhotos(0);
|
||||
@@ -404,7 +432,12 @@ AddParticipantInner::~AddParticipantInner() {
|
||||
}
|
||||
}
|
||||
|
||||
void AddParticipantInner::resizeEvent(QResizeEvent *e) {
|
||||
_addContactLnk.move((width() - _addContactLnk.width()) / 2, (st::noContactsHeight + st::noContactsFont->height) / 2);
|
||||
}
|
||||
|
||||
void AddParticipantInner::selectSkip(int32 dir) {
|
||||
_time = unixtime();
|
||||
_mouseSel = false;
|
||||
int32 rh = st::profileListPhotoSize + st::profileListPadding.height() * 2, origDir = dir;
|
||||
if (_filter.isEmpty()) {
|
||||
@@ -517,7 +550,7 @@ AddParticipantBox::AddParticipantBox(ChatData *chat) :
|
||||
connect(&_scroll, SIGNAL(scrolled()), &_inner, SLOT(updateSel()));
|
||||
connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
|
||||
connect(&_filter, SIGNAL(changed()), this, SLOT(onFilterUpdate()));
|
||||
connect(&_filter, SIGNAL(cancelled()), this, SIGNAL(onClose()));
|
||||
connect(&_filter, SIGNAL(cancelled()), this, SLOT(onClose()));
|
||||
connect(&_inner, SIGNAL(mustScrollTo(int,int)), &_scroll, SLOT(scrollToY(int,int)));
|
||||
connect(&_inner, SIGNAL(selectAllQuery()), &_filter, SLOT(selectAll()));
|
||||
|
||||
@@ -575,6 +608,7 @@ void AddParticipantBox::paintEvent(QPaintEvent *e) {
|
||||
|
||||
// paint shadows
|
||||
p.fillRect(0, st::participantFilter.height, _width, st::scrollDef.topsh, st::scrollDef.shColor->b);
|
||||
p.fillRect(0, size().height() - st::btnSelectCancel.height - st::scrollDef.bottomsh, _width, st::scrollDef.bottomsh, st::scrollDef.shColor->b);
|
||||
|
||||
// paint button sep
|
||||
p.fillRect(st::btnSelectCancel.width, size().height() - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
@@ -31,6 +31,7 @@ public:
|
||||
void leaveEvent(QEvent *e);
|
||||
void mouseMoveEvent(QMouseEvent *e);
|
||||
void mousePressEvent(QMouseEvent *e);
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
|
||||
void paintDialog(QPainter &p, DialogRow *row, bool sel);
|
||||
void updateFilter(QString filter = QString());
|
||||
@@ -87,6 +88,7 @@ private:
|
||||
ContactData *contactData(DialogRow *row);
|
||||
|
||||
QPoint _lastMousePos;
|
||||
LinkButton _addContactLnk;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "lang.h"
|
||||
@@ -22,23 +22,53 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
#include "mainwidget.h"
|
||||
#include "window.h"
|
||||
|
||||
ConfirmBox::ConfirmBox(QString text, QString doneText, QString cancelText) :
|
||||
_confirm(this, doneText.isEmpty() ? lang(lng_continue) : doneText, st::btnSelectDone),
|
||||
_cancel(this, cancelText.isEmpty() ? lang(lng_cancel) : cancelText, st::btnSelectCancel),
|
||||
_text(100), _hiding(false), a_opacity(0, 1), af_opacity(anim::linear) {
|
||||
TextParseOptions _confirmBoxTextOptions = {
|
||||
TextParseLinks | TextParseMultiline | TextParseRichText, // flags
|
||||
0, // maxw
|
||||
0, // maxh
|
||||
Qt::LayoutDirectionAuto, // dir
|
||||
};
|
||||
|
||||
_text.setText(st::boxFont, text, _textPlainOptions);
|
||||
ConfirmBox::ConfirmBox(const QString &text, const QString &doneText, const QString &cancelText) : _infoMsg(false),
|
||||
_confirm(this, doneText.isEmpty() ? lang(lng_continue) : doneText, st::btnSelectDone),
|
||||
_cancel(this, cancelText.isEmpty() ? lang(lng_cancel) : cancelText, st::btnSelectCancel),
|
||||
_close(this, QString(), st::btnInfoClose),
|
||||
_text(100), _hiding(false), a_opacity(0, 1), af_opacity(anim::linear) {
|
||||
init(text);
|
||||
}
|
||||
|
||||
ConfirmBox::ConfirmBox(const QString &text, bool noDone, const QString &cancelText) : _infoMsg(true),
|
||||
_confirm(this, QString(), st::btnSelectDone),
|
||||
_cancel(this, QString(), st::btnSelectCancel),
|
||||
_close(this, cancelText.isEmpty() ? lang(lng_close) : cancelText, st::btnInfoClose),
|
||||
_text(100), _hiding(false), a_opacity(0, 1), af_opacity(anim::linear) {
|
||||
init(text);
|
||||
}
|
||||
|
||||
void ConfirmBox::init(const QString &text) {
|
||||
_text.setText(st::boxFont, text, (_infoMsg ? _confirmBoxTextOptions : _textPlainOptions));
|
||||
|
||||
_width = st::confirmWidth;
|
||||
_textWidth = _width - st::boxPadding.left() - st::boxPadding.right();
|
||||
_textHeight = _text.countHeight(_textWidth);
|
||||
_height = st::boxPadding.top() + _textHeight + st::boxPadding.bottom() + _confirm.height();
|
||||
_height = st::boxPadding.top() + _textHeight + st::boxPadding.bottom() + (_infoMsg ? _close.height() : _confirm.height());
|
||||
|
||||
_confirm.move(_width - _confirm.width(), st::boxPadding.top() + _textHeight + st::boxPadding.bottom());
|
||||
_cancel.move(0, st::boxPadding.top() + _textHeight + st::boxPadding.bottom());
|
||||
if (_infoMsg) {
|
||||
_confirm.hide();
|
||||
_cancel.hide();
|
||||
_close.move(0, st::boxPadding.top() + _textHeight + st::boxPadding.bottom());
|
||||
|
||||
connect(&_confirm, SIGNAL(clicked()), this, SIGNAL(confirmed()));
|
||||
connect(&_cancel, SIGNAL(clicked()), this, SLOT(onCancel()));
|
||||
connect(&_close, SIGNAL(clicked()), this, SLOT(onCancel()));
|
||||
|
||||
setMouseTracking(_text.hasLinks());
|
||||
} else {
|
||||
_confirm.move(_width - _confirm.width(), st::boxPadding.top() + _textHeight + st::boxPadding.bottom());
|
||||
_cancel.move(0, st::boxPadding.top() + _textHeight + st::boxPadding.bottom());
|
||||
_close.hide();
|
||||
|
||||
connect(&_confirm, SIGNAL(clicked()), this, SIGNAL(confirmed()));
|
||||
connect(&_cancel, SIGNAL(clicked()), this, SLOT(onCancel()));
|
||||
}
|
||||
|
||||
resize(_width, _height);
|
||||
|
||||
@@ -47,14 +77,73 @@ ConfirmBox::ConfirmBox(QString text, QString doneText, QString cancelText) :
|
||||
hideAll();
|
||||
}
|
||||
|
||||
void ConfirmBox::mouseMoveEvent(QMouseEvent *e) {
|
||||
_lastMousePos = e->globalPos();
|
||||
updateHover();
|
||||
}
|
||||
|
||||
void ConfirmBox::mousePressEvent(QMouseEvent *e) {
|
||||
_lastMousePos = e->globalPos();
|
||||
updateHover();
|
||||
if (textlnkOver()) {
|
||||
textlnkDown(textlnkOver());
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void ConfirmBox::mouseReleaseEvent(QMouseEvent *e) {
|
||||
_lastMousePos = e->globalPos();
|
||||
updateHover();
|
||||
if (textlnkOver() && textlnkOver() == textlnkDown()) {
|
||||
App::wnd()->hideLayer();
|
||||
textlnkOver()->onClick(e->button());
|
||||
}
|
||||
textlnkDown(TextLinkPtr());
|
||||
}
|
||||
|
||||
void ConfirmBox::leaveEvent(QEvent *e) {
|
||||
if (_myLink) {
|
||||
if (textlnkOver() == _myLink) {
|
||||
textlnkOver(TextLinkPtr());
|
||||
update();
|
||||
}
|
||||
_myLink = TextLinkPtr();
|
||||
setCursor(style::cur_default);
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void ConfirmBox::updateLink() {
|
||||
_lastMousePos = QCursor::pos();
|
||||
updateHover();
|
||||
}
|
||||
|
||||
void ConfirmBox::updateHover() {
|
||||
QPoint m(mapFromGlobal(_lastMousePos));
|
||||
bool wasMy = (_myLink == textlnkOver());
|
||||
_myLink = _text.link(m.x() - st::boxPadding.left(), m.y() - st::boxPadding.top(), _textWidth, (_text.maxWidth() < _width) ? style::al_center : style::al_left);
|
||||
if (_myLink != textlnkOver()) {
|
||||
if (wasMy || _myLink || rect().contains(m)) {
|
||||
textlnkOver(_myLink);
|
||||
}
|
||||
setCursor(_myLink ? style::cur_pointer : style::cur_default);
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void ConfirmBox::hideAll() {
|
||||
_confirm.hide();
|
||||
_cancel.hide();
|
||||
_close.hide();
|
||||
}
|
||||
|
||||
void ConfirmBox::showAll() {
|
||||
_confirm.show();
|
||||
_cancel.show();
|
||||
if (_infoMsg) {
|
||||
_close.show();
|
||||
} else {
|
||||
_confirm.show();
|
||||
_cancel.show();
|
||||
}
|
||||
}
|
||||
|
||||
void ConfirmBox::keyPressEvent(QKeyEvent *e) {
|
||||
@@ -78,11 +167,13 @@ void ConfirmBox::paintEvent(QPaintEvent *e) {
|
||||
// fill bg
|
||||
p.fillRect(0, 0, _width, _height, st::boxBG->b);
|
||||
|
||||
// paint shadows
|
||||
p.fillRect(0, _height - st::btnSelectCancel.height - st::scrollDef.bottomsh, _width, st::scrollDef.bottomsh, st::scrollDef.shColor->b);
|
||||
if (!_infoMsg) {
|
||||
// paint shadows
|
||||
p.fillRect(0, _height - st::btnSelectCancel.height - st::scrollDef.bottomsh, _width, st::scrollDef.bottomsh, st::scrollDef.shColor->b);
|
||||
|
||||
// paint button sep
|
||||
p.fillRect(st::btnSelectCancel.width, _height - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b);
|
||||
// paint button sep
|
||||
p.fillRect(st::btnSelectCancel.width, _height - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b);
|
||||
}
|
||||
|
||||
// draw box title / text
|
||||
p.setFont(st::boxFont->f);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
@@ -24,11 +24,17 @@ class ConfirmBox : public LayeredWidget, public RPCSender {
|
||||
|
||||
public:
|
||||
|
||||
ConfirmBox(QString text, QString doneText = QString(), QString cancelText = QString());
|
||||
ConfirmBox(const QString &text, const QString &doneText = QString(), const QString &cancelText = QString());
|
||||
ConfirmBox(const QString &text, bool noDone, const QString &cancelText = QString());
|
||||
void parentResized();
|
||||
void animStep(float64 ms);
|
||||
void keyPressEvent(QKeyEvent *e);
|
||||
void paintEvent(QPaintEvent *e);
|
||||
void mouseMoveEvent(QMouseEvent *e);
|
||||
void mousePressEvent(QMouseEvent *e);
|
||||
void mouseReleaseEvent(QMouseEvent *e);
|
||||
void leaveEvent(QEvent *e);
|
||||
void updateLink();
|
||||
void startHide();
|
||||
~ConfirmBox();
|
||||
|
||||
@@ -43,11 +49,16 @@ public slots:
|
||||
|
||||
private:
|
||||
|
||||
void init(const QString &text);
|
||||
|
||||
bool _infoMsg;
|
||||
|
||||
void hideAll();
|
||||
void showAll();
|
||||
|
||||
int32 _width, _height;
|
||||
FlatButton _confirm, _cancel;
|
||||
BottomButton _close;
|
||||
Text _text;
|
||||
int32 _textWidth, _textHeight;
|
||||
|
||||
@@ -56,4 +67,9 @@ private:
|
||||
|
||||
anim::fvalue a_opacity;
|
||||
anim::transition af_opacity;
|
||||
|
||||
void updateHover();
|
||||
|
||||
QPoint _lastMousePos;
|
||||
TextLinkPtr _myLink;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "lang.h"
|
||||
@@ -205,6 +205,7 @@ void ConnectionBox::onSave() {
|
||||
}
|
||||
App::writeConfig();
|
||||
MTP::restart();
|
||||
reinitImageLinkManager();
|
||||
emit closed();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "lang.h"
|
||||
@@ -23,14 +23,22 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
#include "mainwidget.h"
|
||||
#include "window.h"
|
||||
|
||||
ContactsInner::ContactsInner() : _contacts(&App::main()->contactsList()), _sel(0), _filteredSel(-1), _mouseSel(false) {
|
||||
_filter = qsl("a");
|
||||
updateFilter();
|
||||
ContactsInner::ContactsInner() :
|
||||
_contacts(&App::main()->contactsList()),
|
||||
_sel(0),
|
||||
_filteredSel(-1),
|
||||
_mouseSel(false),
|
||||
_addContactLnk(this, lang(lng_add_contact_button)) {
|
||||
|
||||
connect(&_addContactLnk, SIGNAL(clicked()), App::wnd(), SLOT(onShowAddContact()));
|
||||
|
||||
for (DialogRow *r = _contacts->list.begin; r != _contacts->list.end; r = r->next) {
|
||||
r->attached = 0;
|
||||
}
|
||||
|
||||
_filter = qsl("a");
|
||||
updateFilter();
|
||||
|
||||
connect(App::main(), SIGNAL(dialogRowReplaced(DialogRow *, DialogRow *)), this, SLOT(onDialogRowReplaced(DialogRow *, DialogRow *)));
|
||||
connect(App::main(), SIGNAL(peerUpdated(PeerData*)), this, SLOT(peerUpdated(PeerData *)));
|
||||
connect(App::main(), SIGNAL(peerNameChanged(PeerData *, const PeerData::Names &, const PeerData::NameFirstChars &)), this, SLOT(peerUpdated(PeerData *)));
|
||||
@@ -98,7 +106,7 @@ ContactsInner::ContactData *ContactsInner::contactData(DialogRow *row) {
|
||||
if (i == _contactsData.cend()) {
|
||||
_contactsData.insert(user, data = new ContactData());
|
||||
data->name.setText(st::profileListNameFont, user->name, _textNameOptions);
|
||||
data->online = App::onlineText(user->onlineTill, _time);
|
||||
data->online = App::onlineText(user, _time);
|
||||
} else {
|
||||
data = i.value();
|
||||
}
|
||||
@@ -153,11 +161,15 @@ void ContactsInner::paintEvent(QPaintEvent *e) {
|
||||
drawFrom = drawFrom->next;
|
||||
}
|
||||
} else {
|
||||
// ..
|
||||
p.setFont(st::noContactsFont->f);
|
||||
p.setPen(st::noContactsColor->p);
|
||||
p.drawText(QRect(0, 0, width(), st::noContactsHeight - (cContactsReceived() ? st::noContactsFont->height : 0)), lang(cContactsReceived() ? lng_no_contacts : lng_contacts_loading), style::al_center);
|
||||
}
|
||||
} else {
|
||||
if (_filtered.isEmpty()) {
|
||||
// ..
|
||||
p.setFont(st::noContactsFont->f);
|
||||
p.setPen(st::noContactsColor->p);
|
||||
p.drawText(QRect(0, 0, width(), st::noContactsHeight), lang(lng_contacts_not_found), style::al_center);
|
||||
} else {
|
||||
int32 from = yFrom / rh;
|
||||
if (from < 0) from = 0;
|
||||
@@ -238,6 +250,8 @@ void ContactsInner::updateSel() {
|
||||
}
|
||||
|
||||
void ContactsInner::updateFilter(QString filter) {
|
||||
filter = textSearchKey(filter);
|
||||
|
||||
QStringList f;
|
||||
if (!filter.isEmpty()) {
|
||||
QStringList filterList = filter.split(cWordSplit(), QString::SkipEmptyParts);
|
||||
@@ -255,11 +269,20 @@ void ContactsInner::updateFilter(QString filter) {
|
||||
int32 rh = (st::profileListPhotoSize + st::profileListPadding.height() * 2);
|
||||
_filter = filter;
|
||||
if (_filter.isEmpty()) {
|
||||
resize(width(), _contacts->list.count * rh + st::contactsClose.height);
|
||||
if (_contacts->list.count) {
|
||||
if (!_addContactLnk.isHidden()) _addContactLnk.hide();
|
||||
resize(width(), _contacts->list.count * rh + st::contactsClose.height);
|
||||
_sel = _contacts->list.begin;
|
||||
} else {
|
||||
resize(width(), st::noContactsHeight);
|
||||
if (cContactsReceived()) {
|
||||
if (_addContactLnk.isHidden()) _addContactLnk.show();
|
||||
} else {
|
||||
if (!_addContactLnk.isHidden()) _addContactLnk.hide();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!_addContactLnk.isHidden()) _addContactLnk.hide();
|
||||
QStringList::const_iterator fb = f.cbegin(), fe = f.cend(), fi;
|
||||
|
||||
_filtered.clear();
|
||||
@@ -302,7 +325,11 @@ void ContactsInner::updateFilter(QString filter) {
|
||||
}
|
||||
_filteredSel = _filtered.isEmpty() ? -1 : 0;
|
||||
|
||||
resize(width(), _filtered.size() * rh + st::contactsClose.height);
|
||||
if (!_filtered.isEmpty()) {
|
||||
resize(width(), _filtered.size() * rh + st::contactsClose.height);
|
||||
} else {
|
||||
resize(width(), st::noContactsHeight);
|
||||
}
|
||||
}
|
||||
if (parentWidget()) parentWidget()->update();
|
||||
loadProfilePhotos(0);
|
||||
@@ -333,7 +360,8 @@ void ContactsInner::onDialogRowReplaced(DialogRow *oldRow, DialogRow *newRow) {
|
||||
}
|
||||
_mouseSel = false;
|
||||
int32 rh = (st::profileListPhotoSize + st::profileListPadding.height() * 2);
|
||||
int32 newh = (_filter.isEmpty() ? _contacts->list.count : _filtered.size()) * rh;
|
||||
int32 cnt = (_filter.isEmpty() ? _contacts->list.count : _filtered.size());
|
||||
int32 newh = cnt ? (cnt * rh + st::contactsClose.height) : st::noContactsHeight;
|
||||
resize(width(), newh);
|
||||
}
|
||||
|
||||
@@ -343,6 +371,10 @@ ContactsInner::~ContactsInner() {
|
||||
}
|
||||
}
|
||||
|
||||
void ContactsInner::resizeEvent(QResizeEvent *e) {
|
||||
_addContactLnk.move((width() - _addContactLnk.width()) / 2, (st::noContactsHeight + st::noContactsFont->height) / 2);
|
||||
}
|
||||
|
||||
void ContactsInner::selectSkip(int32 dir) {
|
||||
_mouseSel = false;
|
||||
int32 rh = st::profileListPhotoSize + st::profileListPadding.height() * 2, origDir = dir;
|
||||
@@ -409,12 +441,12 @@ ContactsBox::ContactsBox() : _scroll(this, st::newGroupScroll), _inner(),
|
||||
_scroll.setWidget(&_inner);
|
||||
_scroll.setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
connect(&_addContact, SIGNAL(clicked()), this, SLOT(onAdd()));
|
||||
connect(&_addContact, SIGNAL(clicked()), App::wnd(), SLOT(onShowAddContact()));
|
||||
connect(&_close, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||
connect(&_scroll, SIGNAL(scrolled()), &_inner, SLOT(updateSel()));
|
||||
connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
|
||||
connect(&_filter, SIGNAL(changed()), this, SLOT(onFilterUpdate()));
|
||||
connect(&_filter, SIGNAL(cancelled()), this, SIGNAL(onClose()));
|
||||
connect(&_filter, SIGNAL(cancelled()), this, SLOT(onClose()));
|
||||
connect(&_inner, SIGNAL(mustScrollTo(int,int)), &_scroll, SLOT(scrollToY(int,int)));
|
||||
|
||||
showAll();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
@@ -31,6 +31,7 @@ public:
|
||||
void leaveEvent(QEvent *e);
|
||||
void mouseMoveEvent(QMouseEvent *e);
|
||||
void mousePressEvent(QMouseEvent *e);
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
|
||||
void paintDialog(QPainter &p, DialogRow *row, bool sel);
|
||||
void updateFilter(QString filter = QString());
|
||||
@@ -77,6 +78,7 @@ private:
|
||||
ContactData *contactData(DialogRow *row);
|
||||
|
||||
QPoint _lastMousePos;
|
||||
LinkButton _addContactLnk;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "lang.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "lang.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "lang.h"
|
||||
@@ -22,7 +22,19 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
#include "mainwidget.h"
|
||||
#include "window.h"
|
||||
|
||||
NewGroupInner::NewGroupInner() : _contacts(&App::main()->contactsList()), _sel(0), _filteredSel(-1), _mouseSel(false), _selCount(0) {
|
||||
NewGroupInner::NewGroupInner() :
|
||||
_contacts(&App::main()->contactsList()),
|
||||
_sel(0),
|
||||
_filteredSel(-1),
|
||||
_mouseSel(false),
|
||||
_selCount(0),
|
||||
_addContactLnk(this, lang(lng_add_contact_button)) {
|
||||
|
||||
connect(&_addContactLnk, SIGNAL(clicked()), App::wnd(), SLOT(onShowAddContact()));
|
||||
|
||||
for (DialogRow *r = _contacts->list.begin; r != _contacts->list.end; r = r->next) {
|
||||
r->attached = 0;
|
||||
}
|
||||
|
||||
_filter = qsl("a");
|
||||
updateFilter();
|
||||
@@ -99,7 +111,7 @@ NewGroupInner::ContactData *NewGroupInner::contactData(DialogRow *row) {
|
||||
_contactsData.insert(user, data = new ContactData());
|
||||
data->check = false;
|
||||
data->name.setText(st::profileListNameFont, user->name, _textNameOptions);
|
||||
data->online = App::onlineText(user->onlineTill, _time);
|
||||
data->online = App::onlineText(user, _time);
|
||||
} else {
|
||||
data = i.value();
|
||||
}
|
||||
@@ -165,11 +177,15 @@ void NewGroupInner::paintEvent(QPaintEvent *e) {
|
||||
drawFrom = drawFrom->next;
|
||||
}
|
||||
} else {
|
||||
// ..
|
||||
p.setFont(st::noContactsFont->f);
|
||||
p.setPen(st::noContactsColor->p);
|
||||
p.drawText(QRect(0, 0, width(), st::noContactsHeight - (cContactsReceived() ? st::noContactsFont->height : 0)), lang(cContactsReceived() ? lng_no_contacts : lng_contacts_loading), style::al_center);
|
||||
}
|
||||
} else {
|
||||
if (_filtered.isEmpty()) {
|
||||
// ..
|
||||
p.setFont(st::noContactsFont->f);
|
||||
p.setPen(st::noContactsColor->p);
|
||||
p.drawText(QRect(0, 0, width(), st::noContactsHeight), lang(lng_contacts_not_found), style::al_center);
|
||||
} else {
|
||||
int32 from = yFrom / rh;
|
||||
if (from < 0) from = 0;
|
||||
@@ -260,6 +276,8 @@ void NewGroupInner::updateSel() {
|
||||
}
|
||||
|
||||
void NewGroupInner::updateFilter(QString filter) {
|
||||
filter = textSearchKey(filter);
|
||||
|
||||
QStringList f;
|
||||
if (!filter.isEmpty()) {
|
||||
QStringList filterList = filter.split(cWordSplit(), QString::SkipEmptyParts);
|
||||
@@ -279,9 +297,19 @@ void NewGroupInner::updateFilter(QString filter) {
|
||||
if (_filter.isEmpty()) {
|
||||
resize(width(), _contacts->list.count * rh);
|
||||
if (_contacts->list.count) {
|
||||
if (!_addContactLnk.isHidden()) _addContactLnk.hide();
|
||||
resize(width(), _contacts->list.count * rh);
|
||||
_sel = _contacts->list.begin;
|
||||
} else {
|
||||
resize(width(), st::noContactsHeight);
|
||||
if (cContactsReceived()) {
|
||||
if (_addContactLnk.isHidden()) _addContactLnk.show();
|
||||
} else {
|
||||
if (!_addContactLnk.isHidden()) _addContactLnk.hide();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!_addContactLnk.isHidden()) _addContactLnk.hide();
|
||||
QStringList::const_iterator fb = f.cbegin(), fe = f.cend(), fi;
|
||||
|
||||
_filtered.clear();
|
||||
@@ -324,7 +352,11 @@ void NewGroupInner::updateFilter(QString filter) {
|
||||
}
|
||||
_filteredSel = _filtered.isEmpty() ? -1 : 0;
|
||||
|
||||
resize(width(), _filtered.size() * rh);
|
||||
if (!_filtered.isEmpty()) {
|
||||
resize(width(), _filtered.size() * rh);
|
||||
} else {
|
||||
resize(width(), st::noContactsHeight);
|
||||
}
|
||||
}
|
||||
if (parentWidget()) parentWidget()->update();
|
||||
loadProfilePhotos(0);
|
||||
@@ -365,6 +397,10 @@ NewGroupInner::~NewGroupInner() {
|
||||
}
|
||||
}
|
||||
|
||||
void NewGroupInner::resizeEvent(QResizeEvent *e) {
|
||||
_addContactLnk.move((width() - _addContactLnk.width()) / 2, (st::noContactsHeight + st::noContactsFont->height) / 2);
|
||||
}
|
||||
|
||||
void NewGroupInner::selectSkip(int32 dir) {
|
||||
_mouseSel = false;
|
||||
int32 rh = st::profileListPhotoSize + st::profileListPadding.height() * 2, origDir = dir;
|
||||
@@ -456,7 +492,7 @@ NewGroupBox::NewGroupBox() : _scroll(this, st::newGroupScroll), _inner(),
|
||||
connect(&_scroll, SIGNAL(scrolled()), &_inner, SLOT(updateSel()));
|
||||
connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
|
||||
connect(&_filter, SIGNAL(changed()), this, SLOT(onFilterUpdate()));
|
||||
connect(&_filter, SIGNAL(cancelled()), this, SIGNAL(onClose()));
|
||||
connect(&_filter, SIGNAL(cancelled()), this, SLOT(onClose()));
|
||||
connect(&_inner, SIGNAL(mustScrollTo(int,int)), &_scroll, SLOT(scrollToY(int,int)));
|
||||
connect(&_inner, SIGNAL(selectAllQuery()), &_filter, SLOT(selectAll()));
|
||||
|
||||
@@ -518,6 +554,7 @@ void NewGroupBox::paintEvent(QPaintEvent *e) {
|
||||
|
||||
// paint shadows
|
||||
p.fillRect(0, st::participantFilter.height, _width, st::scrollDef.topsh, st::scrollDef.shColor->b);
|
||||
p.fillRect(0, size().height() - st::btnSelectCancel.height - st::scrollDef.bottomsh, _width, st::scrollDef.bottomsh, st::scrollDef.shColor->b);
|
||||
|
||||
// paint button sep
|
||||
p.fillRect(st::btnSelectCancel.width, size().height() - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
@@ -31,7 +31,8 @@ public:
|
||||
void leaveEvent(QEvent *e);
|
||||
void mouseMoveEvent(QMouseEvent *e);
|
||||
void mousePressEvent(QMouseEvent *e);
|
||||
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
|
||||
void paintDialog(QPainter &p, DialogRow *row, bool sel);
|
||||
void updateFilter(QString filter = QString());
|
||||
|
||||
@@ -85,6 +86,7 @@ private:
|
||||
ContactData *contactData(DialogRow *row);
|
||||
|
||||
QPoint _lastMousePos;
|
||||
LinkButton _addContactLnk;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "style.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "style.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "lang.h"
|
||||
@@ -28,24 +28,23 @@ UsernameInput::UsernameInput(QWidget *parent, const style::flatInput &st, const
|
||||
|
||||
void UsernameInput::correctValue(QKeyEvent *e, const QString &was) {
|
||||
QString oldText(text()), newText;
|
||||
int32 oldPos(cursorPosition()), newPos(-1), oldLen(oldText.length());
|
||||
newText.reserve(oldLen);
|
||||
|
||||
for (int32 i = 0; i < oldLen; ++i) {
|
||||
if (i == oldPos) {
|
||||
newPos = newText.length();
|
||||
int32 newPos = cursorPosition(), from, len = oldText.size();
|
||||
for (from = 0; from < len; ++from) {
|
||||
if (!oldText.at(from).isSpace()) {
|
||||
break;
|
||||
}
|
||||
|
||||
QChar ch = oldText[i];
|
||||
if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9') || ch == '_' || (ch == '@' && !i)) {
|
||||
if (newText.size() < MaxUsernameLength) {
|
||||
newText.append(ch);
|
||||
}
|
||||
if (newPos > 0) --newPos;
|
||||
}
|
||||
len -= from;
|
||||
if (len > MaxUsernameLength) len = MaxUsernameLength + (oldText.at(from) == '@' ? 1 : 0);
|
||||
for (int32 to = from + len; to > from;) {
|
||||
--to;
|
||||
if (!oldText.at(to).isSpace()) {
|
||||
break;
|
||||
}
|
||||
--len;
|
||||
}
|
||||
if (newPos < 0) {
|
||||
newPos = newText.length();
|
||||
}
|
||||
newText = oldText.mid(from, len);
|
||||
if (newText != oldText) {
|
||||
setText(newText);
|
||||
setCursorPosition(newPos);
|
||||
@@ -59,6 +58,7 @@ _usernameInput(this, st::inpAddContact, qsl("@username"), App::self()->username)
|
||||
_saveRequest(0), _checkRequest(0), _about(st::usernameWidth - 2 * st::addContactTitlePos.x()),
|
||||
a_opacity(0, 1), _hiding(false) {
|
||||
_about.setRichText(st::usernameFont, lang(lng_username_about));
|
||||
_goodText = App::self()->username.isEmpty() ? QString() : lang(lng_username_available);
|
||||
initBox();
|
||||
}
|
||||
|
||||
@@ -135,6 +135,11 @@ void UsernameBox::paintEvent(QPaintEvent *e) {
|
||||
p.setFont(st::setErrFont->f);
|
||||
int32 w = st::setErrFont->m.width(_errorText);
|
||||
p.drawText((_width - w) / 2, _usernameInput.y() + _usernameInput.height() + ((st::usernameSkip - st::setErrFont->height) / 2) + st::setErrFont->ascent, _errorText);
|
||||
} else if (!_goodText.isEmpty()) {
|
||||
p.setPen(st::setGoodColor->p);
|
||||
p.setFont(st::setErrFont->f);
|
||||
int32 w = st::setErrFont->m.width(_goodText);
|
||||
p.drawText((_width - w) / 2, _usernameInput.y() + _usernameInput.height() + ((st::usernameSkip - st::setErrFont->height) / 2) + st::setErrFont->ascent, _goodText);
|
||||
}
|
||||
p.setPen(st::usernameColor->p);
|
||||
_about.draw(p, st::addContactTitlePos.x(), _usernameInput.y() + _usernameInput.height() + st::usernameSkip, width() - 2 * st::addContactTitlePos.x());
|
||||
@@ -180,23 +185,37 @@ void UsernameBox::onCheck() {
|
||||
void UsernameBox::onChanged() {
|
||||
QString name = getName();
|
||||
if (name.isEmpty()) {
|
||||
if (!_errorText.isEmpty()) {
|
||||
_errorText = QString();
|
||||
update();
|
||||
}
|
||||
_checkTimer.stop();
|
||||
} else if (name.size() < MinUsernameLength) {
|
||||
if (_errorText != lang(lng_username_too_short)) {
|
||||
_errorText = lang(lng_username_too_short);
|
||||
if (!_errorText.isEmpty() || !_goodText.isEmpty()) {
|
||||
_errorText = _goodText = QString();
|
||||
update();
|
||||
}
|
||||
_checkTimer.stop();
|
||||
} else {
|
||||
if (!_errorText.isEmpty()) {
|
||||
_errorText = QString();
|
||||
update();
|
||||
int32 i, len = name.size();
|
||||
for (int32 i = 0; i < len; ++i) {
|
||||
QChar ch = name.at(i);
|
||||
if ((ch < 'A' || ch > 'Z') && (ch < 'a' || ch > 'z') && (ch < '0' || ch > '9') && ch != '_' && (ch != '@' || i > 0)) {
|
||||
if (_errorText != lang(lng_username_bad_symbols)) {
|
||||
_errorText = lang(lng_username_bad_symbols);
|
||||
update();
|
||||
}
|
||||
_checkTimer.stop();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (name.size() < MinUsernameLength) {
|
||||
if (_errorText != lang(lng_username_too_short)) {
|
||||
_errorText = lang(lng_username_too_short);
|
||||
update();
|
||||
}
|
||||
_checkTimer.stop();
|
||||
} else {
|
||||
if (!_errorText.isEmpty() || !_goodText.isEmpty()) {
|
||||
_errorText = _goodText = QString();
|
||||
update();
|
||||
}
|
||||
_checkTimer.start(UsernameCheckTimeout);
|
||||
}
|
||||
_checkTimer.start(UsernameCheckTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,8 +249,10 @@ bool UsernameBox::onUpdateFail(const RPCError &error) {
|
||||
void UsernameBox::onCheckDone(const MTPBool &result) {
|
||||
_checkRequest = 0;
|
||||
QString newError = (result.v || _checkUsername == App::self()->username) ? QString() : lang(lng_username_occupied);
|
||||
if (_errorText != newError) {
|
||||
QString newGood = newError.isEmpty() ? lang(lng_username_available) : QString();
|
||||
if (_errorText != newError || _goodText != newGood) {
|
||||
_errorText = newError;
|
||||
_goodText = newGood;
|
||||
update();
|
||||
}
|
||||
}
|
||||
@@ -248,6 +269,7 @@ bool UsernameBox::onCheckFail(const RPCError &error) {
|
||||
update();
|
||||
return true;
|
||||
}
|
||||
_goodText = QString();
|
||||
_usernameInput.setFocus();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
an unofficial desktop messaging app, see https://telegram.org
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014 John Preston, https://tdesktop.com
|
||||
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
@@ -72,7 +72,7 @@ private:
|
||||
QPixmap _cache;
|
||||
|
||||
mtpRequestId _saveRequest, _checkRequest;
|
||||
QString _sentUsername, _checkUsername, _errorText;
|
||||
QString _sentUsername, _checkUsername, _errorText, _goodText;
|
||||
|
||||
Text _about;
|
||||
QTimer _checkTimer;
|
||||
|
||||