new dev version 0.8.41 with pretty number formatting, Qt tray icon for all linux systems and more

This commit is contained in:
John Preston 2015-07-21 16:55:23 +02:00
parent c553ed6775
commit ff0f8c254f
24 changed files with 697 additions and 73 deletions

View file

@ -1,10 +1,10 @@
@echo OFF
set "AppVersionStrMajor=0.8"
set "AppVersion=8040"
set "AppVersionStrSmall=0.8.40"
set "AppVersionStr=0.8.40"
set "AppVersionStrFull=0.8.40.0"
set "AppVersion=8041"
set "AppVersionStrSmall=0.8.41"
set "AppVersionStr=0.8.41"
set "AppVersionStrFull=0.8.41.0"
set "DevChannel=1"
if %DevChannel% neq 0 goto preparedev

View file

@ -0,0 +1,231 @@
1876;JM;Jamaica;1876 XXX XXXX;11;
1869;KN;Saint Kitts & Nevis;1869 XXX XXXX;11;
1868;TT;Trinidad & Tobago;1868 XXX XXXX;11;
1784;VC;Saint Vincent & the Grenadines;1784 XXX XXXX;11;
1767;DM;Dominica;1767 XXX XXXX;11;
1758;LC;Saint Lucia;1758 XXX XXXX;11;
1721;SX;Sint Maarten;1721 XXX XXXX;11;
1684;AS;American Samoa;1684 XXX XXXX;11;
1671;GU;Guam;1671 XXX XXXX;11;
1670;MP;Northern Mariana Islands;1670 XXX XXXX;11;
1664;MS;Montserrat;1664 XXX XXXX;11;
1649;TC;Turks & Caicos Islands;1649 XXX XXXX;11;
1473;GD;Grenada;1473 XXX XXXX;11;
1441;BM;Bermuda;1441 XXX XXXX;11;
1345;KY;Cayman Islands;1345 XXX XXXX;11;
1340;VI;US Virgin Islands;1340 XXX XXXX;11;
1284;VG;British Virgin Islands;1284 XXX XXXX;11;
1268;AG;Antigua & Barbuda;1268 XXX XXXX;11;
1264;AI;Anguilla;1264 XXX XXXX;11;
1246;BB;Barbados;1246 XXX XXXX;11;
1242;BS;Bahamas;1242 XXX XXXX;11;
998;UZ;Uzbekistan;998 XX XXXXXXX;12;
996;KG;Kyrgyzstan
995;GE;Georgia
994;AZ;Azerbaijan;994 XX XXX XX XX;12;
993;TM;Turkmenistan;993 XX XXXXXX;11;
992;TJ;Tajikistan
977;NP;Nepal
976;MN;Mongolia
975;BT;Bhutan
974;QA;Qatar
973;BH;Bahrain;973 XXXX XXXX;11;
972;IL;Israel;972 XX XXX XXXX;12;
971;AE;United Arab Emirates;971 XX XXX XXXX;12;
970;PS;Palestine;970 XXX XX XXXX;12;
968;OM;Oman;968 XXXX XXXX;11;
967;YE;Yemen;967 XXX XXX XXX;12;
966;SA;Saudi Arabia;
965;KW;Kuwait;965 XXXX XXXX;11;
964;IQ;Iraq;964 XXX XXX XXXX;13;
963;SY;Syria
962;JO;Jordan;962 X XXXX XXXX;12;
961;LB;Lebanon
960;MV;Maldives
886;TW;Taiwan
880;BD;Bangladesh
856;LA;Laos
855;KH;Cambodia
853;MO;Macau
852;HK;Hong Kong
850;KP;North Korea
692;MH;Marshall Islands
691;FM;Micronesia
690;TK;Tokelau
689;PF;French Polynesia
688;TV;Tuvalu
687;NC;New Caledonia
686;KI;Kiribati
685;WS;Samoa
683;NU;Niue
682;CK;Cook Islands
681;WF;Wallis & Futuna
680;PW;Palau
679;FJ;Fiji
678;VU;Vanuatu
677;SB;Solomon Islands
676;TO;Tonga
675;PG;Papua New Guinea
674;NR;Nauru
673;BN;Brunei Darussalam;673 XXX XXXX;10;
672;NF;Norfolk Island
670;TL;Timor-Leste
599;BQ;Bonaire, Sint Eustatius & Saba
599;CW;Curaçao
598;UY;Uruguay;598 XXXX XXXX;11;
597;SR;Suriname;597 XXX XXXX;10;
596;MQ;Martinique
595;PY;Paraguay;595 XXX XXX XXX;12;
594;GF;French Guiana
593;EC;Ecuador
592;GY;Guyana
591;BO;Bolivia;591 X XXX XXXX;11;
590;GP;Guadeloupe
509;HT;Haiti
508;PM;Saint Pierre & Miquelon
507;PA;Panama;507 XXXX XXXX;11;
506;CR;Costa Rica
505;NI;Nicaragua;505 XXXX XXXX;11;
504;HN;Honduras;504 XXXX XXXX;11;
503;SV;El Salvador;503 XXXX XXXX;11;
502;GT;Guatemala;502 X XXX XXXX;11;
501;BZ;Belize
500;FK;Falkland Islands
423;LI;Liechtenstein
421;SK;Slovakia
420;CZ;Czech Republic
389;MK;Macedonia
387;BA;Bosnia & Herzegovina
386;SI;Slovenia
385;HR;Croatia
382;ME;Montenegro
381;RS;Serbia;381 XX XXX XXXX;12;
380;UA;Ukraine;380 XX XXX XX XX;12;
378;SM;San Marino;378 XXX XXX XXXX;13;
377;MC;Monaco;377 XXXX XXXX;11;
376;AD;Andorra;376 XX XX XX;9;
375;BY;Belarus;375 XX XXX XXXX;12;
374;AM;Armenia;374 XX XXX XXX;11;
373;MD;Moldova;373 XX XXX XXX;11;
372;EE;Estonia;
371;LV;Latvia;371 XXX XXXXX;11;
370;LT;Lithuania;370 XXX XXXXX;11;
359;BG;Bulgaria;
358;FI;Finland;
357;CY;Cyprus;357 XXXX XXXX;11;
356;MT;Malta;356 XX XX XX XX;11;
355;AL;Albania;355 XX XXX XXXX;12;
354;IS;Iceland;354 XXX XXXX;10;
353;IE;Ireland;353 XX XXX XXXX;12;
352;LU;Luxembourg
351;PT;Portugal;351 X XXXX XXXX;12;
350;GI;Gibraltar;350 XXXX XXXX;11;
299;GL;Greenland;299 XXX XXX;9;
298;FO;Faroe Islands;298 XXX XXX;9;
297;AW;Aruba;297 XXX XXXX;10;
291;ER;Eritrea;291 X XXX XXX;10;
290;SH;Saint Helena;290 XX XXX;8;
269;KM;Comoros;269 XXX XXXX;10;
268;SZ;Swaziland;268 XXXX XXXX;11;
267;BW;Botswana;267 XX XXX XXX;11;
266;LS;Lesotho;266 XX XXX XXX;11;
265;MW;Malawi
264;NA;Namibia;264 XX XXX XXXX;12;
263;ZW;Zimbabwe;263 XX XXX XXXX;12;
262;RE;Réunion;262 XXX XXX XXX;12;
261;MG;Madagascar;261 XX XX XXX XX;12;
260;ZM;Zambia;260 XX XXX XXXX;12;
258;MZ;Mozambique;258 XX XXX XXXX;12;
257;BI;Burundi;257 XX XX XXXX;11;
256;UG;Uganda;256 XX XXX XXXX;12;
255;TZ;Tanzania;255 XX XXX XXXX;12;
254;KE;Kenya;254 XXX XXX XXX;12;
253;DJ;Djibouti;253 XX XX XX XX;11;
252;SO;Somalia;252 XX XXX XXX;11;
251;ET;Ethiopia;251 XX XXX XXXX;12;
250;RW;Rwanda;250 XXX XXX XXX;12;
249;SD;Sudan;249 XX XXX XXXX;12;
248;SC;Seychelles;248 X XX XX XX;10;
247;SH;Saint Helena;247 XXXX;7;
246;IO;Diego Garcia;246 XXX XXXX;10;
245;GW;Guinea-Bissau;245 XXX XXXX;10;
244;AO;Angola;244 XXX XXX XXX;12;
243;CD;Congo (Dem. Rep.);243 XX XXX XXXX;12;
242;CG;Congo (Rep.);242 XX XXX XXXX;12;
241;GA;Gabon;241 X XX XX XX;10;
240;GQ;Equatorial Guinea;240 XXX XXX XXX;12;
239;ST;São Tomé & Príncipe;239 XX XXXXX;10;
238;CV;Cape Verde;238 XXX XXXX;10;
237;CM;Cameroon;237 XXXX XXXX;11;
236;CF;Central African Rep.;236 XX XX XX XX;11;
235;TD;Chad;235 XX XX XX XX;11;
234;NG;Nigeria
233;GH;Ghana
232;SL;Sierra Leone;232 XX XXX XXX;11;
231;LR;Liberia;
230;MU;Mauritius;
229;BJ;Benin;229 XX XXX XXX;11;
228;TG;Togo;228 XX XXX XXX;11;
227;NE;Niger;227 XX XX XX XX;11;
226;BF;Burkina Faso;226 XX XX XX XX;11;
225;CI;Côte d`Ivoire;225 XX XXX XXX;11;
224;GN;Guinea;224 XXX XXX XXX;12;
223;ML;Mali;223 XXXX XXXX;11;
222;MR;Mauritania;222 XXXX XXXX;11;
221;SN;Senegal;221 XX XXX XXXX;12;
220;GM;Gambia;220 XXX XXXX;10;
218;LY;Libya;218 XX XXX XXXX;12;
216;TN;Tunisia;216 XX XXX XXX;11;
213;DZ;Algeria;213 XXX XX XX XX;12;
212;MA;Morocco;212 XX XXX XXXX;12;
211;SS;South Sudan;211 XX XXX XXXX;12;
98;IR;Iran;98 XXX XXX XXXX;12;
95;MM;Myanmar;
94;LK;Sri Lanka;94 XX XXX XXXX;11;
93;AF;Afghanistan;93 XXX XXX XXX;11;
92;PK;Pakistan;92 XXX XXX XXXX;12;
91;IN;India;91 XXXXX XXXXX;12;
90;TR;Turkey;90 XXX XXX XXXX;12
86;CN;China;86 XXX XXXX XXXX;13;
84;VN;Vietnam;
82;KR;South Korea;
81;JP;Japan;81 XX XXXX XXXX;12;
66;TH;Thailand;66 X XXXX XXXX;11;
65;SG;Singapore;65 XXXX XXXX;10;
64;NZ;New Zealand;
63;PH;Philippines;63 XXX XXX XXXX;12;
62;ID;Indonesia;
61;AU;Australia;61 XXX XXX XXX;11;
60;MY;Malaysia;
58;VE;Venezuela;58 XXX XXX XXXX;12;
57;CO;Colombia;57 XXX XXX XXXX;12;
56;CL;Chile;56 X XXXX XXXX;11;
55;BR;Brazil;55 XX XXXXX XXXX;13;
54;AR;Argentina;
53;CU;Cuba;53 XXXX XXXX;10;
52;MX;Mexico;
51;PE;Peru;51 XXX XXX XXX;11;
49;DE;Germany;49 XXX XXXXXXXX;13;
48;PL;Poland;48 XX XXX XXXX;11;
47;NO;Norway;47 XXXX XXXX;10;
46;SE;Sweden;46 XX XXX XXXX;11;
45;DK;Denmark;45 XXXX XXXX;10;
44;GB;United Kingdom;44 XXXX XXXXXX;12;
43;AT;Austria;
41;CH;Switzerland;41 XX XXX XXXX;11;
40;RO;Romania;40 XXX XXX XXX;11;
39;IT;Italy;39 XXX XXX XXXX;12;
36;HU;Hungary;36 XX XXX XXXX;11;
34;ES;Spain;34 XXX XXX XXX;11;
33;FR;France;33 X XX XX XX XX;11;
32;BE;Belgium;32 XXX XX XX XX;11;
31;NL;Netherlands;31 X XX XX XX XX;11;
30;GR;Greece;30 XX XXXX XXXX;12;
27;ZA;South Africa;27 XX XXX XXXX;11;
20;EG;Egypt;20 XX XXX XXXX;11;
7;RU;Russian Federation;7 XXX XXX XX XX;11;
7;KZ;Kazakhstan;7 XXX XXX XX XX;11
1;US;USA;1 XXX XXX XXXX;11;
1;PR;Puerto Rico;1 XXX XXX XXXX;11;
1;DO;Dominican Rep.;1 XXX XXX XXXX;11;
1;CA;Canada;1 XXX XXX XXXX;11;

View file

@ -18,6 +18,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
#include "genstyles.h"
#include <QtCore/QtPlugin>
#include <QtCore/QRegularExpression>
#ifdef Q_OS_WIN
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
@ -1345,6 +1346,12 @@ bool genStyles(const QString &classes_in, const QString &classes_out, const QStr
QCoreApplication::exit(1);
return false;
}
QString numbers_cpp = QString(styles_cpp).replace("style_auto.cpp", "numbers.cpp");
if (numbers_cpp == styles_cpp) {
cout << "Bad output file name '" << numbers_cpp.toUtf8().constData() << "'!\n";
QCoreApplication::exit(1);
return false;
}
QFile f(styles_in);
if (!f.open(QIODevice::ReadOnly)) {
@ -1353,6 +1360,20 @@ bool genStyles(const QString &classes_in, const QString &classes_out, const QStr
return false;
}
QString numbers_in = QString(styles_in).replace("style.txt", "numbers.txt");
if (numbers_in == styles_in) {
cout << "Bad input file name '" << numbers_in.toUtf8().constData() << "'!\n";
QCoreApplication::exit(1);
return false;
}
QFile fnum(numbers_in);
if (!fnum.open(QIODevice::ReadOnly)) {
cout << "Could not open numbers input file '" << numbers_in.toUtf8().constData() << "'!\n";
QCoreApplication::exit(1);
return false;
}
QImage sprites[variantsCount];
int widths[variantsCount] = { 0 };
variantSprites = sprites;
@ -1854,6 +1875,137 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\
if (!cpp.open(QIODevice::WriteOnly)) throw Exception("Could not open style_auto.cpp for writing!");
if (cpp.write(cppText) != cppText.size()) throw Exception("Could not open style_auto.cpp for writing!");
}
QMap<QString, QVector<int> > numberRules;
QList<QByteArray> numlines = fnum.readAll().split('\n');
for (int i = 0, l = numlines.size(); i < l; ++i) {
QList<QByteArray> strs = numlines.at(i).split(';');
if (strs.isEmpty()) continue;
QString code = QString::fromLatin1(strs.at(0)).trimmed();
if (code.isEmpty() || QRegularExpression("[^0-9]").match(code).hasMatch()) {
throw Exception("Bad string in number.txt: " + numlines.at(i));
}
if (strs.size() < 5) {
numberRules.insert(code, QVector<int>());
} else {
QString lenstr = QString::fromLatin1(strs.at(4)).trimmed(), pattern = QString::fromLatin1(strs.at(3)).trimmed();
if (QRegularExpression("[^0-9]").match(lenstr).hasMatch() || !pattern.startsWith(code + ' ')) {
throw Exception("Bad string in number.txt: " + numlines.at(i));
}
QStringList lst = pattern.mid(code.size() + 1).split(' ');
int len = lenstr.toInt(), sum = code.size();
QVector<int> result;
for (int j = 0, c = lst.size(); j < c; ++j) {
if (lst.at(j).isEmpty()) continue;
if (QRegularExpression("[^X]").match(lst.at(j)).hasMatch()) {
throw Exception("Bad string in number.txt: " + numlines.at(i));
}
result.push_back(lst.at(j).size());
sum += lst.at(j).size();
}
if (sum != len) {
throw Exception("Bad length in number.txt: " + numlines.at(i));
}
numberRules.insert(code, result);
}
}
QByteArray numText;
{
QTextStream tnum(&numText);
tnum << "\
/*\n\
Created from \'/Resources/style.txt\' by \'/MetaStyle\' project\n\
\n\
WARNING! All changes made in this file will be lost!\n\
\n\
This file is part of Telegram Desktop,\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\
the Free Software Foundation, either version 3 of the License, or\n\
(at your option) any later version.\n\
\n\
It is distributed in the hope that it will be useful,\n\
but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
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://desktop.telegram.org\n\
*/\n";
tnum << "#include \"stdafx.h\"\n#include \"numbers.h\"\n\n";
tnum << "QVector<int> phoneNumberParse(const QString &number) {\n";
tnum << "\tQVector<int> result;\n\n";
tnum << "\tint32 len = number.size();\n";
tnum << "\tif (len > 0) switch (number.at(0).unicode()) {\n";
QString already;
for (QMap<QString, QVector<int> >::const_iterator i = numberRules.cend(), e = numberRules.cbegin(); i != e;) {
--i;
QString k = i.key();
bool onlyLastChanged = true;
while (!already.isEmpty() && (already.size() > k.size() || !already.endsWith(k.at(already.size() - 1)))) {
if (!onlyLastChanged) {
tnum << QString("\t").repeated(1 + already.size()) << "}\n";
tnum << QString("\t").repeated(1 + already.size()) << "return result;\n";
}
already = already.mid(0, already.size() - 1);
onlyLastChanged = false;
}
if (already == k) {
tnum << QString("\t").repeated(1 + already.size()) << "}\n";
} else {
bool onlyFirstCheck = true;
while (already.size() < k.size()) {
if (!onlyFirstCheck) tnum << QString("\t").repeated(1 + already.size()) << "if (len > " << already.size() << ") switch (number.at(" << already.size() << ").unicode()) {\n";
tnum << QString("\t").repeated(1 + already.size()) << "case '" << k.at(already.size()).toLatin1() << "':\n";
already.push_back(k.at(already.size()));
onlyFirstCheck = false;
}
}
if (i.value().isEmpty()) {
tnum << QString("\t").repeated(1 + already.size()) << "return QVector<int>(1, " << k.size() << ");\n";
} else {
tnum << QString("\t").repeated(1 + already.size()) << "result.reserve(" << (i.value().size() + 1) << ");\n";
tnum << QString("\t").repeated(1 + already.size()) << "result.push_back(" << k.size() << ");\n";
for (int j = 0, l = i.value().size(); j < l; ++j) {
tnum << QString("\t").repeated(1 + already.size()) << "result.push_back(" << i.value().at(j) << ");\n";
}
tnum << QString("\t").repeated(1 + already.size()) << "return result;\n";
}
}
bool onlyLastChanged = true;
while (!already.isEmpty()) {
if (!onlyLastChanged) {
tnum << QString("\t").repeated(1 + already.size()) << "}\n";
// tnum << QString("\t").repeated(1 + already.size()) << "\return result;\n";
}
already = already.mid(0, already.size() - 1);
onlyLastChanged = false;
}
tnum << "\t}\n\n";
tnum << "\treturn result;\n";
tnum << "}\n";
}
QFile num(numbers_cpp);
bool write_num = true;
if (num.open(QIODevice::ReadOnly)) {
QByteArray wasNum = num.readAll();
if (wasNum.size() == numText.size()) {
if (!memcmp(wasNum.constData(), numText.constData(), numText.size())) {
write_num = false;
}
}
num.close();
}
if (write_num) {
cout << "Numbers compiled, writing..\n";
if (!num.open(QIODevice::WriteOnly)) throw Exception("Could not open numbers.cpp for writing!");
if (num.write(numText) != numText.size()) throw Exception("Could not open numbers.cpp for writing!");
}
} catch (exception &e) {
cout << e.what() << "\n";
QCoreApplication::exit(1);

View file

@ -26,6 +26,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
#include "localstorage.h"
#include "numbers.h"
namespace {
bool quiting = false;
@ -107,7 +109,27 @@ namespace {
namespace App {
QString formatPhone(QString phone) {
return '+' + phone.replace(QRegularExpression(qsl("[^\\d]")), QString());
if (phone.isEmpty()) return QString();
QString number = phone;
for (const QChar *ch = phone.constData(), *e = ch + phone.size(); ch != e; ++ch) {
if (ch->unicode() < '0' || ch->unicode() > '9') {
number = phone.replace(QRegularExpression(qsl("[^\\d]")), QString());
}
}
QVector<int> groups = phoneNumberParse(number);
if (groups.isEmpty()) return '+' + number;
QString result;
result.reserve(number.size() + groups.size() + 1);
result.append('+');
int32 sum = 0;
for (int32 i = 0, l = groups.size(); i < l; ++i) {
result.append(number.midRef(sum, groups.at(i)));
sum += groups.at(i);
if (sum < number.size()) result.append(' ');
}
if (sum < number.size()) result.append(number.midRef(sum));
return result;
}
Application *app() {
@ -381,13 +403,22 @@ namespace App {
data->access = UserNoAccess;
status = &emptyStatus;
} else {
data->setPhone(d.has_phone() ? qs(d.vphone) : QString());
QString phone = d.has_phone() ? qs(d.vphone) : QString();
QString fname = d.has_first_name() ? textOneLine(qs(d.vfirst_name)) : QString();
QString lname = d.has_last_name() ? textOneLine(qs(d.vlast_name)) : QString();
QString uname = d.has_username() ? textOneLine(qs(d.vusername)) : QString();
bool phoneChanged = (data->phone != phone);
if (phoneChanged) data->setPhone(phone);
bool nameChanged = (data->firstName != fname) || (data->lastName != lname);
bool showPhone = !isServiceUser(data->id) && !(flags & (MTPDuser_flag_self | MTPDuser_flag_contact | MTPDuser_flag_mutual_contact));
QString pname = (showPhone && !data->phone.isEmpty()) ? formatPhone(data->phone) : QString();
data->setName(fname, lname, QString(), uname);
bool showPhoneChanged = !isServiceUser(data->id) && !(flags & (MTPDuser_flag_self)) && ((showPhone && data->contact) || (!showPhone && !data->contact));
QString pname = (showPhoneChanged || phoneChanged || nameChanged) ? ((showPhone && !phone.isEmpty()) ? formatPhone(phone) : QString()) : data->nameOrPhone;
data->setName(fname, lname, pname, uname);
if (d.has_photo()) {
data->setPhoto(d.vphoto);
} else {
@ -825,6 +856,7 @@ namespace App {
UserData *user = userLoaded(userId.v);
if (user) {
bool wasContact = (user->contact > 0);
bool wasShowPhone = !user->contact;
switch (myLink.type()) {
case mtpc_contactLinkContact:
user->contact = 1;
@ -855,7 +887,12 @@ namespace App {
App::main()->removeContact(user);
}
}
user->setName(textOneLine(user->firstName), textOneLine(user->lastName), (user->contact || isServiceUser(user->id) || user->phone.isEmpty()) ? QString() : App::formatPhone(user->phone), textOneLine(user->username));
bool showPhone = !isServiceUser(user->id) && (user->input.type() != mtpc_inputPeerSelf) && !user->contact;
bool showPhoneChanged = !isServiceUser(user->id) && (user->input.type() != mtpc_inputPeerSelf) && ((showPhone && !wasShowPhone) || (!showPhone && wasShowPhone));
if (showPhoneChanged) {
user->setName(textOneLine(user->firstName), textOneLine(user->lastName), showPhone ? App::formatPhone(user->phone) : QString(), textOneLine(user->username));
}
if (App::main()) {
if (emitPeerUpdated) {
App::main()->peerUpdated(user);
@ -891,7 +928,7 @@ namespace App {
return feedPhoto(photo.c_photo(), convert);
} break;
case mtpc_photoEmpty: {
return App::photo(photo.c_photoEmpty().vid.v, convert);
return App::photoSet(photo.c_photoEmpty().vid.v, convert, 0, 0, 0, ImagePtr(), ImagePtr(), ImagePtr());
} break;
}
return App::photo(0);
@ -935,7 +972,7 @@ namespace App {
switch (photo.type()) {
case mtpc_photo: {
const MTPDphoto &ph(photo.c_photo());
return App::photo(ph.vid.v, 0, ph.vaccess_hash.v, ph.vuser_id.v, ph.vdate.v, ImagePtr(*thumb, "JPG"), ImagePtr(*medium, "JPG"), ImagePtr(*full, "JPG"));
return App::photoSet(ph.vid.v, 0, ph.vaccess_hash.v, ph.vuser_id.v, ph.vdate.v, ImagePtr(*thumb, "JPG"), ImagePtr(*medium, "JPG"), ImagePtr(*full, "JPG"));
} break;
case mtpc_photoEmpty: return App::photo(photo.c_photoEmpty().vid.v);
}
@ -990,13 +1027,13 @@ namespace App {
}
}
if (thumb && medium && full) {
return App::photo(photo.vid.v, convert, photo.vaccess_hash.v, photo.vuser_id.v, photo.vdate.v, App::image(*thumb), App::image(*medium), App::image(*full));
return App::photoSet(photo.vid.v, convert, photo.vaccess_hash.v, photo.vuser_id.v, photo.vdate.v, App::image(*thumb), App::image(*medium), App::image(*full));
}
return App::photo(photo.vid.v, convert);
return App::photoSet(photo.vid.v, convert, 0, 0, 0, ImagePtr(), ImagePtr(), ImagePtr());
}
VideoData *feedVideo(const MTPDvideo &video, VideoData *convert) {
return App::video(video.vid.v, convert, video.vaccess_hash.v, video.vuser_id.v, video.vdate.v, video.vduration.v, video.vw.v, video.vh.v, App::image(video.vthumb), video.vdc_id.v, video.vsize.v);
return App::videoSet(video.vid.v, convert, video.vaccess_hash.v, video.vuser_id.v, video.vdate.v, video.vduration.v, video.vw.v, video.vh.v, App::image(video.vthumb), video.vdc_id.v, video.vsize.v);
}
AudioData *feedAudio(const MTPaudio &audio, AudioData *convert) {
@ -1005,14 +1042,14 @@ namespace App {
return feedAudio(audio.c_audio(), convert);
} break;
case mtpc_audioEmpty: {
return App::audio(audio.c_audioEmpty().vid.v, convert);
return App::audioSet(audio.c_audioEmpty().vid.v, convert, 0, 0, 0, QString(), 0, 0, 0);
} break;
}
return App::audio(0);
}
AudioData *feedAudio(const MTPDaudio &audio, AudioData *convert) {
return App::audio(audio.vid.v, convert, audio.vaccess_hash.v, audio.vuser_id.v, audio.vdate.v, qs(audio.vmime_type), audio.vduration.v, audio.vdc_id.v, audio.vsize.v);
return App::audioSet(audio.vid.v, convert, audio.vaccess_hash.v, audio.vuser_id.v, audio.vdate.v, qs(audio.vmime_type), audio.vduration.v, audio.vdc_id.v, audio.vsize.v);
}
DocumentData *feedDocument(const MTPdocument &document, const QPixmap &thumb) {
@ -1043,11 +1080,11 @@ namespace App {
}
WebPageData *feedWebPage(const MTPDwebPage &webpage, WebPageData *convert) {
return App::webPage(webpage.vid.v, convert, webpage.has_type() ? qs(webpage.vtype) : qsl("article"), qs(webpage.vurl), qs(webpage.vdisplay_url), webpage.has_site_name() ? qs(webpage.vsite_name) : QString(), webpage.has_title() ? qs(webpage.vtitle) : QString(), webpage.has_description() ? qs(webpage.vdescription) : QString(), webpage.has_photo() ? App::feedPhoto(webpage.vphoto) : 0, webpage.has_duration() ? webpage.vduration.v : 0, webpage.has_author() ? qs(webpage.vauthor) : QString(), 0);
return App::webPageSet(webpage.vid.v, convert, webpage.has_type() ? qs(webpage.vtype) : qsl("article"), qs(webpage.vurl), qs(webpage.vdisplay_url), webpage.has_site_name() ? qs(webpage.vsite_name) : QString(), webpage.has_title() ? qs(webpage.vtitle) : QString(), webpage.has_description() ? qs(webpage.vdescription) : QString(), webpage.has_photo() ? App::feedPhoto(webpage.vphoto) : 0, webpage.has_duration() ? webpage.vduration.v : 0, webpage.has_author() ? qs(webpage.vauthor) : QString(), 0);
}
WebPageData *feedWebPage(const MTPDwebPagePending &webpage, WebPageData *convert) {
return App::webPage(webpage.vid.v, convert, QString(), QString(), QString(), QString(), QString(), QString(), 0, 0, QString(), webpage.vdate.v);
return App::webPageSet(webpage.vid.v, convert, QString(), QString(), QString(), QString(), QString(), QString(), 0, 0, QString(), webpage.vdate.v);
}
WebPageData *feedWebPage(const MTPWebPage &webpage) {
@ -1131,7 +1168,15 @@ namespace App {
return App::peer(App::peerFromChat(chat))->asChat();
}
PhotoData *photo(const PhotoId &photo, PhotoData *convert, const uint64 &access, int32 user, int32 date, const ImagePtr &thumb, const ImagePtr &medium, const ImagePtr &full) {
PhotoData *photo(const PhotoId &photo) {
PhotosData::const_iterator i = photosData.constFind(photo);
if (i == photosData.cend()) {
i = photosData.insert(photo, new PhotoData(photo));
}
return i.value();
}
PhotoData *photoSet(const PhotoId &photo, PhotoData *convert, const uint64 &access, int32 user, int32 date, const ImagePtr &thumb, const ImagePtr &medium, const ImagePtr &full) {
if (convert) {
if (convert->id != photo) {
PhotosData::iterator i = photosData.find(convert->id);
@ -1185,7 +1230,15 @@ namespace App {
return result;
}
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) {
VideoData *video(const VideoId &video) {
VideosData::const_iterator i = videosData.constFind(video);
if (i == videosData.cend()) {
i = videosData.insert(video, new VideoData(video));
}
return i.value();
}
VideoData *videoSet(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) {
VideosData::iterator i = videosData.find(convert->id);
@ -1233,7 +1286,15 @@ namespace App {
return result;
}
AudioData *audio(const AudioId &audio, AudioData *convert, const uint64 &access, int32 user, int32 date, const QString &mime, int32 duration, int32 dc, int32 size) {
AudioData *audio(const AudioId &audio) {
AudiosData::const_iterator i = audiosData.constFind(audio);
if (i == audiosData.cend()) {
i = audiosData.insert(audio, new AudioData(audio));
}
return i.value();
}
AudioData *audioSet(const AudioId &audio, AudioData *convert, const uint64 &access, int32 user, int32 date, const QString &mime, int32 duration, int32 dc, int32 size) {
if (convert) {
if (convert->id != audio) {
AudiosData::iterator i = audiosData.find(convert->id);
@ -1375,7 +1436,15 @@ namespace App {
return result;
}
WebPageData *webPage(const WebPageId &webPage, WebPageData *convert, const QString &type, const QString &url, const QString &displayUrl, const QString &siteName, const QString &title, const QString &description, PhotoData *photo, int32 duration, const QString &author, int32 pendingTill) {
WebPageData *webPage(const WebPageId &webPage) {
WebPagesData::const_iterator i = webPagesData.constFind(webPage);
if (i == webPagesData.cend()) {
i = webPagesData.insert(webPage, new WebPageData(webPage));
}
return i.value();
}
WebPageData *webPageSet(const WebPageId &webPage, WebPageData *convert, const QString &type, const QString &url, const QString &displayUrl, const QString &siteName, const QString &title, const QString &description, PhotoData *photo, int32 duration, const QString &author, int32 pendingTill) {
if (convert) {
if (convert->id != webPage) {
WebPagesData::iterator i = webPagesData.find(convert->id);
@ -1433,7 +1502,15 @@ namespace App {
return result;
}
ImageLinkData *imageLink(const QString &imageLink, ImageLinkType type, const QString &url) {
ImageLinkData *imageLink(const QString &imageLink) {
ImageLinksData::const_iterator i = imageLinksData.constFind(imageLink);
if (i == imageLinksData.cend()) {
i = imageLinksData.insert(imageLink, new ImageLinkData(imageLink));
}
return i.value();
}
ImageLinkData *imageLinkSet(const QString &imageLink, ImageLinkType type, const QString &url) {
ImageLinksData::const_iterator i = imageLinksData.constFind(imageLink);
ImageLinkData *result;
if (i == imageLinksData.cend()) {

View file

@ -156,13 +156,18 @@ namespace App {
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());
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);
AudioData *audio(const AudioId &audio, AudioData *convert = 0, const uint64 &access = 0, int32 user = 0, int32 date = 0, const QString &mime = QString(), int32 duration = 0, int32 dc = 0, int32 size = 0);
PhotoData *photo(const PhotoId &photo);
PhotoData *photoSet(const PhotoId &photo, PhotoData *convert, const uint64 &access, int32 user, int32 date, const ImagePtr &thumb, const ImagePtr &medium, const ImagePtr &full);
VideoData *video(const VideoId &video);
VideoData *videoSet(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);
AudioData *audio(const AudioId &audio);
AudioData *audioSet(const AudioId &audio, AudioData *convert, const uint64 &access, int32 user, int32 date, const QString &mime, int32 duration, int32 dc, int32 size);
DocumentData *document(const DocumentId &document);
DocumentData *documentSet(const DocumentId &document, DocumentData *convert, const uint64 &access, int32 date, const QVector<MTPDocumentAttribute> &attributes, const QString &mime, const ImagePtr &thumb, int32 dc, int32 size, const StorageImageLocation &thumbLocation);
WebPageData *webPage(const WebPageId &webPage, WebPageData *convert = 0, const QString &type = QString(), const QString &url = QString(), const QString &displayUrl = QString(), const QString &siteName = QString(), const QString &title = QString(), const QString &description = QString(), PhotoData *photo = 0, int32 duration = 0, const QString &author = QString(), int32 pendingTill = -2);
ImageLinkData *imageLink(const QString &imageLink, ImageLinkType type = InvalidImageLink, const QString &url = QString());
WebPageData *webPage(const WebPageId &webPage);
WebPageData *webPageSet(const WebPageId &webPage, WebPageData *convert, const QString &, const QString &url, const QString &displayUrl, const QString &siteName, const QString &title, const QString &description, PhotoData *photo, int32 duration, const QString &author, int32 pendingTill);
ImageLinkData *imageLink(const QString &imageLink);
ImageLinkData *imageLinkSet(const QString &imageLink, ImageLinkType type, const QString &url);
void forgetMedia();
MTPPhoto photoFromUserPhoto(MTPint userId, MTPint date, const MTPUserProfilePhoto &photo);

View file

@ -654,8 +654,8 @@ void Application::checkMapVersion() {
psRegisterCustomScheme();
if (Local::oldMapVersion()) {
QString versionFeatures;
if (DevChannel && Local::oldMapVersion() < 8040) {
versionFeatures = QString::fromUtf8("\xe2\x80\x94 Fixed critical Qt bug in image scale\n\xe2\x80\x94 Huge amount of unread messages are loaded much faster\n\xe2\x80\x94 Flac audio files are played in-app\n\xe2\x80\x94 Some bugfixes and optimizations");// .replace('@', qsl("@") + QChar(0x200D));
if (DevChannel && Local::oldMapVersion() < 8041) {
versionFeatures = QString::fromUtf8("\xe2\x80\x94 Pretty phone number formatting\n\xe2\x80\x94 Fixed shared contacts display\n\xe2\x80\x94 Fix KDE crash, use Qt tray icon in all Linux systems");// .replace('@', qsl("@") + QChar(0x200D));
} else if (!DevChannel && Local::oldMapVersion() < 8038) {
versionFeatures = lang(lng_new_version_text).trimmed();
}

View file

@ -17,8 +17,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
*/
#pragma once
static const int32 AppVersion = 8040;
static const wchar_t *AppVersionStr = L"0.8.40";
static const int32 AppVersion = 8041;
static const wchar_t *AppVersionStr = L"0.8.41";
static const bool DevChannel = true;
static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)";

View file

@ -42,7 +42,8 @@ namespace {
FlatInputStyle _flatInputStyle;
}
FlatInput::FlatInput(QWidget *parent, const style::flatInput &st, const QString &pholder, const QString &v) : QLineEdit(v, parent), _fullph(pholder), _oldtext(v), _kev(0), _customUpDown(false), _phVisible(!v.length()),
FlatInput::FlatInput(QWidget *parent, const style::flatInput &st, const QString &pholder, const QString &v) : QLineEdit(v, parent),
_fullph(pholder), _fastph(false), _oldtext(v), _kev(0), _customUpDown(false), _phVisible(!v.length()),
a_phLeft(_phVisible ? 0 : st.phShift), a_phAlpha(_phVisible ? 1 : 0), a_phColor(st.phColor->c),
a_borderColor(st.borderColor->c), a_bgColor(st.bgColor->c), _notingBene(0), _st(st) {
resize(_st.width, _st.height);
@ -130,7 +131,7 @@ QRect FlatInput::getTextRect() const {
}
void FlatInput::paintEvent(QPaintEvent *e) {
QPainter p(this);
Painter p(this);
p.fillRect(rect(), a_bgColor.current());
if (_st.borderWidth) {
QBrush b(a_borderColor.current());
@ -151,9 +152,9 @@ void FlatInput::paintEvent(QPaintEvent *e) {
if (phDraw) {
p.save();
p.setClipRect(rect());
QRect phRect(_st.textMrg.left() + _st.phPos.x() + a_phLeft.current(), _st.textMrg.top() + _st.phPos.y(), width() - _st.textMrg.left() - _st.textMrg.right(), height() - _st.textMrg.top() - _st.textMrg.bottom());
p.setFont(_st.font->f);
p.setPen(a_phColor.current());
QRect phRect(placeholderRect());
phRect.moveLeft(phRect.left() + a_phLeft.current());
phPrepare(p);
p.drawText(phRect, _ph, QTextOption(_st.phAlign));
p.restore();
}
@ -228,20 +229,53 @@ bool FlatInput::animStep(float64 ms) {
return res;
}
void FlatInput::setPlaceholder(const QString &ph) {
_fullph = ph;
resizeEvent(0);
update();
}
void FlatInput::setPlaceholderFast(bool fast) {
_fastph = fast;
if (_fastph) {
a_phLeft = anim::ivalue(_phVisible ? 0 : _st.phShift, _phVisible ? 0 : _st.phShift);
a_phAlpha = anim::fvalue(_phVisible ? 1 : 0, _phVisible ? 1 : 0);
update();
}
}
void FlatInput::updatePlaceholder() {
bool vis = !text().length();
if (vis == _phVisible) return;
a_phLeft.start(vis ? 0 : _st.phShift);
a_phAlpha.start(vis ? 1 : 0);
anim::start(this);
if (_fastph) {
a_phLeft = anim::ivalue(vis ? 0 : _st.phShift, vis ? 0 : _st.phShift);
a_phAlpha = anim::fvalue(vis ? 1 : 0, vis ? 1 : 0);
update();
} else {
a_phLeft.start(vis ? 0 : _st.phShift);
a_phAlpha.start(vis ? 1 : 0);
anim::start(this);
}
_phVisible = vis;
}
const QString &FlatInput::placeholder() const {
return _fullph;
}
QRect FlatInput::placeholderRect() const {
return QRect(_st.textMrg.left() + _st.phPos.x(), _st.textMrg.top() + _st.phPos.y(), width() - _st.textMrg.left() - _st.textMrg.right(), height() - _st.textMrg.top() - _st.textMrg.bottom());
}
void FlatInput::correctValue(QKeyEvent *e, const QString &was) {
}
void FlatInput::phPrepare(Painter &p) {
p.setFont(_st.font->f);
p.setPen(a_phColor.current());
}
void FlatInput::keyPressEvent(QKeyEvent *e) {
QString was(text());
_kev = e;

View file

@ -38,7 +38,11 @@ public:
void notaBene();
void setPlaceholder(const QString &ph);
void setPlaceholderFast(bool fast);
void updatePlaceholder();
const QString &placeholder() const;
QRect placeholderRect() const;
QRect getTextRect() const;
@ -68,9 +72,16 @@ protected:
virtual void correctValue(QKeyEvent *e, const QString &was);
style::font phFont() {
return _st.font;
}
void phPrepare(Painter &p);
private:
QString _ph, _fullph, _oldtext;
bool _fastph;
QKeyEvent *_kev;
bool _customUpDown;

View file

@ -19,8 +19,30 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
#include "style.h"
#include "gui/phoneinput.h"
#include "numbers.h"
#include "lang.h"
PhoneInput::PhoneInput(QWidget *parent, const style::flatInput &st, const QString &ph) : FlatInput(parent, st, ph) {
PhoneInput::PhoneInput(QWidget *parent, const style::flatInput &st) : FlatInput(parent, st, lang(lng_phone_ph)) {
}
void PhoneInput::paintEvent(QPaintEvent *e) {
FlatInput::paintEvent(e);
Painter p(this);
QString t(text());
if (!pattern.isEmpty() && !t.isEmpty()) {
QString ph = placeholder().mid(t.size());
if (!ph.isEmpty()) {
p.setClipRect(rect());
QRect phRect(placeholderRect());
int tw = phFont()->m.width(t);
if (tw < phRect.width()) {
phRect.setLeft(phRect.left() + tw);
phPrepare(p);
p.drawText(phRect, ph, style::al_left);
}
}
}
}
void PhoneInput::correctValue(QKeyEvent *e, const QString &was) {
@ -36,34 +58,58 @@ void PhoneInput::correctValue(QKeyEvent *e, const QString &was) {
}
}
if (digitCount > MaxPhoneTailLength) digitCount = MaxPhoneTailLength;
bool strict = (digitCount == MaxPhoneTailLength);
bool inPart = !pattern.isEmpty();
int curPart = -1, leftInPart = 0;
newText.reserve(oldLen);
for (int i = 0; i < oldLen; ++i) {
if (i == oldPos && newPos < 0) {
newPos = newText.length();
}
QChar ch(oldText[i]);
if (ch.isDigit()) {
if (!digitCount--) {
break;
}
newText += ch;
if (strict && !digitCount) {
break;
if (inPart) {
if (leftInPart) {
--leftInPart;
} else {
newText += ' ';
++curPart;
inPart = curPart < pattern.size();
leftInPart = inPart ? (pattern.at(curPart) - 1) : 0;
++oldPos;
}
}
} else if (ch == ' ' || ch == '-' || ch == '(' || ch == ')') {
newText += ch;
}
if (i == oldPos) {
newPos = newText.length();
} else if (ch == ' ' || ch == '-' || ch == '(' || ch == ')') {
if (inPart) {
if (leftInPart) {
} else {
newText += ch;
++curPart;
inPart = curPart < pattern.size();
leftInPart = inPart ? pattern.at(curPart) : 0;
}
} else {
newText += ch;
}
}
}
int32 newlen = newText.size();
while (newlen > 0 && newText.at(newlen - 1).isSpace()) {
--newlen;
}
if (newlen < newText.size()) newText = newText.mid(0, newlen);
if (newPos < 0) {
newPos = newText.length();
}
if (newText != oldText) {
setText(newText);
if (newPos != oldPos) {
setCursorPosition(newPos);
}
setCursorPosition(newPos);
}
}
@ -76,6 +122,29 @@ void PhoneInput::addedToNumber(const QString &added) {
updatePlaceholder();
}
void PhoneInput::onChooseCode(const QString &code) {
pattern = phoneNumberParse(code);
if (!pattern.isEmpty() && pattern.at(0) == code.size()) {
pattern.pop_front();
} else {
pattern.clear();
}
if (pattern.isEmpty()) {
setPlaceholder(lang(lng_phone_ph));
} else {
QString ph;
ph.reserve(20);
for (int i = 0, l = pattern.size(); i < l; ++i) {
ph.append(' ');
ph.append(qsl("X").repeated(pattern.at(i)));
}
setPlaceholder(ph);
}
correctValue(0, text());
setPlaceholderFast(!pattern.isEmpty());
updatePlaceholder();
}
PortInput::PortInput(QWidget *parent, const style::flatInput &st, const QString &ph, const QString &val) : FlatInput(parent, st, ph, val) {
correctValue(0, QString());
}

View file

@ -24,11 +24,14 @@ class PhoneInput : public FlatInput {
public:
PhoneInput(QWidget *parent, const style::flatInput &st, const QString &ph);
PhoneInput(QWidget *parent, const style::flatInput &st);
void paintEvent(QPaintEvent *e);
public slots:
void addedToNumber(const QString &added);
void onChooseCode(const QString &code);
signals:
@ -38,6 +41,10 @@ protected:
void correctValue(QKeyEvent *e, const QString &was);
private:
QVector<int> pattern;
};
class PortInput : public FlatInput {

View file

@ -626,7 +626,8 @@ HistoryItem *History::createItem(HistoryBlock *block, const MTPmessage &msg, boo
const MTPDmessage m(msg.c_message());
int badMedia = 0; // 1 - unsupported, 2 - empty
switch (m.vmedia.type()) {
case mtpc_messageMediaEmpty: break;
case mtpc_messageMediaEmpty:
case mtpc_messageMediaContact: break;
case mtpc_messageMediaGeo:
switch (m.vmedia.c_messageMediaGeo().vgeo.type()) {
case mtpc_geoPoint: break;
@ -4552,7 +4553,7 @@ _description(st::msgMinWidth) {
QString lnk = qsl("https://maps.google.com/maps?q=") + url.mid(9) + qsl("&ll=") + url.mid(9) + qsl("&z=17");
link.reset(new TextLink(lnk));
data = App::imageLink(url, GoogleMapsLink, lnk);
data = App::imageLinkSet(url, GoogleMapsLink, lnk);
} else {
link.reset(new TextLink(url));
@ -4563,15 +4564,15 @@ _description(st::msgMinWidth) {
matchIndex = 3;
}
if (m.hasMatch()) {
data = App::imageLink(qsl("youtube:") + m.captured(matchIndex), YouTubeLink, url);
data = App::imageLinkSet(qsl("youtube:") + m.captured(matchIndex), YouTubeLink, url);
} else {
m = reVimeo.match(url);
if (m.hasMatch()) {
data = App::imageLink(qsl("vimeo:") + m.captured(3), VimeoLink, url);
data = App::imageLinkSet(qsl("vimeo:") + m.captured(3), VimeoLink, url);
} else {
m = reInstagram.match(url);
if (m.hasMatch()) {
data = App::imageLink(qsl("instagram:") + m.captured(3), InstagramLink, url);
data = App::imageLinkSet(qsl("instagram:") + m.captured(3), InstagramLink, url);
data->title = qsl("instagram.com/p/") + m.captured(3);
} else {
data = 0;

View file

@ -5235,7 +5235,7 @@ void HistoryWidget::drawField(Painter &p) {
}
p.setPen(st::replyColor->p);
_replyToName.drawElided(p, replyLeft, backy + st::msgReplyPadding.top(), width() - replyLeft - _replyForwardPreviewCancel.width() - st::msgReplyPadding.right());
p.setPen(((drawReplyTo->getMedia() || drawReplyTo->serviceMsg()) ? st::msgInDateColor : st::msgColor)->p);
p.setPen((((drawReplyTo->toHistoryMessage() && drawReplyTo->toHistoryMessage()->justMedia()) || drawReplyTo->serviceMsg()) ? st::msgInDateColor : st::msgColor)->p);
_replyToText.drawElided(p, replyLeft, backy + st::msgReplyPadding.top() + st::msgServiceNameFont->height, width() - replyLeft - _replyForwardPreviewCancel.width() - st::msgReplyPadding.right());
} else {
p.setFont(st::msgDateFont->f);

View file

@ -46,7 +46,7 @@ IntroPhone::IntroPhone(IntroWidget *parent) : IntroStage(parent),
errorAlpha(0), changed(false),
next(this, lang(lng_intro_next), st::btnIntroNext),
country(this, st::introCountry),
phone(this, st::inpIntroPhone, lang(lng_phone_ph)), code(this, st::inpIntroCountryCode),
phone(this, st::inpIntroPhone), code(this, st::inpIntroCountryCode),
_signup(this, lng_phone_notreg(lt_signup_start, textcmdStartLink(1), lt_signup_end, textcmdStopLink()), st::introErrLabel, st::introErrLabelTextStyle),
_showSignup(false) {
setVisible(false);
@ -57,6 +57,8 @@ IntroPhone::IntroPhone(IntroWidget *parent) : IntroStage(parent),
connect(&phone, SIGNAL(voidBackspace(QKeyEvent*)), &code, SLOT(startErasing(QKeyEvent*)));
connect(&country, SIGNAL(codeChanged(const QString &)), &code, SLOT(codeSelected(const QString &)));
connect(&code, SIGNAL(codeChanged(const QString &)), &country, SLOT(onChooseCode(const QString &)));
connect(&code, SIGNAL(codeChanged(const QString &)), &phone, SLOT(onChooseCode(const QString &)));
connect(&country, SIGNAL(codeChanged(const QString &)), &phone, SLOT(onChooseCode(const QString &)));
connect(&code, SIGNAL(addedToNumber(const QString &)), &phone, SLOT(addedToNumber(const QString &)));
connect(&country, SIGNAL(selectClosed()), this, SLOT(onSelectClose()));
connect(&phone, SIGNAL(changed()), this, SLOT(onInputChange()));

View file

@ -3611,7 +3611,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
UserData *user = App::userLoaded(d.vuser_id.v);
if (user) {
user->setPhone(qs(d.vphone));
user->setName(user->firstName, user->lastName, (user->contact || isServiceUser(user->id) || user->phone.isEmpty()) ? QString() : App::formatPhone(user->phone), user->username);
user->setName(user->firstName, user->lastName, (user->contact || isServiceUser(user->id) || user->input.type() == mtpc_inputPeerSelf || user->phone.isEmpty()) ? QString() : App::formatPhone(user->phone), user->username);
App::markPeerUpdated(user);
}
} break;

View file

@ -0,0 +1,21 @@
/*
This file is part of Telegram Desktop,
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
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
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://desktop.telegram.org
*/
#pragma once
QVector<int> phoneNumberParse(const QString &number);

View file

@ -76,7 +76,7 @@ ProfileInner::ProfileInner(ProfileWidget *profile, ScrollArea *scroll, const Pee
connect(App::api(), SIGNAL(fullPeerUpdated(PeerData*)), this, SLOT(onFullPeerUpdated(PeerData*)));
if (_peerUser) {
_phoneText = _peerUser->phone.isEmpty() ? QString() : App::formatPhone(_peerUser->phone);
_phoneText = App::formatPhone(_peerUser->phone);
PhotoData *userPhoto = (_peerUser->photoId && _peerUser->photoId != UnknownPeerPhotoId) ? App::photo(_peerUser->photoId) : 0;
if (userPhoto && userPhoto->date) {
_photoLink = TextLinkPtr(new PhotoLink(userPhoto, _peer));
@ -382,7 +382,7 @@ void ProfileInner::peerUpdated(PeerData *data) {
if (data == _peer) {
PhotoData *photo = 0;
if (_peerUser) {
_phoneText = _peerUser->phone.isEmpty() ? QString() : App::formatPhone(_peerUser->phone);
_phoneText = App::formatPhone(_peerUser->phone);
if (_peerUser->photoId && _peerUser->photoId != UnknownPeerPhotoId) photo = App::photo(_peerUser->photoId);
} else {
if (_peerChat->photoId && _peerChat->photoId != UnknownPeerPhotoId) photo = App::photo(_peerChat->photoId);

View file

@ -681,7 +681,7 @@ inline WebPageType toWebPageType(const QString &type) {
}
struct WebPageData {
WebPageData(const WebPageId &id, WebPageType type = WebPageArticle, const QString &url = QString(), const QString &displayUrl = QString(), const QString &siteName = QString(), const QString &title = QString(), const QString &description = QString(), PhotoData *photo = 0, int32 duration = 0, const QString &author = QString(), int32 pendingTill = 0);
WebPageData(const WebPageId &id, WebPageType type = WebPageArticle, const QString &url = QString(), const QString &displayUrl = QString(), const QString &siteName = QString(), const QString &title = QString(), const QString &description = QString(), PhotoData *photo = 0, int32 duration = 0, const QString &author = QString(), int32 pendingTill = -1);
void forget() {
if (photo) photo->forget();

View file

@ -11,7 +11,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.8.40</string>
<string>0.8.41</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>CFBundleSignature</key>

Binary file not shown.

View file

@ -689,6 +689,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="GeneratedFiles\lang_auto.cpp" />
<ClCompile Include="GeneratedFiles\numbers.cpp" />
<ClCompile Include="GeneratedFiles\qrc_telegram.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
@ -1117,6 +1118,11 @@
</CustomBuild>
<CustomBuild Include="Resources\style.txt">
<Outputs>.\GeneratedFiles\style_auto.h</Outputs>
<Outputs>.\GeneratedFiles\style_auto.cpp</Outputs>
<Command>"$(SolutionDir)$(Platform)\$(Configuration)Style\MetaStyle.exe" -classes_in ".\Resources\style_classes.txt" -classes_out ".\GeneratedFiles\style_classes.h" -styles_in ".\Resources\style.txt" -styles_out ".\GeneratedFiles\style_auto.h" -path_to_sprites ".\SourceFiles\art\\"</Command>
</CustomBuild>
<CustomBuild Include="Resources\numbers.txt">
<Outputs>.\GeneratedFiles\numbers.cpp</Outputs>
<Command>"$(SolutionDir)$(Platform)\$(Configuration)Style\MetaStyle.exe" -classes_in ".\Resources\style_classes.txt" -classes_out ".\GeneratedFiles\style_classes.h" -styles_in ".\Resources\style.txt" -styles_out ".\GeneratedFiles\style_auto.h" -path_to_sprites ".\SourceFiles\art\\"</Command>
</CustomBuild>
<CustomBuild Include="Resources\lang.strings">
@ -2020,6 +2026,7 @@
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -D_WITH_DEBUG -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\OpenSSL-Win32\include" "-I.\..\..\Libraries\libogg-1.3.2\include" "-I.\..\..\Libraries\opus\include" "-I.\..\..\Libraries\opusfile\include" "-I.\..\..\Libraries\mpg123-1.22.1\ports\MSVC++" "-I.\..\..\Libraries\mpg123-1.22.1\src\libmpg123" "-I.\..\..\Libraries\faad2-2.7\include" "-I.\..\..\Libraries\faad2-2.7\common\mp4ff" "-I.\..\..\Libraries\ffmpeg-2.6.3" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.0\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.0\QtGui" "-fstdafx.h" "-f../../SourceFiles/playerwidget.h"</Command>
</CustomBuild>
<ClInclude Include="SourceFiles\numbers.h" />
<ClInclude Include="SourceFiles\pspecific.h" />
<CustomBuild Include="SourceFiles\pspecific_linux.h">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Deploy|Win32'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>

View file

@ -915,6 +915,9 @@
<ClCompile Include="GeneratedFiles\Release\moc_playerwidget.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\numbers.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="SourceFiles\stdafx.h">
@ -1001,6 +1004,9 @@
<ClInclude Include="SourceFiles\structs.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="SourceFiles\numbers.h">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="SourceFiles\mtproto\mtpConnection.h">
@ -1213,6 +1219,7 @@
<CustomBuild Include="SourceFiles\playerwidget.h">
<Filter>Source Files</Filter>
</CustomBuild>
<CustomBuild Include="Resources\numbers.txt" />
</ItemGroup>
<ItemGroup>
<Image Include="SourceFiles\art\icon256.ico" />

View file

@ -1705,7 +1705,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.8.40;
CURRENT_PROJECT_VERSION = 0.8.41;
DEBUG_INFORMATION_FORMAT = dwarf;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
@ -1723,7 +1723,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 0.8.40;
CURRENT_PROJECT_VERSION = 0.8.41;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_OPTIMIZATION_LEVEL = fast;
GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h;
@ -1749,10 +1749,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.8.40;
CURRENT_PROJECT_VERSION = 0.8.41;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 0.8;
DYLIB_CURRENT_VERSION = 0.8.40;
DYLIB_CURRENT_VERSION = 0.8.41;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
@ -1886,10 +1886,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.8.40;
CURRENT_PROJECT_VERSION = 0.8.41;
DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 0.8;
DYLIB_CURRENT_VERSION = 0.8.40;
DYLIB_CURRENT_VERSION = 0.8.41;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;

View file

@ -1,2 +1,2 @@
echo 0.8 8040 0.8.40 1
echo 0.8 8041 0.8.41 1
# AppVersionStrMajor AppVersion AppVersionStr DevChannel