mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Replaced some qsl with u""_q literal.
This commit is contained in:
parent
ad3f8e72a0
commit
4fabb3f2a2
109 changed files with 762 additions and 757 deletions
|
@ -34,8 +34,8 @@ Authorizations::Entry ParseEntry(const MTPDauthorization &data) {
|
||||||
|| isTest;
|
|| isTest;
|
||||||
|
|
||||||
const auto appName = isDesktop
|
const auto appName = isDesktop
|
||||||
? QString("Telegram Desktop%1").arg(isTest ? " (GitHub)" : QString())
|
? u"Telegram Desktop%1"_q.arg(isTest ? " (GitHub)" : QString())
|
||||||
: qs(data.vapp_name());// +qsl(" for ") + qs(d.vplatform());
|
: qs(data.vapp_name());// + u" for "_q + qs(d.vplatform());
|
||||||
const auto appVer = [&] {
|
const auto appVer = [&] {
|
||||||
const auto version = qs(data.vapp_version());
|
const auto version = qs(data.vapp_version());
|
||||||
if (isDesktop) {
|
if (isDesktop) {
|
||||||
|
|
|
@ -486,7 +486,7 @@ void ApiWrap::sendMessageFail(
|
||||||
} else if (error == u"USER_BANNED_IN_CHANNEL"_q) {
|
} else if (error == u"USER_BANNED_IN_CHANNEL"_q) {
|
||||||
const auto link = Ui::Text::Link(
|
const auto link = Ui::Text::Link(
|
||||||
tr::lng_cant_more_info(tr::now),
|
tr::lng_cant_more_info(tr::now),
|
||||||
session().createInternalLinkFull(qsl("spambot")));
|
session().createInternalLinkFull(u"spambot"_q));
|
||||||
show->showBox(
|
show->showBox(
|
||||||
Ui::MakeInformBox(
|
Ui::MakeInformBox(
|
||||||
tr::lng_error_public_groups_denied(
|
tr::lng_error_public_groups_denied(
|
||||||
|
@ -734,7 +734,7 @@ QString ApiWrap::exportDirectMessageLink(
|
||||||
if (const auto media = item->media()) {
|
if (const auto media = item->media()) {
|
||||||
if (const auto document = media->document()) {
|
if (const auto document = media->document()) {
|
||||||
if (document->isVideoMessage()) {
|
if (document->isVideoMessage()) {
|
||||||
return qsl("https://telesco.pe/") + query;
|
return u"https://telesco.pe/"_q + query;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,14 +53,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
bool IsValidPhone(QString phone) {
|
bool IsValidPhone(QString phone) {
|
||||||
phone = phone.replace(QRegularExpression(qsl("[^\\d]")), QString());
|
phone = phone.replace(QRegularExpression(u"[^\\d]"_q), QString());
|
||||||
return (phone.length() >= 8)
|
return (phone.length() >= 8)
|
||||||
|| (phone == qsl("333"))
|
|| (phone == u"333"_q)
|
||||||
|| (phone.startsWith(qsl("42"))
|
|| (phone.startsWith(u"42"_q)
|
||||||
&& (phone.length() == 2
|
&& (phone.length() == 2
|
||||||
|| phone.length() == 5
|
|| phone.length() == 5
|
||||||
|| phone.length() == 6
|
|| phone.length() == 6
|
||||||
|| phone == qsl("4242")));
|
|| phone == u"4242"_q));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatCreateDone(
|
void ChatCreateDone(
|
||||||
|
@ -112,7 +112,7 @@ TextWithEntities PeerFloodErrorText(
|
||||||
PeerFloodType type) {
|
PeerFloodType type) {
|
||||||
const auto link = Ui::Text::Link(
|
const auto link = Ui::Text::Link(
|
||||||
tr::lng_cant_more_info(tr::now),
|
tr::lng_cant_more_info(tr::now),
|
||||||
session->createInternalLinkFull(qsl("spambot")));
|
session->createInternalLinkFull(u"spambot"_q));
|
||||||
return ((type == PeerFloodType::InviteGroup)
|
return ((type == PeerFloodType::InviteGroup)
|
||||||
? tr::lng_cant_invite_not_contact
|
? tr::lng_cant_invite_not_contact
|
||||||
: tr::lng_cant_send_to_not_contact)(
|
: tr::lng_cant_send_to_not_contact)(
|
||||||
|
|
|
@ -1092,17 +1092,17 @@ ProxiesBoxController::ProxiesBoxController(not_null<Main::Account*> account)
|
||||||
void ProxiesBoxController::ShowApplyConfirmation(
|
void ProxiesBoxController::ShowApplyConfirmation(
|
||||||
Type type,
|
Type type,
|
||||||
const QMap<QString, QString> &fields) {
|
const QMap<QString, QString> &fields) {
|
||||||
const auto server = fields.value(qsl("server"));
|
const auto server = fields.value(u"server"_q);
|
||||||
const auto port = fields.value(qsl("port")).toUInt();
|
const auto port = fields.value(u"port"_q).toUInt();
|
||||||
auto proxy = ProxyData();
|
auto proxy = ProxyData();
|
||||||
proxy.type = type;
|
proxy.type = type;
|
||||||
proxy.host = server;
|
proxy.host = server;
|
||||||
proxy.port = port;
|
proxy.port = port;
|
||||||
if (type == Type::Socks5) {
|
if (type == Type::Socks5) {
|
||||||
proxy.user = fields.value(qsl("user"));
|
proxy.user = fields.value(u"user"_q);
|
||||||
proxy.password = fields.value(qsl("pass"));
|
proxy.password = fields.value(u"pass"_q);
|
||||||
} else if (type == Type::Mtproto) {
|
} else if (type == Type::Mtproto) {
|
||||||
proxy.password = fields.value(qsl("secret"));
|
proxy.password = fields.value(u"secret"_q);
|
||||||
}
|
}
|
||||||
if (proxy) {
|
if (proxy) {
|
||||||
const auto displayed = "https://" + server + "/";
|
const auto displayed = "https://" + server + "/";
|
||||||
|
@ -1504,12 +1504,9 @@ void ProxiesBoxController::updateView(const Item &item) {
|
||||||
const auto deleted = item.deleted;
|
const auto deleted = item.deleted;
|
||||||
const auto type = [&] {
|
const auto type = [&] {
|
||||||
switch (item.data.type) {
|
switch (item.data.type) {
|
||||||
case Type::Http:
|
case Type::Http: return u"HTTP"_q;
|
||||||
return qsl("HTTP");
|
case Type::Socks5: return u"SOCKS5"_q;
|
||||||
case Type::Socks5:
|
case Type::Mtproto: return u"MTPROTO"_q;
|
||||||
return qsl("SOCKS5");
|
|
||||||
case Type::Mtproto:
|
|
||||||
return qsl("MTPROTO");
|
|
||||||
}
|
}
|
||||||
Unexpected("Proxy type in ProxiesBoxController::updateView.");
|
Unexpected("Proxy type in ProxiesBoxController::updateView.");
|
||||||
}();
|
}();
|
||||||
|
@ -1541,7 +1538,7 @@ void ProxiesBoxController::share(const ProxyData &proxy) {
|
||||||
if (proxy.type == Type::Http) {
|
if (proxy.type == Type::Http) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto link = qsl("https://t.me/")
|
const auto link = u"https://t.me/"_q
|
||||||
+ (proxy.type == Type::Socks5 ? "socks" : "proxy")
|
+ (proxy.type == Type::Socks5 ? "socks" : "proxy")
|
||||||
+ "?server=" + proxy.host + "&port=" + QString::number(proxy.port)
|
+ "?server=" + proxy.host + "&port=" + QString::number(proxy.port)
|
||||||
+ ((proxy.type == Type::Socks5 && !proxy.user.isEmpty())
|
+ ((proxy.type == Type::Socks5 && !proxy.user.isEmpty())
|
||||||
|
|
|
@ -40,7 +40,7 @@ void DownloadPathBox::prepare() {
|
||||||
_group->setChangedCallback([this](Directory value) { radioChanged(value); });
|
_group->setChangedCallback([this](Directory value) { radioChanged(value); });
|
||||||
|
|
||||||
_pathLink->addClickHandler([=] { editPath(); });
|
_pathLink->addClickHandler([=] { editPath(); });
|
||||||
if (!_path.isEmpty() && _path != qsl("tmp")) {
|
if (!_path.isEmpty() && _path != u"tmp"_q) {
|
||||||
setPathText(QDir::toNativeSeparators(_path));
|
setPathText(QDir::toNativeSeparators(_path));
|
||||||
}
|
}
|
||||||
updateControlsVisibility();
|
updateControlsVisibility();
|
||||||
|
@ -73,14 +73,14 @@ void DownloadPathBox::resizeEvent(QResizeEvent *e) {
|
||||||
|
|
||||||
void DownloadPathBox::radioChanged(Directory value) {
|
void DownloadPathBox::radioChanged(Directory value) {
|
||||||
if (value == Directory::Custom) {
|
if (value == Directory::Custom) {
|
||||||
if (_path.isEmpty() || _path == qsl("tmp")) {
|
if (_path.isEmpty() || _path == u"tmp"_q) {
|
||||||
_group->setValue(_path.isEmpty() ? Directory::Downloads : Directory::Temp);
|
_group->setValue(_path.isEmpty() ? Directory::Downloads : Directory::Temp);
|
||||||
editPath();
|
editPath();
|
||||||
} else {
|
} else {
|
||||||
setPathText(QDir::toNativeSeparators(_path));
|
setPathText(QDir::toNativeSeparators(_path));
|
||||||
}
|
}
|
||||||
} else if (value == Directory::Temp) {
|
} else if (value == Directory::Temp) {
|
||||||
_path = qsl("tmp");
|
_path = u"tmp"_q;
|
||||||
} else {
|
} else {
|
||||||
_path = QString();
|
_path = QString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ private:
|
||||||
Directory typeFromPath(const QString &path) {
|
Directory typeFromPath(const QString &path) {
|
||||||
if (path.isEmpty()) {
|
if (path.isEmpty()) {
|
||||||
return Directory::Downloads;
|
return Directory::Downloads;
|
||||||
} else if (path == qsl("tmp")) {
|
} else if (path == u"tmp"_q) {
|
||||||
return Directory::Temp;
|
return Directory::Temp;
|
||||||
}
|
}
|
||||||
return Directory::Custom;
|
return Directory::Custom;
|
||||||
|
|
|
@ -463,6 +463,6 @@ auto EditFilterChatsListController::createRow(not_null<History*> history)
|
||||||
void EditFilterChatsListController::updateTitle() {
|
void EditFilterChatsListController::updateTitle() {
|
||||||
const auto count = delegate()->peerListSelectedRowsCount()
|
const auto count = delegate()->peerListSelectedRowsCount()
|
||||||
- selectedTypesCount();
|
- selectedTypesCount();
|
||||||
const auto additional = qsl("%1 / %2").arg(count).arg(_limit);
|
const auto additional = u"%1 / %2"_q.arg(count).arg(_limit);
|
||||||
delegate()->peerListSetAdditionalTitle(rpl::single(additional));
|
delegate()->peerListSetAdditionalTitle(rpl::single(additional));
|
||||||
}
|
}
|
||||||
|
|
|
@ -416,7 +416,7 @@ bool Rows::hasMenu(not_null<const Row*> row) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rows::share(not_null<const Row*> row) const {
|
void Rows::share(not_null<const Row*> row) const {
|
||||||
const auto link = qsl("https://t.me/setlanguage/") + row->data.id;
|
const auto link = u"https://t.me/setlanguage/"_q + row->data.id;
|
||||||
QGuiApplication::clipboard()->setText(link);
|
QGuiApplication::clipboard()->setText(link);
|
||||||
Ui::Toast::Show(tr::lng_username_copied(tr::now));
|
Ui::Toast::Show(tr::lng_username_copied(tr::now));
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ void AddParticipantsBoxController::updateTitle() {
|
||||||
&& _peer->isChannel()
|
&& _peer->isChannel()
|
||||||
&& !_peer->isMegagroup())
|
&& !_peer->isMegagroup())
|
||||||
? QString()
|
? QString()
|
||||||
: qsl("%1 / %2"
|
: (u"%1 / %2"_q
|
||||||
).arg(fullCount()
|
).arg(fullCount()
|
||||||
).arg(session().serverConfig().megagroupSizeMax);
|
).arg(session().serverConfig().megagroupSizeMax);
|
||||||
delegate()->peerListSetTitle(tr::lng_profile_add_participant());
|
delegate()->peerListSetTitle(tr::lng_profile_add_participant());
|
||||||
|
|
|
@ -693,7 +693,7 @@ ShareBox::Inner::Inner(
|
||||||
}
|
}
|
||||||
addList(_descriptor.session->data().contactsNoChatsList());
|
addList(_descriptor.session->data().contactsNoChatsList());
|
||||||
|
|
||||||
_filter = qsl("a");
|
_filter = u"a"_q;
|
||||||
updateFilter();
|
updateFilter();
|
||||||
|
|
||||||
_descriptor.session->changes().peerUpdates(
|
_descriptor.session->changes().peerUpdates(
|
||||||
|
@ -1325,9 +1325,9 @@ QString AppendShareGameScoreUrl(
|
||||||
}
|
}
|
||||||
|
|
||||||
auto shareHash = shareHashEncrypted.toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals);
|
auto shareHash = shareHashEncrypted.toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals);
|
||||||
auto shareUrl = qsl("tg://share_game_score?hash=") + QString::fromLatin1(shareHash);
|
auto shareUrl = u"tg://share_game_score?hash="_q + QString::fromLatin1(shareHash);
|
||||||
|
|
||||||
auto shareComponent = qsl("tgShareScoreUrl=") + qthelp::url_encode(shareUrl);
|
auto shareComponent = u"tgShareScoreUrl="_q + qthelp::url_encode(shareUrl);
|
||||||
|
|
||||||
auto hashPosition = url.indexOf('#');
|
auto hashPosition = url.indexOf('#');
|
||||||
if (hashPosition < 0) {
|
if (hashPosition < 0) {
|
||||||
|
@ -1391,7 +1391,7 @@ void FastShareMessage(
|
||||||
if (const auto media = item->media()) {
|
if (const auto media = item->media()) {
|
||||||
if (const auto game = media->game()) {
|
if (const auto game = media->game()) {
|
||||||
const auto link = session->createInternalLinkFull(
|
const auto link = session->createInternalLinkFull(
|
||||||
bot->username() + qsl("?game=") + game->shortName);
|
bot->username() + u"?game="_q + game->shortName);
|
||||||
|
|
||||||
QGuiApplication::clipboard()->setText(link);
|
QGuiApplication::clipboard()->setText(link);
|
||||||
|
|
||||||
|
|
|
@ -1179,13 +1179,13 @@ StickersBox::Inner::Inner(
|
||||||
, _megagroupSetField(
|
, _megagroupSetField(
|
||||||
this,
|
this,
|
||||||
st::groupStickersField,
|
st::groupStickersField,
|
||||||
rpl::single(qsl("stickerset")),
|
rpl::single(u"stickerset"_q),
|
||||||
QString(),
|
QString(),
|
||||||
_controller->session().createInternalLink(QString()))
|
_controller->session().createInternalLink(QString()))
|
||||||
, _megagroupDivider(this)
|
, _megagroupDivider(this)
|
||||||
, _megagroupSubTitle(this, tr::lng_stickers_group_from_your(tr::now), st::boxTitle) {
|
, _megagroupSubTitle(this, tr::lng_stickers_group_from_your(tr::now), st::boxTitle) {
|
||||||
_megagroupSetField->setLinkPlaceholder(
|
_megagroupSetField->setLinkPlaceholder(
|
||||||
_controller->session().createInternalLink(qsl("addstickers/")));
|
_controller->session().createInternalLink(u"addstickers/"_q));
|
||||||
_megagroupSetField->setPlaceholderHidden(false);
|
_megagroupSetField->setPlaceholderHidden(false);
|
||||||
_megagroupSetAddressChangedTimer.setCallback([this] { handleMegagroupSetAddressChange(); });
|
_megagroupSetAddressChangedTimer.setCallback([this] { handleMegagroupSetAddressChange(); });
|
||||||
connect(
|
connect(
|
||||||
|
|
|
@ -500,8 +500,8 @@ void Call::startWaitingTrack() {
|
||||||
_waitingTrack = Media::Audio::Current().createTrack();
|
_waitingTrack = Media::Audio::Current().createTrack();
|
||||||
const auto trackFileName = Core::App().settings().getSoundPath(
|
const auto trackFileName = Core::App().settings().getSoundPath(
|
||||||
(_type == Type::Outgoing)
|
(_type == Type::Outgoing)
|
||||||
? qsl("call_outgoing")
|
? u"call_outgoing"_q
|
||||||
: qsl("call_incoming"));
|
: u"call_incoming"_q);
|
||||||
_waitingTrack->samplePeakEach(kSoundSampleMs);
|
_waitingTrack->samplePeakEach(kSoundSampleMs);
|
||||||
_waitingTrack->fillFromFile(trackFileName);
|
_waitingTrack->fillFromFile(trackFileName);
|
||||||
_waitingTrack->playInLoop();
|
_waitingTrack->playInLoop();
|
||||||
|
@ -893,8 +893,8 @@ void Call::createAndStartController(const MTPDphoneCall &call) {
|
||||||
settings.callAudioBackend()),
|
settings.callAudioBackend()),
|
||||||
};
|
};
|
||||||
if (Logs::DebugEnabled()) {
|
if (Logs::DebugEnabled()) {
|
||||||
const auto callLogFolder = cWorkingDir() + qsl("DebugLogs");
|
const auto callLogFolder = cWorkingDir() + u"DebugLogs"_q;
|
||||||
const auto callLogPath = callLogFolder + qsl("/last_call_log.txt");
|
const auto callLogPath = callLogFolder + u"/last_call_log.txt"_q;
|
||||||
const auto callLogNative = QDir::toNativeSeparators(callLogPath);
|
const auto callLogNative = QDir::toNativeSeparators(callLogPath);
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
descriptor.config.logPath.data = callLogNative.toStdWString();
|
descriptor.config.logPath.data = callLogNative.toStdWString();
|
||||||
|
|
|
@ -147,7 +147,7 @@ DebugInfoBox::DebugInfoBox(QWidget*, base::weak_ptr<Call> call)
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebugInfoBox::prepare() {
|
void DebugInfoBox::prepare() {
|
||||||
setTitle(rpl::single(qsl("Call Debug")));
|
setTitle(rpl::single(u"Call Debug"_q));
|
||||||
|
|
||||||
addButton(tr::lng_close(), [this] { closeBox(); });
|
addButton(tr::lng_close(), [this] { closeBox(); });
|
||||||
_text = setInnerWidget(
|
_text = setInnerWidget(
|
||||||
|
|
|
@ -2427,8 +2427,8 @@ bool GroupCall::tryCreateController() {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
if (Logs::DebugEnabled()) {
|
if (Logs::DebugEnabled()) {
|
||||||
auto callLogFolder = cWorkingDir() + qsl("DebugLogs");
|
auto callLogFolder = cWorkingDir() + u"DebugLogs"_q;
|
||||||
auto callLogPath = callLogFolder + qsl("/last_group_call_log.txt");
|
auto callLogPath = callLogFolder + u"/last_group_call_log.txt"_q;
|
||||||
auto callLogNative = QDir::toNativeSeparators(callLogPath);
|
auto callLogNative = QDir::toNativeSeparators(callLogPath);
|
||||||
descriptor.config.need_log = true;
|
descriptor.config.need_log = true;
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
|
|
@ -36,7 +36,7 @@ struct Set : public Blob {
|
||||||
};
|
};
|
||||||
|
|
||||||
inline auto PreviewPath(int i) {
|
inline auto PreviewPath(int i) {
|
||||||
return qsl(":/gui/emoji/set%1_preview.webp").arg(i);
|
return u":/gui/emoji/set%1_preview.webp"_q.arg(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto kSets = {
|
const auto kSets = {
|
||||||
|
|
|
@ -693,7 +693,7 @@ void FieldAutocomplete::hideAnimated() {
|
||||||
void FieldAutocomplete::hideFinish() {
|
void FieldAutocomplete::hideFinish() {
|
||||||
hide();
|
hide();
|
||||||
_hiding = false;
|
_hiding = false;
|
||||||
_filter = qsl("-");
|
_filter = u"-"_q;
|
||||||
_inner->clearSel(true);
|
_inner->clearSel(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -225,7 +225,7 @@ void EditLinkBox(
|
||||||
|
|
||||||
TextWithEntities StripSupportHashtag(TextWithEntities &&text) {
|
TextWithEntities StripSupportHashtag(TextWithEntities &&text) {
|
||||||
static const auto expression = QRegularExpression(
|
static const auto expression = QRegularExpression(
|
||||||
qsl("\\n?#tsf[a-z0-9_-]*[\\s#a-z0-9_-]*$"),
|
u"\\n?#tsf[a-z0-9_-]*[\\s#a-z0-9_-]*$"_q,
|
||||||
QRegularExpression::CaseInsensitiveOption);
|
QRegularExpression::CaseInsensitiveOption);
|
||||||
const auto match = expression.match(text.text);
|
const auto match = expression.match(text.text);
|
||||||
if (!match.hasMatch()) {
|
if (!match.hasMatch()) {
|
||||||
|
|
|
@ -245,13 +245,13 @@ MTP::DedicatedLoader::Location GetDownloadLocation(int id) {
|
||||||
|
|
||||||
QString DictPathByLangId(int langId) {
|
QString DictPathByLangId(int langId) {
|
||||||
EnsurePath();
|
EnsurePath();
|
||||||
return qsl("%1/%2").arg(
|
return u"%1/%2"_q.arg(
|
||||||
DictionariesPath(),
|
DictionariesPath(),
|
||||||
Spellchecker::LocaleFromLangId(langId).name());
|
Spellchecker::LocaleFromLangId(langId).name());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DictionariesPath() {
|
QString DictionariesPath() {
|
||||||
return cWorkingDir() + qsl("tdata/dictionaries");
|
return cWorkingDir() + u"tdata/dictionaries"_q;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UnpackDictionary(const QString &path, int langId) {
|
bool UnpackDictionary(const QString &path, int langId) {
|
||||||
|
@ -275,7 +275,7 @@ bool RemoveDictionary(int langId) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const auto fileName = Spellchecker::LocaleFromLangId(langId).name();
|
const auto fileName = Spellchecker::LocaleFromLangId(langId).name();
|
||||||
const auto folder = qsl("%1/%2/").arg(
|
const auto folder = u"%1/%2/"_q.arg(
|
||||||
DictionariesPath(),
|
DictionariesPath(),
|
||||||
fileName);
|
fileName);
|
||||||
return QDir(folder).removeRecursively();
|
return QDir(folder).removeRecursively();
|
||||||
|
@ -288,14 +288,14 @@ bool WriteDefaultDictionary() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const auto fileName = QLocale(en).name();
|
const auto fileName = QLocale(en).name();
|
||||||
const auto folder = qsl("%1/%2/").arg(
|
const auto folder = u"%1/%2/"_q.arg(
|
||||||
DictionariesPath(),
|
DictionariesPath(),
|
||||||
fileName);
|
fileName);
|
||||||
QDir(folder).removeRecursively();
|
QDir(folder).removeRecursively();
|
||||||
|
|
||||||
const auto path = folder + fileName;
|
const auto path = folder + fileName;
|
||||||
QDir().mkpath(folder);
|
QDir().mkpath(folder);
|
||||||
auto input = QFile(qsl(":/misc/en_US_dictionary"));
|
auto input = QFile(u":/misc/en_US_dictionary"_q);
|
||||||
auto output = QFile(path);
|
auto output = QFile(path);
|
||||||
if (input.open(QIODevice::ReadOnly)
|
if (input.open(QIODevice::ReadOnly)
|
||||||
&& output.open(QIODevice::WriteOnly)) {
|
&& output.open(QIODevice::WriteOnly)) {
|
||||||
|
|
|
@ -108,7 +108,7 @@ static const char *AlphaPrivateKey = "";
|
||||||
extern QString gKeyFile;
|
extern QString gKeyFile;
|
||||||
inline const QString &cDataFile() {
|
inline const QString &cDataFile() {
|
||||||
if (!gKeyFile.isEmpty()) return gKeyFile;
|
if (!gKeyFile.isEmpty()) return gKeyFile;
|
||||||
static const QString res(qsl("data"));
|
static const QString res(u"data"_q);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -290,7 +290,7 @@ void Application::run() {
|
||||||
DEBUG_LOG(("Application Info: starting app..."));
|
DEBUG_LOG(("Application Info: starting app..."));
|
||||||
|
|
||||||
// Create mime database, so it won't be slow later.
|
// Create mime database, so it won't be slow later.
|
||||||
QMimeDatabase().mimeTypeForName(qsl("text/plain"));
|
QMimeDatabase().mimeTypeForName(u"text/plain"_q);
|
||||||
|
|
||||||
_primaryWindow = std::make_unique<Window::Controller>();
|
_primaryWindow = std::make_unique<Window::Controller>();
|
||||||
_lastActiveWindow = _primaryWindow.get();
|
_lastActiveWindow = _primaryWindow.get();
|
||||||
|
@ -863,10 +863,10 @@ void Application::switchDebugMode() {
|
||||||
|
|
||||||
void Application::switchFreeType() {
|
void Application::switchFreeType() {
|
||||||
if (cUseFreeType()) {
|
if (cUseFreeType()) {
|
||||||
QFile(cWorkingDir() + qsl("tdata/withfreetype")).remove();
|
QFile(cWorkingDir() + u"tdata/withfreetype"_q).remove();
|
||||||
cSetUseFreeType(false);
|
cSetUseFreeType(false);
|
||||||
} else {
|
} else {
|
||||||
QFile f(cWorkingDir() + qsl("tdata/withfreetype"));
|
QFile f(cWorkingDir() + u"tdata/withfreetype"_q);
|
||||||
if (f.open(QIODevice::WriteOnly)) {
|
if (f.open(QIODevice::WriteOnly)) {
|
||||||
f.write("1");
|
f.write("1");
|
||||||
f.close();
|
f.close();
|
||||||
|
@ -1471,11 +1471,11 @@ void Application::RegisterUrlScheme() {
|
||||||
base::Platform::RegisterUrlScheme(base::Platform::UrlSchemeDescriptor{
|
base::Platform::RegisterUrlScheme(base::Platform::UrlSchemeDescriptor{
|
||||||
.executable = cExeDir() + cExeName(),
|
.executable = cExeDir() + cExeName(),
|
||||||
.arguments = Sandbox::Instance().customWorkingDir()
|
.arguments = Sandbox::Instance().customWorkingDir()
|
||||||
? qsl("-workdir \"%1\"").arg(cWorkingDir())
|
? u"-workdir \"%1\""_q.arg(cWorkingDir())
|
||||||
: QString(),
|
: QString(),
|
||||||
.protocol = qsl("tg"),
|
.protocol = u"tg"_q,
|
||||||
.protocolName = qsl("Telegram Link"),
|
.protocolName = u"Telegram Link"_q,
|
||||||
.shortAppName = qsl("tdesktop"),
|
.shortAppName = u"tdesktop"_q,
|
||||||
.longAppName = QCoreApplication::applicationName(),
|
.longAppName = QCoreApplication::applicationName(),
|
||||||
.displayAppName = AppName.utf16(),
|
.displayAppName = AppName.utf16(),
|
||||||
.displayAppDescription = AppName.utf16(),
|
.displayAppDescription = AppName.utf16(),
|
||||||
|
|
|
@ -180,7 +180,7 @@ void Changelogs::addBetaLog(int changeVersion, const char *changes) {
|
||||||
return result.replace(simple, separator);
|
return result.replace(simple, separator);
|
||||||
}();
|
}();
|
||||||
const auto version = FormatVersionDisplay(changeVersion);
|
const auto version = FormatVersionDisplay(changeVersion);
|
||||||
const auto log = qsl("New in version %1 beta:\n\n").arg(version) + text;
|
const auto log = u"New in version %1 beta:\n\n"_q.arg(version) + text;
|
||||||
addLocalLog(log);
|
addLocalLog(log);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -739,7 +739,7 @@ QString Settings::getSoundPath(const QString &key) const {
|
||||||
if (it != _soundOverrides.end()) {
|
if (it != _soundOverrides.end()) {
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
return qsl(":/sounds/") + key + qsl(".mp3");
|
return u":/sounds/"_q + key + u".mp3"_q;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::setTabbedSelectorSectionEnabled(bool enabled) {
|
void Settings::setTabbedSelectorSectionEnabled(bool enabled) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ PreLaunchWindow::PreLaunchWindow(QString title) {
|
||||||
setWindowIcon(Window::CreateIcon());
|
setWindowIcon(Window::CreateIcon());
|
||||||
setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint);
|
setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint);
|
||||||
|
|
||||||
setWindowTitle(title.isEmpty() ? qsl("Telegram") : title);
|
setWindowTitle(title.isEmpty() ? u"Telegram"_q : title);
|
||||||
|
|
||||||
QPalette p(palette());
|
QPalette p(palette());
|
||||||
p.setColor(QPalette::Window, QColor(255, 255, 255));
|
p.setColor(QPalette::Window, QColor(255, 255, 255));
|
||||||
|
@ -48,7 +48,7 @@ PreLaunchWindow::PreLaunchWindow(QString title) {
|
||||||
int paddingVertical = (_size / 2);
|
int paddingVertical = (_size / 2);
|
||||||
int paddingHorizontal = _size;
|
int paddingHorizontal = _size;
|
||||||
int borderRadius = (_size / 5);
|
int borderRadius = (_size / 5);
|
||||||
setStyleSheet(qsl("QPushButton { padding: %1px %2px; background-color: #ffffff; border-radius: %3px; }\nQPushButton#confirm:hover, QPushButton#cancel:hover { background-color: #e3f1fa; color: #2f9fea; }\nQPushButton#confirm { color: #2f9fea; }\nQPushButton#cancel { color: #aeaeae; }\nQLineEdit { border: 1px solid #e0e0e0; padding: 5px; }\nQLineEdit:focus { border: 2px solid #37a1de; padding: 4px; }").arg(paddingVertical).arg(paddingHorizontal).arg(borderRadius));
|
setStyleSheet(u"QPushButton { padding: %1px %2px; background-color: #ffffff; border-radius: %3px; }\nQPushButton#confirm:hover, QPushButton#cancel:hover { background-color: #e3f1fa; color: #2f9fea; }\nQPushButton#confirm { color: #2f9fea; }\nQPushButton#cancel { color: #aeaeae; }\nQLineEdit { border: 1px solid #e0e0e0; padding: 5px; }\nQLineEdit:focus { border: 2px solid #37a1de; padding: 4px; }"_q.arg(paddingVertical).arg(paddingHorizontal).arg(borderRadius));
|
||||||
if (!PreLaunchWindowInstance) {
|
if (!PreLaunchWindowInstance) {
|
||||||
PreLaunchWindowInstance = this;
|
PreLaunchWindowInstance = this;
|
||||||
}
|
}
|
||||||
|
@ -179,12 +179,12 @@ NotStartedWindow::NotStartedWindow()
|
||||||
: _label(this)
|
: _label(this)
|
||||||
, _log(this)
|
, _log(this)
|
||||||
, _close(this) {
|
, _close(this) {
|
||||||
_label.setText(qsl("Could not start Telegram Desktop!\nYou can see complete log below:"));
|
_label.setText(u"Could not start Telegram Desktop!\nYou can see complete log below:"_q);
|
||||||
|
|
||||||
_log.setPlainText(Logs::full());
|
_log.setPlainText(Logs::full());
|
||||||
|
|
||||||
connect(&_close, &QPushButton::clicked, [=] { close(); });
|
connect(&_close, &QPushButton::clicked, [=] { close(); });
|
||||||
_close.setText(qsl("CLOSE"));
|
_close.setText(u"CLOSE"_q);
|
||||||
|
|
||||||
QRect scr(QApplication::primaryScreen()->availableGeometry());
|
QRect scr(QApplication::primaryScreen()->availableGeometry());
|
||||||
move(scr.x() + (scr.width() / 6), scr.y() + (scr.height() / 6));
|
move(scr.x() + (scr.width() / 6), scr.y() + (scr.height() / 6));
|
||||||
|
@ -261,9 +261,9 @@ LastCrashedWindow::LastCrashedWindow(
|
||||||
}
|
}
|
||||||
if (_sendingState != SendingNoReport) {
|
if (_sendingState != SendingNoReport) {
|
||||||
qint64 dumpsize = 0;
|
qint64 dumpsize = 0;
|
||||||
QString dumpspath = cWorkingDir() + qsl("tdata/dumps");
|
QString dumpspath = cWorkingDir() + u"tdata/dumps"_q;
|
||||||
#if defined Q_OS_MAC && !defined MAC_USE_BREAKPAD
|
#if defined Q_OS_MAC && !defined MAC_USE_BREAKPAD
|
||||||
dumpspath += qsl("/completed");
|
dumpspath += u"/completed"_q;
|
||||||
#endif
|
#endif
|
||||||
QString possibleDump = getReportField(qstr("minidump"), qstr("Minidump:"));
|
QString possibleDump = getReportField(qstr("minidump"), qstr("Minidump:"));
|
||||||
if (!possibleDump.isEmpty()) {
|
if (!possibleDump.isEmpty()) {
|
||||||
|
@ -271,7 +271,7 @@ LastCrashedWindow::LastCrashedWindow(
|
||||||
possibleDump = dumpspath + '/' + possibleDump;
|
possibleDump = dumpspath + '/' + possibleDump;
|
||||||
}
|
}
|
||||||
if (!possibleDump.endsWith(qstr(".dmp"))) {
|
if (!possibleDump.endsWith(qstr(".dmp"))) {
|
||||||
possibleDump += qsl(".dmp");
|
possibleDump += u".dmp"_q;
|
||||||
}
|
}
|
||||||
QFileInfo possibleInfo(possibleDump);
|
QFileInfo possibleInfo(possibleDump);
|
||||||
if (possibleInfo.exists()) {
|
if (possibleInfo.exists()) {
|
||||||
|
@ -282,7 +282,7 @@ LastCrashedWindow::LastCrashedWindow(
|
||||||
}
|
}
|
||||||
if (_minidumpFull.isEmpty()) {
|
if (_minidumpFull.isEmpty()) {
|
||||||
QString maxDump, maxDumpFull;
|
QString maxDump, maxDumpFull;
|
||||||
QDateTime maxDumpModified, workingModified = QFileInfo(cWorkingDir() + qsl("tdata/working")).lastModified();
|
QDateTime maxDumpModified, workingModified = QFileInfo(cWorkingDir() + u"tdata/working"_q).lastModified();
|
||||||
QFileInfoList list = QDir(dumpspath).entryInfoList();
|
QFileInfoList list = QDir(dumpspath).entryInfoList();
|
||||||
for (int32 i = 0, l = list.size(); i < l; ++i) {
|
for (int32 i = 0, l = list.size(); i < l; ++i) {
|
||||||
QString name = list.at(i).fileName();
|
QString name = list.at(i).fileName();
|
||||||
|
@ -304,36 +304,36 @@ LastCrashedWindow::LastCrashedWindow(
|
||||||
if (_minidumpName.isEmpty()) { // currently don't accept crash reports without dumps from google libraries
|
if (_minidumpName.isEmpty()) { // currently don't accept crash reports without dumps from google libraries
|
||||||
_sendingState = SendingNoReport;
|
_sendingState = SendingNoReport;
|
||||||
} else {
|
} else {
|
||||||
_minidump.setText(qsl("+ %1 (%2 KB)").arg(_minidumpName).arg(dumpsize / 1024));
|
_minidump.setText(u"+ %1 (%2 KB)"_q.arg(_minidumpName).arg(dumpsize / 1024));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_sendingState != SendingNoReport) {
|
if (_sendingState != SendingNoReport) {
|
||||||
QString version = getReportField(qstr("version"), qstr("Version:"));
|
QString version = getReportField(qstr("version"), qstr("Version:"));
|
||||||
QString current = cAlphaVersion() ? qsl("-%1").arg(cAlphaVersion()) : QString::number(AppVersion);
|
QString current = cAlphaVersion() ? u"-%1"_q.arg(cAlphaVersion()) : QString::number(AppVersion);
|
||||||
if (version != current) { // currently don't accept crash reports from not current app version
|
if (version != current) { // currently don't accept crash reports from not current app version
|
||||||
_sendingState = SendingNoReport;
|
_sendingState = SendingNoReport;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_networkSettings.setText(qsl("NETWORK SETTINGS"));
|
_networkSettings.setText(u"NETWORK SETTINGS"_q);
|
||||||
connect(
|
connect(
|
||||||
&_networkSettings,
|
&_networkSettings,
|
||||||
&QPushButton::clicked,
|
&QPushButton::clicked,
|
||||||
[=] { networkSettings(); });
|
[=] { networkSettings(); });
|
||||||
|
|
||||||
if (_sendingState == SendingNoReport) {
|
if (_sendingState == SendingNoReport) {
|
||||||
_label.setText(qsl("Last time Telegram Desktop was not closed properly."));
|
_label.setText(u"Last time Telegram Desktop was not closed properly."_q);
|
||||||
} else {
|
} else {
|
||||||
_label.setText(qsl("Last time Telegram Desktop crashed :("));
|
_label.setText(u"Last time Telegram Desktop crashed :("_q);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_updaterData) {
|
if (_updaterData) {
|
||||||
_updaterData->check.setText(qsl("TRY AGAIN"));
|
_updaterData->check.setText(u"TRY AGAIN"_q);
|
||||||
connect(
|
connect(
|
||||||
&_updaterData->check,
|
&_updaterData->check,
|
||||||
&QPushButton::clicked,
|
&QPushButton::clicked,
|
||||||
[=] { updateRetry(); });
|
[=] { updateRetry(); });
|
||||||
_updaterData->skip.setText(qsl("SKIP"));
|
_updaterData->skip.setText(u"SKIP"_q);
|
||||||
connect(
|
connect(
|
||||||
&_updaterData->skip,
|
&_updaterData->skip,
|
||||||
&QPushButton::clicked,
|
&QPushButton::clicked,
|
||||||
|
@ -393,39 +393,39 @@ LastCrashedWindow::LastCrashedWindow(
|
||||||
cSetLastUpdateCheck(0);
|
cSetLastUpdateCheck(0);
|
||||||
checker.start();
|
checker.start();
|
||||||
} else {
|
} else {
|
||||||
_updating.setText(qsl("Please check if there is a new version available."));
|
_updating.setText(u"Please check if there is a new version available."_q);
|
||||||
if (_sendingState != SendingNoReport) {
|
if (_sendingState != SendingNoReport) {
|
||||||
_sendingState = SendingNone;
|
_sendingState = SendingNone;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_pleaseSendReport.setText(qsl("Please send us a crash report."));
|
_pleaseSendReport.setText(u"Please send us a crash report."_q);
|
||||||
_yourReportName.setText(qsl("Your Report Tag: %1\nYour User Tag: %2").arg(QString(_minidumpName).replace(".dmp", "")).arg(launcher->installationTag(), 0, 16));
|
_yourReportName.setText(u"Your Report Tag: %1\nYour User Tag: %2"_q.arg(QString(_minidumpName).replace(".dmp", "")).arg(launcher->installationTag(), 0, 16));
|
||||||
_yourReportName.setCursor(style::cur_text);
|
_yourReportName.setCursor(style::cur_text);
|
||||||
_yourReportName.setTextInteractionFlags(Qt::TextSelectableByMouse);
|
_yourReportName.setTextInteractionFlags(Qt::TextSelectableByMouse);
|
||||||
|
|
||||||
_includeUsername.setText(qsl("Include username @%1 as your contact info").arg(_reportUsername));
|
_includeUsername.setText(u"Include username @%1 as your contact info"_q.arg(_reportUsername));
|
||||||
|
|
||||||
_report.setPlainText(_reportTextNoUsername);
|
_report.setPlainText(_reportTextNoUsername);
|
||||||
|
|
||||||
_showReport.setText(qsl("VIEW REPORT"));
|
_showReport.setText(u"VIEW REPORT"_q);
|
||||||
connect(&_showReport, &QPushButton::clicked, [=] {
|
connect(&_showReport, &QPushButton::clicked, [=] {
|
||||||
_reportShown = !_reportShown;
|
_reportShown = !_reportShown;
|
||||||
updateControls();
|
updateControls();
|
||||||
});
|
});
|
||||||
_saveReport.setText(qsl("SAVE TO FILE"));
|
_saveReport.setText(u"SAVE TO FILE"_q);
|
||||||
connect(&_saveReport, &QPushButton::clicked, [=] { saveReport(); });
|
connect(&_saveReport, &QPushButton::clicked, [=] { saveReport(); });
|
||||||
_getApp.setText(qsl("GET THE LATEST OFFICIAL VERSION OF TELEGRAM DESKTOP"));
|
_getApp.setText(u"GET THE LATEST OFFICIAL VERSION OF TELEGRAM DESKTOP"_q);
|
||||||
connect(&_getApp, &QPushButton::clicked, [=] {
|
connect(&_getApp, &QPushButton::clicked, [=] {
|
||||||
QDesktopServices::openUrl(qsl("https://desktop.telegram.org"));
|
QDesktopServices::openUrl(u"https://desktop.telegram.org"_q);
|
||||||
});
|
});
|
||||||
|
|
||||||
_send.setText(qsl("SEND CRASH REPORT"));
|
_send.setText(u"SEND CRASH REPORT"_q);
|
||||||
connect(&_send, &QPushButton::clicked, [=] { sendReport(); });
|
connect(&_send, &QPushButton::clicked, [=] { sendReport(); });
|
||||||
|
|
||||||
_sendSkip.setText(qsl("SKIP"));
|
_sendSkip.setText(u"SKIP"_q);
|
||||||
connect(&_sendSkip, &QPushButton::clicked, [=] { processContinue(); });
|
connect(&_sendSkip, &QPushButton::clicked, [=] { processContinue(); });
|
||||||
_continue.setText(qsl("CONTINUE"));
|
_continue.setText(u"CONTINUE"_q);
|
||||||
connect(&_continue, &QPushButton::clicked, [=] { processContinue(); });
|
connect(&_continue, &QPushButton::clicked, [=] { processContinue(); });
|
||||||
|
|
||||||
QRect scr(QApplication::primaryScreen()->availableGeometry());
|
QRect scr(QApplication::primaryScreen()->availableGeometry());
|
||||||
|
@ -435,7 +435,7 @@ LastCrashedWindow::LastCrashedWindow(
|
||||||
}
|
}
|
||||||
|
|
||||||
void LastCrashedWindow::saveReport() {
|
void LastCrashedWindow::saveReport() {
|
||||||
QString to = QFileDialog::getSaveFileName(0, qsl("Telegram Crash Report"), QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) + qsl("/report.telegramcrash"), qsl("Telegram crash report (*.telegramcrash)"));
|
QString to = QFileDialog::getSaveFileName(0, u"Telegram Crash Report"_q, QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) + u"/report.telegramcrash"_q, u"Telegram crash report (*.telegramcrash)"_q);
|
||||||
if (!to.isEmpty()) {
|
if (!to.isEmpty()) {
|
||||||
QFile file(to);
|
QFile file(to);
|
||||||
if (file.open(QIODevice::WriteOnly)) {
|
if (file.open(QIODevice::WriteOnly)) {
|
||||||
|
@ -450,7 +450,7 @@ QByteArray LastCrashedWindow::getCrashReportRaw() const {
|
||||||
auto result = _dumpraw;
|
auto result = _dumpraw;
|
||||||
if (!_reportUsername.isEmpty() && _includeUsername.checkState() != Qt::Checked) {
|
if (!_reportUsername.isEmpty() && _includeUsername.checkState() != Qt::Checked) {
|
||||||
result.replace(
|
result.replace(
|
||||||
(qsl("Username: ") + _reportUsername).toUtf8(),
|
(u"Username: "_q + _reportUsername).toUtf8(),
|
||||||
"Username: _not_included_");
|
"Username: _not_included_");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -477,9 +477,9 @@ QString LastCrashedWindow::getReportField(const QLatin1String &name, const QLati
|
||||||
|
|
||||||
if (name == qstr("version")) {
|
if (name == qstr("version")) {
|
||||||
if (data.endsWith(qstr(" alpha"))) {
|
if (data.endsWith(qstr(" alpha"))) {
|
||||||
data = QString::number(-data.replace(QRegularExpression(qsl("[^\\d]")), "").toLongLong());
|
data = QString::number(-data.replace(QRegularExpression(u"[^\\d]"_q), "").toLongLong());
|
||||||
} else {
|
} else {
|
||||||
data = QString::number(data.replace(QRegularExpression(qsl("[^\\d]")), "").toLongLong());
|
data = QString::number(data.replace(QRegularExpression(u"[^\\d]"_q), "").toLongLong());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,7 +493,7 @@ void LastCrashedWindow::addReportFieldPart(const QLatin1String &name, const QLat
|
||||||
QString data = getReportField(name, prefix);
|
QString data = getReportField(name, prefix);
|
||||||
if (!data.isEmpty()) {
|
if (!data.isEmpty()) {
|
||||||
QHttpPart reportPart;
|
QHttpPart reportPart;
|
||||||
reportPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(qsl("form-data; name=\"%1\"").arg(name)));
|
reportPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(u"form-data; name=\"%1\""_q.arg(name)));
|
||||||
reportPart.setBody(data.toUtf8());
|
reportPart.setBody(data.toUtf8());
|
||||||
multipart->append(reportPart);
|
multipart->append(reportPart);
|
||||||
}
|
}
|
||||||
|
@ -510,7 +510,7 @@ void LastCrashedWindow::sendReport() {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString apiid = getReportField(qstr("apiid"), qstr("ApiId:")), version = getReportField(qstr("version"), qstr("Version:"));
|
QString apiid = getReportField(qstr("apiid"), qstr("ApiId:")), version = getReportField(qstr("version"), qstr("Version:"));
|
||||||
_checkReply = _sendManager.get(QNetworkRequest(qsl("https://tdesktop.com/crash.php?act=query_report&apiid=%1&version=%2&dmp=%3&platform=%4").arg(
|
_checkReply = _sendManager.get(QNetworkRequest(u"https://tdesktop.com/crash.php?act=query_report&apiid=%1&version=%2&dmp=%3&platform=%4"_q.arg(
|
||||||
apiid,
|
apiid,
|
||||||
version,
|
version,
|
||||||
QString::number(minidumpFileName().isEmpty() ? 0 : 1),
|
QString::number(minidumpFileName().isEmpty() ? 0 : 1),
|
||||||
|
@ -525,7 +525,7 @@ void LastCrashedWindow::sendReport() {
|
||||||
&QNetworkReply::finished,
|
&QNetworkReply::finished,
|
||||||
[=] { checkingFinished(); });
|
[=] { checkingFinished(); });
|
||||||
|
|
||||||
_pleaseSendReport.setText(qsl("Sending crash report..."));
|
_pleaseSendReport.setText(u"Sending crash report..."_q);
|
||||||
_sendingState = SendingProgress;
|
_sendingState = SendingProgress;
|
||||||
_reportShown = false;
|
_reportShown = false;
|
||||||
updateControls();
|
updateControls();
|
||||||
|
@ -534,7 +534,7 @@ void LastCrashedWindow::sendReport() {
|
||||||
QString LastCrashedWindow::minidumpFileName() {
|
QString LastCrashedWindow::minidumpFileName() {
|
||||||
QFileInfo dmpFile(_minidumpFull);
|
QFileInfo dmpFile(_minidumpFull);
|
||||||
if (dmpFile.exists() && dmpFile.size() > 0 && dmpFile.size() < 20 * 1024 * 1024 &&
|
if (dmpFile.exists() && dmpFile.size() > 0 && dmpFile.size() < 20 * 1024 * 1024 &&
|
||||||
QRegularExpression(qsl("^[a-zA-Z0-9\\-]{1,64}\\.dmp$")).match(dmpFile.fileName()).hasMatch()) {
|
QRegularExpression(u"^[a-zA-Z0-9\\-]{1,64}\\.dmp$"_q).match(dmpFile.fileName()).hasMatch()) {
|
||||||
return dmpFile.fileName();
|
return dmpFile.fileName();
|
||||||
}
|
}
|
||||||
return QString();
|
return QString();
|
||||||
|
@ -550,17 +550,17 @@ void LastCrashedWindow::checkingFinished() {
|
||||||
LOG(("Crash report check for sending done, result: %1").arg(QString::fromUtf8(result)));
|
LOG(("Crash report check for sending done, result: %1").arg(QString::fromUtf8(result)));
|
||||||
|
|
||||||
if (result == "Old") {
|
if (result == "Old") {
|
||||||
_pleaseSendReport.setText(qsl("This report is about some old version of Telegram Desktop."));
|
_pleaseSendReport.setText(u"This report is about some old version of Telegram Desktop."_q);
|
||||||
_sendingState = SendingTooOld;
|
_sendingState = SendingTooOld;
|
||||||
updateControls();
|
updateControls();
|
||||||
return;
|
return;
|
||||||
} else if (result == "Unofficial") {
|
} else if (result == "Unofficial") {
|
||||||
_pleaseSendReport.setText(qsl("You use some custom version of Telegram Desktop."));
|
_pleaseSendReport.setText(u"You use some custom version of Telegram Desktop."_q);
|
||||||
_sendingState = SendingUnofficial;
|
_sendingState = SendingUnofficial;
|
||||||
updateControls();
|
updateControls();
|
||||||
return;
|
return;
|
||||||
} else if (result != "Report") {
|
} else if (result != "Report") {
|
||||||
_pleaseSendReport.setText(qsl("Thank you for your report!"));
|
_pleaseSendReport.setText(u"Thank you for your report!"_q);
|
||||||
_sendingState = SendingDone;
|
_sendingState = SendingDone;
|
||||||
updateControls();
|
updateControls();
|
||||||
|
|
||||||
|
@ -600,16 +600,16 @@ void LastCrashedWindow::checkingFinished() {
|
||||||
if (minidumpZip.error() == ZIP_OK) {
|
if (minidumpZip.error() == ZIP_OK) {
|
||||||
QHttpPart dumpPart;
|
QHttpPart dumpPart;
|
||||||
dumpPart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("application/octet-stream"));
|
dumpPart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("application/octet-stream"));
|
||||||
dumpPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(qsl("form-data; name=\"dump\"; filename=\"%1\"").arg(zipName)));
|
dumpPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(u"form-data; name=\"dump\"; filename=\"%1\""_q.arg(zipName)));
|
||||||
dumpPart.setBody(minidumpZip.result());
|
dumpPart.setBody(minidumpZip.result());
|
||||||
multipart->append(dumpPart);
|
multipart->append(dumpPart);
|
||||||
|
|
||||||
_minidump.setText(qsl("+ %1 (%2 KB)").arg(zipName).arg(minidumpZip.result().size() / 1024));
|
_minidump.setText(u"+ %1 (%2 KB)"_q.arg(zipName).arg(minidumpZip.result().size() / 1024));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_sendReply = _sendManager.post(QNetworkRequest(qsl("https://tdesktop.com/crash.php?act=report")), multipart);
|
_sendReply = _sendManager.post(QNetworkRequest(u"https://tdesktop.com/crash.php?act=report"_q), multipart);
|
||||||
multipart->setParent(_sendReply);
|
multipart->setParent(_sendReply);
|
||||||
|
|
||||||
connect(
|
connect(
|
||||||
|
@ -843,7 +843,7 @@ void LastCrashedWindow::updateControls() {
|
||||||
h += _networkSettings.height() + padding;
|
h += _networkSettings.height() + padding;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize s(2 * padding + QFontMetrics(_label.font()).horizontalAdvance(qsl("Last time Telegram Desktop was not closed properly.")) + padding + _networkSettings.width(), h);
|
QSize s(2 * padding + QFontMetrics(_label.font()).horizontalAdvance(u"Last time Telegram Desktop was not closed properly."_q) + padding + _networkSettings.width(), h);
|
||||||
if (s == size()) {
|
if (s == size()) {
|
||||||
resizeEvent(0);
|
resizeEvent(0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -896,7 +896,7 @@ void LastCrashedWindow::setUpdatingState(UpdatingState state, bool force) {
|
||||||
_updaterData->state = state;
|
_updaterData->state = state;
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case UpdatingLatest:
|
case UpdatingLatest:
|
||||||
_updating.setText(qsl("Latest version is installed."));
|
_updating.setText(u"Latest version is installed."_q);
|
||||||
if (_sendingState == SendingNoReport) {
|
if (_sendingState == SendingNoReport) {
|
||||||
InvokeQueued(this, [=] { processContinue(); });
|
InvokeQueued(this, [=] { processContinue(); });
|
||||||
} else {
|
} else {
|
||||||
|
@ -914,10 +914,10 @@ void LastCrashedWindow::setUpdatingState(UpdatingState state, bool force) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case UpdatingCheck:
|
case UpdatingCheck:
|
||||||
_updating.setText(qsl("Checking for updates..."));
|
_updating.setText(u"Checking for updates..."_q);
|
||||||
break;
|
break;
|
||||||
case UpdatingFail:
|
case UpdatingFail:
|
||||||
_updating.setText(qsl("Update check failed :("));
|
_updating.setText(u"Update check failed :("_q);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
updateControls();
|
updateControls();
|
||||||
|
@ -930,7 +930,7 @@ void LastCrashedWindow::setDownloadProgress(qint64 ready, qint64 total) {
|
||||||
qint64 readyTenthMb = (ready * 10 / (1024 * 1024)), totalTenthMb = (total * 10 / (1024 * 1024));
|
qint64 readyTenthMb = (ready * 10 / (1024 * 1024)), totalTenthMb = (total * 10 / (1024 * 1024));
|
||||||
QString readyStr = QString::number(readyTenthMb / 10) + '.' + QString::number(readyTenthMb % 10);
|
QString readyStr = QString::number(readyTenthMb / 10) + '.' + QString::number(readyTenthMb % 10);
|
||||||
QString totalStr = QString::number(totalTenthMb / 10) + '.' + QString::number(totalTenthMb % 10);
|
QString totalStr = QString::number(totalTenthMb / 10) + '.' + QString::number(totalTenthMb % 10);
|
||||||
QString res = qsl("Downloading update {ready} / {total} MB..").replace(qstr("{ready}"), readyStr).replace(qstr("{total}"), totalStr);
|
QString res = u"Downloading update {ready} / {total} MB.."_q.replace(qstr("{ready}"), readyStr).replace(qstr("{total}"), totalStr);
|
||||||
if (_updaterData->newVersionDownload != res) {
|
if (_updaterData->newVersionDownload != res) {
|
||||||
_updaterData->newVersionDownload = res;
|
_updaterData->newVersionDownload = res;
|
||||||
_updating.setText(_updaterData->newVersionDownload);
|
_updating.setText(_updaterData->newVersionDownload);
|
||||||
|
@ -970,7 +970,7 @@ void LastCrashedWindow::processContinue() {
|
||||||
void LastCrashedWindow::sendingError(QNetworkReply::NetworkError e) {
|
void LastCrashedWindow::sendingError(QNetworkReply::NetworkError e) {
|
||||||
LOG(("Crash report sending error: %1").arg(e));
|
LOG(("Crash report sending error: %1").arg(e));
|
||||||
|
|
||||||
_pleaseSendReport.setText(qsl("Sending crash report failed :("));
|
_pleaseSendReport.setText(u"Sending crash report failed :("_q);
|
||||||
_sendingState = SendingFail;
|
_sendingState = SendingFail;
|
||||||
if (_checkReply) {
|
if (_checkReply) {
|
||||||
_checkReply->deleteLater();
|
_checkReply->deleteLater();
|
||||||
|
@ -990,7 +990,7 @@ void LastCrashedWindow::sendingFinished() {
|
||||||
|
|
||||||
_sendReply->deleteLater();
|
_sendReply->deleteLater();
|
||||||
_sendReply = nullptr;
|
_sendReply = nullptr;
|
||||||
_pleaseSendReport.setText(qsl("Thank you for your report!"));
|
_pleaseSendReport.setText(u"Thank you for your report!"_q);
|
||||||
_sendingState = SendingDone;
|
_sendingState = SendingDone;
|
||||||
updateControls();
|
updateControls();
|
||||||
|
|
||||||
|
@ -1003,9 +1003,9 @@ void LastCrashedWindow::sendingProgress(qint64 uploaded, qint64 total) {
|
||||||
_sendingState = SendingUploading;
|
_sendingState = SendingUploading;
|
||||||
|
|
||||||
if (total < 0) {
|
if (total < 0) {
|
||||||
_pleaseSendReport.setText(qsl("Sending crash report %1 KB...").arg(uploaded / 1024));
|
_pleaseSendReport.setText(u"Sending crash report %1 KB..."_q.arg(uploaded / 1024));
|
||||||
} else {
|
} else {
|
||||||
_pleaseSendReport.setText(qsl("Sending crash report %1 / %2 KB...").arg(uploaded / 1024).arg(total / 1024));
|
_pleaseSendReport.setText(u"Sending crash report %1 / %2 KB..."_q.arg(uploaded / 1024).arg(total / 1024));
|
||||||
}
|
}
|
||||||
updateControls();
|
updateControls();
|
||||||
}
|
}
|
||||||
|
@ -1076,7 +1076,7 @@ void LastCrashedWindow::resizeEvent(QResizeEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkSettingsWindow::NetworkSettingsWindow(QWidget *parent, QString host, quint32 port, QString username, QString password)
|
NetworkSettingsWindow::NetworkSettingsWindow(QWidget *parent, QString host, quint32 port, QString username, QString password)
|
||||||
: PreLaunchWindow(qsl("HTTP Proxy Settings"))
|
: PreLaunchWindow(u"HTTP Proxy Settings"_q)
|
||||||
, _hostLabel(this)
|
, _hostLabel(this)
|
||||||
, _portLabel(this)
|
, _portLabel(this)
|
||||||
, _usernameLabel(this)
|
, _usernameLabel(this)
|
||||||
|
@ -1090,14 +1090,14 @@ NetworkSettingsWindow::NetworkSettingsWindow(QWidget *parent, QString host, quin
|
||||||
, _parent(parent) {
|
, _parent(parent) {
|
||||||
setWindowModality(Qt::ApplicationModal);
|
setWindowModality(Qt::ApplicationModal);
|
||||||
|
|
||||||
_hostLabel.setText(qsl("Hostname"));
|
_hostLabel.setText(u"Hostname"_q);
|
||||||
_portLabel.setText(qsl("Port"));
|
_portLabel.setText(u"Port"_q);
|
||||||
_usernameLabel.setText(qsl("Username"));
|
_usernameLabel.setText(u"Username"_q);
|
||||||
_passwordLabel.setText(qsl("Password"));
|
_passwordLabel.setText(u"Password"_q);
|
||||||
|
|
||||||
_save.setText(qsl("SAVE"));
|
_save.setText(u"SAVE"_q);
|
||||||
connect(&_save, &QPushButton::clicked, [=] { save(); });
|
connect(&_save, &QPushButton::clicked, [=] { save(); });
|
||||||
_cancel.setText(qsl("CANCEL"));
|
_cancel.setText(u"CANCEL"_q);
|
||||||
connect(&_cancel, &QPushButton::clicked, [=] { close(); });
|
connect(&_cancel, &QPushButton::clicked, [=] { close(); });
|
||||||
|
|
||||||
_hostInput.setText(host);
|
_hostInput.setText(host);
|
||||||
|
|
|
@ -300,18 +300,18 @@ bool DumpCallback(const google_breakpad::MinidumpDescriptor &md, void *context,
|
||||||
QString PlatformString() {
|
QString PlatformString() {
|
||||||
if (Platform::IsWindowsStoreBuild()) {
|
if (Platform::IsWindowsStoreBuild()) {
|
||||||
return Platform::IsWindows64Bit()
|
return Platform::IsWindows64Bit()
|
||||||
? qsl("WinStore64Bit")
|
? u"WinStore64Bit"_q
|
||||||
: qsl("WinStore32Bit");
|
: u"WinStore32Bit"_q;
|
||||||
} else if (Platform::IsWindows32Bit()) {
|
} else if (Platform::IsWindows32Bit()) {
|
||||||
return qsl("Windows32Bit");
|
return u"Windows32Bit"_q;
|
||||||
} else if (Platform::IsWindows64Bit()) {
|
} else if (Platform::IsWindows64Bit()) {
|
||||||
return qsl("Windows64Bit");
|
return u"Windows64Bit"_q;
|
||||||
} else if (Platform::IsMacStoreBuild()) {
|
} else if (Platform::IsMacStoreBuild()) {
|
||||||
return qsl("MacAppStore");
|
return u"MacAppStore"_q;
|
||||||
} else if (Platform::IsMac()) {
|
} else if (Platform::IsMac()) {
|
||||||
return qsl("MacOS");
|
return u"MacOS"_q;
|
||||||
} else if (Platform::IsLinux()) {
|
} else if (Platform::IsLinux()) {
|
||||||
return qsl("Linux");
|
return u"Linux"_q;
|
||||||
}
|
}
|
||||||
Unexpected("Platform in CrashReports::PlatformString.");
|
Unexpected("Platform in CrashReports::PlatformString.");
|
||||||
}
|
}
|
||||||
|
@ -320,12 +320,16 @@ void StartCatching(not_null<Core::Launcher*> launcher) {
|
||||||
#ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS
|
#ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS
|
||||||
ProcessAnnotations["Binary"] = cExeName().toUtf8().constData();
|
ProcessAnnotations["Binary"] = cExeName().toUtf8().constData();
|
||||||
ProcessAnnotations["ApiId"] = QString::number(ApiId).toUtf8().constData();
|
ProcessAnnotations["ApiId"] = QString::number(ApiId).toUtf8().constData();
|
||||||
ProcessAnnotations["Version"] = (cAlphaVersion() ? qsl("%1 alpha").arg(cAlphaVersion()) : (AppBetaVersion ? qsl("%1 beta") : qsl("%1")).arg(AppVersion)).toUtf8().constData();
|
ProcessAnnotations["Version"] = (cAlphaVersion()
|
||||||
|
? u"%1 alpha"_q.arg(cAlphaVersion())
|
||||||
|
: (AppBetaVersion
|
||||||
|
? u"%1 beta"_q
|
||||||
|
: u"%1"_q).arg(AppVersion)).toUtf8().constData();
|
||||||
ProcessAnnotations["Launched"] = QDateTime::currentDateTime().toString("dd.MM.yyyy hh:mm:ss").toUtf8().constData();
|
ProcessAnnotations["Launched"] = QDateTime::currentDateTime().toString("dd.MM.yyyy hh:mm:ss").toUtf8().constData();
|
||||||
ProcessAnnotations["Platform"] = PlatformString().toUtf8().constData();
|
ProcessAnnotations["Platform"] = PlatformString().toUtf8().constData();
|
||||||
ProcessAnnotations["UserTag"] = QString::number(launcher->installationTag(), 16).toUtf8().constData();
|
ProcessAnnotations["UserTag"] = QString::number(launcher->installationTag(), 16).toUtf8().constData();
|
||||||
|
|
||||||
QString dumpspath = cWorkingDir() + qsl("tdata/dumps");
|
QString dumpspath = cWorkingDir() + u"tdata/dumps"_q;
|
||||||
QDir().mkpath(dumpspath);
|
QDir().mkpath(dumpspath);
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
@ -356,7 +360,7 @@ void StartCatching(not_null<Core::Launcher*> launcher) {
|
||||||
SetSignalHandlers = false;
|
SetSignalHandlers = false;
|
||||||
#else // MAC_USE_BREAKPAD
|
#else // MAC_USE_BREAKPAD
|
||||||
crashpad::CrashpadClient crashpad_client;
|
crashpad::CrashpadClient crashpad_client;
|
||||||
std::string handler = (cExeDir() + cExeName() + qsl("/Contents/Helpers/crashpad_handler")).toUtf8().constData();
|
std::string handler = (cExeDir() + cExeName() + u"/Contents/Helpers/crashpad_handler"_q).toUtf8().constData();
|
||||||
std::string database = QFile::encodeName(dumpspath).constData();
|
std::string database = QFile::encodeName(dumpspath).constData();
|
||||||
if (crashpad_client.StartHandler(
|
if (crashpad_client.StartHandler(
|
||||||
base::FilePath(handler),
|
base::FilePath(handler),
|
||||||
|
@ -394,7 +398,7 @@ void FinishCatching() {
|
||||||
|
|
||||||
StartResult Start() {
|
StartResult Start() {
|
||||||
#ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS
|
#ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS
|
||||||
ReportPath = cWorkingDir() + qsl("tdata/working");
|
ReportPath = cWorkingDir() + u"tdata/working"_q;
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
FILE *f = nullptr;
|
FILE *f = nullptr;
|
||||||
|
|
|
@ -83,8 +83,8 @@ QString filedialogDefaultName(
|
||||||
time_t t = time(NULL);
|
time_t t = time(NULL);
|
||||||
mylocaltime(&tm, &t);
|
mylocaltime(&tm, &t);
|
||||||
|
|
||||||
QChar zero('0');
|
const auto zero = QChar('0');
|
||||||
base = prefix + qsl("_%1-%2-%3_%4-%5-%6").arg(tm.tm_year + 1900).arg(tm.tm_mon + 1, 2, 10, zero).arg(tm.tm_mday, 2, 10, zero).arg(tm.tm_hour, 2, 10, zero).arg(tm.tm_min, 2, 10, zero).arg(tm.tm_sec, 2, 10, zero);
|
base = prefix + u"_%1-%2-%3_%4-%5-%6"_q.arg(tm.tm_year + 1900).arg(tm.tm_mon + 1, 2, 10, zero).arg(tm.tm_mday, 2, 10, zero).arg(tm.tm_hour, 2, 10, zero).arg(tm.tm_min, 2, 10, zero).arg(tm.tm_sec, 2, 10, zero);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString name;
|
QString name;
|
||||||
|
@ -97,7 +97,7 @@ QString filedialogDefaultName(
|
||||||
+ base;
|
+ base;
|
||||||
name = nameBase + extension;
|
name = nameBase + extension;
|
||||||
for (int i = 0; QFileInfo::exists(name); ++i) {
|
for (int i = 0; QFileInfo::exists(name); ++i) {
|
||||||
name = nameBase + qsl(" (%1)").arg(i + 2) + extension;
|
name = nameBase + u" (%1)"_q.arg(i + 2) + extension;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
|
@ -118,7 +118,7 @@ QString filedialogNextFilename(
|
||||||
const auto nameBase = (dir.endsWith('/') ? dir : (dir + '/')) + prefix;
|
const auto nameBase = (dir.endsWith('/') ? dir : (dir + '/')) + prefix;
|
||||||
auto result = nameBase + extension;
|
auto result = nameBase + extension;
|
||||||
for (int i = 0; result.toLower() != cur.toLower() && QFileInfo::exists(result); ++i) {
|
for (int i = 0; result.toLower() != cur.toLower() && QFileInfo::exists(result); ++i) {
|
||||||
result = nameBase + qsl(" (%1)").arg(i + 2) + extension;
|
result = nameBase + u" (%1)"_q.arg(i + 2) + extension;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -336,9 +336,9 @@ void GetFolder(
|
||||||
|
|
||||||
QString AllFilesFilter() {
|
QString AllFilesFilter() {
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
return qsl("All files (*.*)");
|
return u"All files (*.*)"_q;
|
||||||
#else // Q_OS_WIN
|
#else // Q_OS_WIN
|
||||||
return qsl("All files (*)");
|
return u"All files (*)"_q;
|
||||||
#endif // Q_OS_WIN
|
#endif // Q_OS_WIN
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ FilteredCommandLineArguments::FilteredCommandLineArguments(
|
||||||
#endif // !Q_OS_WIN
|
#endif // !Q_OS_WIN
|
||||||
}
|
}
|
||||||
#elif defined Q_OS_UNIX
|
#elif defined Q_OS_UNIX
|
||||||
if (QFile::exists(cWorkingDir() + qsl("tdata/nowayland"))
|
if (QFile::exists(cWorkingDir() + u"tdata/nowayland"_q)
|
||||||
&& qEnvironmentVariableIsEmpty("QT_QPA_PLATFORM")) {
|
&& qEnvironmentVariableIsEmpty("QT_QPA_PLATFORM")) {
|
||||||
LOG(("Wayland: Disable on old installations"));
|
LOG(("Wayland: Disable on old installations"));
|
||||||
pushArgument("-platform");
|
pushArgument("-platform");
|
||||||
|
@ -87,7 +87,7 @@ void FilteredCommandLineArguments::pushArgument(const char *text) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DebugModeSettingPath() {
|
QString DebugModeSettingPath() {
|
||||||
return cWorkingDir() + qsl("tdata/withdebug");
|
return cWorkingDir() + u"tdata/withdebug"_q;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteDebugModeSetting() {
|
void WriteDebugModeSetting() {
|
||||||
|
@ -113,7 +113,7 @@ void ComputeDebugMode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComputeExternalUpdater() {
|
void ComputeExternalUpdater() {
|
||||||
QFile file(qsl("/etc/tdesktop/externalupdater"));
|
QFile file(u"/etc/tdesktop/externalupdater"_q);
|
||||||
|
|
||||||
if (file.exists() && file.open(QIODevice::ReadOnly)) {
|
if (file.exists() && file.open(QIODevice::ReadOnly)) {
|
||||||
QTextStream fileStream(&file);
|
QTextStream fileStream(&file);
|
||||||
|
@ -129,13 +129,13 @@ void ComputeExternalUpdater() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComputeFreeType() {
|
void ComputeFreeType() {
|
||||||
if (QFile::exists(cWorkingDir() + qsl("tdata/withfreetype"))) {
|
if (QFile::exists(cWorkingDir() + u"tdata/withfreetype"_q)) {
|
||||||
cSetUseFreeType(true);
|
cSetUseFreeType(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString InstallBetaVersionsSettingPath() {
|
QString InstallBetaVersionsSettingPath() {
|
||||||
return cWorkingDir() + qsl("tdata/devversion");
|
return cWorkingDir() + u"tdata/devversion"_q;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteInstallBetaVersionsSetting() {
|
void WriteInstallBetaVersionsSetting() {
|
||||||
|
@ -161,7 +161,7 @@ void ComputeInstallBetaVersions() {
|
||||||
|
|
||||||
void ComputeInstallationTag() {
|
void ComputeInstallationTag() {
|
||||||
InstallationTag = 0;
|
InstallationTag = 0;
|
||||||
auto file = QFile(cWorkingDir() + qsl("tdata/usertag"));
|
auto file = QFile(cWorkingDir() + u"tdata/usertag"_q);
|
||||||
if (file.open(QIODevice::ReadOnly)) {
|
if (file.open(QIODevice::ReadOnly)) {
|
||||||
const auto result = file.read(
|
const auto result = file.read(
|
||||||
reinterpret_cast<char*>(&InstallationTag),
|
reinterpret_cast<char*>(&InstallationTag),
|
||||||
|
@ -189,7 +189,7 @@ void ComputeInstallationTag() {
|
||||||
|
|
||||||
bool MoveLegacyAlphaFolder(const QString &folder, const QString &file) {
|
bool MoveLegacyAlphaFolder(const QString &folder, const QString &file) {
|
||||||
const auto was = cExeDir() + folder;
|
const auto was = cExeDir() + folder;
|
||||||
const auto now = cExeDir() + qsl("TelegramForcePortable");
|
const auto now = cExeDir() + u"TelegramForcePortable"_q;
|
||||||
if (QDir(was).exists() && !QDir(now).exists()) {
|
if (QDir(was).exists() && !QDir(now).exists()) {
|
||||||
const auto oldFile = was + "/tdata/" + file;
|
const auto oldFile = was + "/tdata/" + file;
|
||||||
const auto newFile = was + "/tdata/alpha";
|
const auto newFile = was + "/tdata/alpha";
|
||||||
|
@ -210,8 +210,8 @@ bool MoveLegacyAlphaFolder(const QString &folder, const QString &file) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveLegacyAlphaFolder() {
|
bool MoveLegacyAlphaFolder() {
|
||||||
if (!MoveLegacyAlphaFolder(qsl("TelegramAlpha_data"), qsl("alpha"))
|
if (!MoveLegacyAlphaFolder(u"TelegramAlpha_data"_q, u"alpha"_q)
|
||||||
|| !MoveLegacyAlphaFolder(qsl("TelegramBeta_data"), qsl("beta"))) {
|
|| !MoveLegacyAlphaFolder(u"TelegramBeta_data"_q, u"beta"_q)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -222,8 +222,8 @@ bool CheckPortableVersionFolder() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto portable = cExeDir() + qsl("TelegramForcePortable");
|
const auto portable = cExeDir() + u"TelegramForcePortable"_q;
|
||||||
QFile key(portable + qsl("/tdata/alpha"));
|
QFile key(portable + u"/tdata/alpha"_q);
|
||||||
if (cAlphaVersion()) {
|
if (cAlphaVersion()) {
|
||||||
Assert(*AlphaPrivateKey != 0);
|
Assert(*AlphaPrivateKey != 0);
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ void Launcher::init() {
|
||||||
prepareSettings();
|
prepareSettings();
|
||||||
initQtMessageLogging();
|
initQtMessageLogging();
|
||||||
|
|
||||||
QApplication::setApplicationName(qsl("TelegramDesktop"));
|
QApplication::setApplicationName(u"TelegramDesktop"_q);
|
||||||
QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
|
QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
|
||||||
QApplication::setHighDpiScaleFactorRoundingPolicy(
|
QApplication::setHighDpiScaleFactorRoundingPolicy(
|
||||||
Qt::HighDpiScaleFactorRoundingPolicy::Floor);
|
Qt::HighDpiScaleFactorRoundingPolicy::Floor);
|
||||||
|
@ -326,7 +326,7 @@ int Launcher::exec() {
|
||||||
|
|
||||||
if (Logs::DebugEnabled()) {
|
if (Logs::DebugEnabled()) {
|
||||||
const auto openalLogPath = QDir::toNativeSeparators(
|
const auto openalLogPath = QDir::toNativeSeparators(
|
||||||
cWorkingDir() + qsl("DebugLogs/last_openal_log.txt"));
|
cWorkingDir() + u"DebugLogs/last_openal_log.txt"_q);
|
||||||
|
|
||||||
qputenv("ALSOFT_LOGLEVEL", "3");
|
qputenv("ALSOFT_LOGLEVEL", "3");
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ int Launcher::exec() {
|
||||||
if (!UpdaterDisabled() && cRestartingUpdate()) {
|
if (!UpdaterDisabled() && cRestartingUpdate()) {
|
||||||
DEBUG_LOG(("Sandbox Info: executing updater to install update."));
|
DEBUG_LOG(("Sandbox Info: executing updater to install update."));
|
||||||
if (!launchUpdater(UpdaterLaunch::PerformUpdate)) {
|
if (!launchUpdater(UpdaterLaunch::PerformUpdate)) {
|
||||||
base::Platform::DeleteDirectory(cWorkingDir() + qsl("tupdates/temp"));
|
base::Platform::DeleteDirectory(cWorkingDir() + u"tupdates/temp"_q);
|
||||||
}
|
}
|
||||||
} else if (cRestarting()) {
|
} else if (cRestarting()) {
|
||||||
DEBUG_LOG(("Sandbox Info: executing Telegram because of restart."));
|
DEBUG_LOG(("Sandbox Info: executing Telegram because of restart."));
|
||||||
|
|
|
@ -264,17 +264,17 @@ void Sandbox::socketConnected() {
|
||||||
QString commands;
|
QString commands;
|
||||||
const QStringList &lst(cSendPaths());
|
const QStringList &lst(cSendPaths());
|
||||||
for (QStringList::const_iterator i = lst.cbegin(), e = lst.cend(); i != e; ++i) {
|
for (QStringList::const_iterator i = lst.cbegin(), e = lst.cend(); i != e; ++i) {
|
||||||
commands += qsl("SEND:") + _escapeTo7bit(*i) + ';';
|
commands += u"SEND:"_q + _escapeTo7bit(*i) + ';';
|
||||||
}
|
}
|
||||||
if (qEnvironmentVariableIsSet("XDG_ACTIVATION_TOKEN")) {
|
if (qEnvironmentVariableIsSet("XDG_ACTIVATION_TOKEN")) {
|
||||||
commands += qsl("XDG_ACTIVATION_TOKEN:") + _escapeTo7bit(qEnvironmentVariable("XDG_ACTIVATION_TOKEN")) + ';';
|
commands += u"XDG_ACTIVATION_TOKEN:"_q + _escapeTo7bit(qEnvironmentVariable("XDG_ACTIVATION_TOKEN")) + ';';
|
||||||
}
|
}
|
||||||
if (!cStartUrl().isEmpty()) {
|
if (!cStartUrl().isEmpty()) {
|
||||||
commands += qsl("OPEN:") + _escapeTo7bit(cStartUrl()) + ';';
|
commands += u"OPEN:"_q + _escapeTo7bit(cStartUrl()) + ';';
|
||||||
} else if (cQuit()) {
|
} else if (cQuit()) {
|
||||||
commands += qsl("CMD:quit;");
|
commands += u"CMD:quit;"_q;
|
||||||
} else {
|
} else {
|
||||||
commands += qsl("CMD:show;");
|
commands += u"CMD:show;"_q;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_LOG(("Sandbox Info: writing commands %1").arg(commands));
|
DEBUG_LOG(("Sandbox Info: writing commands %1").arg(commands));
|
||||||
|
@ -425,17 +425,17 @@ void Sandbox::readClients() {
|
||||||
int32 from = 0, l = cmds.length();
|
int32 from = 0, l = cmds.length();
|
||||||
for (int32 to = cmds.indexOf(QChar(';'), from); to >= from; to = (from < l) ? cmds.indexOf(QChar(';'), from) : -1) {
|
for (int32 to = cmds.indexOf(QChar(';'), from); to >= from; to = (from < l) ? cmds.indexOf(QChar(';'), from) : -1) {
|
||||||
auto cmd = base::StringViewMid(cmds, from, to - from);
|
auto cmd = base::StringViewMid(cmds, from, to - from);
|
||||||
if (cmd.startsWith(qsl("CMD:"))) {
|
if (cmd.startsWith(u"CMD:"_q)) {
|
||||||
execExternal(cmds.mid(from + 4, to - from - 4));
|
execExternal(cmds.mid(from + 4, to - from - 4));
|
||||||
const auto response = qsl("RES:%1;").arg(QApplication::applicationPid()).toLatin1();
|
const auto response = u"RES:%1;"_q.arg(QApplication::applicationPid()).toLatin1();
|
||||||
i->first->write(response.data(), response.size());
|
i->first->write(response.data(), response.size());
|
||||||
} else if (cmd.startsWith(qsl("SEND:"))) {
|
} else if (cmd.startsWith(u"SEND:"_q)) {
|
||||||
if (cSendPaths().isEmpty()) {
|
if (cSendPaths().isEmpty()) {
|
||||||
toSend.append(_escapeFrom7bit(cmds.mid(from + 5, to - from - 5)));
|
toSend.append(_escapeFrom7bit(cmds.mid(from + 5, to - from - 5)));
|
||||||
}
|
}
|
||||||
} else if (cmd.startsWith(qsl("XDG_ACTIVATION_TOKEN:"))) {
|
} else if (cmd.startsWith(u"XDG_ACTIVATION_TOKEN:"_q)) {
|
||||||
qputenv("XDG_ACTIVATION_TOKEN", _escapeFrom7bit(cmds.mid(from + 21, to - from - 21)).toUtf8());
|
qputenv("XDG_ACTIVATION_TOKEN", _escapeFrom7bit(cmds.mid(from + 21, to - from - 21)).toUtf8());
|
||||||
} else if (cmd.startsWith(qsl("OPEN:"))) {
|
} else if (cmd.startsWith(u"OPEN:"_q)) {
|
||||||
startUrl = _escapeFrom7bit(cmds.mid(from + 5, to - from - 5)).mid(0, 8192);
|
startUrl = _escapeFrom7bit(cmds.mid(from + 5, to - from - 5)).mid(0, 8192);
|
||||||
auto activateRequired = StartUrlRequiresActivate(startUrl);
|
auto activateRequired = StartUrlRequiresActivate(startUrl);
|
||||||
if (activateRequired) {
|
if (activateRequired) {
|
||||||
|
@ -444,7 +444,7 @@ void Sandbox::readClients() {
|
||||||
const auto responsePid = activateRequired
|
const auto responsePid = activateRequired
|
||||||
? QApplication::applicationPid()
|
? QApplication::applicationPid()
|
||||||
: kEmptyPidForCommandResponse;
|
: kEmptyPidForCommandResponse;
|
||||||
const auto response = qsl("RES:%1;").arg(responsePid).toLatin1();
|
const auto response = u"RES:%1;"_q.arg(responsePid).toLatin1();
|
||||||
i->first->write(response.data(), response.size());
|
i->first->write(response.data(), response.size());
|
||||||
} else {
|
} else {
|
||||||
LOG(("Sandbox Error: unknown command %1 passed in local socket").arg(cmd.toString()));
|
LOG(("Sandbox Error: unknown command %1 passed in local socket").arg(cmd.toString()));
|
||||||
|
|
|
@ -55,87 +55,87 @@ const auto SupportCommands = base::flat_set<Command>{
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto CommandByName = base::flat_map<QString, Command>{
|
const auto CommandByName = base::flat_map<QString, Command>{
|
||||||
{ qsl("close_telegram") , Command::Close },
|
{ u"close_telegram"_q , Command::Close },
|
||||||
{ qsl("lock_telegram") , Command::Lock },
|
{ u"lock_telegram"_q , Command::Lock },
|
||||||
{ qsl("minimize_telegram") , Command::Minimize },
|
{ u"minimize_telegram"_q , Command::Minimize },
|
||||||
{ qsl("quit_telegram") , Command::Quit },
|
{ u"quit_telegram"_q , Command::Quit },
|
||||||
|
|
||||||
{ qsl("media_play") , Command::MediaPlay },
|
{ u"media_play"_q , Command::MediaPlay },
|
||||||
{ qsl("media_pause") , Command::MediaPause },
|
{ u"media_pause"_q , Command::MediaPause },
|
||||||
{ qsl("media_playpause") , Command::MediaPlayPause },
|
{ u"media_playpause"_q , Command::MediaPlayPause },
|
||||||
{ qsl("media_stop") , Command::MediaStop },
|
{ u"media_stop"_q , Command::MediaStop },
|
||||||
{ qsl("media_previous") , Command::MediaPrevious },
|
{ u"media_previous"_q , Command::MediaPrevious },
|
||||||
{ qsl("media_next") , Command::MediaNext },
|
{ u"media_next"_q , Command::MediaNext },
|
||||||
|
|
||||||
{ qsl("search") , Command::Search },
|
{ u"search"_q , Command::Search },
|
||||||
|
|
||||||
{ qsl("previous_chat") , Command::ChatPrevious },
|
{ u"previous_chat"_q , Command::ChatPrevious },
|
||||||
{ qsl("next_chat") , Command::ChatNext },
|
{ u"next_chat"_q , Command::ChatNext },
|
||||||
{ qsl("first_chat") , Command::ChatFirst },
|
{ u"first_chat"_q , Command::ChatFirst },
|
||||||
{ qsl("last_chat") , Command::ChatLast },
|
{ u"last_chat"_q , Command::ChatLast },
|
||||||
{ qsl("self_chat") , Command::ChatSelf },
|
{ u"self_chat"_q , Command::ChatSelf },
|
||||||
|
|
||||||
{ qsl("previous_folder") , Command::FolderPrevious },
|
{ u"previous_folder"_q , Command::FolderPrevious },
|
||||||
{ qsl("next_folder") , Command::FolderNext },
|
{ u"next_folder"_q , Command::FolderNext },
|
||||||
{ qsl("all_chats") , Command::ShowAllChats },
|
{ u"all_chats"_q , Command::ShowAllChats },
|
||||||
|
|
||||||
{ qsl("folder1") , Command::ShowFolder1 },
|
{ u"folder1"_q , Command::ShowFolder1 },
|
||||||
{ qsl("folder2") , Command::ShowFolder2 },
|
{ u"folder2"_q , Command::ShowFolder2 },
|
||||||
{ qsl("folder3") , Command::ShowFolder3 },
|
{ u"folder3"_q , Command::ShowFolder3 },
|
||||||
{ qsl("folder4") , Command::ShowFolder4 },
|
{ u"folder4"_q , Command::ShowFolder4 },
|
||||||
{ qsl("folder5") , Command::ShowFolder5 },
|
{ u"folder5"_q , Command::ShowFolder5 },
|
||||||
{ qsl("folder6") , Command::ShowFolder6 },
|
{ u"folder6"_q , Command::ShowFolder6 },
|
||||||
{ qsl("last_folder") , Command::ShowFolderLast },
|
{ u"last_folder"_q , Command::ShowFolderLast },
|
||||||
|
|
||||||
{ qsl("show_archive") , Command::ShowArchive },
|
{ u"show_archive"_q , Command::ShowArchive },
|
||||||
{ qsl("show_contacts") , Command::ShowContacts },
|
{ u"show_contacts"_q , Command::ShowContacts },
|
||||||
|
|
||||||
{ qsl("read_chat") , Command::ReadChat },
|
{ u"read_chat"_q , Command::ReadChat },
|
||||||
|
|
||||||
// Shortcuts that have no default values.
|
// Shortcuts that have no default values.
|
||||||
{ qsl("message") , Command::JustSendMessage },
|
{ u"message"_q , Command::JustSendMessage },
|
||||||
{ qsl("message_silently") , Command::SendSilentMessage },
|
{ u"message_silently"_q , Command::SendSilentMessage },
|
||||||
{ qsl("message_scheduled") , Command::ScheduleMessage },
|
{ u"message_scheduled"_q , Command::ScheduleMessage },
|
||||||
//
|
//
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto CommandNames = base::flat_map<Command, QString>{
|
const auto CommandNames = base::flat_map<Command, QString>{
|
||||||
{ Command::Close , qsl("close_telegram") },
|
{ Command::Close , u"close_telegram"_q },
|
||||||
{ Command::Lock , qsl("lock_telegram") },
|
{ Command::Lock , u"lock_telegram"_q },
|
||||||
{ Command::Minimize , qsl("minimize_telegram") },
|
{ Command::Minimize , u"minimize_telegram"_q },
|
||||||
{ Command::Quit , qsl("quit_telegram") },
|
{ Command::Quit , u"quit_telegram"_q },
|
||||||
|
|
||||||
{ Command::MediaPlay , qsl("media_play") },
|
{ Command::MediaPlay , u"media_play"_q },
|
||||||
{ Command::MediaPause , qsl("media_pause") },
|
{ Command::MediaPause , u"media_pause"_q },
|
||||||
{ Command::MediaPlayPause , qsl("media_playpause") },
|
{ Command::MediaPlayPause , u"media_playpause"_q },
|
||||||
{ Command::MediaStop , qsl("media_stop") },
|
{ Command::MediaStop , u"media_stop"_q },
|
||||||
{ Command::MediaPrevious , qsl("media_previous") },
|
{ Command::MediaPrevious , u"media_previous"_q },
|
||||||
{ Command::MediaNext , qsl("media_next") },
|
{ Command::MediaNext , u"media_next"_q },
|
||||||
|
|
||||||
{ Command::Search , qsl("search") },
|
{ Command::Search , u"search"_q },
|
||||||
|
|
||||||
{ Command::ChatPrevious , qsl("previous_chat") },
|
{ Command::ChatPrevious , u"previous_chat"_q },
|
||||||
{ Command::ChatNext , qsl("next_chat") },
|
{ Command::ChatNext , u"next_chat"_q },
|
||||||
{ Command::ChatFirst , qsl("first_chat") },
|
{ Command::ChatFirst , u"first_chat"_q },
|
||||||
{ Command::ChatLast , qsl("last_chat") },
|
{ Command::ChatLast , u"last_chat"_q },
|
||||||
{ Command::ChatSelf , qsl("self_chat") },
|
{ Command::ChatSelf , u"self_chat"_q },
|
||||||
|
|
||||||
{ Command::FolderPrevious , qsl("previous_folder") },
|
{ Command::FolderPrevious , u"previous_folder"_q },
|
||||||
{ Command::FolderNext , qsl("next_folder") },
|
{ Command::FolderNext , u"next_folder"_q },
|
||||||
{ Command::ShowAllChats , qsl("all_chats") },
|
{ Command::ShowAllChats , u"all_chats"_q },
|
||||||
|
|
||||||
{ Command::ShowFolder1 , qsl("folder1") },
|
{ Command::ShowFolder1 , u"folder1"_q },
|
||||||
{ Command::ShowFolder2 , qsl("folder2") },
|
{ Command::ShowFolder2 , u"folder2"_q },
|
||||||
{ Command::ShowFolder3 , qsl("folder3") },
|
{ Command::ShowFolder3 , u"folder3"_q },
|
||||||
{ Command::ShowFolder4 , qsl("folder4") },
|
{ Command::ShowFolder4 , u"folder4"_q },
|
||||||
{ Command::ShowFolder5 , qsl("folder5") },
|
{ Command::ShowFolder5 , u"folder5"_q },
|
||||||
{ Command::ShowFolder6 , qsl("folder6") },
|
{ Command::ShowFolder6 , u"folder6"_q },
|
||||||
{ Command::ShowFolderLast , qsl("last_folder") },
|
{ Command::ShowFolderLast , u"last_folder"_q },
|
||||||
|
|
||||||
{ Command::ShowArchive , qsl("show_archive") },
|
{ Command::ShowArchive , u"show_archive"_q },
|
||||||
{ Command::ShowContacts , qsl("show_contacts") },
|
{ Command::ShowContacts , u"show_contacts"_q },
|
||||||
|
|
||||||
{ Command::ReadChat , qsl("read_chat") },
|
{ Command::ReadChat , u"read_chat"_q },
|
||||||
};
|
};
|
||||||
|
|
||||||
class Manager {
|
class Manager {
|
||||||
|
@ -169,11 +169,11 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
QString DefaultFilePath() {
|
QString DefaultFilePath() {
|
||||||
return cWorkingDir() + qsl("tdata/shortcuts-default.json");
|
return cWorkingDir() + u"tdata/shortcuts-default.json"_q;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CustomFilePath() {
|
QString CustomFilePath() {
|
||||||
return cWorkingDir() + qsl("tdata/shortcuts-custom.json");
|
return cWorkingDir() + u"tdata/shortcuts-custom.json"_q;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DefaultFileIsValid() {
|
bool DefaultFileIsValid() {
|
||||||
|
@ -195,7 +195,7 @@ bool DefaultFileIsValid() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const auto versionObject = (*shortcuts.constBegin()).toObject();
|
const auto versionObject = (*shortcuts.constBegin()).toObject();
|
||||||
const auto version = versionObject.constFind(qsl("version"));
|
const auto version = versionObject.constFind(u"version"_q);
|
||||||
if (version == versionObject.constEnd()
|
if (version == versionObject.constEnd()
|
||||||
|| !(*version).isString()
|
|| !(*version).isString()
|
||||||
|| (*version).toString() != QString::number(AppVersion)) {
|
|| (*version).toString() != QString::number(AppVersion)) {
|
||||||
|
@ -266,12 +266,12 @@ bool Manager::readCustomFile() {
|
||||||
}
|
}
|
||||||
const auto guard = gsl::finally([&] {
|
const auto guard = gsl::finally([&] {
|
||||||
if (!_errors.isEmpty()) {
|
if (!_errors.isEmpty()) {
|
||||||
_errors.push_front(qsl("While reading file '%1'..."
|
_errors.push_front((u"While reading file '%1'..."_q
|
||||||
).arg(file.fileName()));
|
).arg(file.fileName()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!file.open(QIODevice::ReadOnly)) {
|
if (!file.open(QIODevice::ReadOnly)) {
|
||||||
_errors.push_back(qsl("Could not read the file!"));
|
_errors.push_back(u"Could not read the file!"_q);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
auto error = QJsonParseError{ 0, QJsonParseError::NoError };
|
auto error = QJsonParseError{ 0, QJsonParseError::NoError };
|
||||||
|
@ -281,23 +281,23 @@ bool Manager::readCustomFile() {
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
if (error.error != QJsonParseError::NoError) {
|
if (error.error != QJsonParseError::NoError) {
|
||||||
_errors.push_back(qsl("Failed to parse! Error: %2"
|
_errors.push_back((u"Failed to parse! Error: %2"_q
|
||||||
).arg(error.errorString()));
|
).arg(error.errorString()));
|
||||||
return true;
|
return true;
|
||||||
} else if (!document.isArray()) {
|
} else if (!document.isArray()) {
|
||||||
_errors.push_back(qsl("Failed to parse! Error: array expected"));
|
_errors.push_back(u"Failed to parse! Error: array expected"_q);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const auto shortcuts = document.array();
|
const auto shortcuts = document.array();
|
||||||
auto limit = kCountLimit;
|
auto limit = kCountLimit;
|
||||||
for (auto i = shortcuts.constBegin(), e = shortcuts.constEnd(); i != e; ++i) {
|
for (auto i = shortcuts.constBegin(), e = shortcuts.constEnd(); i != e; ++i) {
|
||||||
if (!(*i).isObject()) {
|
if (!(*i).isObject()) {
|
||||||
_errors.push_back(qsl("Bad entry! Error: object expected"));
|
_errors.push_back(u"Bad entry! Error: object expected"_q);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const auto entry = (*i).toObject();
|
const auto entry = (*i).toObject();
|
||||||
const auto keys = entry.constFind(qsl("keys"));
|
const auto keys = entry.constFind(u"keys"_q);
|
||||||
const auto command = entry.constFind(qsl("command"));
|
const auto command = entry.constFind(u"command"_q);
|
||||||
if (keys == entry.constEnd()
|
if (keys == entry.constEnd()
|
||||||
|| command == entry.constEnd()
|
|| command == entry.constEnd()
|
||||||
|| !(*keys).isString()
|
|| !(*keys).isString()
|
||||||
|
@ -319,8 +319,8 @@ bool Manager::readCustomFile() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!--limit) {
|
if (!--limit) {
|
||||||
_errors.push_back(qsl("Too many entries! Limit is %1"
|
_errors.push_back(u"Too many entries! Limit is %1"_q.arg(
|
||||||
).arg(kCountLimit));
|
kCountLimit));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -328,66 +328,66 @@ bool Manager::readCustomFile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::fillDefaults() {
|
void Manager::fillDefaults() {
|
||||||
const auto ctrl = Platform::IsMac() ? qsl("meta") : qsl("ctrl");
|
const auto ctrl = Platform::IsMac() ? u"meta"_q : u"ctrl"_q;
|
||||||
|
|
||||||
set(qsl("ctrl+w"), Command::Close);
|
set(u"ctrl+w"_q, Command::Close);
|
||||||
set(qsl("ctrl+f4"), Command::Close);
|
set(u"ctrl+f4"_q, Command::Close);
|
||||||
set(qsl("ctrl+l"), Command::Lock);
|
set(u"ctrl+l"_q, Command::Lock);
|
||||||
set(qsl("ctrl+m"), Command::Minimize);
|
set(u"ctrl+m"_q, Command::Minimize);
|
||||||
set(qsl("ctrl+q"), Command::Quit);
|
set(u"ctrl+q"_q, Command::Quit);
|
||||||
|
|
||||||
set(qsl("media play"), Command::MediaPlay);
|
set(u"media play"_q, Command::MediaPlay);
|
||||||
set(qsl("media pause"), Command::MediaPause);
|
set(u"media pause"_q, Command::MediaPause);
|
||||||
set(qsl("toggle media play/pause"), Command::MediaPlayPause);
|
set(u"toggle media play/pause"_q, Command::MediaPlayPause);
|
||||||
set(qsl("media stop"), Command::MediaStop);
|
set(u"media stop"_q, Command::MediaStop);
|
||||||
set(qsl("media previous"), Command::MediaPrevious);
|
set(u"media previous"_q, Command::MediaPrevious);
|
||||||
set(qsl("media next"), Command::MediaNext);
|
set(u"media next"_q, Command::MediaNext);
|
||||||
|
|
||||||
set(qsl("ctrl+f"), Command::Search);
|
set(u"ctrl+f"_q, Command::Search);
|
||||||
set(qsl("search"), Command::Search);
|
set(u"search"_q, Command::Search);
|
||||||
set(qsl("find"), Command::Search);
|
set(u"find"_q, Command::Search);
|
||||||
|
|
||||||
set(qsl("ctrl+pgdown"), Command::ChatNext);
|
set(u"ctrl+pgdown"_q, Command::ChatNext);
|
||||||
set(qsl("alt+down"), Command::ChatNext);
|
set(u"alt+down"_q, Command::ChatNext);
|
||||||
set(qsl("ctrl+pgup"), Command::ChatPrevious);
|
set(u"ctrl+pgup"_q, Command::ChatPrevious);
|
||||||
set(qsl("alt+up"), Command::ChatPrevious);
|
set(u"alt+up"_q, Command::ChatPrevious);
|
||||||
|
|
||||||
set(qsl("%1+tab").arg(ctrl), Command::ChatNext);
|
set(u"%1+tab"_q.arg(ctrl), Command::ChatNext);
|
||||||
set(qsl("%1+shift+tab").arg(ctrl), Command::ChatPrevious);
|
set(u"%1+shift+tab"_q.arg(ctrl), Command::ChatPrevious);
|
||||||
set(qsl("%1+backtab").arg(ctrl), Command::ChatPrevious);
|
set(u"%1+backtab"_q.arg(ctrl), Command::ChatPrevious);
|
||||||
|
|
||||||
set(qsl("ctrl+alt+home"), Command::ChatFirst);
|
set(u"ctrl+alt+home"_q, Command::ChatFirst);
|
||||||
set(qsl("ctrl+alt+end"), Command::ChatLast);
|
set(u"ctrl+alt+end"_q, Command::ChatLast);
|
||||||
|
|
||||||
set(qsl("f5"), Command::SupportReloadTemplates);
|
set(u"f5"_q, Command::SupportReloadTemplates);
|
||||||
set(qsl("ctrl+delete"), Command::SupportToggleMuted);
|
set(u"ctrl+delete"_q, Command::SupportToggleMuted);
|
||||||
set(qsl("ctrl+insert"), Command::SupportScrollToCurrent);
|
set(u"ctrl+insert"_q, Command::SupportScrollToCurrent);
|
||||||
set(qsl("ctrl+shift+x"), Command::SupportHistoryBack);
|
set(u"ctrl+shift+x"_q, Command::SupportHistoryBack);
|
||||||
set(qsl("ctrl+shift+c"), Command::SupportHistoryForward);
|
set(u"ctrl+shift+c"_q, Command::SupportHistoryForward);
|
||||||
|
|
||||||
set(qsl("ctrl+1"), Command::ChatPinned1);
|
set(u"ctrl+1"_q, Command::ChatPinned1);
|
||||||
set(qsl("ctrl+2"), Command::ChatPinned2);
|
set(u"ctrl+2"_q, Command::ChatPinned2);
|
||||||
set(qsl("ctrl+3"), Command::ChatPinned3);
|
set(u"ctrl+3"_q, Command::ChatPinned3);
|
||||||
set(qsl("ctrl+4"), Command::ChatPinned4);
|
set(u"ctrl+4"_q, Command::ChatPinned4);
|
||||||
set(qsl("ctrl+5"), Command::ChatPinned5);
|
set(u"ctrl+5"_q, Command::ChatPinned5);
|
||||||
|
|
||||||
auto &&folders = ranges::views::zip(
|
auto &&folders = ranges::views::zip(
|
||||||
kShowFolder,
|
kShowFolder,
|
||||||
ranges::views::ints(1, ranges::unreachable));
|
ranges::views::ints(1, ranges::unreachable));
|
||||||
|
|
||||||
for (const auto [command, index] : folders) {
|
for (const auto [command, index] : folders) {
|
||||||
set(qsl("%1+%2").arg(ctrl).arg(index), command);
|
set(u"%1+%2"_q.arg(ctrl).arg(index), command);
|
||||||
}
|
}
|
||||||
|
|
||||||
set(qsl("%1+shift+down").arg(ctrl), Command::FolderNext);
|
set(u"%1+shift+down"_q.arg(ctrl), Command::FolderNext);
|
||||||
set(qsl("%1+shift+up").arg(ctrl), Command::FolderPrevious);
|
set(u"%1+shift+up"_q.arg(ctrl), Command::FolderPrevious);
|
||||||
|
|
||||||
set(qsl("ctrl+0"), Command::ChatSelf);
|
set(u"ctrl+0"_q, Command::ChatSelf);
|
||||||
|
|
||||||
set(qsl("ctrl+9"), Command::ShowArchive);
|
set(u"ctrl+9"_q, Command::ShowArchive);
|
||||||
set(qsl("ctrl+j"), Command::ShowContacts);
|
set(u"ctrl+j"_q, Command::ShowContacts);
|
||||||
|
|
||||||
set(qsl("ctrl+r"), Command::ReadChat);
|
set(u"ctrl+r"_q, Command::ReadChat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::writeDefaultFile() {
|
void Manager::writeDefaultFile() {
|
||||||
|
@ -405,7 +405,7 @@ void Manager::writeDefaultFile() {
|
||||||
|
|
||||||
auto shortcuts = QJsonArray();
|
auto shortcuts = QJsonArray();
|
||||||
auto version = QJsonObject();
|
auto version = QJsonObject();
|
||||||
version.insert(qsl("version"), QString::number(AppVersion));
|
version.insert(u"version"_q, QString::number(AppVersion));
|
||||||
shortcuts.push_back(version);
|
shortcuts.push_back(version);
|
||||||
|
|
||||||
for (const auto &[sequence, shortcut] : _shortcuts) {
|
for (const auto &[sequence, shortcut] : _shortcuts) {
|
||||||
|
@ -416,8 +416,8 @@ void Manager::writeDefaultFile() {
|
||||||
const auto j = CommandNames.find(i->second);
|
const auto j = CommandNames.find(i->second);
|
||||||
if (j != CommandNames.end()) {
|
if (j != CommandNames.end()) {
|
||||||
QJsonObject entry;
|
QJsonObject entry;
|
||||||
entry.insert(qsl("keys"), sequence.toString().toLower());
|
entry.insert(u"keys"_q, sequence.toString().toLower());
|
||||||
entry.insert(qsl("command"), j->second);
|
entry.insert(u"command"_q, j->second);
|
||||||
shortcuts.append(entry);
|
shortcuts.append(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -435,8 +435,7 @@ void Manager::set(const QString &keys, Command command, bool replace) {
|
||||||
|
|
||||||
const auto result = QKeySequence(keys, QKeySequence::PortableText);
|
const auto result = QKeySequence(keys, QKeySequence::PortableText);
|
||||||
if (result.isEmpty()) {
|
if (result.isEmpty()) {
|
||||||
_errors.push_back(qsl("Could not derive key sequence '%1'!"
|
_errors.push_back(u"Could not derive key sequence '%1'!"_q.arg(keys));
|
||||||
).arg(keys));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto shortcut = base::make_unique_q<QShortcut>(
|
auto shortcut = base::make_unique_q<QShortcut>(
|
||||||
|
@ -463,7 +462,7 @@ void Manager::set(const QString &keys, Command command, bool replace) {
|
||||||
id = i->second->id();
|
id = i->second->id();
|
||||||
}
|
}
|
||||||
if (!id) {
|
if (!id) {
|
||||||
_errors.push_back(qsl("Could not create shortcut '%1'!").arg(keys));
|
_errors.push_back(u"Could not create shortcut '%1'!"_q.arg(keys));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_commandByShortcutId.emplace(id, command);
|
_commandByShortcutId.emplace(id, command);
|
||||||
|
@ -482,8 +481,7 @@ void Manager::remove(const QString &keys) {
|
||||||
|
|
||||||
const auto result = QKeySequence(keys, QKeySequence::PortableText);
|
const auto result = QKeySequence(keys, QKeySequence::PortableText);
|
||||||
if (result.isEmpty()) {
|
if (result.isEmpty()) {
|
||||||
_errors.push_back(qsl("Could not derive key sequence '%1'!"
|
_errors.push_back(u"Could not derive key sequence '%1'!"_q.arg(keys));
|
||||||
).arg(keys));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto i = _shortcuts.find(result);
|
const auto i = _shortcuts.find(result);
|
||||||
|
|
|
@ -164,13 +164,13 @@ std::shared_ptr<ClickHandler> UiIntegration::createLinkHandler(
|
||||||
using HashtagMentionType = MarkedTextContext::HashtagMentionType;
|
using HashtagMentionType = MarkedTextContext::HashtagMentionType;
|
||||||
if (my && my->type == HashtagMentionType::Twitter) {
|
if (my && my->type == HashtagMentionType::Twitter) {
|
||||||
return std::make_shared<UrlClickHandler>(
|
return std::make_shared<UrlClickHandler>(
|
||||||
(qsl("https://twitter.com/hashtag/")
|
(u"https://twitter.com/hashtag/"_q
|
||||||
+ data.data.mid(1)
|
+ data.data.mid(1)
|
||||||
+ qsl("?src=hash")),
|
+ u"?src=hash"_q),
|
||||||
true);
|
true);
|
||||||
} else if (my && my->type == HashtagMentionType::Instagram) {
|
} else if (my && my->type == HashtagMentionType::Instagram) {
|
||||||
return std::make_shared<UrlClickHandler>(
|
return std::make_shared<UrlClickHandler>(
|
||||||
(qsl("https://instagram.com/explore/tags/")
|
(u"https://instagram.com/explore/tags/"_q
|
||||||
+ data.data.mid(1)
|
+ data.data.mid(1)
|
||||||
+ '/'),
|
+ '/'),
|
||||||
true);
|
true);
|
||||||
|
@ -184,11 +184,11 @@ std::shared_ptr<ClickHandler> UiIntegration::createLinkHandler(
|
||||||
using HashtagMentionType = MarkedTextContext::HashtagMentionType;
|
using HashtagMentionType = MarkedTextContext::HashtagMentionType;
|
||||||
if (my && my->type == HashtagMentionType::Twitter) {
|
if (my && my->type == HashtagMentionType::Twitter) {
|
||||||
return std::make_shared<UrlClickHandler>(
|
return std::make_shared<UrlClickHandler>(
|
||||||
qsl("https://twitter.com/") + data.data.mid(1),
|
u"https://twitter.com/"_q + data.data.mid(1),
|
||||||
true);
|
true);
|
||||||
} else if (my && my->type == HashtagMentionType::Instagram) {
|
} else if (my && my->type == HashtagMentionType::Instagram) {
|
||||||
return std::make_shared<UrlClickHandler>(
|
return std::make_shared<UrlClickHandler>(
|
||||||
qsl("https://instagram.com/") + data.data.mid(1) + '/',
|
u"https://instagram.com/"_q + data.data.mid(1) + '/',
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
return std::make_shared<MentionClickHandler>(data.data);
|
return std::make_shared<MentionClickHandler>(data.data);
|
||||||
|
|
|
@ -228,7 +228,7 @@ std::shared_ptr<Updater> GetUpdaterInstance() {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString UpdatesFolder() {
|
QString UpdatesFolder() {
|
||||||
return cWorkingDir() + qsl("tupdates");
|
return cWorkingDir() + u"tupdates"_q;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearAll() {
|
void ClearAll() {
|
||||||
|
@ -259,10 +259,10 @@ QString FindUpdateFile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ExtractFilename(const QString &url) {
|
QString ExtractFilename(const QString &url) {
|
||||||
const auto expression = QRegularExpression(qsl("/([^/\\?]+)(\\?|$)"));
|
const auto expression = QRegularExpression(u"/([^/\\?]+)(\\?|$)"_q);
|
||||||
if (const auto match = expression.match(url); match.hasMatch()) {
|
if (const auto match = expression.match(url); match.hasMatch()) {
|
||||||
return match.captured(1).replace(
|
return match.captured(1).replace(
|
||||||
QRegularExpression(qsl("[^a-zA-Z0-9_\\-]")),
|
QRegularExpression(u"[^a-zA-Z0-9_\\-]"_q),
|
||||||
QString());
|
QString());
|
||||||
}
|
}
|
||||||
return QString();
|
return QString();
|
||||||
|
@ -290,7 +290,7 @@ bool UnpackUpdate(const QString &filepath) {
|
||||||
}
|
}
|
||||||
input.close();
|
input.close();
|
||||||
|
|
||||||
QString tempDirPath = cWorkingDir() + qsl("tupdates/temp"), readyFilePath = cWorkingDir() + qsl("tupdates/temp/ready");
|
QString tempDirPath = cWorkingDir() + u"tupdates/temp"_q, readyFilePath = cWorkingDir() + u"tupdates/temp/ready"_q;
|
||||||
base::Platform::DeleteDirectory(tempDirPath);
|
base::Platform::DeleteDirectory(tempDirPath);
|
||||||
|
|
||||||
QDir tempDir(tempDirPath);
|
QDir tempDir(tempDirPath);
|
||||||
|
@ -485,7 +485,7 @@ bool UnpackUpdate(const QString &filepath) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// create tdata/version file
|
// create tdata/version file
|
||||||
tempDir.mkdir(QDir(tempDirPath + qsl("/tdata")).absolutePath());
|
tempDir.mkdir(QDir(tempDirPath + u"/tdata"_q).absolutePath());
|
||||||
std::wstring versionString = FormatVersionDisplay(version).toStdWString();
|
std::wstring versionString = FormatVersionDisplay(version).toStdWString();
|
||||||
|
|
||||||
const auto versionNum = VersionInt(version);
|
const auto versionNum = VersionInt(version);
|
||||||
|
@ -493,9 +493,9 @@ bool UnpackUpdate(const QString &filepath) {
|
||||||
VersionChar versionStr[32];
|
VersionChar versionStr[32];
|
||||||
memcpy(versionStr, versionString.c_str(), versionLen);
|
memcpy(versionStr, versionString.c_str(), versionLen);
|
||||||
|
|
||||||
QFile fVersion(tempDirPath + qsl("/tdata/version"));
|
QFile fVersion(tempDirPath + u"/tdata/version"_q);
|
||||||
if (!fVersion.open(QIODevice::WriteOnly)) {
|
if (!fVersion.open(QIODevice::WriteOnly)) {
|
||||||
LOG(("Update Error: cant write version file '%1'").arg(tempDirPath + qsl("/version")));
|
LOG(("Update Error: cant write version file '%1'").arg(tempDirPath + u"/version"_q));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fVersion.write((const char*)&versionNum, sizeof(VersionInt));
|
fVersion.write((const char*)&versionNum, sizeof(VersionInt));
|
||||||
|
@ -723,7 +723,7 @@ std::optional<QString> HttpChecker::parseOldResponse(
|
||||||
const QByteArray &response) const {
|
const QByteArray &response) const {
|
||||||
const auto string = QString::fromLatin1(response);
|
const auto string = QString::fromLatin1(response);
|
||||||
const auto old = QRegularExpression(
|
const auto old = QRegularExpression(
|
||||||
qsl("^\\s*(\\d+)\\s*:\\s*([\\x21-\\x7f]+)\\s*$")
|
u"^\\s*(\\d+)\\s*:\\s*([\\x21-\\x7f]+)\\s*$"_q
|
||||||
).match(string);
|
).match(string);
|
||||||
if (!old.hasMatch()) {
|
if (!old.hasMatch()) {
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
@ -871,7 +871,7 @@ void HttpLoaderActor::gotMetaData() {
|
||||||
const auto pairs = _reply->rawHeaderPairs();
|
const auto pairs = _reply->rawHeaderPairs();
|
||||||
for (const auto &pair : pairs) {
|
for (const auto &pair : pairs) {
|
||||||
if (QString::fromUtf8(pair.first).toLower() == "content-range") {
|
if (QString::fromUtf8(pair.first).toLower() == "content-range") {
|
||||||
const auto m = QRegularExpression(qsl("/(\\d+)([^\\d]|$)")).match(QString::fromUtf8(pair.second));
|
const auto m = QRegularExpression(u"/(\\d+)([^\\d]|$)"_q).match(QString::fromUtf8(pair.second));
|
||||||
if (m.hasMatch()) {
|
if (m.hasMatch()) {
|
||||||
_parent->writeChunk({}, m.captured(1).toInt());
|
_parent->writeChunk({}, m.captured(1).toInt());
|
||||||
}
|
}
|
||||||
|
@ -1506,16 +1506,16 @@ int UpdateChecker::size() const {
|
||||||
//}
|
//}
|
||||||
|
|
||||||
bool checkReadyUpdate() {
|
bool checkReadyUpdate() {
|
||||||
QString readyFilePath = cWorkingDir() + qsl("tupdates/temp/ready"), readyPath = cWorkingDir() + qsl("tupdates/temp");
|
QString readyFilePath = cWorkingDir() + u"tupdates/temp/ready"_q, readyPath = cWorkingDir() + u"tupdates/temp"_q;
|
||||||
if (!QFile(readyFilePath).exists() || cExeName().isEmpty()) {
|
if (!QFile(readyFilePath).exists() || cExeName().isEmpty()) {
|
||||||
if (QDir(cWorkingDir() + qsl("tupdates/ready")).exists() || QDir(cWorkingDir() + qsl("tupdates/temp")).exists()) {
|
if (QDir(cWorkingDir() + u"tupdates/ready"_q).exists() || QDir(cWorkingDir() + u"tupdates/temp"_q).exists()) {
|
||||||
ClearAll();
|
ClearAll();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check ready version
|
// check ready version
|
||||||
QString versionPath = readyPath + qsl("/tdata/version");
|
QString versionPath = readyPath + u"/tdata/version"_q;
|
||||||
{
|
{
|
||||||
QFile fVersion(versionPath);
|
QFile fVersion(versionPath);
|
||||||
if (!fVersion.open(QIODevice::ReadOnly)) {
|
if (!fVersion.open(QIODevice::ReadOnly)) {
|
||||||
|
@ -1550,14 +1550,14 @@ bool checkReadyUpdate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
QString curUpdater = (cExeDir() + qsl("Updater.exe"));
|
QString curUpdater = (cExeDir() + u"Updater.exe"_q);
|
||||||
QFileInfo updater(cWorkingDir() + qsl("tupdates/temp/Updater.exe"));
|
QFileInfo updater(cWorkingDir() + u"tupdates/temp/Updater.exe"_q);
|
||||||
#elif defined Q_OS_MAC // Q_OS_WIN
|
#elif defined Q_OS_MAC // Q_OS_WIN
|
||||||
QString curUpdater = (cExeDir() + cExeName() + qsl("/Contents/Frameworks/Updater"));
|
QString curUpdater = (cExeDir() + cExeName() + u"/Contents/Frameworks/Updater"_q);
|
||||||
QFileInfo updater(cWorkingDir() + qsl("tupdates/temp/Telegram.app/Contents/Frameworks/Updater"));
|
QFileInfo updater(cWorkingDir() + u"tupdates/temp/Telegram.app/Contents/Frameworks/Updater"_q);
|
||||||
#elif defined Q_OS_UNIX // Q_OS_MAC
|
#elif defined Q_OS_UNIX // Q_OS_MAC
|
||||||
QString curUpdater = (cExeDir() + qsl("Updater"));
|
QString curUpdater = (cExeDir() + u"Updater"_q);
|
||||||
QFileInfo updater(cWorkingDir() + qsl("tupdates/temp/Updater"));
|
QFileInfo updater(cWorkingDir() + u"tupdates/temp/Updater"_q);
|
||||||
#endif // Q_OS_UNIX
|
#endif // Q_OS_UNIX
|
||||||
if (!updater.exists()) {
|
if (!updater.exists()) {
|
||||||
QFileInfo current(curUpdater);
|
QFileInfo current(curUpdater);
|
||||||
|
|
|
@ -339,12 +339,12 @@ namespace {
|
||||||
|
|
||||||
QString translitLetterRusEng(QChar letter, QChar next, int32 &toSkip) {
|
QString translitLetterRusEng(QChar letter, QChar next, int32 &toSkip) {
|
||||||
if (fastDoubleLetterRusEng.isEmpty()) {
|
if (fastDoubleLetterRusEng.isEmpty()) {
|
||||||
fastDoubleLetterRusEng.insert((QString::fromUtf8("Ы").at(0).unicode() << 16) | QString::fromUtf8("й").at(0).unicode(), qsl("Y"));
|
fastDoubleLetterRusEng.insert((QString::fromUtf8("Ы").at(0).unicode() << 16) | QString::fromUtf8("й").at(0).unicode(), u"Y"_q);
|
||||||
fastDoubleLetterRusEng.insert((QString::fromUtf8("и").at(0).unicode() << 16) | QString::fromUtf8("я").at(0).unicode(), qsl("ia"));
|
fastDoubleLetterRusEng.insert((QString::fromUtf8("и").at(0).unicode() << 16) | QString::fromUtf8("я").at(0).unicode(), u"ia"_q);
|
||||||
fastDoubleLetterRusEng.insert((QString::fromUtf8("и").at(0).unicode() << 16) | QString::fromUtf8("й").at(0).unicode(), qsl("y"));
|
fastDoubleLetterRusEng.insert((QString::fromUtf8("и").at(0).unicode() << 16) | QString::fromUtf8("й").at(0).unicode(), u"y"_q);
|
||||||
fastDoubleLetterRusEng.insert((QString::fromUtf8("к").at(0).unicode() << 16) | QString::fromUtf8("с").at(0).unicode(), qsl("x"));
|
fastDoubleLetterRusEng.insert((QString::fromUtf8("к").at(0).unicode() << 16) | QString::fromUtf8("с").at(0).unicode(), u"x"_q);
|
||||||
fastDoubleLetterRusEng.insert((QString::fromUtf8("ы").at(0).unicode() << 16) | QString::fromUtf8("й").at(0).unicode(), qsl("y"));
|
fastDoubleLetterRusEng.insert((QString::fromUtf8("ы").at(0).unicode() << 16) | QString::fromUtf8("й").at(0).unicode(), u"y"_q);
|
||||||
fastDoubleLetterRusEng.insert((QString::fromUtf8("ь").at(0).unicode() << 16) | QString::fromUtf8("е").at(0).unicode(), qsl("ye"));
|
fastDoubleLetterRusEng.insert((QString::fromUtf8("ь").at(0).unicode() << 16) | QString::fromUtf8("е").at(0).unicode(), u"ye"_q);
|
||||||
}
|
}
|
||||||
QMap<uint32, QString>::const_iterator i = fastDoubleLetterRusEng.constFind((letter.unicode() << 16) | next.unicode());
|
QMap<uint32, QString>::const_iterator i = fastDoubleLetterRusEng.constFind((letter.unicode() << 16) | next.unicode());
|
||||||
if (i != fastDoubleLetterRusEng.cend()) {
|
if (i != fastDoubleLetterRusEng.cend()) {
|
||||||
|
@ -354,81 +354,81 @@ QString translitLetterRusEng(QChar letter, QChar next, int32 &toSkip) {
|
||||||
|
|
||||||
toSkip = 1;
|
toSkip = 1;
|
||||||
if (fastLetterRusEng.isEmpty()) {
|
if (fastLetterRusEng.isEmpty()) {
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("А").at(0), qsl("A"));
|
fastLetterRusEng.insert(QString::fromUtf8("А").at(0), u"A"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Б").at(0), qsl("B"));
|
fastLetterRusEng.insert(QString::fromUtf8("Б").at(0), u"B"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("В").at(0), qsl("V"));
|
fastLetterRusEng.insert(QString::fromUtf8("В").at(0), u"V"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Г").at(0), qsl("G"));
|
fastLetterRusEng.insert(QString::fromUtf8("Г").at(0), u"G"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Ґ").at(0), qsl("G"));
|
fastLetterRusEng.insert(QString::fromUtf8("Ґ").at(0), u"G"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Д").at(0), qsl("D"));
|
fastLetterRusEng.insert(QString::fromUtf8("Д").at(0), u"D"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Е").at(0), qsl("E"));
|
fastLetterRusEng.insert(QString::fromUtf8("Е").at(0), u"E"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Є").at(0), qsl("Ye"));
|
fastLetterRusEng.insert(QString::fromUtf8("Є").at(0), u"Ye"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Ё").at(0), qsl("Yo"));
|
fastLetterRusEng.insert(QString::fromUtf8("Ё").at(0), u"Yo"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Ж").at(0), qsl("Zh"));
|
fastLetterRusEng.insert(QString::fromUtf8("Ж").at(0), u"Zh"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("З").at(0), qsl("Z"));
|
fastLetterRusEng.insert(QString::fromUtf8("З").at(0), u"Z"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("И").at(0), qsl("I"));
|
fastLetterRusEng.insert(QString::fromUtf8("И").at(0), u"I"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Ї").at(0), qsl("Yi"));
|
fastLetterRusEng.insert(QString::fromUtf8("Ї").at(0), u"Yi"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("І").at(0), qsl("I"));
|
fastLetterRusEng.insert(QString::fromUtf8("І").at(0), u"I"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Й").at(0), qsl("J"));
|
fastLetterRusEng.insert(QString::fromUtf8("Й").at(0), u"J"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("К").at(0), qsl("K"));
|
fastLetterRusEng.insert(QString::fromUtf8("К").at(0), u"K"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Л").at(0), qsl("L"));
|
fastLetterRusEng.insert(QString::fromUtf8("Л").at(0), u"L"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("М").at(0), qsl("M"));
|
fastLetterRusEng.insert(QString::fromUtf8("М").at(0), u"M"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Н").at(0), qsl("N"));
|
fastLetterRusEng.insert(QString::fromUtf8("Н").at(0), u"N"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("О").at(0), qsl("O"));
|
fastLetterRusEng.insert(QString::fromUtf8("О").at(0), u"O"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("П").at(0), qsl("P"));
|
fastLetterRusEng.insert(QString::fromUtf8("П").at(0), u"P"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Р").at(0), qsl("R"));
|
fastLetterRusEng.insert(QString::fromUtf8("Р").at(0), u"R"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("С").at(0), qsl("S"));
|
fastLetterRusEng.insert(QString::fromUtf8("С").at(0), u"S"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Т").at(0), qsl("T"));
|
fastLetterRusEng.insert(QString::fromUtf8("Т").at(0), u"T"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("У").at(0), qsl("U"));
|
fastLetterRusEng.insert(QString::fromUtf8("У").at(0), u"U"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Ў").at(0), qsl("W"));
|
fastLetterRusEng.insert(QString::fromUtf8("Ў").at(0), u"W"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Ф").at(0), qsl("F"));
|
fastLetterRusEng.insert(QString::fromUtf8("Ф").at(0), u"F"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Х").at(0), qsl("Kh"));
|
fastLetterRusEng.insert(QString::fromUtf8("Х").at(0), u"Kh"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Ц").at(0), qsl("Ts"));
|
fastLetterRusEng.insert(QString::fromUtf8("Ц").at(0), u"Ts"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Ч").at(0), qsl("Ch"));
|
fastLetterRusEng.insert(QString::fromUtf8("Ч").at(0), u"Ch"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Ш").at(0), qsl("Sh"));
|
fastLetterRusEng.insert(QString::fromUtf8("Ш").at(0), u"Sh"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Щ").at(0), qsl("Sch"));
|
fastLetterRusEng.insert(QString::fromUtf8("Щ").at(0), u"Sch"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Э").at(0), qsl("E"));
|
fastLetterRusEng.insert(QString::fromUtf8("Э").at(0), u"E"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Ю").at(0), qsl("Yu"));
|
fastLetterRusEng.insert(QString::fromUtf8("Ю").at(0), u"Yu"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Я").at(0), qsl("Ya"));
|
fastLetterRusEng.insert(QString::fromUtf8("Я").at(0), u"Ya"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Ў").at(0), qsl("W"));
|
fastLetterRusEng.insert(QString::fromUtf8("Ў").at(0), u"W"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("а").at(0), qsl("a"));
|
fastLetterRusEng.insert(QString::fromUtf8("а").at(0), u"a"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("б").at(0), qsl("b"));
|
fastLetterRusEng.insert(QString::fromUtf8("б").at(0), u"b"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("в").at(0), qsl("v"));
|
fastLetterRusEng.insert(QString::fromUtf8("в").at(0), u"v"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("г").at(0), qsl("g"));
|
fastLetterRusEng.insert(QString::fromUtf8("г").at(0), u"g"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("ґ").at(0), qsl("g"));
|
fastLetterRusEng.insert(QString::fromUtf8("ґ").at(0), u"g"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("д").at(0), qsl("d"));
|
fastLetterRusEng.insert(QString::fromUtf8("д").at(0), u"d"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("е").at(0), qsl("e"));
|
fastLetterRusEng.insert(QString::fromUtf8("е").at(0), u"e"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("є").at(0), qsl("ye"));
|
fastLetterRusEng.insert(QString::fromUtf8("є").at(0), u"ye"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("ё").at(0), qsl("yo"));
|
fastLetterRusEng.insert(QString::fromUtf8("ё").at(0), u"yo"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("ж").at(0), qsl("zh"));
|
fastLetterRusEng.insert(QString::fromUtf8("ж").at(0), u"zh"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("з").at(0), qsl("z"));
|
fastLetterRusEng.insert(QString::fromUtf8("з").at(0), u"z"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("й").at(0), qsl("y"));
|
fastLetterRusEng.insert(QString::fromUtf8("й").at(0), u"y"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("ї").at(0), qsl("yi"));
|
fastLetterRusEng.insert(QString::fromUtf8("ї").at(0), u"yi"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("і").at(0), qsl("i"));
|
fastLetterRusEng.insert(QString::fromUtf8("і").at(0), u"i"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("л").at(0), qsl("l"));
|
fastLetterRusEng.insert(QString::fromUtf8("л").at(0), u"l"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("м").at(0), qsl("m"));
|
fastLetterRusEng.insert(QString::fromUtf8("м").at(0), u"m"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("н").at(0), qsl("n"));
|
fastLetterRusEng.insert(QString::fromUtf8("н").at(0), u"n"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("о").at(0), qsl("o"));
|
fastLetterRusEng.insert(QString::fromUtf8("о").at(0), u"o"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("п").at(0), qsl("p"));
|
fastLetterRusEng.insert(QString::fromUtf8("п").at(0), u"p"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("р").at(0), qsl("r"));
|
fastLetterRusEng.insert(QString::fromUtf8("р").at(0), u"r"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("с").at(0), qsl("s"));
|
fastLetterRusEng.insert(QString::fromUtf8("с").at(0), u"s"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("т").at(0), qsl("t"));
|
fastLetterRusEng.insert(QString::fromUtf8("т").at(0), u"t"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("у").at(0), qsl("u"));
|
fastLetterRusEng.insert(QString::fromUtf8("у").at(0), u"u"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("ў").at(0), qsl("w"));
|
fastLetterRusEng.insert(QString::fromUtf8("ў").at(0), u"w"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("ф").at(0), qsl("f"));
|
fastLetterRusEng.insert(QString::fromUtf8("ф").at(0), u"f"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("х").at(0), qsl("kh"));
|
fastLetterRusEng.insert(QString::fromUtf8("х").at(0), u"kh"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("ц").at(0), qsl("ts"));
|
fastLetterRusEng.insert(QString::fromUtf8("ц").at(0), u"ts"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("ч").at(0), qsl("ch"));
|
fastLetterRusEng.insert(QString::fromUtf8("ч").at(0), u"ch"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("ш").at(0), qsl("sh"));
|
fastLetterRusEng.insert(QString::fromUtf8("ш").at(0), u"sh"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("щ").at(0), qsl("sch"));
|
fastLetterRusEng.insert(QString::fromUtf8("щ").at(0), u"sch"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("ъ").at(0), QString());
|
fastLetterRusEng.insert(QString::fromUtf8("ъ").at(0), QString());
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("э").at(0), qsl("e"));
|
fastLetterRusEng.insert(QString::fromUtf8("э").at(0), u"e"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("ю").at(0), qsl("yu"));
|
fastLetterRusEng.insert(QString::fromUtf8("ю").at(0), u"yu"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("я").at(0), qsl("ya"));
|
fastLetterRusEng.insert(QString::fromUtf8("я").at(0), u"ya"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("ў").at(0), qsl("w"));
|
fastLetterRusEng.insert(QString::fromUtf8("ў").at(0), u"w"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("Ы").at(0), qsl("Y"));
|
fastLetterRusEng.insert(QString::fromUtf8("Ы").at(0), u"Y"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("и").at(0), qsl("i"));
|
fastLetterRusEng.insert(QString::fromUtf8("и").at(0), u"i"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("к").at(0), qsl("k"));
|
fastLetterRusEng.insert(QString::fromUtf8("к").at(0), u"k"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("ы").at(0), qsl("y"));
|
fastLetterRusEng.insert(QString::fromUtf8("ы").at(0), u"y"_q);
|
||||||
fastLetterRusEng.insert(QString::fromUtf8("ь").at(0), QString());
|
fastLetterRusEng.insert(QString::fromUtf8("ь").at(0), QString());
|
||||||
}
|
}
|
||||||
QHash<QChar, QString>::const_iterator j = fastLetterRusEng.constFind(letter);
|
QHash<QChar, QString>::const_iterator j = fastLetterRusEng.constFind(letter);
|
||||||
|
@ -440,16 +440,16 @@ QString translitLetterRusEng(QChar letter, QChar next, int32 &toSkip) {
|
||||||
|
|
||||||
QString translitRusEng(const QString &rus) {
|
QString translitRusEng(const QString &rus) {
|
||||||
if (fastRusEng.isEmpty()) {
|
if (fastRusEng.isEmpty()) {
|
||||||
fastRusEng.insert(QString::fromUtf8("Александр"), qsl("Alexander"));
|
fastRusEng.insert(QString::fromUtf8("Александр"), u"Alexander"_q);
|
||||||
fastRusEng.insert(QString::fromUtf8("александр"), qsl("alexander"));
|
fastRusEng.insert(QString::fromUtf8("александр"), u"alexander"_q);
|
||||||
fastRusEng.insert(QString::fromUtf8("Филипп"), qsl("Philip"));
|
fastRusEng.insert(QString::fromUtf8("Филипп"), u"Philip"_q);
|
||||||
fastRusEng.insert(QString::fromUtf8("филипп"), qsl("philip"));
|
fastRusEng.insert(QString::fromUtf8("филипп"), u"philip"_q);
|
||||||
fastRusEng.insert(QString::fromUtf8("Пётр"), qsl("Petr"));
|
fastRusEng.insert(QString::fromUtf8("Пётр"), u"Petr"_q);
|
||||||
fastRusEng.insert(QString::fromUtf8("пётр"), qsl("petr"));
|
fastRusEng.insert(QString::fromUtf8("пётр"), u"petr"_q);
|
||||||
fastRusEng.insert(QString::fromUtf8("Гай"), qsl("Gai"));
|
fastRusEng.insert(QString::fromUtf8("Гай"), u"Gai"_q);
|
||||||
fastRusEng.insert(QString::fromUtf8("гай"), qsl("gai"));
|
fastRusEng.insert(QString::fromUtf8("гай"), u"gai"_q);
|
||||||
fastRusEng.insert(QString::fromUtf8("Ильин"), qsl("Ilyin"));
|
fastRusEng.insert(QString::fromUtf8("Ильин"), u"Ilyin"_q);
|
||||||
fastRusEng.insert(QString::fromUtf8("ильин"), qsl("ilyin"));
|
fastRusEng.insert(QString::fromUtf8("ильин"), u"ilyin"_q);
|
||||||
}
|
}
|
||||||
QMap<QString, QString>::const_iterator i = fastRusEng.constFind(rus);
|
QMap<QString, QString>::const_iterator i = fastRusEng.constFind(rus);
|
||||||
if (i != fastRusEng.cend()) {
|
if (i != fastRusEng.cend()) {
|
||||||
|
|
|
@ -56,7 +56,7 @@ inline QList<QUrl> GetMimeUrls(const QMimeData *data) {
|
||||||
inline QString IconName() {
|
inline QString IconName() {
|
||||||
static const auto Result = KSandbox::isFlatpak()
|
static const auto Result = KSandbox::isFlatpak()
|
||||||
? qEnvironmentVariable("FLATPAK_ID")
|
? qEnvironmentVariable("FLATPAK_ID")
|
||||||
: qsl("telegram");
|
: u"telegram"_q;
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -104,7 +104,7 @@ QString FileNameUnsafe(
|
||||||
if (Core::App().settings().askDownloadPath() || savingAs) {
|
if (Core::App().settings().askDownloadPath() || savingAs) {
|
||||||
if (!name.isEmpty() && name.at(0) == QChar::fromLatin1('.')) {
|
if (!name.isEmpty() && name.at(0) == QChar::fromLatin1('.')) {
|
||||||
name = filedialogDefaultName(prefix, name);
|
name = filedialogDefaultName(prefix, name);
|
||||||
} else if (dir.path() != qsl(".")) {
|
} else if (dir.path() != u"."_q) {
|
||||||
QString path = dir.absolutePath();
|
QString path = dir.absolutePath();
|
||||||
if (path != cDialogLastPath()) {
|
if (path != cDialogLastPath()) {
|
||||||
cSetDialogLastPath(path);
|
cSetDialogLastPath(path);
|
||||||
|
@ -115,21 +115,21 @@ QString FileNameUnsafe(
|
||||||
// check if extension of filename is present in filter
|
// check if extension of filename is present in filter
|
||||||
// it should be in first filter section on the first place
|
// it should be in first filter section on the first place
|
||||||
// place it there, if it is not
|
// place it there, if it is not
|
||||||
QString ext = QFileInfo(name).suffix(), fil = filter, sep = qsl(";;");
|
QString ext = QFileInfo(name).suffix(), fil = filter, sep = u";;"_q;
|
||||||
if (!ext.isEmpty()) {
|
if (!ext.isEmpty()) {
|
||||||
if (QRegularExpression(qsl("^[a-zA-Z_0-9]+$")).match(ext).hasMatch()) {
|
if (QRegularExpression(u"^[a-zA-Z_0-9]+$"_q).match(ext).hasMatch()) {
|
||||||
QStringList filters = filter.split(sep);
|
QStringList filters = filter.split(sep);
|
||||||
if (filters.size() > 1) {
|
if (filters.size() > 1) {
|
||||||
const auto &first = filters.at(0);
|
const auto &first = filters.at(0);
|
||||||
int32 start = first.indexOf(qsl("(*."));
|
int32 start = first.indexOf(u"(*."_q);
|
||||||
if (start >= 0) {
|
if (start >= 0) {
|
||||||
if (!QRegularExpression(qsl("\\(\\*\\.") + ext + qsl("[\\)\\s]"), QRegularExpression::CaseInsensitiveOption).match(first).hasMatch()) {
|
if (!QRegularExpression(u"\\(\\*\\."_q + ext + u"[\\)\\s]"_q, QRegularExpression::CaseInsensitiveOption).match(first).hasMatch()) {
|
||||||
QRegularExpressionMatch m = QRegularExpression(qsl(" \\*\\.") + ext + qsl("[\\)\\s]"), QRegularExpression::CaseInsensitiveOption).match(first);
|
QRegularExpressionMatch m = QRegularExpression(u" \\*\\."_q + ext + u"[\\)\\s]"_q, QRegularExpression::CaseInsensitiveOption).match(first);
|
||||||
if (m.hasMatch() && m.capturedStart() > start + 3) {
|
if (m.hasMatch() && m.capturedStart() > start + 3) {
|
||||||
int32 oldpos = m.capturedStart(), oldend = m.capturedEnd();
|
int32 oldpos = m.capturedStart(), oldend = m.capturedEnd();
|
||||||
fil = first.mid(0, start + 3) + ext + qsl(" *.") + first.mid(start + 3, oldpos - start - 3) + first.mid(oldend - 1) + sep + JoinStringList(filters.mid(1), sep);
|
fil = first.mid(0, start + 3) + ext + u" *."_q + first.mid(start + 3, oldpos - start - 3) + first.mid(oldend - 1) + sep + JoinStringList(filters.mid(1), sep);
|
||||||
} else {
|
} else {
|
||||||
fil = first.mid(0, start + 3) + ext + qsl(" *.") + first.mid(start + 3) + sep + JoinStringList(filters.mid(1), sep);
|
fil = first.mid(0, start + 3) + ext + u" *."_q + first.mid(start + 3) + sep + JoinStringList(filters.mid(1), sep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -149,19 +149,19 @@ QString FileNameUnsafe(
|
||||||
const auto path = Core::App().settings().downloadPath();
|
const auto path = Core::App().settings().downloadPath();
|
||||||
if (path.isEmpty()) {
|
if (path.isEmpty()) {
|
||||||
return File::DefaultDownloadPath(session);
|
return File::DefaultDownloadPath(session);
|
||||||
} else if (path == qsl("tmp")) {
|
} else if (path == u"tmp"_q) {
|
||||||
return session->local().tempDirectory();
|
return session->local().tempDirectory();
|
||||||
} else {
|
} else {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
}();
|
}();
|
||||||
if (path.isEmpty()) return QString();
|
if (path.isEmpty()) return QString();
|
||||||
if (name.isEmpty()) name = qsl(".unknown");
|
if (name.isEmpty()) name = u".unknown"_q;
|
||||||
if (name.at(0) == QChar::fromLatin1('.')) {
|
if (name.at(0) == QChar::fromLatin1('.')) {
|
||||||
if (!QDir().exists(path)) QDir().mkpath(path);
|
if (!QDir().exists(path)) QDir().mkpath(path);
|
||||||
return filedialogDefaultName(prefix, name, path);
|
return filedialogDefaultName(prefix, name, path);
|
||||||
}
|
}
|
||||||
if (dir.path() != qsl(".")) {
|
if (dir.path() != u"."_q) {
|
||||||
path = dir.absolutePath() + '/';
|
path = dir.absolutePath() + '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ QString FileNameUnsafe(
|
||||||
QString nameBase = path + nameStart;
|
QString nameBase = path + nameStart;
|
||||||
name = nameBase + extension;
|
name = nameBase + extension;
|
||||||
for (int i = 0; QFileInfo::exists(name); ++i) {
|
for (int i = 0; QFileInfo::exists(name); ++i) {
|
||||||
name = nameBase + QString(" (%1)").arg(i + 2) + extension;
|
name = nameBase + u" (%1)"_q.arg(i + 2) + extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!QDir().exists(path)) QDir().mkpath(path);
|
if (!QDir().exists(path)) QDir().mkpath(path);
|
||||||
|
@ -202,7 +202,7 @@ QString FileNameForSave(
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
const auto lower = result.trimmed().toLower();
|
const auto lower = result.trimmed().toLower();
|
||||||
const auto kBadExtensions = { u".lnk"_q, u".scf"_q };
|
const auto kBadExtensions = { u".lnk"_q, u".scf"_q };
|
||||||
const auto kMaskExtension = qsl(".download");
|
const auto kMaskExtension = u".download"_q;
|
||||||
for (const auto extension : kBadExtensions) {
|
for (const auto extension : kBadExtensions) {
|
||||||
if (lower.endsWith(extension)) {
|
if (lower.endsWith(extension)) {
|
||||||
return result + kMaskExtension;
|
return result + kMaskExtension;
|
||||||
|
@ -228,37 +228,37 @@ QString DocumentFileNameForSave(
|
||||||
QString pattern = p.isEmpty() ? QString() : p.front();
|
QString pattern = p.isEmpty() ? QString() : p.front();
|
||||||
if (data->isVoiceMessage()) {
|
if (data->isVoiceMessage()) {
|
||||||
auto mp3 = data->hasMimeType(u"audio/mp3"_q);
|
auto mp3 = data->hasMimeType(u"audio/mp3"_q);
|
||||||
name = already.isEmpty() ? (mp3 ? qsl(".mp3") : qsl(".ogg")) : already;
|
name = already.isEmpty() ? (mp3 ? u".mp3"_q : u".ogg"_q) : already;
|
||||||
filter = mp3 ? qsl("MP3 Audio (*.mp3);;") : qsl("OGG Opus Audio (*.ogg);;");
|
filter = mp3 ? u"MP3 Audio (*.mp3);;"_q : u"OGG Opus Audio (*.ogg);;"_q;
|
||||||
filter += FileDialog::AllFilesFilter();
|
filter += FileDialog::AllFilesFilter();
|
||||||
caption = tr::lng_save_audio(tr::now);
|
caption = tr::lng_save_audio(tr::now);
|
||||||
prefix = qsl("audio");
|
prefix = u"audio"_q;
|
||||||
} else if (data->isVideoFile()) {
|
} else if (data->isVideoFile()) {
|
||||||
name = already.isEmpty() ? data->filename() : already;
|
name = already.isEmpty() ? data->filename() : already;
|
||||||
if (name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
name = pattern.isEmpty() ? qsl(".mov") : pattern.replace('*', QString());
|
name = pattern.isEmpty() ? u".mov"_q : pattern.replace('*', QString());
|
||||||
}
|
}
|
||||||
if (pattern.isEmpty()) {
|
if (pattern.isEmpty()) {
|
||||||
filter = qsl("MOV Video (*.mov);;") + FileDialog::AllFilesFilter();
|
filter = u"MOV Video (*.mov);;"_q + FileDialog::AllFilesFilter();
|
||||||
} else {
|
} else {
|
||||||
filter = mimeType.filterString() + qsl(";;") + FileDialog::AllFilesFilter();
|
filter = mimeType.filterString() + u";;"_q + FileDialog::AllFilesFilter();
|
||||||
}
|
}
|
||||||
caption = tr::lng_save_video(tr::now);
|
caption = tr::lng_save_video(tr::now);
|
||||||
prefix = qsl("video");
|
prefix = u"video"_q;
|
||||||
} else {
|
} else {
|
||||||
name = already.isEmpty() ? data->filename() : already;
|
name = already.isEmpty() ? data->filename() : already;
|
||||||
if (name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
name = pattern.isEmpty() ? qsl(".unknown") : pattern.replace('*', QString());
|
name = pattern.isEmpty() ? u".unknown"_q : pattern.replace('*', QString());
|
||||||
}
|
}
|
||||||
if (pattern.isEmpty()) {
|
if (pattern.isEmpty()) {
|
||||||
filter = QString();
|
filter = QString();
|
||||||
} else {
|
} else {
|
||||||
filter = mimeType.filterString() + qsl(";;") + FileDialog::AllFilesFilter();
|
filter = mimeType.filterString() + u";;"_q + FileDialog::AllFilesFilter();
|
||||||
}
|
}
|
||||||
caption = data->isAudioFile()
|
caption = data->isAudioFile()
|
||||||
? tr::lng_save_audio_file(tr::now)
|
? tr::lng_save_audio_file(tr::now)
|
||||||
: tr::lng_save_file(tr::now);
|
: tr::lng_save_file(tr::now);
|
||||||
prefix = qsl("doc");
|
prefix = u"doc"_q;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FileNameForSave(
|
return FileNameForSave(
|
||||||
|
|
|
@ -152,14 +152,14 @@ bool IsExecutableName(const QString &filepath) {
|
||||||
static const auto kExtensions = [] {
|
static const auto kExtensions = [] {
|
||||||
const auto joined =
|
const auto joined =
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
qsl("\
|
u"\
|
||||||
applescript action app bin command csh osx workflow terminal url caction \
|
applescript action app bin command csh osx workflow terminal url caction \
|
||||||
mpkg pkg scpt scptd xhtm webarchive");
|
mpkg pkg scpt scptd xhtm webarchive"_q;
|
||||||
#elif defined Q_OS_UNIX // Q_OS_MAC
|
#elif defined Q_OS_UNIX // Q_OS_MAC
|
||||||
qsl("bin csh deb desktop ksh out pet pkg pup rpm run sh shar \
|
u"bin csh deb desktop ksh out pet pkg pup rpm run sh shar \
|
||||||
slp zsh");
|
slp zsh"_q;
|
||||||
#else // Q_OS_MAC || Q_OS_UNIX
|
#else // Q_OS_MAC || Q_OS_UNIX
|
||||||
qsl("\
|
u"\
|
||||||
ad ade adp app application appref-ms asp asx bas bat bin cab cdxml cer cfg \
|
ad ade adp app application appref-ms asp asx bas bat bin cab cdxml cer cfg \
|
||||||
chi chm cmd cnt com cpl crt csh der diagcab dll drv eml exe fon fxp gadget \
|
chi chm cmd cnt com cpl crt csh der diagcab dll drv eml exe fon fxp gadget \
|
||||||
grp hlp hpj hta htt inf ini ins inx isp isu its jar jnlp job js jse key ksh \
|
grp hlp hpj hta htt inf ini ins inx isp isu its jar jnlp job js jse key ksh \
|
||||||
|
@ -170,7 +170,7 @@ php-s pht phtml pif pl plg pm pod prf prg ps1 ps2 ps1xml ps2xml psc1 psc2 \
|
||||||
psd1 psm1 pssc pst py py3 pyc pyd pyi pyo pyw pywz pyz rb reg rgs scf scr \
|
psd1 psm1 pssc pst py py3 pyc pyd pyi pyo pyw pywz pyz rb reg rgs scf scr \
|
||||||
sct search-ms settingcontent-ms sh shb shs slk sys t tmp u3p url vb vbe vbp \
|
sct search-ms settingcontent-ms sh shb shs slk sys t tmp u3p url vb vbe vbp \
|
||||||
vbs vbscript vdx vsmacros vsd vsdm vsdx vss vssm vssx vst vstm vstx vsw vsx \
|
vbs vbscript vdx vsmacros vsd vsdm vsdx vss vssm vssx vst vstm vstx vsw vsx \
|
||||||
vtx website ws wsc wsf wsh xbap xll xnk xs");
|
vtx website ws wsc wsf wsh xbap xll xnk xs"_q;
|
||||||
#endif // !Q_OS_MAC && !Q_OS_UNIX
|
#endif // !Q_OS_MAC && !Q_OS_UNIX
|
||||||
const auto list = joined.split(' ');
|
const auto list = joined.split(' ');
|
||||||
return base::flat_set<QString>(list.begin(), list.end());
|
return base::flat_set<QString>(list.begin(), list.end());
|
||||||
|
|
|
@ -871,7 +871,7 @@ TextWithEntities MediaFile::notificationText() const {
|
||||||
if (_document->isVideoMessage()) {
|
if (_document->isVideoMessage()) {
|
||||||
return tr::lng_in_dlg_video_message(tr::now);
|
return tr::lng_in_dlg_video_message(tr::now);
|
||||||
} else if (_document->isAnimation()) {
|
} else if (_document->isAnimation()) {
|
||||||
return qsl("GIF");
|
return u"GIF"_q;
|
||||||
} else if (_document->isVideoFile()) {
|
} else if (_document->isVideoFile()) {
|
||||||
return tr::lng_in_dlg_video(tr::now);
|
return tr::lng_in_dlg_video(tr::now);
|
||||||
} else if (_document->isVoiceMessage()) {
|
} else if (_document->isVoiceMessage()) {
|
||||||
|
@ -928,7 +928,7 @@ TextForMimeData MediaFile::clipboardText() const {
|
||||||
if (_document->isVideoMessage()) {
|
if (_document->isVideoMessage()) {
|
||||||
return tr::lng_in_dlg_video_message(tr::now);
|
return tr::lng_in_dlg_video_message(tr::now);
|
||||||
}
|
}
|
||||||
return qsl("GIF");
|
return u"GIF"_q;
|
||||||
} else if (_document->isVideoFile()) {
|
} else if (_document->isVideoFile()) {
|
||||||
return tr::lng_in_dlg_video(tr::now);
|
return tr::lng_in_dlg_video(tr::now);
|
||||||
} else if (_document->isVoiceMessage()) {
|
} else if (_document->isVoiceMessage()) {
|
||||||
|
@ -1147,9 +1147,9 @@ QString MediaContact::pinnedTextSubstring() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
TextForMimeData MediaContact::clipboardText() const {
|
TextForMimeData MediaContact::clipboardText() const {
|
||||||
const auto text = qsl("[ ")
|
const auto text = u"[ "_q
|
||||||
+ tr::lng_in_dlg_contact(tr::now)
|
+ tr::lng_in_dlg_contact(tr::now)
|
||||||
+ qsl(" ]\n")
|
+ u" ]\n"_q
|
||||||
+ tr::lng_full_name(
|
+ tr::lng_full_name(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_first_name,
|
lt_first_name,
|
||||||
|
|
|
@ -650,14 +650,14 @@ void PeerData::fillNames() {
|
||||||
}
|
}
|
||||||
appendToIndex(user->username());
|
appendToIndex(user->username());
|
||||||
if (isSelf()) {
|
if (isSelf()) {
|
||||||
const auto english = qsl("Saved messages");
|
const auto english = u"Saved messages"_q;
|
||||||
const auto localized = tr::lng_saved_messages(tr::now);
|
const auto localized = tr::lng_saved_messages(tr::now);
|
||||||
appendToIndex(english);
|
appendToIndex(english);
|
||||||
if (localized != english) {
|
if (localized != english) {
|
||||||
appendToIndex(localized);
|
appendToIndex(localized);
|
||||||
}
|
}
|
||||||
} else if (isRepliesChat()) {
|
} else if (isRepliesChat()) {
|
||||||
const auto english = qsl("Replies");
|
const auto english = u"Replies"_q;
|
||||||
const auto localized = tr::lng_replies_messages(tr::now);
|
const auto localized = tr::lng_replies_messages(tr::now);
|
||||||
appendToIndex(english);
|
appendToIndex(english);
|
||||||
if (localized != english) {
|
if (localized != english) {
|
||||||
|
|
|
@ -20,16 +20,19 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
QString SiteNameFromUrl(const QString &url) {
|
QString SiteNameFromUrl(const QString &url) {
|
||||||
QUrl u(url);
|
const auto u = QUrl(url);
|
||||||
QString pretty = u.isValid() ? u.toDisplayString() : url;
|
QString pretty = u.isValid() ? u.toDisplayString() : url;
|
||||||
QRegularExpressionMatch m = QRegularExpression(qsl("^[a-zA-Z0-9]+://")).match(pretty);
|
const auto m = QRegularExpression(u"^[a-zA-Z0-9]+://"_q).match(pretty);
|
||||||
if (m.hasMatch()) pretty = pretty.mid(m.capturedLength());
|
if (m.hasMatch()) pretty = pretty.mid(m.capturedLength());
|
||||||
int32 slash = pretty.indexOf('/');
|
int32 slash = pretty.indexOf('/');
|
||||||
if (slash > 0) pretty = pretty.mid(0, slash);
|
if (slash > 0) pretty = pretty.mid(0, slash);
|
||||||
QStringList components = pretty.split('.', Qt::SkipEmptyParts);
|
QStringList components = pretty.split('.', Qt::SkipEmptyParts);
|
||||||
if (components.size() >= 2) {
|
if (components.size() >= 2) {
|
||||||
components = components.mid(components.size() - 2);
|
components = components.mid(components.size() - 2);
|
||||||
return components.at(0).at(0).toUpper() + components.at(0).mid(1) + '.' + components.at(1);
|
return components.at(0).at(0).toUpper()
|
||||||
|
+ components.at(0).mid(1)
|
||||||
|
+ '.'
|
||||||
|
+ components.at(1);
|
||||||
}
|
}
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -799,7 +799,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
|
||||||
const auto text = _searchResults.empty()
|
const auto text = _searchResults.empty()
|
||||||
? tr::lng_search_no_results(tr::now)
|
? tr::lng_search_no_results(tr::now)
|
||||||
: showUnreadInSearchResults
|
: showUnreadInSearchResults
|
||||||
? qsl("Search results")
|
? u"Search results"_q
|
||||||
: tr::lng_search_found_results(
|
: tr::lng_search_found_results(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_count,
|
lt_count,
|
||||||
|
|
|
@ -1771,7 +1771,7 @@ void Widget::dragEnterEvent(QDragEnterEvent *e) {
|
||||||
const auto data = e->mimeData();
|
const auto data = e->mimeData();
|
||||||
_dragInScroll = false;
|
_dragInScroll = false;
|
||||||
_dragForward = !controller()->adaptive().isOneColumn()
|
_dragForward = !controller()->adaptive().isOneColumn()
|
||||||
&& data->hasFormat(qsl("application/x-td-forward"));
|
&& data->hasFormat(u"application/x-td-forward"_q);
|
||||||
if (_dragForward) {
|
if (_dragForward) {
|
||||||
e->setDropAction(Qt::CopyAction);
|
e->setDropAction(Qt::CopyAction);
|
||||||
e->accept();
|
e->accept();
|
||||||
|
|
|
@ -792,7 +792,7 @@ void PaintUnreadBadge(QPainter &p, const QRect &rect, const UnreadBadgeStyle &st
|
||||||
const QString &unreadCount,
|
const QString &unreadCount,
|
||||||
int allowDigits) {
|
int allowDigits) {
|
||||||
return (allowDigits > 0) && (unreadCount.size() > allowDigits + 1)
|
return (allowDigits > 0) && (unreadCount.size() > allowDigits + 1)
|
||||||
? qsl("..") + unreadCount.mid(unreadCount.size() - allowDigits)
|
? u".."_q + unreadCount.mid(unreadCount.size() - allowDigits)
|
||||||
: unreadCount;
|
: unreadCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -332,23 +332,23 @@ QString ComputeDocumentName(
|
||||||
const auto pattern = patterns.isEmpty() ? QString() : patterns.front();
|
const auto pattern = patterns.isEmpty() ? QString() : patterns.front();
|
||||||
if (data.isVoiceMessage) {
|
if (data.isVoiceMessage) {
|
||||||
const auto isMP3 = hasMimeType(u"audio/mp3"_q);
|
const auto isMP3 = hasMimeType(u"audio/mp3"_q);
|
||||||
return qsl("audio_")
|
return u"audio_"_q
|
||||||
+ QString::number(++context.audios)
|
+ QString::number(++context.audios)
|
||||||
+ PrepareFileNameDatePart(date)
|
+ PrepareFileNameDatePart(date)
|
||||||
+ (isMP3 ? qsl(".mp3") : qsl(".ogg"));
|
+ (isMP3 ? u".mp3"_q : u".ogg"_q);
|
||||||
} else if (data.isVideoFile) {
|
} else if (data.isVideoFile) {
|
||||||
const auto extension = pattern.isEmpty()
|
const auto extension = pattern.isEmpty()
|
||||||
? qsl(".mov")
|
? u".mov"_q
|
||||||
: QString(pattern).replace('*', QString());
|
: QString(pattern).replace('*', QString());
|
||||||
return qsl("video_")
|
return u"video_"_q
|
||||||
+ QString::number(++context.videos)
|
+ QString::number(++context.videos)
|
||||||
+ PrepareFileNameDatePart(date)
|
+ PrepareFileNameDatePart(date)
|
||||||
+ extension;
|
+ extension;
|
||||||
} else {
|
} else {
|
||||||
const auto extension = pattern.isEmpty()
|
const auto extension = pattern.isEmpty()
|
||||||
? qsl(".unknown")
|
? u".unknown"_q
|
||||||
: QString(pattern).replace('*', QString());
|
: QString(pattern).replace('*', QString());
|
||||||
return qsl("file_")
|
return u"file_"_q
|
||||||
+ QString::number(++context.files)
|
+ QString::number(++context.files)
|
||||||
+ PrepareFileNameDatePart(date)
|
+ PrepareFileNameDatePart(date)
|
||||||
+ extension;
|
+ extension;
|
||||||
|
|
|
@ -378,7 +378,7 @@ void SettingsWidget::addLimitsLabel(
|
||||||
? rpl::single(langDayOfMonthFull(
|
? rpl::single(langDayOfMonthFull(
|
||||||
base::unixtime::parse(from).date()))
|
base::unixtime::parse(from).date()))
|
||||||
: tr::lng_export_beginning()
|
: tr::lng_export_beginning()
|
||||||
) | Ui::Text::ToLink(qsl("internal:edit_from"));
|
) | Ui::Text::ToLink(u"internal:edit_from"_q);
|
||||||
}) | rpl::flatten_latest();
|
}) | rpl::flatten_latest();
|
||||||
|
|
||||||
auto tillLink = value() | rpl::map([](const Settings &data) {
|
auto tillLink = value() | rpl::map([](const Settings &data) {
|
||||||
|
@ -389,7 +389,7 @@ void SettingsWidget::addLimitsLabel(
|
||||||
? rpl::single(langDayOfMonthFull(
|
? rpl::single(langDayOfMonthFull(
|
||||||
base::unixtime::parse(till).date()))
|
base::unixtime::parse(till).date()))
|
||||||
: tr::lng_export_end()
|
: tr::lng_export_end()
|
||||||
) | Ui::Text::ToLink(qsl("internal:edit_till"));
|
) | Ui::Text::ToLink(u"internal:edit_till"_q);
|
||||||
}) | rpl::flatten_latest();
|
}) | rpl::flatten_latest();
|
||||||
|
|
||||||
auto datesText = tr::lng_export_limits(
|
auto datesText = tr::lng_export_limits(
|
||||||
|
|
|
@ -1330,12 +1330,12 @@ void InnerWidget::savePhotoToFile(not_null<PhotoData*> photo) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto filter = qsl("JPEG Image (*.jpg);;") + FileDialog::AllFilesFilter();
|
auto filter = u"JPEG Image (*.jpg);;"_q + FileDialog::AllFilesFilter();
|
||||||
FileDialog::GetWritePath(
|
FileDialog::GetWritePath(
|
||||||
this,
|
this,
|
||||||
tr::lng_save_photo(tr::now),
|
tr::lng_save_photo(tr::now),
|
||||||
filter,
|
filter,
|
||||||
filedialogDefaultName(qsl("photo"), qsl(".jpg")),
|
filedialogDefaultName(u"photo"_q, u".jpg"_q),
|
||||||
crl::guard(this, [=](const QString &result) {
|
crl::guard(this, [=](const QString &result) {
|
||||||
if (!result.isEmpty()) {
|
if (!result.isEmpty()) {
|
||||||
media->saveToFile(result);
|
media->saveToFile(result);
|
||||||
|
@ -1885,7 +1885,7 @@ void InnerWidget::performDrag() {
|
||||||
// auto selectedState = getSelectionState();
|
// auto selectedState = getSelectionState();
|
||||||
// if (selectedState.count > 0 && selectedState.count == selectedState.canForwardCount) {
|
// if (selectedState.count > 0 && selectedState.count == selectedState.canForwardCount) {
|
||||||
// session().data().setMimeForwardIds(getSelectedItems());
|
// session().data().setMimeForwardIds(getSelectedItems());
|
||||||
// mimeData->setData(qsl("application/x-td-forward"), "1");
|
// mimeData->setData(u"application/x-td-forward"_q, "1");
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// _controller->window()->launchDrag(std::move(mimeData));
|
// _controller->window()->launchDrag(std::move(mimeData));
|
||||||
|
@ -1897,7 +1897,7 @@ void InnerWidget::performDrag() {
|
||||||
// pressedMedia = pressedItem->media();
|
// pressedMedia = pressedItem->media();
|
||||||
// if (_mouseCursorState == CursorState::Date
|
// if (_mouseCursorState == CursorState::Date
|
||||||
// || (pressedMedia && pressedMedia->dragItem())) {
|
// || (pressedMedia && pressedMedia->dragItem())) {
|
||||||
// forwardMimeType = qsl("application/x-td-forward");
|
// forwardMimeType = u"application/x-td-forward"_q;
|
||||||
// session().data().setMimeForwardIds(
|
// session().data().setMimeForwardIds(
|
||||||
// session().data().itemOrItsGroup(pressedItem->data()));
|
// session().data().itemOrItsGroup(pressedItem->data()));
|
||||||
// }
|
// }
|
||||||
|
@ -1906,7 +1906,7 @@ void InnerWidget::performDrag() {
|
||||||
// if ((pressedMedia = pressedLnkItem->media())) {
|
// if ((pressedMedia = pressedLnkItem->media())) {
|
||||||
// if (forwardMimeType.isEmpty()
|
// if (forwardMimeType.isEmpty()
|
||||||
// && pressedMedia->dragItemByHandler(pressedHandler)) {
|
// && pressedMedia->dragItemByHandler(pressedHandler)) {
|
||||||
// forwardMimeType = qsl("application/x-td-forward");
|
// forwardMimeType = u"application/x-td-forward"_q;
|
||||||
// session().data().setMimeForwardIds(
|
// session().data().setMimeForwardIds(
|
||||||
// { 1, pressedLnkItem->fullId() });
|
// { 1, pressedLnkItem->fullId() });
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -1707,7 +1707,7 @@ std::unique_ptr<QMimeData> HistoryInner::prepareDrag() {
|
||||||
auto selectedState = getSelectionState();
|
auto selectedState = getSelectionState();
|
||||||
if (selectedState.count > 0 && selectedState.count == selectedState.canForwardCount) {
|
if (selectedState.count > 0 && selectedState.count == selectedState.canForwardCount) {
|
||||||
session().data().setMimeForwardIds(getSelectedItems());
|
session().data().setMimeForwardIds(getSelectedItems());
|
||||||
mimeData->setData(qsl("application/x-td-forward"), "1");
|
mimeData->setData(u"application/x-td-forward"_q, "1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mimeData;
|
return mimeData;
|
||||||
|
@ -1732,7 +1732,7 @@ std::unique_ptr<QMimeData> HistoryInner::prepareDrag() {
|
||||||
}
|
}
|
||||||
session().data().setMimeForwardIds(std::move(forwardIds));
|
session().data().setMimeForwardIds(std::move(forwardIds));
|
||||||
auto result = std::make_unique<QMimeData>();
|
auto result = std::make_unique<QMimeData>();
|
||||||
result->setData(qsl("application/x-td-forward"), "1");
|
result->setData(u"application/x-td-forward"_q, "1");
|
||||||
if (const auto media = view->media()) {
|
if (const auto media = view->media()) {
|
||||||
if (const auto document = media->getDocument()) {
|
if (const auto document = media->getDocument()) {
|
||||||
const auto filepath = document->filepath(true);
|
const auto filepath = document->filepath(true);
|
||||||
|
@ -2628,14 +2628,12 @@ void HistoryInner::savePhotoToFile(not_null<PhotoData*> photo) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto filter = qsl("JPEG Image (*.jpg);;") + FileDialog::AllFilesFilter();
|
auto filter = u"JPEG Image (*.jpg);;"_q + FileDialog::AllFilesFilter();
|
||||||
FileDialog::GetWritePath(
|
FileDialog::GetWritePath(
|
||||||
this,
|
this,
|
||||||
tr::lng_save_photo(tr::now),
|
tr::lng_save_photo(tr::now),
|
||||||
filter,
|
filter,
|
||||||
filedialogDefaultName(
|
filedialogDefaultName(u"photo"_q, u".jpg"_q),
|
||||||
qsl("photo"),
|
|
||||||
qsl(".jpg")),
|
|
||||||
crl::guard(this, [=](const QString &result) {
|
crl::guard(this, [=](const QString &result) {
|
||||||
if (!result.isEmpty()) {
|
if (!result.isEmpty()) {
|
||||||
media->saveToFile(result);
|
media->saveToFile(result);
|
||||||
|
|
|
@ -78,7 +78,7 @@ not_null<HistoryItem*> CreateUnsupportedMessage(
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
PeerId from) {
|
PeerId from) {
|
||||||
const auto siteLink = qsl("https://desktop.telegram.org");
|
const auto siteLink = u"https://desktop.telegram.org"_q;
|
||||||
auto text = TextWithEntities{
|
auto text = TextWithEntities{
|
||||||
tr::lng_message_unsupported(tr::now, lt_link, siteLink)
|
tr::lng_message_unsupported(tr::now, lt_link, siteLink)
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,5 +34,9 @@ void LocationClickHandler::setup() {
|
||||||
|
|
||||||
QString LocationClickHandler::Url(const Data::LocationPoint &point) {
|
QString LocationClickHandler::Url(const Data::LocationPoint &point) {
|
||||||
const auto latlon = point.latAsString() + ',' + point.lonAsString();
|
const auto latlon = point.latAsString() + ',' + point.lonAsString();
|
||||||
return qsl("https://maps.google.com/maps?q=") + latlon + qsl("&ll=") + latlon + qsl("&z=16");
|
return u"https://maps.google.com/maps?q="_q
|
||||||
|
+ latlon
|
||||||
|
+ u"&ll="_q
|
||||||
|
+ latlon
|
||||||
|
+ u"&z=16"_q;
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,7 +138,7 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
|
||||||
lt_from,
|
lt_from,
|
||||||
fromLinkText(), // Link 1.
|
fromLinkText(), // Link 1.
|
||||||
lt_user,
|
lt_user,
|
||||||
{ .text = qsl("somebody") },
|
{ .text = u"somebody"_q },
|
||||||
Ui::Text::WithEntities);
|
Ui::Text::WithEntities);
|
||||||
} else {
|
} else {
|
||||||
result.links.push_back(fromLink());
|
result.links.push_back(fromLink());
|
||||||
|
@ -928,7 +928,7 @@ HistoryService::PreparedText HistoryService::prepareInvitedToCallText(
|
||||||
lt_from,
|
lt_from,
|
||||||
fromLinkText(), // Link 1.
|
fromLinkText(), // Link 1.
|
||||||
lt_user,
|
lt_user,
|
||||||
{ .text = qsl("somebody") },
|
{ .text = u"somebody"_q },
|
||||||
lt_chat,
|
lt_chat,
|
||||||
chatText,
|
chatText,
|
||||||
Ui::Text::WithEntities);
|
Ui::Text::WithEntities);
|
||||||
|
|
|
@ -4273,7 +4273,7 @@ bool HistoryWidget::insertBotCommand(const QString &cmd) {
|
||||||
if (!insertingInlineBot) {
|
if (!insertingInlineBot) {
|
||||||
auto &textWithTags = _field->getTextWithTags();
|
auto &textWithTags = _field->getTextWithTags();
|
||||||
TextWithTags textWithTagsToSet;
|
TextWithTags textWithTagsToSet;
|
||||||
QRegularExpressionMatch m = QRegularExpression(qsl("^/[A-Za-z_0-9]{0,64}(@[A-Za-z_0-9]{0,32})?(\\s|$)")).match(textWithTags.text);
|
const auto m = QRegularExpression(u"^/[A-Za-z_0-9]{0,64}(@[A-Za-z_0-9]{0,32})?(\\s|$)"_q).match(textWithTags.text);
|
||||||
if (m.hasMatch()) {
|
if (m.hasMatch()) {
|
||||||
textWithTagsToSet = _field->getTextWithTagsPart(m.capturedLength());
|
textWithTagsToSet = _field->getTextWithTagsPart(m.capturedLength());
|
||||||
} else {
|
} else {
|
||||||
|
@ -4631,7 +4631,7 @@ void HistoryWidget::toggleKeyboard(bool manual) {
|
||||||
|
|
||||||
void HistoryWidget::startBotCommand() {
|
void HistoryWidget::startBotCommand() {
|
||||||
setFieldText(
|
setFieldText(
|
||||||
{ qsl("/"), TextWithTags::Tags() },
|
{ u"/"_q, TextWithTags::Tags() },
|
||||||
0,
|
0,
|
||||||
Ui::InputField::HistoryAction::NewEntry);
|
Ui::InputField::HistoryAction::NewEntry);
|
||||||
}
|
}
|
||||||
|
@ -7610,7 +7610,7 @@ void HistoryWidget::paintEditHeader(Painter &p, const QRect &rect, int left, int
|
||||||
auto timeSinceMessage = ItemDateTime(_replyEditMsg).msecsTo(QDateTime::currentDateTime());
|
auto timeSinceMessage = ItemDateTime(_replyEditMsg).msecsTo(QDateTime::currentDateTime());
|
||||||
auto editTimeLeft = (session().serverConfig().editTimeLimit * 1000LL) - timeSinceMessage;
|
auto editTimeLeft = (session().serverConfig().editTimeLimit * 1000LL) - timeSinceMessage;
|
||||||
if (editTimeLeft < 2) {
|
if (editTimeLeft < 2) {
|
||||||
editTimeLeftText = qsl("0:00");
|
editTimeLeftText = u"0:00"_q;
|
||||||
} else if (editTimeLeft > kDisplayEditTimeWarningMs) {
|
} else if (editTimeLeft > kDisplayEditTimeWarningMs) {
|
||||||
updateIn = static_cast<int>(qMin(editTimeLeft - kDisplayEditTimeWarningMs, qint64(kFullDayInMs)));
|
updateIn = static_cast<int>(qMin(editTimeLeft - kDisplayEditTimeWarningMs, qint64(kFullDayInMs)));
|
||||||
} else {
|
} else {
|
||||||
|
@ -7621,7 +7621,7 @@ void HistoryWidget::paintEditHeader(Painter &p, const QRect &rect, int left, int
|
||||||
++updateIn;
|
++updateIn;
|
||||||
|
|
||||||
editTimeLeft = (editTimeLeft - 1) / 1000; // seconds
|
editTimeLeft = (editTimeLeft - 1) / 1000; // seconds
|
||||||
editTimeLeftText = qsl("%1:%2").arg(editTimeLeft / 60).arg(editTimeLeft % 60, 2, 10, QChar('0'));
|
editTimeLeftText = u"%1:%2"_q.arg(editTimeLeft / 60).arg(editTimeLeft % 60, 2, 10, QChar('0'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restart timer only if we are sure that we've painted the whole timer.
|
// Restart timer only if we are sure that we've painted the whole timer.
|
||||||
|
|
|
@ -465,7 +465,7 @@ void BottomInfo::layoutDateText() {
|
||||||
? (tr::lng_edited(tr::now) + ' ')
|
? (tr::lng_edited(tr::now) + ' ')
|
||||||
: QString();
|
: QString();
|
||||||
const auto author = _data.author;
|
const auto author = _data.author;
|
||||||
const auto prefix = !author.isEmpty() ? qsl(", ") : QString();
|
const auto prefix = !author.isEmpty() ? u", "_q : QString();
|
||||||
const auto date = edited + QLocale().toString(_data.date, cTimeFormat());
|
const auto date = edited + QLocale().toString(_data.date, cTimeFormat());
|
||||||
const auto afterAuthor = prefix + date;
|
const auto afterAuthor = prefix + date;
|
||||||
const auto afterAuthorWidth = st::msgDateFont->width(afterAuthor);
|
const auto afterAuthorWidth = st::msgDateFont->width(afterAuthor);
|
||||||
|
|
|
@ -110,8 +110,8 @@ void SavePhotoToFile(not_null<PhotoData*> photo) {
|
||||||
FileDialog::GetWritePath(
|
FileDialog::GetWritePath(
|
||||||
Core::App().getFileDialogParent(),
|
Core::App().getFileDialogParent(),
|
||||||
tr::lng_save_photo(tr::now),
|
tr::lng_save_photo(tr::now),
|
||||||
qsl("JPEG Image (*.jpg);;") + FileDialog::AllFilesFilter(),
|
u"JPEG Image (*.jpg);;"_q + FileDialog::AllFilesFilter(),
|
||||||
filedialogDefaultName(qsl("photo"), qsl(".jpg")),
|
filedialogDefaultName(u"photo"_q, u".jpg"_q),
|
||||||
crl::guard(&photo->session(), [=](const QString &result) {
|
crl::guard(&photo->session(), [=](const QString &result) {
|
||||||
if (!result.isEmpty()) {
|
if (!result.isEmpty()) {
|
||||||
media->saveToFile(result);
|
media->saveToFile(result);
|
||||||
|
|
|
@ -3559,7 +3559,7 @@ std::unique_ptr<QMimeData> ListWidget::prepareDrag() {
|
||||||
: MessageIdsList();
|
: MessageIdsList();
|
||||||
if (!items.empty()) {
|
if (!items.empty()) {
|
||||||
session().data().setMimeForwardIds(std::move(items));
|
session().data().setMimeForwardIds(std::move(items));
|
||||||
mimeData->setData(qsl("application/x-td-forward"), "1");
|
mimeData->setData(u"application/x-td-forward"_q, "1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mimeData;
|
return mimeData;
|
||||||
|
@ -3589,7 +3589,7 @@ std::unique_ptr<QMimeData> ListWidget::prepareDrag() {
|
||||||
}
|
}
|
||||||
session().data().setMimeForwardIds(std::move(forwardIds));
|
session().data().setMimeForwardIds(std::move(forwardIds));
|
||||||
auto result = std::make_unique<QMimeData>();
|
auto result = std::make_unique<QMimeData>();
|
||||||
result->setData(qsl("application/x-td-forward"), "1");
|
result->setData(u"application/x-td-forward"_q, "1");
|
||||||
if (const auto media = pressedView->media()) {
|
if (const auto media = pressedView->media()) {
|
||||||
if (const auto document = media->getDocument()) {
|
if (const auto document = media->getDocument()) {
|
||||||
const auto filepath = document->filepath(true);
|
const auto filepath = document->filepath(true);
|
||||||
|
|
|
@ -1402,7 +1402,7 @@ void TopBarWidget::updateUnreadBadge() {
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
return (counter > 999)
|
return (counter > 999)
|
||||||
? qsl("..%1").arg(counter % 100, 2, 10, QChar('0'))
|
? u"..%1"_q.arg(counter % 100, 2, 10, QChar('0'))
|
||||||
: QString::number(counter);
|
: QString::number(counter);
|
||||||
}();
|
}();
|
||||||
_unreadBadge->setText(text, !muted);
|
_unreadBadge->setText(text, !muted);
|
||||||
|
|
|
@ -75,7 +75,7 @@ void File::setStatusSize(
|
||||||
if (_statusSize == Ui::FileStatusSizeReady) {
|
if (_statusSize == Ui::FileStatusSizeReady) {
|
||||||
_statusText = (duration >= 0) ? Ui::FormatDurationAndSizeText(duration, fullSize) : (duration < -1 ? Ui::FormatGifAndSizeText(fullSize) : Ui::FormatSizeText(fullSize));
|
_statusText = (duration >= 0) ? Ui::FormatDurationAndSizeText(duration, fullSize) : (duration < -1 ? Ui::FormatGifAndSizeText(fullSize) : Ui::FormatSizeText(fullSize));
|
||||||
} else if (_statusSize == Ui::FileStatusSizeLoaded) {
|
} else if (_statusSize == Ui::FileStatusSizeLoaded) {
|
||||||
_statusText = (duration >= 0) ? Ui::FormatDurationText(duration) : (duration < -1 ? qsl("GIF") : Ui::FormatSizeText(fullSize));
|
_statusText = (duration >= 0) ? Ui::FormatDurationText(duration) : (duration < -1 ? u"GIF"_q : Ui::FormatSizeText(fullSize));
|
||||||
} else if (_statusSize == Ui::FileStatusSizeFailed) {
|
} else if (_statusSize == Ui::FileStatusSizeFailed) {
|
||||||
_statusText = tr::lng_attach_failed(tr::now);
|
_statusText = tr::lng_attach_failed(tr::now);
|
||||||
} else if (_statusSize >= 0) {
|
} else if (_statusSize >= 0) {
|
||||||
|
|
|
@ -1645,7 +1645,7 @@ void ListWidget::performDrag() {
|
||||||
// auto selectedState = getSelectionState();
|
// auto selectedState = getSelectionState();
|
||||||
// if (selectedState.count > 0 && selectedState.count == selectedState.canForwardCount) {
|
// if (selectedState.count > 0 && selectedState.count == selectedState.canForwardCount) {
|
||||||
// session().data().setMimeForwardIds(collectSelectedIds());
|
// session().data().setMimeForwardIds(collectSelectedIds());
|
||||||
// mimeData->setData(qsl("application/x-td-forward"), "1");
|
// mimeData->setData(u"application/x-td-forward"_q, "1");
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// _controller->parentController()->window()->launchDrag(std::move(mimeData));
|
// _controller->parentController()->window()->launchDrag(std::move(mimeData));
|
||||||
|
@ -1657,14 +1657,14 @@ void ListWidget::performDrag() {
|
||||||
// pressedMedia = pressedItem->getMedia();
|
// pressedMedia = pressedItem->getMedia();
|
||||||
// if (_mouseCursorState == CursorState::Date || (pressedMedia && pressedMedia->dragItem())) {
|
// if (_mouseCursorState == CursorState::Date || (pressedMedia && pressedMedia->dragItem())) {
|
||||||
// session().data().setMimeForwardIds(session().data().itemOrItsGroup(pressedItem));
|
// session().data().setMimeForwardIds(session().data().itemOrItsGroup(pressedItem));
|
||||||
// forwardMimeType = qsl("application/x-td-forward");
|
// forwardMimeType = u"application/x-td-forward"_q;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// if (auto pressedLnkItem = App::pressedLinkItem()) {
|
// if (auto pressedLnkItem = App::pressedLinkItem()) {
|
||||||
// if ((pressedMedia = pressedLnkItem->getMedia())) {
|
// if ((pressedMedia = pressedLnkItem->getMedia())) {
|
||||||
// if (forwardMimeType.isEmpty() && pressedMedia->dragItemByHandler(pressedHandler)) {
|
// if (forwardMimeType.isEmpty() && pressedMedia->dragItemByHandler(pressedHandler)) {
|
||||||
// session().data().setMimeForwardIds({ 1, pressedLnkItem->fullId() });
|
// session().data().setMimeForwardIds({ 1, pressedLnkItem->fullId() });
|
||||||
// forwardMimeType = qsl("application/x-td-forward");
|
// forwardMimeType = u"application/x-td-forward"_q;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -853,10 +853,10 @@ void ActionsFiller::addBotCommandActions(not_null<UserData*> user) {
|
||||||
};
|
};
|
||||||
addBotCommand(
|
addBotCommand(
|
||||||
tr::lng_profile_bot_help(),
|
tr::lng_profile_bot_help(),
|
||||||
qsl("help"),
|
u"help"_q,
|
||||||
&st::infoIconInformation);
|
&st::infoIconInformation);
|
||||||
addBotCommand(tr::lng_profile_bot_settings(), qsl("settings"));
|
addBotCommand(tr::lng_profile_bot_settings(), u"settings"_q);
|
||||||
addBotCommand(tr::lng_profile_bot_privacy(), qsl("privacy"));
|
addBotCommand(tr::lng_profile_bot_privacy(), u"privacy"_q);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionsFiller::addReportAction() {
|
void ActionsFiller::addReportAction() {
|
||||||
|
|
|
@ -1154,7 +1154,7 @@ void File::setStatusSize(
|
||||||
if (_statusSize == Ui::FileStatusSizeReady) {
|
if (_statusSize == Ui::FileStatusSizeReady) {
|
||||||
_statusText = (duration >= 0) ? Ui::FormatDurationAndSizeText(duration, fullSize) : (duration < -1 ? Ui::FormatGifAndSizeText(fullSize) : Ui::FormatSizeText(fullSize));
|
_statusText = (duration >= 0) ? Ui::FormatDurationAndSizeText(duration, fullSize) : (duration < -1 ? Ui::FormatGifAndSizeText(fullSize) : Ui::FormatSizeText(fullSize));
|
||||||
} else if (_statusSize == Ui::FileStatusSizeLoaded) {
|
} else if (_statusSize == Ui::FileStatusSizeLoaded) {
|
||||||
_statusText = (duration >= 0) ? Ui::FormatDurationText(duration) : (duration < -1 ? qsl("GIF") : Ui::FormatSizeText(fullSize));
|
_statusText = (duration >= 0) ? Ui::FormatDurationText(duration) : (duration < -1 ? u"GIF"_q : Ui::FormatSizeText(fullSize));
|
||||||
} else if (_statusSize == Ui::FileStatusSizeFailed) {
|
} else if (_statusSize == Ui::FileStatusSizeFailed) {
|
||||||
_statusText = tr::lng_attach_failed(tr::now);
|
_statusText = tr::lng_attach_failed(tr::now);
|
||||||
} else if (_statusSize >= 0) {
|
} else if (_statusSize >= 0) {
|
||||||
|
|
|
@ -507,10 +507,10 @@ MTPVector<MTPDocumentAttribute> Result::adjustAttributes(
|
||||||
const auto p = Core::MimeTypeForName(mime).globPatterns();
|
const auto p = Core::MimeTypeForName(mime).globPatterns();
|
||||||
auto pattern = p.isEmpty() ? QString() : p.front();
|
auto pattern = p.isEmpty() ? QString() : p.front();
|
||||||
const auto extension = pattern.isEmpty()
|
const auto extension = pattern.isEmpty()
|
||||||
? qsl(".unknown")
|
? u".unknown"_q
|
||||||
: pattern.replace('*', QString());
|
: pattern.replace('*', QString());
|
||||||
const auto filename = filedialogDefaultName(
|
const auto filename = filedialogDefaultName(
|
||||||
qsl("inline"),
|
u"inline"_q,
|
||||||
extension,
|
extension,
|
||||||
QString(),
|
QString(),
|
||||||
true);
|
true);
|
||||||
|
|
|
@ -145,18 +145,18 @@ void CodeWidget::updateCallText() {
|
||||||
return tr::lng_code_call(
|
return tr::lng_code_call(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_minutes,
|
lt_minutes,
|
||||||
qsl("%1:%2"
|
(u"%1:%2"_q
|
||||||
).arg(_callTimeout / 3600
|
).arg(_callTimeout / 3600
|
||||||
).arg((_callTimeout / 60) % 60, 2, 10, QChar('0')),
|
).arg((_callTimeout / 60) % 60, 2, 10, QChar('0')),
|
||||||
lt_seconds,
|
lt_seconds,
|
||||||
qsl("%1").arg(_callTimeout % 60, 2, 10, QChar('0')));
|
u"%1"_q.arg(_callTimeout % 60, 2, 10, QChar('0')));
|
||||||
} else {
|
} else {
|
||||||
return tr::lng_code_call(
|
return tr::lng_code_call(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_minutes,
|
lt_minutes,
|
||||||
QString::number(_callTimeout / 60),
|
QString::number(_callTimeout / 60),
|
||||||
lt_seconds,
|
lt_seconds,
|
||||||
qsl("%1").arg(_callTimeout % 60, 2, 10, QChar('0')));
|
u"%1"_q.arg(_callTimeout % 60, 2, 10, QChar('0')));
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case CallStatus::Calling:
|
case CallStatus::Calling:
|
||||||
|
|
|
@ -86,7 +86,7 @@ PhoneWidget::PhoneWidget(
|
||||||
setupQrLogin();
|
setupQrLogin();
|
||||||
|
|
||||||
if (!_country->chooseCountry(getData()->country)) {
|
if (!_country->chooseCountry(getData()->country)) {
|
||||||
_country->chooseCountry(qsl("US"));
|
_country->chooseCountry(u"US"_q);
|
||||||
}
|
}
|
||||||
_changed = false;
|
_changed = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ StartWidget::StartWidget(
|
||||||
not_null<Data*> data)
|
not_null<Data*> data)
|
||||||
: Step(parent, account, data, true) {
|
: Step(parent, account, data, true) {
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
setTitleText(rpl::single(qsl("Telegram Desktop")));
|
setTitleText(rpl::single(u"Telegram Desktop"_q));
|
||||||
setDescriptionText(tr::lng_intro_about());
|
setDescriptionText(tr::lng_intro_about());
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
namespace Lang {
|
namespace Lang {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
const auto kSerializeVersionTag = qsl("#new");
|
const auto kSerializeVersionTag = u"#new"_q;
|
||||||
constexpr auto kSerializeVersion = 1;
|
constexpr auto kSerializeVersion = 1;
|
||||||
constexpr auto kDefaultLanguage = "en"_cs;
|
constexpr auto kDefaultLanguage = "en"_cs;
|
||||||
constexpr auto kCloudLangPackName = "tdesktop"_cs;
|
constexpr auto kCloudLangPackName = "tdesktop"_cs;
|
||||||
|
@ -231,11 +231,11 @@ QString CustomLanguageId() {
|
||||||
|
|
||||||
Language DefaultLanguage() {
|
Language DefaultLanguage() {
|
||||||
return Language{
|
return Language{
|
||||||
qsl("en"),
|
u"en"_q,
|
||||||
QString(),
|
QString(),
|
||||||
QString(),
|
QString(),
|
||||||
qsl("English"),
|
u"English"_q,
|
||||||
qsl("English"),
|
u"English"_q,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ DocumentGenericPreview DocumentGenericPreview::Create(
|
||||||
? (document->filename().isEmpty()
|
? (document->filename().isEmpty()
|
||||||
? (document->sticker()
|
? (document->sticker()
|
||||||
? tr::lng_in_dlg_sticker(tr::now)
|
? tr::lng_in_dlg_sticker(tr::now)
|
||||||
: qsl("Unknown File"))
|
: u"Unknown File"_q)
|
||||||
: document->filename())
|
: document->filename())
|
||||||
: tr::lng_message_empty(tr::now)).toLower();
|
: tr::lng_message_empty(tr::now)).toLower();
|
||||||
auto lastDot = name.lastIndexOf('.');
|
auto lastDot = name.lastIndexOf('.');
|
||||||
|
|
|
@ -80,7 +80,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool openMain() {
|
bool openMain() {
|
||||||
return reopen(LogDataMain, 0, qsl("start"));
|
return reopen(LogDataMain, 0, u"start"_q);
|
||||||
}
|
}
|
||||||
|
|
||||||
void closeMain() {
|
void closeMain() {
|
||||||
|
@ -181,7 +181,7 @@ private:
|
||||||
int32 oldest = -1; // find not existing log_startX.txt or pick the oldest one (by lastModified)
|
int32 oldest = -1; // find not existing log_startX.txt or pick the oldest one (by lastModified)
|
||||||
QDateTime oldestLastModified;
|
QDateTime oldestLastModified;
|
||||||
for (int32 i = 0; i < 10; ++i) {
|
for (int32 i = 0; i < 10; ++i) {
|
||||||
QString trying = _logsFilePath(type, qsl("_start%1").arg(i));
|
QString trying = _logsFilePath(type, u"_start%1"_q.arg(i));
|
||||||
files[type]->setFileName(trying);
|
files[type]->setFileName(trying);
|
||||||
if (!files[type]->exists()) {
|
if (!files[type]->exists()) {
|
||||||
LogsStartIndexChosen = i;
|
LogsStartIndexChosen = i;
|
||||||
|
@ -195,7 +195,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
files[type]->setFileName(_logsFilePath(type, qsl("_start%1").arg(oldest)));
|
files[type]->setFileName(_logsFilePath(type, u"_start%1"_q.arg(oldest)));
|
||||||
LogsStartIndexChosen = oldest;
|
LogsStartIndexChosen = oldest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -437,7 +437,7 @@ void start(not_null<Core::Launcher*> launcher) {
|
||||||
|
|
||||||
if (!LogsData) {
|
if (!LogsData) {
|
||||||
LOG(("FATAL: Could not open '%1' for writing log!"
|
LOG(("FATAL: Could not open '%1' for writing log!"
|
||||||
).arg(_logsFilePath(LogDataMain, qsl("_startXX"))));
|
).arg(_logsFilePath(LogDataMain, u"_startXX"_q)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -634,7 +634,7 @@ bool MainWidget::filesOrForwardDrop(
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (data->hasFormat(qsl("application/x-td-forward"))) {
|
if (data->hasFormat(u"application/x-td-forward"_q)) {
|
||||||
auto draft = Data::ForwardDraft{
|
auto draft = Data::ForwardDraft{
|
||||||
.ids = session().data().takeMimeForwardIds(),
|
.ids = session().data().takeMimeForwardIds(),
|
||||||
};
|
};
|
||||||
|
|
|
@ -55,7 +55,7 @@ SystemMediaControlsManager::SystemMediaControlsManager(
|
||||||
|
|
||||||
// Flatpak provides default permission to MPRIS, but not snap
|
// Flatpak provides default permission to MPRIS, but not snap
|
||||||
if (!KSandbox::isFlatpak()) {
|
if (!KSandbox::isFlatpak()) {
|
||||||
_controls->setServiceName(qsl("tdesktop"));
|
_controls->setServiceName(u"tdesktop"_q);
|
||||||
}
|
}
|
||||||
_controls->setApplicationName(AppName.utf16());
|
_controls->setApplicationName(AppName.utf16());
|
||||||
const auto inited = _controls->init(controller->widget());
|
const auto inited = _controls->init(controller->widget());
|
||||||
|
|
|
@ -314,7 +314,7 @@ OverlayWidget::OverlayWidget()
|
||||||
? Core::App().settings().videoVolume()
|
? Core::App().settings().videoVolume()
|
||||||
: Core::Settings::kDefaultVolume;
|
: Core::Settings::kDefaultVolume;
|
||||||
|
|
||||||
_widget->setWindowTitle(qsl("Media viewer"));
|
_widget->setWindowTitle(u"Media viewer"_q);
|
||||||
|
|
||||||
const auto text = tr::lng_mediaview_saved_to(
|
const auto text = tr::lng_mediaview_saved_to(
|
||||||
tr::now,
|
tr::now,
|
||||||
|
@ -1617,20 +1617,20 @@ void OverlayWidget::saveAs() {
|
||||||
QStringList p = mimeType.globPatterns();
|
QStringList p = mimeType.globPatterns();
|
||||||
QString pattern = p.isEmpty() ? QString() : p.front();
|
QString pattern = p.isEmpty() ? QString() : p.front();
|
||||||
if (name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
name = pattern.isEmpty() ? qsl(".unknown") : pattern.replace('*', QString());
|
name = pattern.isEmpty() ? u".unknown"_q : pattern.replace('*', QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pattern.isEmpty()) {
|
if (pattern.isEmpty()) {
|
||||||
filter = QString();
|
filter = QString();
|
||||||
} else {
|
} else {
|
||||||
filter = mimeType.filterString() + qsl(";;") + FileDialog::AllFilesFilter();
|
filter = mimeType.filterString() + u";;"_q + FileDialog::AllFilesFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
file = FileNameForSave(
|
file = FileNameForSave(
|
||||||
_session,
|
_session,
|
||||||
tr::lng_save_file(tr::now),
|
tr::lng_save_file(tr::now),
|
||||||
filter,
|
filter,
|
||||||
qsl("doc"),
|
u"doc"_q,
|
||||||
name,
|
name,
|
||||||
true,
|
true,
|
||||||
alreadyDir);
|
alreadyDir);
|
||||||
|
@ -1667,14 +1667,14 @@ void OverlayWidget::saveAs() {
|
||||||
constexpr auto large = Data::PhotoSize::Large;
|
constexpr auto large = Data::PhotoSize::Large;
|
||||||
if (const auto bytes = _photoMedia->videoContent(large); !bytes.isEmpty()) {
|
if (const auto bytes = _photoMedia->videoContent(large); !bytes.isEmpty()) {
|
||||||
const auto photo = _photo;
|
const auto photo = _photo;
|
||||||
auto filter = qsl("Video Files (*.mp4);;") + FileDialog::AllFilesFilter();
|
auto filter = u"Video Files (*.mp4);;"_q + FileDialog::AllFilesFilter();
|
||||||
FileDialog::GetWritePath(
|
FileDialog::GetWritePath(
|
||||||
_widget.get(),
|
_widget.get(),
|
||||||
tr::lng_save_video(tr::now),
|
tr::lng_save_video(tr::now),
|
||||||
filter,
|
filter,
|
||||||
filedialogDefaultName(
|
filedialogDefaultName(
|
||||||
qsl("photo"),
|
u"photo"_q,
|
||||||
qsl(".mp4"),
|
u".mp4"_q,
|
||||||
QString(),
|
QString(),
|
||||||
false,
|
false,
|
||||||
_photo->date),
|
_photo->date),
|
||||||
|
@ -1697,15 +1697,15 @@ void OverlayWidget::saveAs() {
|
||||||
|
|
||||||
const auto media = _photoMedia;
|
const auto media = _photoMedia;
|
||||||
const auto photo = _photo;
|
const auto photo = _photo;
|
||||||
const auto filter = qsl("JPEG Image (*.jpg);;")
|
const auto filter = u"JPEG Image (*.jpg);;"_q
|
||||||
+ FileDialog::AllFilesFilter();
|
+ FileDialog::AllFilesFilter();
|
||||||
FileDialog::GetWritePath(
|
FileDialog::GetWritePath(
|
||||||
_widget.get(),
|
_widget.get(),
|
||||||
tr::lng_save_photo(tr::now),
|
tr::lng_save_photo(tr::now),
|
||||||
filter,
|
filter,
|
||||||
filedialogDefaultName(
|
filedialogDefaultName(
|
||||||
qsl("photo"),
|
u"photo"_q,
|
||||||
qsl(".jpg"),
|
u".jpg"_q,
|
||||||
QString(),
|
QString(),
|
||||||
false,
|
false,
|
||||||
_photo->date),
|
_photo->date),
|
||||||
|
@ -1745,7 +1745,7 @@ void OverlayWidget::downloadMedia() {
|
||||||
const auto session = _photo ? &_photo->session() : &_document->session();
|
const auto session = _photo ? &_photo->session() : &_document->session();
|
||||||
if (Core::App().settings().downloadPath().isEmpty()) {
|
if (Core::App().settings().downloadPath().isEmpty()) {
|
||||||
path = File::DefaultDownloadPath(session);
|
path = File::DefaultDownloadPath(session);
|
||||||
} else if (Core::App().settings().downloadPath() == qsl("tmp")) {
|
} else if (Core::App().settings().downloadPath() == u"tmp"_q) {
|
||||||
path = session->local().tempDirectory();
|
path = session->local().tempDirectory();
|
||||||
} else {
|
} else {
|
||||||
path = Core::App().settings().downloadPath();
|
path = Core::App().settings().downloadPath();
|
||||||
|
@ -1792,7 +1792,7 @@ void OverlayWidget::downloadMedia() {
|
||||||
if (!QDir().exists(path)) {
|
if (!QDir().exists(path)) {
|
||||||
QDir().mkpath(path);
|
QDir().mkpath(path);
|
||||||
}
|
}
|
||||||
toName = filedialogDefaultName(qsl("photo"), qsl(".mp4"), path);
|
toName = filedialogDefaultName(u"photo"_q, u".mp4"_q, path);
|
||||||
if (!_photoMedia->saveToFile(toName)) {
|
if (!_photoMedia->saveToFile(toName)) {
|
||||||
toName = QString();
|
toName = QString();
|
||||||
}
|
}
|
||||||
|
@ -1808,7 +1808,7 @@ void OverlayWidget::downloadMedia() {
|
||||||
if (!QDir().exists(path)) {
|
if (!QDir().exists(path)) {
|
||||||
QDir().mkpath(path);
|
QDir().mkpath(path);
|
||||||
}
|
}
|
||||||
toName = filedialogDefaultName(qsl("photo"), qsl(".jpg"), path);
|
toName = filedialogDefaultName(u"photo"_q, u".jpg"_q, path);
|
||||||
const auto saved = _photoMedia->saveToFile(toName);
|
const auto saved = _photoMedia->saveToFile(toName);
|
||||||
if (!saved) {
|
if (!saved) {
|
||||||
toName = QString();
|
toName = QString();
|
||||||
|
@ -2676,7 +2676,7 @@ void OverlayWidget::displayDocument(
|
||||||
_docName = (_document->type == StickerDocument)
|
_docName = (_document->type == StickerDocument)
|
||||||
? tr::lng_in_dlg_sticker(tr::now)
|
? tr::lng_in_dlg_sticker(tr::now)
|
||||||
: (_document->type == AnimatedDocument
|
: (_document->type == AnimatedDocument
|
||||||
? qsl("GIF")
|
? u"GIF"_q
|
||||||
: (_document->filename().isEmpty()
|
: (_document->filename().isEmpty()
|
||||||
? tr::lng_mediaview_doc_image(tr::now)
|
? tr::lng_mediaview_doc_image(tr::now)
|
||||||
: _document->filename()));
|
: _document->filename()));
|
||||||
|
|
|
@ -40,8 +40,12 @@ void HttpConnection::sendData(mtpBuffer &&buffer) {
|
||||||
int32 requestSize = (buffer.size() - 2) * sizeof(mtpPrime);
|
int32 requestSize = (buffer.size() - 2) * sizeof(mtpPrime);
|
||||||
|
|
||||||
QNetworkRequest request(url());
|
QNetworkRequest request(url());
|
||||||
request.setHeader(QNetworkRequest::ContentLengthHeader, QVariant(requestSize));
|
request.setHeader(
|
||||||
request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(qsl("application/x-www-form-urlencoded")));
|
QNetworkRequest::ContentLengthHeader,
|
||||||
|
QVariant(requestSize));
|
||||||
|
request.setHeader(
|
||||||
|
QNetworkRequest::ContentTypeHeader,
|
||||||
|
QVariant(u"application/x-www-form-urlencoded"_q));
|
||||||
|
|
||||||
CONNECTION_LOG_INFO(u"Sending %1 len request."_q.arg(requestSize));
|
CONNECTION_LOG_INFO(u"Sending %1 len request."_q.arg(requestSize));
|
||||||
_requests.insert(_manager.post(request, QByteArray((const char*)(&buffer[2]), requestSize)));
|
_requests.insert(_manager.post(request, QByteArray((const char*)(&buffer[2]), requestSize)));
|
||||||
|
@ -255,27 +259,27 @@ QString HttpConnection::transport() const {
|
||||||
if (!isConnected()) {
|
if (!isConnected()) {
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
auto result = qsl("HTTP");
|
auto result = u"HTTP"_q;
|
||||||
if (qthelp::is_ipv6(_address)) {
|
if (qthelp::is_ipv6(_address)) {
|
||||||
result += qsl("/IPv6");
|
result += u"/IPv6"_q;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString HttpConnection::tag() const {
|
QString HttpConnection::tag() const {
|
||||||
auto result = qsl("HTTP");
|
auto result = u"HTTP"_q;
|
||||||
if (qthelp::is_ipv6(_address)) {
|
if (qthelp::is_ipv6(_address)) {
|
||||||
result += qsl("/IPv6");
|
result += u"/IPv6"_q;
|
||||||
} else {
|
} else {
|
||||||
result += qsl("/IPv4");
|
result += u"/IPv4"_q;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl HttpConnection::url() const {
|
QUrl HttpConnection::url() const {
|
||||||
const auto pattern = qthelp::is_ipv6(_address)
|
const auto pattern = qthelp::is_ipv6(_address)
|
||||||
? qsl("http://[%1]:%2/api")
|
? u"http://[%1]:%2/api"_q
|
||||||
: qsl("http://%1:%2/api");
|
: u"http://%1:%2/api"_q;
|
||||||
|
|
||||||
// Not endpoint.port - always 80 port for http transport.
|
// Not endpoint.port - always 80 port for http transport.
|
||||||
return QUrl(pattern.arg(_address).arg(kForceHttpPort));
|
return QUrl(pattern.arg(_address).arg(kForceHttpPort));
|
||||||
|
|
|
@ -636,19 +636,19 @@ QString TcpConnection::transport() const {
|
||||||
if (!isConnected()) {
|
if (!isConnected()) {
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
auto result = qsl("TCP");
|
auto result = u"TCP"_q;
|
||||||
if (qthelp::is_ipv6(_address)) {
|
if (qthelp::is_ipv6(_address)) {
|
||||||
result += qsl("/IPv6");
|
result += u"/IPv6"_q;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TcpConnection::tag() const {
|
QString TcpConnection::tag() const {
|
||||||
auto result = qsl("TCP");
|
auto result = u"TCP"_q;
|
||||||
if (qthelp::is_ipv6(_address)) {
|
if (qthelp::is_ipv6(_address)) {
|
||||||
result += qsl("/IPv6");
|
result += u"/IPv6"_q;
|
||||||
} else {
|
} else {
|
||||||
result += qsl("/IPv4");
|
result += u"/IPv4"_q;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1342,7 +1342,7 @@ bool Instance::Private::onErrorDefault(
|
||||||
const auto requestId = response.requestId;
|
const auto requestId = response.requestId;
|
||||||
const auto &type = error.type();
|
const auto &type = error.type();
|
||||||
const auto code = error.code();
|
const auto code = error.code();
|
||||||
auto badGuestDc = (code == 400) && (type == qsl("FILE_ID_INVALID"));
|
auto badGuestDc = (code == 400) && (type == u"FILE_ID_INVALID"_q);
|
||||||
QRegularExpressionMatch m1, m2;
|
QRegularExpressionMatch m1, m2;
|
||||||
if ((m1 = QRegularExpression("^(FILE|PHONE|NETWORK|USER)_MIGRATE_(\\d+)$").match(type)).hasMatch()) {
|
if ((m1 = QRegularExpression("^(FILE|PHONE|NETWORK|USER)_MIGRATE_(\\d+)$").match(type)).hasMatch()) {
|
||||||
if (!requestId) return false;
|
if (!requestId) return false;
|
||||||
|
|
|
@ -100,7 +100,7 @@ QByteArray ParseRemoteConfigResponse(const QByteArray &bytes) {
|
||||||
return document.object().value(
|
return document.object().value(
|
||||||
"entries"
|
"entries"
|
||||||
).toObject().value(
|
).toObject().value(
|
||||||
qsl("%1%2").arg(kConfigKey, kConfigSubKey)
|
u"%1%2"_q.arg(kConfigKey, kConfigSubKey)
|
||||||
).toString().toLatin1();
|
).toString().toLatin1();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,22 +283,22 @@ void SpecialConfigRequest::sendNextRequest() {
|
||||||
void SpecialConfigRequest::performRequest(const Attempt &attempt) {
|
void SpecialConfigRequest::performRequest(const Attempt &attempt) {
|
||||||
const auto type = attempt.type;
|
const auto type = attempt.type;
|
||||||
auto url = QUrl();
|
auto url = QUrl();
|
||||||
url.setScheme(qsl("https"));
|
url.setScheme(u"https"_q);
|
||||||
auto request = QNetworkRequest();
|
auto request = QNetworkRequest();
|
||||||
auto payload = QByteArray();
|
auto payload = QByteArray();
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Type::Mozilla: {
|
case Type::Mozilla: {
|
||||||
url.setHost(attempt.data);
|
url.setHost(attempt.data);
|
||||||
url.setPath(qsl("/dns-query"));
|
url.setPath(u"/dns-query"_q);
|
||||||
url.setQuery(qsl("name=%1&type=16&random_padding=%2").arg(
|
url.setQuery(u"name=%1&type=16&random_padding=%2"_q.arg(
|
||||||
_domainString,
|
_domainString,
|
||||||
GenerateDnsRandomPadding()));
|
GenerateDnsRandomPadding()));
|
||||||
request.setRawHeader("accept", "application/dns-json");
|
request.setRawHeader("accept", "application/dns-json");
|
||||||
} break;
|
} break;
|
||||||
case Type::Google: {
|
case Type::Google: {
|
||||||
url.setHost(attempt.data);
|
url.setHost(attempt.data);
|
||||||
url.setPath(qsl("/resolve"));
|
url.setPath(u"/resolve"_q);
|
||||||
url.setQuery(qsl("name=%1&type=ANY&random_padding=%2").arg(
|
url.setQuery(u"name=%1&type=ANY&random_padding=%2"_q.arg(
|
||||||
_domainString,
|
_domainString,
|
||||||
GenerateDnsRandomPadding()));
|
GenerateDnsRandomPadding()));
|
||||||
if (!attempt.host.isEmpty()) {
|
if (!attempt.host.isEmpty()) {
|
||||||
|
@ -308,23 +308,23 @@ void SpecialConfigRequest::performRequest(const Attempt &attempt) {
|
||||||
} break;
|
} break;
|
||||||
case Type::RemoteConfig: {
|
case Type::RemoteConfig: {
|
||||||
url.setHost(ApiDomain(attempt.data));
|
url.setHost(ApiDomain(attempt.data));
|
||||||
url.setPath(qsl("/v1/projects/%1/namespaces/firebase:fetch"
|
url.setPath((u"/v1/projects/%1/namespaces/firebase:fetch"_q
|
||||||
).arg(kRemoteProject));
|
).arg(kRemoteProject));
|
||||||
url.setQuery(qsl("key=%1").arg(kApiKey));
|
url.setQuery(u"key=%1"_q.arg(kApiKey));
|
||||||
payload = qsl("{\"app_id\":\"%1\",\"app_instance_id\":\"%2\"}").arg(
|
payload = u"{\"app_id\":\"%1\",\"app_instance_id\":\"%2\"}"_q.arg(
|
||||||
kAppId,
|
kAppId,
|
||||||
InstanceId()).toLatin1();
|
InstanceId()).toLatin1();
|
||||||
request.setRawHeader("Content-Type", "application/json");
|
request.setRawHeader("Content-Type", "application/json");
|
||||||
} break;
|
} break;
|
||||||
case Type::Realtime: {
|
case Type::Realtime: {
|
||||||
url.setHost(kFireProject + qsl(".%1").arg(attempt.data));
|
url.setHost(kFireProject + u".%1"_q.arg(attempt.data));
|
||||||
url.setPath(qsl("/%1%2.json").arg(kConfigKey, kConfigSubKey));
|
url.setPath(u"/%1%2.json"_q.arg(kConfigKey, kConfigSubKey));
|
||||||
} break;
|
} break;
|
||||||
case Type::FireStore: {
|
case Type::FireStore: {
|
||||||
url.setHost(attempt.host.isEmpty()
|
url.setHost(attempt.host.isEmpty()
|
||||||
? ApiDomain(attempt.data)
|
? ApiDomain(attempt.data)
|
||||||
: attempt.data);
|
: attempt.data);
|
||||||
url.setPath(qsl("/v1/projects/%1/databases/(default)/documents/%2/%3"
|
url.setPath((u"/v1/projects/%1/databases/(default)/documents/%2/%3"_q
|
||||||
).arg(
|
).arg(
|
||||||
kFireProject,
|
kFireProject,
|
||||||
kConfigKey,
|
kConfigKey,
|
||||||
|
@ -517,7 +517,7 @@ void SpecialConfigRequest::handleResponse(const QByteArray &bytes) {
|
||||||
for (const auto &address : data.vips().v) {
|
for (const auto &address : data.vips().v) {
|
||||||
const auto parseIp = [](const MTPint &ipv4) {
|
const auto parseIp = [](const MTPint &ipv4) {
|
||||||
const auto ip = *reinterpret_cast<const uint32*>(&ipv4.v);
|
const auto ip = *reinterpret_cast<const uint32*>(&ipv4.v);
|
||||||
return qsl("%1.%2.%3.%4"
|
return (u"%1.%2.%3.%4"_q
|
||||||
).arg((ip >> 24) & 0xFF
|
).arg((ip >> 24) & 0xFF
|
||||||
).arg((ip >> 16) & 0xFF
|
).arg((ip >> 16) & 0xFF
|
||||||
).arg((ip >> 8) & 0xFF
|
).arg((ip >> 8) & 0xFF
|
||||||
|
|
|
@ -276,7 +276,7 @@ void StatusText::update(
|
||||||
if (_size == Ui::FileStatusSizeReady) {
|
if (_size == Ui::FileStatusSizeReady) {
|
||||||
_text = (duration >= 0) ? Ui::FormatDurationAndSizeText(duration, fullSize) : (duration < -1 ? Ui::FormatGifAndSizeText(fullSize) : Ui::FormatSizeText(fullSize));
|
_text = (duration >= 0) ? Ui::FormatDurationAndSizeText(duration, fullSize) : (duration < -1 ? Ui::FormatGifAndSizeText(fullSize) : Ui::FormatSizeText(fullSize));
|
||||||
} else if (_size == Ui::FileStatusSizeLoaded) {
|
} else if (_size == Ui::FileStatusSizeLoaded) {
|
||||||
_text = (duration >= 0) ? Ui::FormatDurationText(duration) : (duration < -1 ? qsl("GIF") : Ui::FormatSizeText(fullSize));
|
_text = (duration >= 0) ? Ui::FormatDurationText(duration) : (duration < -1 ? u"GIF"_q : Ui::FormatSizeText(fullSize));
|
||||||
} else if (_size == Ui::FileStatusSizeFailed) {
|
} else if (_size == Ui::FileStatusSizeFailed) {
|
||||||
_text = tr::lng_attach_failed(tr::now);
|
_text = tr::lng_attach_failed(tr::now);
|
||||||
} else if (_size >= 0) {
|
} else if (_size >= 0) {
|
||||||
|
@ -1531,7 +1531,7 @@ Link::Link(
|
||||||
}
|
}
|
||||||
int32 afterLinkStart = entity.offset() + entity.length();
|
int32 afterLinkStart = entity.offset() + entity.length();
|
||||||
if (till > afterLinkStart) {
|
if (till > afterLinkStart) {
|
||||||
if (!QRegularExpression(qsl("^[,.\\s_=+\\-;:`'\"\\(\\)\\[\\]\\{\\}<>*&^%\\$#@!\\\\/]+$")).match(text.mid(afterLinkStart, till - afterLinkStart)).hasMatch()) {
|
if (!QRegularExpression(u"^[,.\\s_=+\\-;:`'\"\\(\\)\\[\\]\\{\\}<>*&^%\\$#@!\\\\/]+$"_q).match(text.mid(afterLinkStart, till - afterLinkStart)).hasMatch()) {
|
||||||
++lnk;
|
++lnk;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1539,7 +1539,7 @@ Link::Link(
|
||||||
till = entity.offset();
|
till = entity.offset();
|
||||||
}
|
}
|
||||||
if (!lnk) {
|
if (!lnk) {
|
||||||
if (QRegularExpression(qsl("^[,.\\s\\-;:`'\"\\(\\)\\[\\]\\{\\}<>*&^%\\$#@!\\\\/]+$")).match(text.mid(from, till - from)).hasMatch()) {
|
if (QRegularExpression(u"^[,.\\s\\-;:`'\"\\(\\)\\[\\]\\{\\}<>*&^%\\$#@!\\\\/]+$"_q).match(text.mid(from, till - from)).hasMatch()) {
|
||||||
till = from;
|
till = from;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -267,9 +267,9 @@ void IdentityBox::updateControlsPosition() {
|
||||||
|
|
||||||
void IdentityBox::chooseScan() {
|
void IdentityBox::chooseScan() {
|
||||||
const auto filter = FileDialog::AllFilesFilter()
|
const auto filter = FileDialog::AllFilesFilter()
|
||||||
+ qsl(";;Image files (*")
|
+ u";;Image files (*"_q
|
||||||
+ cImgExtensions().join(qsl(" *"))
|
+ cImgExtensions().join(u" *"_q)
|
||||||
+ qsl(")");
|
+ u")"_q;
|
||||||
const auto callback = [=](FileDialog::OpenResult &&result) {
|
const auto callback = [=](FileDialog::OpenResult &&result) {
|
||||||
if (result.paths.size() == 1) {
|
if (result.paths.size() == 1) {
|
||||||
encryptScan(result.paths.front());
|
encryptScan(result.paths.front());
|
||||||
|
|
|
@ -268,10 +268,9 @@ auto ParseConfig(const QByteArray &json) {
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
QString NonceNameByScope(const QString &scope) {
|
QString NonceNameByScope(const QString &scope) {
|
||||||
if (scope.startsWith('{') && scope.endsWith('}')) {
|
return (scope.startsWith('{') && scope.endsWith('}'))
|
||||||
return qsl("nonce");
|
? u"nonce"_q
|
||||||
}
|
: u"payload"_q;
|
||||||
return qsl("payload");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ValueChanged(not_null<const Value*> value, const ValueMap &data) {
|
bool ValueChanged(not_null<const Value*> value, const ValueMap &data) {
|
||||||
|
|
|
@ -217,7 +217,7 @@ EditDocumentScheme GetDocumentScheme(
|
||||||
{
|
{
|
||||||
ValueClass::Fields,
|
ValueClass::Fields,
|
||||||
Ui::PanelDetailsType::Text,
|
Ui::PanelDetailsType::Text,
|
||||||
qsl("first_name"),
|
"first_name"_q,
|
||||||
tr::lng_passport_first_name(tr::now),
|
tr::lng_passport_first_name(tr::now),
|
||||||
NameValidate,
|
NameValidate,
|
||||||
DontFormat,
|
DontFormat,
|
||||||
|
@ -226,27 +226,27 @@ EditDocumentScheme GetDocumentScheme(
|
||||||
{
|
{
|
||||||
ValueClass::Fields,
|
ValueClass::Fields,
|
||||||
Ui::PanelDetailsType::Text,
|
Ui::PanelDetailsType::Text,
|
||||||
qsl("middle_name"),
|
"middle_name"_q,
|
||||||
tr::lng_passport_middle_name(tr::now),
|
tr::lng_passport_middle_name(tr::now),
|
||||||
NameOrEmptyValidate,
|
NameOrEmptyValidate,
|
||||||
DontFormat,
|
DontFormat,
|
||||||
kMaxNameSize,
|
kMaxNameSize,
|
||||||
qsl("first_name"),
|
"first_name"_q,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ValueClass::Fields,
|
ValueClass::Fields,
|
||||||
Ui::PanelDetailsType::Text,
|
Ui::PanelDetailsType::Text,
|
||||||
qsl("last_name"),
|
"last_name"_q,
|
||||||
tr::lng_passport_last_name(tr::now),
|
tr::lng_passport_last_name(tr::now),
|
||||||
NameValidate,
|
NameValidate,
|
||||||
DontFormat,
|
DontFormat,
|
||||||
kMaxNameSize,
|
kMaxNameSize,
|
||||||
qsl("first_name"),
|
"first_name"_q,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ValueClass::Fields,
|
ValueClass::Fields,
|
||||||
Ui::PanelDetailsType::Date,
|
Ui::PanelDetailsType::Date,
|
||||||
qsl("birth_date"),
|
"birth_date"_q,
|
||||||
tr::lng_passport_birth_date(tr::now),
|
tr::lng_passport_birth_date(tr::now),
|
||||||
DateValidate,
|
DateValidate,
|
||||||
DontFormat,
|
DontFormat,
|
||||||
|
@ -254,7 +254,7 @@ EditDocumentScheme GetDocumentScheme(
|
||||||
{
|
{
|
||||||
ValueClass::Fields,
|
ValueClass::Fields,
|
||||||
Ui::PanelDetailsType::Gender,
|
Ui::PanelDetailsType::Gender,
|
||||||
qsl("gender"),
|
"gender"_q,
|
||||||
tr::lng_passport_gender(tr::now),
|
tr::lng_passport_gender(tr::now),
|
||||||
GenderValidate,
|
GenderValidate,
|
||||||
GenderFormat,
|
GenderFormat,
|
||||||
|
@ -262,7 +262,7 @@ EditDocumentScheme GetDocumentScheme(
|
||||||
{
|
{
|
||||||
ValueClass::Fields,
|
ValueClass::Fields,
|
||||||
Ui::PanelDetailsType::Country,
|
Ui::PanelDetailsType::Country,
|
||||||
qsl("country_code"),
|
"country_code"_q,
|
||||||
tr::lng_passport_country(tr::now),
|
tr::lng_passport_country(tr::now),
|
||||||
CountryValidate,
|
CountryValidate,
|
||||||
CountryFormat,
|
CountryFormat,
|
||||||
|
@ -270,7 +270,7 @@ EditDocumentScheme GetDocumentScheme(
|
||||||
{
|
{
|
||||||
ValueClass::Fields,
|
ValueClass::Fields,
|
||||||
Ui::PanelDetailsType::Country,
|
Ui::PanelDetailsType::Country,
|
||||||
qsl("residence_country_code"),
|
"residence_country_code"_q,
|
||||||
tr::lng_passport_residence_country(tr::now),
|
tr::lng_passport_residence_country(tr::now),
|
||||||
CountryValidate,
|
CountryValidate,
|
||||||
CountryFormat,
|
CountryFormat,
|
||||||
|
@ -278,7 +278,7 @@ EditDocumentScheme GetDocumentScheme(
|
||||||
{
|
{
|
||||||
ValueClass::Scans,
|
ValueClass::Scans,
|
||||||
Ui::PanelDetailsType::Text,
|
Ui::PanelDetailsType::Text,
|
||||||
qsl("document_no"),
|
"document_no"_q,
|
||||||
tr::lng_passport_document_number(tr::now),
|
tr::lng_passport_document_number(tr::now),
|
||||||
DocumentValidate,
|
DocumentValidate,
|
||||||
DontFormat,
|
DontFormat,
|
||||||
|
@ -287,14 +287,14 @@ EditDocumentScheme GetDocumentScheme(
|
||||||
{
|
{
|
||||||
ValueClass::Scans,
|
ValueClass::Scans,
|
||||||
Ui::PanelDetailsType::Date,
|
Ui::PanelDetailsType::Date,
|
||||||
qsl("expiry_date"),
|
"expiry_date"_q,
|
||||||
tr::lng_passport_expiry_date(tr::now),
|
tr::lng_passport_expiry_date(tr::now),
|
||||||
DateOrEmptyValidate,
|
DateOrEmptyValidate,
|
||||||
DontFormat,
|
DontFormat,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
if (nativeNames) {
|
if (nativeNames) {
|
||||||
result.additionalDependencyKey = qsl("residence_country_code");
|
result.additionalDependencyKey = "residence_country_code"_q;
|
||||||
|
|
||||||
result.preferredLanguage = preferredLanguage
|
result.preferredLanguage = preferredLanguage
|
||||||
? std::move(preferredLanguage)
|
? std::move(preferredLanguage)
|
||||||
|
@ -342,35 +342,35 @@ EditDocumentScheme GetDocumentScheme(
|
||||||
{
|
{
|
||||||
ValueClass::Additional,
|
ValueClass::Additional,
|
||||||
Ui::PanelDetailsType::Text,
|
Ui::PanelDetailsType::Text,
|
||||||
qsl("first_name_native"),
|
"first_name_native"_q,
|
||||||
tr::lng_passport_first_name(tr::now),
|
tr::lng_passport_first_name(tr::now),
|
||||||
NativeNameValidate,
|
NativeNameValidate,
|
||||||
DontFormat,
|
DontFormat,
|
||||||
kMaxNameSize,
|
kMaxNameSize,
|
||||||
QString(),
|
QString(),
|
||||||
qsl("first_name"),
|
"first_name"_q,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ValueClass::Additional,
|
ValueClass::Additional,
|
||||||
Ui::PanelDetailsType::Text,
|
Ui::PanelDetailsType::Text,
|
||||||
qsl("middle_name_native"),
|
"middle_name_native"_q,
|
||||||
tr::lng_passport_middle_name(tr::now),
|
tr::lng_passport_middle_name(tr::now),
|
||||||
NativeNameOrEmptyValidate,
|
NativeNameOrEmptyValidate,
|
||||||
DontFormat,
|
DontFormat,
|
||||||
kMaxNameSize,
|
kMaxNameSize,
|
||||||
qsl("first_name_native"),
|
"first_name_native"_q,
|
||||||
qsl("middle_name"),
|
"middle_name"_q,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ValueClass::Additional,
|
ValueClass::Additional,
|
||||||
Ui::PanelDetailsType::Text,
|
Ui::PanelDetailsType::Text,
|
||||||
qsl("last_name_native"),
|
"last_name_native"_q,
|
||||||
tr::lng_passport_last_name(tr::now),
|
tr::lng_passport_last_name(tr::now),
|
||||||
NativeNameValidate,
|
NativeNameValidate,
|
||||||
DontFormat,
|
DontFormat,
|
||||||
kMaxNameSize,
|
kMaxNameSize,
|
||||||
qsl("first_name_native"),
|
"first_name_native"_q,
|
||||||
qsl("last_name"),
|
"last_name"_q,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
for (auto &row : additional) {
|
for (auto &row : additional) {
|
||||||
|
@ -409,7 +409,7 @@ EditDocumentScheme GetDocumentScheme(
|
||||||
{
|
{
|
||||||
ValueClass::Fields,
|
ValueClass::Fields,
|
||||||
Ui::PanelDetailsType::Text,
|
Ui::PanelDetailsType::Text,
|
||||||
qsl("street_line1"),
|
"street_line1"_q,
|
||||||
tr::lng_passport_street(tr::now),
|
tr::lng_passport_street(tr::now),
|
||||||
StreetValidate,
|
StreetValidate,
|
||||||
DontFormat,
|
DontFormat,
|
||||||
|
@ -418,7 +418,7 @@ EditDocumentScheme GetDocumentScheme(
|
||||||
{
|
{
|
||||||
ValueClass::Fields,
|
ValueClass::Fields,
|
||||||
Ui::PanelDetailsType::Text,
|
Ui::PanelDetailsType::Text,
|
||||||
qsl("street_line2"),
|
"street_line2"_q,
|
||||||
tr::lng_passport_street(tr::now),
|
tr::lng_passport_street(tr::now),
|
||||||
DontValidate,
|
DontValidate,
|
||||||
DontFormat,
|
DontFormat,
|
||||||
|
@ -427,7 +427,7 @@ EditDocumentScheme GetDocumentScheme(
|
||||||
{
|
{
|
||||||
ValueClass::Fields,
|
ValueClass::Fields,
|
||||||
Ui::PanelDetailsType::Text,
|
Ui::PanelDetailsType::Text,
|
||||||
qsl("city"),
|
"city"_q,
|
||||||
tr::lng_passport_city(tr::now),
|
tr::lng_passport_city(tr::now),
|
||||||
CityValidate,
|
CityValidate,
|
||||||
DontFormat,
|
DontFormat,
|
||||||
|
@ -436,7 +436,7 @@ EditDocumentScheme GetDocumentScheme(
|
||||||
{
|
{
|
||||||
ValueClass::Fields,
|
ValueClass::Fields,
|
||||||
Ui::PanelDetailsType::Text,
|
Ui::PanelDetailsType::Text,
|
||||||
qsl("state"),
|
"state"_q,
|
||||||
tr::lng_passport_state(tr::now),
|
tr::lng_passport_state(tr::now),
|
||||||
DontValidate,
|
DontValidate,
|
||||||
DontFormat,
|
DontFormat,
|
||||||
|
@ -445,7 +445,7 @@ EditDocumentScheme GetDocumentScheme(
|
||||||
{
|
{
|
||||||
ValueClass::Fields,
|
ValueClass::Fields,
|
||||||
Ui::PanelDetailsType::Country,
|
Ui::PanelDetailsType::Country,
|
||||||
qsl("country_code"),
|
"country_code"_q,
|
||||||
tr::lng_passport_country(tr::now),
|
tr::lng_passport_country(tr::now),
|
||||||
CountryValidate,
|
CountryValidate,
|
||||||
CountryFormat,
|
CountryFormat,
|
||||||
|
@ -453,7 +453,7 @@ EditDocumentScheme GetDocumentScheme(
|
||||||
{
|
{
|
||||||
ValueClass::Fields,
|
ValueClass::Fields,
|
||||||
Ui::PanelDetailsType::Postcode,
|
Ui::PanelDetailsType::Postcode,
|
||||||
qsl("post_code"),
|
"post_code"_q,
|
||||||
tr::lng_passport_postcode(tr::now),
|
tr::lng_passport_postcode(tr::now),
|
||||||
PostcodeValidate,
|
PostcodeValidate,
|
||||||
DontFormat,
|
DontFormat,
|
||||||
|
@ -512,18 +512,18 @@ EditContactScheme GetContactScheme(Scope::Type type) {
|
||||||
|
|
||||||
const std::map<QString, QString> &LatinToNativeMap() {
|
const std::map<QString, QString> &LatinToNativeMap() {
|
||||||
static const auto result = std::map<QString, QString> {
|
static const auto result = std::map<QString, QString> {
|
||||||
{ qsl("first_name"), qsl("first_name_native") },
|
{ "first_name"_q, "first_name_native"_q },
|
||||||
{ qsl("last_name"), qsl("last_name_native") },
|
{ "last_name"_q, "last_name_native"_q },
|
||||||
{ qsl("middle_name"), qsl("middle_name_native") },
|
{ "middle_name"_q, "middle_name_native"_q },
|
||||||
};
|
};
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::map<QString, QString> &NativeToLatinMap() {
|
const std::map<QString, QString> &NativeToLatinMap() {
|
||||||
static const auto result = std::map<QString, QString> {
|
static const auto result = std::map<QString, QString> {
|
||||||
{ qsl("first_name_native"), qsl("first_name") },
|
{ "first_name_native"_q, "first_name"_q },
|
||||||
{ qsl("last_name_native"), qsl("last_name") },
|
{ "last_name_native"_q, "last_name"_q },
|
||||||
{ qsl("middle_name_native"), qsl("middle_name") },
|
{ "middle_name_native"_q, "middle_name"_q },
|
||||||
};
|
};
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,8 +84,8 @@ bool Launcher::launchUpdater(UpdaterLaunch action) {
|
||||||
const auto binaryPath = (action == UpdaterLaunch::JustRelaunch)
|
const auto binaryPath = (action == UpdaterLaunch::JustRelaunch)
|
||||||
? (cExeDir() + cExeName())
|
? (cExeDir() + cExeName())
|
||||||
: (cWriteProtected()
|
: (cWriteProtected()
|
||||||
? (cWorkingDir() + qsl("tupdates/temp/Updater"))
|
? (cWorkingDir() + u"tupdates/temp/Updater"_q)
|
||||||
: (cExeDir() + qsl("Updater")));
|
: (cExeDir() + u"Updater"_q));
|
||||||
|
|
||||||
auto argumentsList = Arguments();
|
auto argumentsList = Arguments();
|
||||||
if (action == UpdaterLaunch::PerformUpdate && cWriteProtected()) {
|
if (action == UpdaterLaunch::PerformUpdate && cWriteProtected()) {
|
||||||
|
@ -102,7 +102,7 @@ bool Launcher::launchUpdater(UpdaterLaunch action) {
|
||||||
if (cStartInTray()) {
|
if (cStartInTray()) {
|
||||||
argumentsList.push("-startintray");
|
argumentsList.push("-startintray");
|
||||||
}
|
}
|
||||||
if (cDataFile() != qsl("data")) {
|
if (cDataFile() != u"data"_q) {
|
||||||
argumentsList.push("-key");
|
argumentsList.push("-key");
|
||||||
argumentsList.push(QFile::encodeName(cDataFile()));
|
argumentsList.push(QFile::encodeName(cDataFile()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,11 +105,11 @@ std::vector<Type> ComputeAndLog() {
|
||||||
const auto names = ranges::accumulate(
|
const auto names = ranges::accumulate(
|
||||||
result | ranges::views::transform([](auto type) {
|
result | ranges::views::transform([](auto type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Type::Gnome: return qsl("Gnome, ");
|
case Type::Gnome: return u"Gnome, "_q;
|
||||||
case Type::Cinnamon: return qsl("Cinnamon, ");
|
case Type::Cinnamon: return u"Cinnamon, "_q;
|
||||||
case Type::KDE: return qsl("KDE, ");
|
case Type::KDE: return u"KDE, "_q;
|
||||||
case Type::Unity: return qsl("Unity, ");
|
case Type::Unity: return u"Unity, "_q;
|
||||||
case Type::MATE: return qsl("MATE, ");
|
case Type::MATE: return u"MATE, "_q;
|
||||||
}
|
}
|
||||||
Unexpected("Type in Platform::DesktopEnvironment::ComputeAndLog");
|
Unexpected("Type in Platform::DesktopEnvironment::ComputeAndLog");
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -324,7 +324,7 @@ void MainWindow::createGlobalMenu() {
|
||||||
});
|
});
|
||||||
|
|
||||||
auto quit = file->addAction(
|
auto quit = file->addAction(
|
||||||
tr::lng_mac_menu_quit_telegram(tr::now, lt_telegram, qsl("Telegram")),
|
tr::lng_mac_menu_quit_telegram(tr::now, lt_telegram, u"Telegram"_q),
|
||||||
this,
|
this,
|
||||||
[=] { quitFromTray(); },
|
[=] { quitFromTray(); },
|
||||||
QKeySequence::Quit);
|
QKeySequence::Quit);
|
||||||
|
@ -485,7 +485,7 @@ void MainWindow::createGlobalMenu() {
|
||||||
tr::lng_mac_menu_about_telegram(
|
tr::lng_mac_menu_about_telegram(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_telegram,
|
lt_telegram,
|
||||||
qsl("Telegram")),
|
u"Telegram"_q),
|
||||||
[=] {
|
[=] {
|
||||||
ensureWindowShown();
|
ensureWindowShown();
|
||||||
controller().show(Box<AboutBox>());
|
controller().show(Box<AboutBox>());
|
||||||
|
|
|
@ -387,7 +387,7 @@ bool NotificationData::init(
|
||||||
_notification->set_body(
|
_notification->set_body(
|
||||||
subtitle.isEmpty()
|
subtitle.isEmpty()
|
||||||
? msg.toStdString()
|
? msg.toStdString()
|
||||||
: qsl("%1\n%2").arg(subtitle, msg).toStdString());
|
: u("%1\n%2"_q.arg(subtitle, msg).toStdString());
|
||||||
|
|
||||||
_notification->set_icon(
|
_notification->set_icon(
|
||||||
Gio::ThemedIcon::create(base::IconName().toStdString()));
|
Gio::ThemedIcon::create(base::IconName().toStdString()));
|
||||||
|
@ -500,16 +500,16 @@ bool NotificationData::init(
|
||||||
_title = title.toStdString();
|
_title = title.toStdString();
|
||||||
_imageKey = GetImageKey(CurrentServerInformationValue().specVersion);
|
_imageKey = GetImageKey(CurrentServerInformationValue().specVersion);
|
||||||
|
|
||||||
if (capabilities.contains(qsl("body-markup"))) {
|
if (capabilities.contains(u"body-markup"_q)) {
|
||||||
_body = subtitle.isEmpty()
|
_body = subtitle.isEmpty()
|
||||||
? msg.toHtmlEscaped().toStdString()
|
? msg.toHtmlEscaped().toStdString()
|
||||||
: qsl("<b>%1</b>\n%2").arg(
|
: u"<b>%1</b>\n%2"_q.arg(
|
||||||
subtitle.toHtmlEscaped(),
|
subtitle.toHtmlEscaped(),
|
||||||
msg.toHtmlEscaped()).toStdString();
|
msg.toHtmlEscaped()).toStdString();
|
||||||
} else {
|
} else {
|
||||||
_body = subtitle.isEmpty()
|
_body = subtitle.isEmpty()
|
||||||
? msg.toStdString()
|
? msg.toStdString()
|
||||||
: qsl("%1\n%2").arg(subtitle, msg).toStdString();
|
: u"%1\n%2"_q.arg(subtitle, msg).toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (capabilities.contains("actions")) {
|
if (capabilities.contains("actions")) {
|
||||||
|
@ -812,16 +812,16 @@ bool ByDefault() {
|
||||||
// with custom notifications
|
// with custom notifications
|
||||||
static const auto NeededCapabilities = {
|
static const auto NeededCapabilities = {
|
||||||
// To show message content
|
// To show message content
|
||||||
qsl("body"),
|
u"body"_q,
|
||||||
// To make the sender name bold
|
// To make the sender name bold
|
||||||
qsl("body-markup"),
|
u"body-markup"_q,
|
||||||
// To have buttons on notifications
|
// To have buttons on notifications
|
||||||
qsl("actions"),
|
u"actions"_q,
|
||||||
// To have quick reply
|
// To have quick reply
|
||||||
qsl("inline-reply"),
|
u"inline-reply"_q,
|
||||||
// To not to play sound with Don't Disturb activated
|
// To not to play sound with Don't Disturb activated
|
||||||
// (no, using sound capability is not a way)
|
// (no, using sound capability is not a way)
|
||||||
qsl("inhibitions"),
|
u"inhibitions"_q,
|
||||||
};
|
};
|
||||||
|
|
||||||
return ranges::all_of(NeededCapabilities, [&](const auto &capability) {
|
return ranges::all_of(NeededCapabilities, [&](const auto &capability) {
|
||||||
|
@ -962,7 +962,7 @@ Manager::Private::Private(not_null<Manager*> manager)
|
||||||
.arg(capabilities.join(", ")));
|
.arg(capabilities.join(", ")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (capabilities.contains(qsl("inhibitions"))) {
|
if (capabilities.contains(u"inhibitions"_q)) {
|
||||||
Noexcept([&] {
|
Noexcept([&] {
|
||||||
_dbusConnection = Gio::DBus::Connection::get_sync(
|
_dbusConnection = Gio::DBus::Connection::get_sync(
|
||||||
Gio::DBus::BusType::SESSION);
|
Gio::DBus::BusType::SESSION);
|
||||||
|
|
|
@ -464,7 +464,7 @@ bool GenerateDesktopFile(
|
||||||
QStringList exec;
|
QStringList exec;
|
||||||
exec.append(cExeDir() + cExeName());
|
exec.append(cExeDir() + cExeName());
|
||||||
if (Core::Sandbox::Instance().customWorkingDir()) {
|
if (Core::Sandbox::Instance().customWorkingDir()) {
|
||||||
exec.append(qsl("-workdir"));
|
exec.append(u"-workdir"_q);
|
||||||
exec.append(cWorkingDir());
|
exec.append(cWorkingDir());
|
||||||
}
|
}
|
||||||
exec.append(args);
|
exec.append(args);
|
||||||
|
@ -485,7 +485,7 @@ bool GenerateDesktopFile(
|
||||||
if (!exec.isEmpty()) {
|
if (!exec.isEmpty()) {
|
||||||
exec[0] = cExeDir() + cExeName();
|
exec[0] = cExeDir() + cExeName();
|
||||||
if (Core::Sandbox::Instance().customWorkingDir()) {
|
if (Core::Sandbox::Instance().customWorkingDir()) {
|
||||||
exec.insert(1, qsl("-workdir"));
|
exec.insert(1, u"-workdir"_q);
|
||||||
exec.insert(2, cWorkingDir());
|
exec.insert(2, cWorkingDir());
|
||||||
}
|
}
|
||||||
target->set_string(
|
target->set_string(
|
||||||
|
@ -509,10 +509,10 @@ bool GenerateDesktopFile(
|
||||||
|
|
||||||
if (!Core::UpdaterDisabled()) {
|
if (!Core::UpdaterDisabled()) {
|
||||||
DEBUG_LOG(("App Info: removing old .desktop files"));
|
DEBUG_LOG(("App Info: removing old .desktop files"));
|
||||||
QFile::remove(qsl("%1telegram.desktop").arg(targetPath));
|
QFile::remove(u"%1telegram.desktop"_q.arg(targetPath));
|
||||||
QFile::remove(qsl("%1telegramdesktop.desktop").arg(targetPath));
|
QFile::remove(u"%1telegramdesktop.desktop"_q.arg(targetPath));
|
||||||
|
|
||||||
const auto appimagePath = qsl("file://%1%2").arg(
|
const auto appimagePath = u"file://%1%2"_q.arg(
|
||||||
cExeDir(),
|
cExeDir(),
|
||||||
cExeName()).toUtf8();
|
cExeName()).toUtf8();
|
||||||
|
|
||||||
|
@ -522,7 +522,7 @@ bool GenerateDesktopFile(
|
||||||
appimagePath.size(),
|
appimagePath.size(),
|
||||||
md5Hash);
|
md5Hash);
|
||||||
|
|
||||||
QFile::remove(qsl("%1appimagekit_%2-%3.desktop").arg(
|
QFile::remove(u"%1appimagekit_%2-%3.desktop"_q.arg(
|
||||||
targetPath,
|
targetPath,
|
||||||
md5Hash,
|
md5Hash,
|
||||||
AppName.utf16().replace(' ', '_')));
|
AppName.utf16().replace(' ', '_')));
|
||||||
|
@ -536,7 +536,7 @@ bool GenerateDesktopFile(
|
||||||
hashMd5Hex(exePath.constData(), exePath.size(), md5Hash);
|
hashMd5Hex(exePath.constData(), exePath.size(), md5Hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
QFile::remove(qsl("%1org.telegram.desktop.%2.desktop").arg(
|
QFile::remove(u"%1org.telegram.desktop.%2.desktop"_q.arg(
|
||||||
targetPath,
|
targetPath,
|
||||||
md5Hash));
|
md5Hash));
|
||||||
}
|
}
|
||||||
|
@ -622,10 +622,10 @@ void AutostartToggle(bool enabled, Fn<void(bool)> done) {
|
||||||
} else {
|
} else {
|
||||||
const auto autostart = QStandardPaths::writableLocation(
|
const auto autostart = QStandardPaths::writableLocation(
|
||||||
QStandardPaths::GenericConfigLocation)
|
QStandardPaths::GenericConfigLocation)
|
||||||
+ qsl("/autostart/");
|
+ u"/autostart/"_q;
|
||||||
|
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
GenerateDesktopFile(autostart, { qsl("-autostart") }, silent);
|
GenerateDesktopFile(autostart, { u"-autostart"_q }, silent);
|
||||||
} else {
|
} else {
|
||||||
QFile::remove(autostart + QGuiApplication::desktopFileName());
|
QFile::remove(autostart + QGuiApplication::desktopFileName());
|
||||||
}
|
}
|
||||||
|
@ -668,8 +668,8 @@ QString psAppDataPath() {
|
||||||
// If we find data there, we should still use it.
|
// If we find data there, we should still use it.
|
||||||
auto home = QDir::homePath();
|
auto home = QDir::homePath();
|
||||||
if (!home.isEmpty()) {
|
if (!home.isEmpty()) {
|
||||||
auto oldPath = home + qsl("/.TelegramDesktop/");
|
auto oldPath = home + u"/.TelegramDesktop/"_q;
|
||||||
auto oldSettingsBase = oldPath + qsl("tdata/settings");
|
auto oldSettingsBase = oldPath + u"tdata/settings"_q;
|
||||||
if (QFile::exists(oldSettingsBase + '0')
|
if (QFile::exists(oldSettingsBase + '0')
|
||||||
|| QFile::exists(oldSettingsBase + '1')
|
|| QFile::exists(oldSettingsBase + '1')
|
||||||
|| QFile::exists(oldSettingsBase + 's')) {
|
|| QFile::exists(oldSettingsBase + 's')) {
|
||||||
|
@ -710,14 +710,14 @@ void start() {
|
||||||
|
|
||||||
QGuiApplication::setDesktopFileName([&] {
|
QGuiApplication::setDesktopFileName([&] {
|
||||||
if (KSandbox::isFlatpak()) {
|
if (KSandbox::isFlatpak()) {
|
||||||
return qEnvironmentVariable("FLATPAK_ID") + qsl(".desktop");
|
return qEnvironmentVariable("FLATPAK_ID") + u".desktop"_q;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (KSandbox::isSnap()) {
|
if (KSandbox::isSnap()) {
|
||||||
return qEnvironmentVariable("SNAP_INSTANCE_NAME")
|
return qEnvironmentVariable("SNAP_INSTANCE_NAME")
|
||||||
+ '_'
|
+ '_'
|
||||||
+ cExeName()
|
+ cExeName()
|
||||||
+ qsl(".desktop");
|
+ u".desktop"_q;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Core::UpdaterDisabled()) {
|
if (!Core::UpdaterDisabled()) {
|
||||||
|
@ -732,10 +732,10 @@ void start() {
|
||||||
md5Hash.data());
|
md5Hash.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
return qsl("org.telegram.desktop._%1.desktop").arg(md5Hash);
|
return u"org.telegram.desktop._%1.desktop"_q.arg(md5Hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
return qsl("org.telegram.desktop.desktop");
|
return u"org.telegram.desktop.desktop"_q;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
LOG(("Launcher filename: %1").arg(QGuiApplication::desktopFileName()));
|
LOG(("Launcher filename: %1").arg(QGuiApplication::desktopFileName()));
|
||||||
|
@ -768,11 +768,11 @@ void start() {
|
||||||
#endif // DESKTOP_APP_USE_PACKAGED_FONTS
|
#endif // DESKTOP_APP_USE_PACKAGED_FONTS
|
||||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
|
|
||||||
Webview::WebKit2Gtk::SetSocketPath(qsl("%1/%2-%3-webview-%4").arg(
|
Webview::WebKit2Gtk::SetSocketPath(u"%1/%2-%3-webview-%4"_q.arg(
|
||||||
QDir::tempPath(),
|
QDir::tempPath(),
|
||||||
h,
|
h,
|
||||||
cGUIDStr(),
|
cGUIDStr(),
|
||||||
qsl("%1")).toStdString());
|
u"%1"_q).toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void finish() {
|
void finish() {
|
||||||
|
@ -795,11 +795,11 @@ void InstallLauncher(bool force) {
|
||||||
GenerateDesktopFile(applicationsPath);
|
GenerateDesktopFile(applicationsPath);
|
||||||
|
|
||||||
const auto icons = QStandardPaths::writableLocation(
|
const auto icons = QStandardPaths::writableLocation(
|
||||||
QStandardPaths::GenericDataLocation) + qsl("/icons/");
|
QStandardPaths::GenericDataLocation) + u"/icons/"_q;
|
||||||
|
|
||||||
if (!QDir(icons).exists()) QDir().mkpath(icons);
|
if (!QDir(icons).exists()) QDir().mkpath(icons);
|
||||||
|
|
||||||
const auto icon = icons + base::IconName() + qsl(".png");
|
const auto icon = icons + base::IconName() + u".png"_q;
|
||||||
auto iconExists = QFile::exists(icon);
|
auto iconExists = QFile::exists(icon);
|
||||||
if (Local::oldSettingsVersion() < 2008012 && iconExists) {
|
if (Local::oldSettingsVersion() < 2008012 && iconExists) {
|
||||||
// Icon was changed.
|
// Icon was changed.
|
||||||
|
@ -808,7 +808,7 @@ void InstallLauncher(bool force) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!iconExists) {
|
if (!iconExists) {
|
||||||
if (QFile::copy(qsl(":/gui/art/logo_256.png"), icon)) {
|
if (QFile::copy(u":/gui/art/logo_256.png"_q, icon)) {
|
||||||
DEBUG_LOG(("App Info: Icon copied to '%1'").arg(icon));
|
DEBUG_LOG(("App Info: Icon copied to '%1'").arg(icon));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -876,8 +876,8 @@ void NewVersionLaunched(int oldVersion) {
|
||||||
&& oldVersion <= 4000002
|
&& oldVersion <= 4000002
|
||||||
&& qEnvironmentVariableIsSet("WAYLAND_DISPLAY")
|
&& qEnvironmentVariableIsSet("WAYLAND_DISPLAY")
|
||||||
&& DesktopEnvironment::IsGnome()
|
&& DesktopEnvironment::IsGnome()
|
||||||
&& !QFile::exists(cWorkingDir() + qsl("tdata/nowayland"))) {
|
&& !QFile::exists(cWorkingDir() + u"tdata/nowayland"_q)) {
|
||||||
QFile f(cWorkingDir() + qsl("tdata/nowayland"));
|
QFile f(cWorkingDir() + u"tdata/nowayland"_q);
|
||||||
if (f.open(QIODevice::WriteOnly)) {
|
if (f.open(QIODevice::WriteOnly)) {
|
||||||
f.write("1");
|
f.write("1");
|
||||||
f.close();
|
f.close();
|
||||||
|
|
|
@ -383,8 +383,8 @@ namespace File {
|
||||||
|
|
||||||
QString UrlToLocal(const QUrl &url) {
|
QString UrlToLocal(const QUrl &url) {
|
||||||
auto result = url.toLocalFile();
|
auto result = url.toLocalFile();
|
||||||
if (result.startsWith(qsl("/.file/id="))) {
|
if (result.startsWith(u"/.file/id="_q)) {
|
||||||
NSString *nsurl = [[[NSURL URLWithString: [NSString stringWithUTF8String: (qsl("file://") + result).toUtf8().constData()]] filePathURL] path];
|
NSString *nsurl = [[[NSURL URLWithString: [NSString stringWithUTF8String: (u"file://"_q + result).toUtf8().constData()]] filePathURL] path];
|
||||||
if (!nsurl) return QString();
|
if (!nsurl) return QString();
|
||||||
|
|
||||||
return NS2QString(nsurl);
|
return NS2QString(nsurl);
|
||||||
|
|
|
@ -64,7 +64,7 @@ bool Launcher::launchUpdater(UpdaterLaunch action) {
|
||||||
if (Logs::DebugEnabled()) [args addObject:@"-debug"];
|
if (Logs::DebugEnabled()) [args addObject:@"-debug"];
|
||||||
if (cStartInTray()) [args addObject:@"-startintray"];
|
if (cStartInTray()) [args addObject:@"-startintray"];
|
||||||
if (cUseFreeType()) [args addObject:@"-freetype"];
|
if (cUseFreeType()) [args addObject:@"-freetype"];
|
||||||
if (cDataFile() != qsl("data")) {
|
if (cDataFile() != u"data"_q) {
|
||||||
[args addObject:@"-key"];
|
[args addObject:@"-key"];
|
||||||
[args addObject:Q2NSString(cDataFile())];
|
[args addObject:Q2NSString(cDataFile())];
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,7 +291,7 @@ void MainWindow::createGlobalMenu() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
auto main = psMainMenu.addMenu(qsl("Telegram"));
|
auto main = psMainMenu.addMenu(u"Telegram"_q);
|
||||||
{
|
{
|
||||||
auto callback = [=] {
|
auto callback = [=] {
|
||||||
ensureWindowShown();
|
ensureWindowShown();
|
||||||
|
@ -301,7 +301,7 @@ void MainWindow::createGlobalMenu() {
|
||||||
tr::lng_mac_menu_about_telegram(
|
tr::lng_mac_menu_about_telegram(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_telegram,
|
lt_telegram,
|
||||||
qsl("Telegram")),
|
u"Telegram"_q),
|
||||||
std::move(callback))
|
std::move(callback))
|
||||||
->setMenuRole(QAction::AboutQtRole);
|
->setMenuRole(QAction::AboutQtRole);
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ void finish() {
|
||||||
|
|
||||||
QString SingleInstanceLocalServerName(const QString &hash) {
|
QString SingleInstanceLocalServerName(const QString &hash) {
|
||||||
#ifndef OS_MAC_STORE
|
#ifndef OS_MAC_STORE
|
||||||
return qsl("/tmp/") + hash + '-' + cGUIDStr();
|
return u"/tmp/"_q + hash + '-' + cGUIDStr();
|
||||||
#else // OS_MAC_STORE
|
#else // OS_MAC_STORE
|
||||||
return objc_documentsPath() + hash.left(4);
|
return objc_documentsPath() + hash.left(4);
|
||||||
#endif // OS_MAC_STORE
|
#endif // OS_MAC_STORE
|
||||||
|
@ -208,7 +208,7 @@ QByteArray psDownloadPathBookmark(const QString &path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool psLaunchMaps(const Data::LocationPoint &point) {
|
bool psLaunchMaps(const Data::LocationPoint &point) {
|
||||||
return QDesktopServices::openUrl(qsl("https://maps.apple.com/?q=Point&z=16&ll=%1,%2").arg(point.latAsString()).arg(point.lonAsString()));
|
return QDesktopServices::openUrl(u"https://maps.apple.com/?q=Point&z=16&ll=%1,%2"_q.arg(point.latAsString()).arg(point.lonAsString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString strNotificationAboutThemeChange() {
|
QString strNotificationAboutThemeChange() {
|
||||||
|
|
|
@ -79,7 +79,7 @@ void PreviewWindowTitle(Painter &p, const style::palette &palette, QRect body, i
|
||||||
p.setPen(st::titleFgActive[palette]);
|
p.setPen(st::titleFgActive[palette]);
|
||||||
p.setFont(font);
|
p.setFont(font);
|
||||||
|
|
||||||
p.drawText(titleRect, qsl("Telegram"), style::al_center);
|
p.drawText(titleRect, u"Telegram"_q, style::al_center);
|
||||||
|
|
||||||
auto isGraphite = ([NSColor currentControlTint] == NSGraphiteControlTint);
|
auto isGraphite = ([NSColor currentControlTint] == NSGraphiteControlTint);
|
||||||
auto buttonSkip = 8;
|
auto buttonSkip = 8;
|
||||||
|
|
|
@ -46,50 +46,50 @@ bool Launcher::launchUpdater(UpdaterLaunch action) {
|
||||||
const auto operation = (action == UpdaterLaunch::JustRelaunch)
|
const auto operation = (action == UpdaterLaunch::JustRelaunch)
|
||||||
? QString()
|
? QString()
|
||||||
: (cWriteProtected()
|
: (cWriteProtected()
|
||||||
? qsl("runas")
|
? u"runas"_q
|
||||||
: QString());
|
: QString());
|
||||||
const auto binaryPath = (action == UpdaterLaunch::JustRelaunch)
|
const auto binaryPath = (action == UpdaterLaunch::JustRelaunch)
|
||||||
? (cExeDir() + cExeName())
|
? (cExeDir() + cExeName())
|
||||||
: (cWriteProtected()
|
: (cWriteProtected()
|
||||||
? (cWorkingDir() + qsl("tupdates/temp/Updater.exe"))
|
? (cWorkingDir() + u"tupdates/temp/Updater.exe"_q)
|
||||||
: (cExeDir() + qsl("Updater.exe")));
|
: (cExeDir() + u"Updater.exe"_q));
|
||||||
|
|
||||||
auto argumentsList = QStringList();
|
auto argumentsList = QStringList();
|
||||||
const auto pushArgument = [&](const QString &argument) {
|
const auto pushArgument = [&](const QString &argument) {
|
||||||
argumentsList.push_back(argument.trimmed());
|
argumentsList.push_back(argument.trimmed());
|
||||||
};
|
};
|
||||||
if (cLaunchMode() == LaunchModeAutoStart) {
|
if (cLaunchMode() == LaunchModeAutoStart) {
|
||||||
pushArgument(qsl("-autostart"));
|
pushArgument(u"-autostart"_q);
|
||||||
}
|
}
|
||||||
if (Logs::DebugEnabled()) {
|
if (Logs::DebugEnabled()) {
|
||||||
pushArgument(qsl("-debug"));
|
pushArgument(u"-debug"_q);
|
||||||
}
|
}
|
||||||
if (cStartInTray()) {
|
if (cStartInTray()) {
|
||||||
pushArgument(qsl("-startintray"));
|
pushArgument(u"-startintray"_q);
|
||||||
}
|
}
|
||||||
if (cUseFreeType()) {
|
if (cUseFreeType()) {
|
||||||
pushArgument(qsl("-freetype"));
|
pushArgument(u"-freetype"_q);
|
||||||
}
|
}
|
||||||
if (customWorkingDir()) {
|
if (customWorkingDir()) {
|
||||||
pushArgument(qsl("-workdir"));
|
pushArgument(u"-workdir"_q);
|
||||||
pushArgument('"' + cWorkingDir() + '"');
|
pushArgument('"' + cWorkingDir() + '"');
|
||||||
}
|
}
|
||||||
if (cDataFile() != qsl("data")) {
|
if (cDataFile() != u"data"_q) {
|
||||||
pushArgument(qsl("-key"));
|
pushArgument(u"-key"_q);
|
||||||
pushArgument('"' + cDataFile() + '"');
|
pushArgument('"' + cDataFile() + '"');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action == UpdaterLaunch::JustRelaunch) {
|
if (action == UpdaterLaunch::JustRelaunch) {
|
||||||
pushArgument(qsl("-noupdate"));
|
pushArgument(u"-noupdate"_q);
|
||||||
if (cRestartingToSettings()) {
|
if (cRestartingToSettings()) {
|
||||||
pushArgument(qsl("-tosettings"));
|
pushArgument(u"-tosettings"_q);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pushArgument(qsl("-update"));
|
pushArgument(u"-update"_q);
|
||||||
pushArgument(qsl("-exename"));
|
pushArgument(u"-exename"_q);
|
||||||
pushArgument('"' + cExeName() + '"');
|
pushArgument('"' + cExeName() + '"');
|
||||||
if (cWriteProtected()) {
|
if (cWriteProtected()) {
|
||||||
pushArgument(qsl("-writeprotected"));
|
pushArgument(u"-writeprotected"_q);
|
||||||
pushArgument('"' + cExeDir() + '"');
|
pushArgument('"' + cExeDir() + '"');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ BOOL CALLBACK ActivateProcessByPid(HWND hWnd, LPARAM lParam) {
|
||||||
WCHAR nameBuf[nameBufSize];
|
WCHAR nameBuf[nameBufSize];
|
||||||
int32 len = GetWindowText(hWnd, nameBuf, nameBufSize);
|
int32 len = GetWindowText(hWnd, nameBuf, nameBufSize);
|
||||||
if (len && len < nameBufSize) {
|
if (len && len < nameBufSize) {
|
||||||
if (QRegularExpression(qsl("^Telegram(\\s*\\(\\d+\\))?$")).match(QString::fromStdWString(nameBuf)).hasMatch()) {
|
if (QRegularExpression(u"^Telegram(\\s*\\(\\d+\\))?$"_q).match(QString::fromStdWString(nameBuf)).hasMatch()) {
|
||||||
BOOL res = ::SetForegroundWindow(hWnd);
|
BOOL res = ::SetForegroundWindow(hWnd);
|
||||||
::SetFocus(hWnd);
|
::SetFocus(hWnd);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -149,7 +149,7 @@ void ManageAppLink(bool create, bool silent, int path_csidl, const wchar_t *args
|
||||||
WCHAR startupFolder[MAX_PATH];
|
WCHAR startupFolder[MAX_PATH];
|
||||||
HRESULT hr = SHGetFolderPath(0, path_csidl, 0, SHGFP_TYPE_CURRENT, startupFolder);
|
HRESULT hr = SHGetFolderPath(0, path_csidl, 0, SHGFP_TYPE_CURRENT, startupFolder);
|
||||||
if (SUCCEEDED(hr)) {
|
if (SUCCEEDED(hr)) {
|
||||||
QString lnk = QString::fromWCharArray(startupFolder) + '\\' + AppFile.utf16() + qsl(".lnk");
|
QString lnk = QString::fromWCharArray(startupFolder) + '\\' + AppFile.utf16() + u".lnk"_q;
|
||||||
if (create) {
|
if (create) {
|
||||||
const auto shellLink = base::WinRT::TryCreateInstance<IShellLink>(
|
const auto shellLink = base::WinRT::TryCreateInstance<IShellLink>(
|
||||||
CLSID_ShellLink,
|
CLSID_ShellLink,
|
||||||
|
@ -203,7 +203,7 @@ QString psAppDataPath() {
|
||||||
if (GetEnvironmentVariable(L"APPDATA", wstrPath, maxFileLen)) {
|
if (GetEnvironmentVariable(L"APPDATA", wstrPath, maxFileLen)) {
|
||||||
QDir appData(QString::fromStdWString(std::wstring(wstrPath)));
|
QDir appData(QString::fromStdWString(std::wstring(wstrPath)));
|
||||||
#ifdef OS_WIN_STORE
|
#ifdef OS_WIN_STORE
|
||||||
return appData.absolutePath() + qsl("/Telegram Desktop UWP/");
|
return appData.absolutePath() + u"/Telegram Desktop UWP/"_q;
|
||||||
#else // OS_WIN_STORE
|
#else // OS_WIN_STORE
|
||||||
return appData.absolutePath() + '/' + AppName.utf16() + '/';
|
return appData.absolutePath() + '/' + AppName.utf16() + '/';
|
||||||
#endif // OS_WIN_STORE
|
#endif // OS_WIN_STORE
|
||||||
|
@ -341,7 +341,7 @@ void SetApplicationIcon(const QIcon &icon) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SingleInstanceLocalServerName(const QString &hash) {
|
QString SingleInstanceLocalServerName(const QString &hash) {
|
||||||
return qsl("Global\\") + hash + '-' + cGUIDStr();
|
return u"Global\\"_q + hash + '-' + cGUIDStr();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<bool> IsDarkMode() {
|
std::optional<bool> IsDarkMode() {
|
||||||
|
@ -485,12 +485,12 @@ namespace {
|
||||||
if (status == ERROR_FILE_NOT_FOUND) {
|
if (status == ERROR_FILE_NOT_FOUND) {
|
||||||
status = RegCreateKeyEx(HKEY_CURRENT_USER, key, 0, 0, REG_OPTION_NON_VOLATILE, KEY_QUERY_VALUE | KEY_WRITE, 0, rkey, 0);
|
status = RegCreateKeyEx(HKEY_CURRENT_USER, key, 0, 0, REG_OPTION_NON_VOLATILE, KEY_QUERY_VALUE | KEY_WRITE, 0, rkey, 0);
|
||||||
if (status != ERROR_SUCCESS) {
|
if (status != ERROR_SUCCESS) {
|
||||||
QString msg = qsl("App Error: could not create '%1' registry key, error %2").arg(QString::fromStdWString(key)).arg(qsl("%1: %2"));
|
QString msg = u"App Error: could not create '%1' registry key, error %2"_q.arg(QString::fromStdWString(key)).arg(u"%1: %2"_q);
|
||||||
_psLogError(msg.toUtf8().constData(), status);
|
_psLogError(msg.toUtf8().constData(), status);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QString msg = qsl("App Error: could not open '%1' registry key, error %2").arg(QString::fromStdWString(key)).arg(qsl("%1: %2"));
|
QString msg = u"App Error: could not open '%1' registry key, error %2"_q.arg(QString::fromStdWString(key)).arg(u"%1: %2"_q);
|
||||||
_psLogError(msg.toUtf8().constData(), status);
|
_psLogError(msg.toUtf8().constData(), status);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -504,10 +504,10 @@ namespace {
|
||||||
WCHAR defaultStr[bufSize] = { 0 };
|
WCHAR defaultStr[bufSize] = { 0 };
|
||||||
if (RegQueryValueEx(rkey, value, 0, &defaultType, (BYTE*)defaultStr, &defaultSize) != ERROR_SUCCESS || defaultType != REG_SZ || defaultSize != (v.size() + 1) * 2 || QString::fromStdWString(defaultStr) != v) {
|
if (RegQueryValueEx(rkey, value, 0, &defaultType, (BYTE*)defaultStr, &defaultSize) != ERROR_SUCCESS || defaultType != REG_SZ || defaultSize != (v.size() + 1) * 2 || QString::fromStdWString(defaultStr) != v) {
|
||||||
WCHAR tmp[bufSize] = { 0 };
|
WCHAR tmp[bufSize] = { 0 };
|
||||||
if (!v.isEmpty()) StringCbPrintf(tmp, bufSize, v.replace(QChar('%'), qsl("%%")).toStdWString().c_str());
|
if (!v.isEmpty()) StringCbPrintf(tmp, bufSize, v.replace(QChar('%'), u"%%"_q).toStdWString().c_str());
|
||||||
LSTATUS status = RegSetValueEx(rkey, value, 0, REG_SZ, (BYTE*)tmp, (wcslen(tmp) + 1) * sizeof(WCHAR));
|
LSTATUS status = RegSetValueEx(rkey, value, 0, REG_SZ, (BYTE*)tmp, (wcslen(tmp) + 1) * sizeof(WCHAR));
|
||||||
if (status != ERROR_SUCCESS) {
|
if (status != ERROR_SUCCESS) {
|
||||||
QString msg = qsl("App Error: could not set %1, error %2").arg(value ? ('\'' + QString::fromStdWString(value) + '\'') : qsl("(Default)")).arg("%1: %2");
|
QString msg = u"App Error: could not set %1, error %2"_q.arg(value ? ('\'' + QString::fromStdWString(value) + '\'') : u"(Default)"_q).arg("%1: %2");
|
||||||
_psLogError(msg.toUtf8().constData(), status);
|
_psLogError(msg.toUtf8().constData(), status);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,7 @@ QString systemShortcutPath() {
|
||||||
void cleanupShortcut() {
|
void cleanupShortcut() {
|
||||||
static const int maxFileLen = MAX_PATH * 10;
|
static const int maxFileLen = MAX_PATH * 10;
|
||||||
|
|
||||||
QString path = systemShortcutPath() + qsl("Telegram.lnk");
|
QString path = systemShortcutPath() + u"Telegram.lnk"_q;
|
||||||
std::wstring p = QDir::toNativeSeparators(path).toStdWString();
|
std::wstring p = QDir::toNativeSeparators(path).toStdWString();
|
||||||
|
|
||||||
DWORD attributes = GetFileAttributes(p.c_str());
|
DWORD attributes = GetFileAttributes(p.c_str());
|
||||||
|
|
|
@ -47,8 +47,8 @@ QByteArray gLocalSalt;
|
||||||
int gScreenScale = style::kScaleAuto;
|
int gScreenScale = style::kScaleAuto;
|
||||||
int gConfigScale = style::kScaleAuto;
|
int gConfigScale = style::kScaleAuto;
|
||||||
|
|
||||||
QString gDateFormat = qsl("dd.MM.yy");
|
QString gDateFormat = u"dd.MM.yy"_q;
|
||||||
QString gTimeFormat = qsl("hh:mm");
|
QString gTimeFormat = u"hh:mm"_q;
|
||||||
|
|
||||||
RecentStickerPreload gRecentStickersPreload;
|
RecentStickerPreload gRecentStickersPreload;
|
||||||
RecentStickerPack gRecentStickers;
|
RecentStickerPack gRecentStickers;
|
||||||
|
|
|
@ -636,9 +636,9 @@ void ChooseFromFile(
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Window::SessionController*> controller,
|
||||||
not_null<QWidget*> parent) {
|
not_null<QWidget*> parent) {
|
||||||
auto filters = QStringList(
|
auto filters = QStringList(
|
||||||
qsl("Theme files (*.tdesktop-theme *.tdesktop-palette *")
|
u"Theme files (*.tdesktop-theme *.tdesktop-palette *"_q
|
||||||
+ Ui::ImageExtensions().join(qsl(" *"))
|
+ Ui::ImageExtensions().join(u" *"_q)
|
||||||
+ qsl(")"));
|
+ u")"_q);
|
||||||
filters.push_back(FileDialog::AllFilesFilter());
|
filters.push_back(FileDialog::AllFilesFilter());
|
||||||
const auto callback = crl::guard(controller, [=](
|
const auto callback = crl::guard(controller, [=](
|
||||||
const FileDialog::OpenResult &result) {
|
const FileDialog::OpenResult &result) {
|
||||||
|
@ -674,7 +674,7 @@ void ChooseFromFile(
|
||||||
FileDialog::GetOpenPath(
|
FileDialog::GetOpenPath(
|
||||||
parent.get(),
|
parent.get(),
|
||||||
tr::lng_choose_image(tr::now),
|
tr::lng_choose_image(tr::now),
|
||||||
filters.join(qsl(";;")),
|
filters.join(u";;"_q),
|
||||||
crl::guard(parent, callback));
|
crl::guard(parent, callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1056,7 +1056,7 @@ void SetupDataStorage(
|
||||||
) | rpl::map([](const QString &text) {
|
) | rpl::map([](const QString &text) {
|
||||||
if (text.isEmpty()) {
|
if (text.isEmpty()) {
|
||||||
return tr::lng_download_path_default(tr::now);
|
return tr::lng_download_path_default(tr::now);
|
||||||
} else if (text == qsl("tmp")) {
|
} else if (text == u"tmp"_q) {
|
||||||
return tr::lng_download_path_temp(tr::now);
|
return tr::lng_download_path_temp(tr::now);
|
||||||
}
|
}
|
||||||
return QDir::toNativeSeparators(text);
|
return QDir::toNativeSeparators(text);
|
||||||
|
@ -1630,7 +1630,7 @@ void SetupSupport(
|
||||||
not_null<Ui::VerticalLayout*> container) {
|
not_null<Ui::VerticalLayout*> container) {
|
||||||
AddSkip(container);
|
AddSkip(container);
|
||||||
|
|
||||||
AddSubsectionTitle(container, rpl::single(qsl("Support settings")));
|
AddSubsectionTitle(container, rpl::single(u"Support settings"_q));
|
||||||
|
|
||||||
AddSkip(container, st::settingsSendTypeSkip);
|
AddSkip(container, st::settingsSendTypeSkip);
|
||||||
|
|
||||||
|
@ -1677,7 +1677,7 @@ void SetupSupport(
|
||||||
|
|
||||||
AddSkip(inner, st::settingsCheckboxesSkip);
|
AddSkip(inner, st::settingsCheckboxesSkip);
|
||||||
|
|
||||||
AddSubsectionTitle(inner, rpl::single(qsl("Load chats for a period")));
|
AddSubsectionTitle(inner, rpl::single(u"Load chats for a period"_q));
|
||||||
|
|
||||||
SetupSupportChatsLimitSlice(controller, inner);
|
SetupSupportChatsLimitSlice(controller, inner);
|
||||||
|
|
||||||
|
|
|
@ -75,61 +75,62 @@ using SessionController = Window::SessionController;
|
||||||
|
|
||||||
auto GenerateCodes() {
|
auto GenerateCodes() {
|
||||||
auto codes = std::map<QString, Fn<void(SessionController*)>>();
|
auto codes = std::map<QString, Fn<void(SessionController*)>>();
|
||||||
codes.emplace(qsl("debugmode"), [](SessionController *window) {
|
codes.emplace(u"debugmode"_q, [](SessionController *window) {
|
||||||
QString text = Logs::DebugEnabled()
|
QString text = Logs::DebugEnabled()
|
||||||
? qsl("Do you want to disable DEBUG logs?")
|
? u"Do you want to disable DEBUG logs?"_q
|
||||||
: qsl("Do you want to enable DEBUG logs?\n\n"
|
: u"Do you want to enable DEBUG logs?\n\nAll network events will be logged."_q;
|
||||||
"All network events will be logged.");
|
|
||||||
Ui::show(Ui::MakeConfirmBox({ text, [] {
|
Ui::show(Ui::MakeConfirmBox({ text, [] {
|
||||||
Core::App().switchDebugMode();
|
Core::App().switchDebugMode();
|
||||||
} }));
|
} }));
|
||||||
});
|
});
|
||||||
codes.emplace(qsl("viewlogs"), [](SessionController *window) {
|
codes.emplace(u"viewlogs"_q, [](SessionController *window) {
|
||||||
File::ShowInFolder(cWorkingDir() + "log.txt");
|
File::ShowInFolder(cWorkingDir() + "log.txt");
|
||||||
});
|
});
|
||||||
if (!Core::UpdaterDisabled()) {
|
if (!Core::UpdaterDisabled()) {
|
||||||
codes.emplace(qsl("testupdate"), [](SessionController *window) {
|
codes.emplace(u"testupdate"_q, [](SessionController *window) {
|
||||||
Core::UpdateChecker().test();
|
Core::UpdateChecker().test();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
codes.emplace(qsl("loadlang"), [](SessionController *window) {
|
codes.emplace(u"loadlang"_q, [](SessionController *window) {
|
||||||
Lang::CurrentCloudManager().switchToLanguage({ qsl("#custom") });
|
Lang::CurrentCloudManager().switchToLanguage({ u"#custom"_q });
|
||||||
});
|
});
|
||||||
codes.emplace(qsl("crashplease"), [](SessionController *window) {
|
codes.emplace(u"crashplease"_q, [](SessionController *window) {
|
||||||
Unexpected("Crashed in Settings!");
|
Unexpected("Crashed in Settings!");
|
||||||
});
|
});
|
||||||
codes.emplace(qsl("moderate"), [](SessionController *window) {
|
codes.emplace(u"moderate"_q, [](SessionController *window) {
|
||||||
auto text = Core::App().settings().moderateModeEnabled() ? qsl("Disable moderate mode?") : qsl("Enable moderate mode?");
|
auto text = Core::App().settings().moderateModeEnabled() ? u"Disable moderate mode?"_q : u"Enable moderate mode?"_q;
|
||||||
Ui::show(Ui::MakeConfirmBox({ text, [=] {
|
Ui::show(Ui::MakeConfirmBox({ text, [=] {
|
||||||
Core::App().settings().setModerateModeEnabled(!Core::App().settings().moderateModeEnabled());
|
Core::App().settings().setModerateModeEnabled(!Core::App().settings().moderateModeEnabled());
|
||||||
Core::App().saveSettingsDelayed();
|
Core::App().saveSettingsDelayed();
|
||||||
Ui::hideLayer();
|
Ui::hideLayer();
|
||||||
} }));
|
} }));
|
||||||
});
|
});
|
||||||
codes.emplace(qsl("getdifference"), [](SessionController *window) {
|
codes.emplace(u"getdifference"_q, [](SessionController *window) {
|
||||||
if (window) {
|
if (window) {
|
||||||
window->session().updates().getDifference();
|
window->session().updates().getDifference();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
codes.emplace(qsl("loadcolors"), [](SessionController *window) {
|
codes.emplace(u"loadcolors"_q, [](SessionController *window) {
|
||||||
FileDialog::GetOpenPath(Core::App().getFileDialogParent(), "Open palette file", "Palette (*.tdesktop-palette)", [](const FileDialog::OpenResult &result) {
|
FileDialog::GetOpenPath(Core::App().getFileDialogParent(), "Open palette file", "Palette (*.tdesktop-palette)", [](const FileDialog::OpenResult &result) {
|
||||||
if (!result.paths.isEmpty()) {
|
if (!result.paths.isEmpty()) {
|
||||||
Window::Theme::Apply(result.paths.front());
|
Window::Theme::Apply(result.paths.front());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
codes.emplace(qsl("videoplayer"), [](SessionController *window) {
|
codes.emplace(u"videoplayer"_q, [](SessionController *window) {
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto text = cUseExternalVideoPlayer() ? qsl("Use internal video player?") : qsl("Use external video player?");
|
auto text = cUseExternalVideoPlayer()
|
||||||
|
? u"Use internal video player?"_q
|
||||||
|
: u"Use external video player?"_q;
|
||||||
Ui::show(Ui::MakeConfirmBox({ text, [=] {
|
Ui::show(Ui::MakeConfirmBox({ text, [=] {
|
||||||
cSetUseExternalVideoPlayer(!cUseExternalVideoPlayer());
|
cSetUseExternalVideoPlayer(!cUseExternalVideoPlayer());
|
||||||
window->session().saveSettingsDelayed();
|
window->session().saveSettingsDelayed();
|
||||||
Ui::hideLayer();
|
Ui::hideLayer();
|
||||||
} }));
|
} }));
|
||||||
});
|
});
|
||||||
codes.emplace(qsl("endpoints"), [](SessionController *window) {
|
codes.emplace(u"endpoints"_q, [](SessionController *window) {
|
||||||
if (!Core::App().domain().started()) {
|
if (!Core::App().domain().started()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -154,7 +155,7 @@ auto GenerateCodes() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
codes.emplace(qsl("testmode"), [](SessionController *window) {
|
codes.emplace(u"testmode"_q, [](SessionController *window) {
|
||||||
auto &domain = Core::App().domain();
|
auto &domain = Core::App().domain();
|
||||||
if (domain.started()
|
if (domain.started()
|
||||||
&& (domain.accounts().size() == 1)
|
&& (domain.accounts().size() == 1)
|
||||||
|
@ -170,29 +171,29 @@ auto GenerateCodes() {
|
||||||
: "Switched to the production environment.");
|
: "Switched to the production environment.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
codes.emplace(qsl("folders"), [](SessionController *window) {
|
codes.emplace(u"folders"_q, [](SessionController *window) {
|
||||||
if (window) {
|
if (window) {
|
||||||
window->showSettings(Settings::Folders::Id());
|
window->showSettings(Settings::Folders::Id());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
codes.emplace(qsl("registertg"), [](SessionController *window) {
|
codes.emplace(u"registertg"_q, [](SessionController *window) {
|
||||||
Core::Application::RegisterUrlScheme();
|
Core::Application::RegisterUrlScheme();
|
||||||
Ui::Toast::Show("Forced custom scheme register.");
|
Ui::Toast::Show("Forced custom scheme register.");
|
||||||
});
|
});
|
||||||
codes.emplace(qsl("installlauncher"), [](SessionController *window) {
|
codes.emplace(u"installlauncher"_q, [](SessionController *window) {
|
||||||
Platform::InstallLauncher(true);
|
Platform::InstallLauncher(true);
|
||||||
Ui::Toast::Show("Forced launcher installation.");
|
Ui::Toast::Show("Forced launcher installation.");
|
||||||
});
|
});
|
||||||
|
|
||||||
#if defined Q_OS_WIN || defined Q_OS_MAC
|
#if defined Q_OS_WIN || defined Q_OS_MAC
|
||||||
codes.emplace(qsl("freetype"), [](SessionController *window) {
|
codes.emplace(u"freetype"_q, [](SessionController *window) {
|
||||||
auto text = cUseFreeType()
|
auto text = cUseFreeType()
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
? qsl("Switch font engine to GDI?")
|
? u"Switch font engine to GDI?"_q
|
||||||
#else // Q_OS_WIN
|
#else // Q_OS_WIN
|
||||||
? qsl("Switch font engine to Cocoa?")
|
? u"Switch font engine to Cocoa?"_q
|
||||||
#endif // !Q_OS_WIN
|
#endif // !Q_OS_WIN
|
||||||
: qsl("Switch font engine to FreeType?");
|
: u"Switch font engine to FreeType?"_q;
|
||||||
|
|
||||||
Ui::show(Ui::MakeConfirmBox({ text, [] {
|
Ui::show(Ui::MakeConfirmBox({ text, [] {
|
||||||
Core::App().switchFreeType();
|
Core::App().switchFreeType();
|
||||||
|
@ -200,14 +201,14 @@ auto GenerateCodes() {
|
||||||
});
|
});
|
||||||
#endif // Q_OS_WIN || Q_OS_MAC
|
#endif // Q_OS_WIN || Q_OS_MAC
|
||||||
|
|
||||||
auto audioFilters = qsl("Audio files (*.wav *.mp3);;") + FileDialog::AllFilesFilter();
|
auto audioFilters = u"Audio files (*.wav *.mp3);;"_q + FileDialog::AllFilesFilter();
|
||||||
auto audioKeys = {
|
auto audioKeys = {
|
||||||
qsl("msg_incoming"),
|
u"msg_incoming"_q,
|
||||||
qsl("call_incoming"),
|
u"call_incoming"_q,
|
||||||
qsl("call_outgoing"),
|
u"call_outgoing"_q,
|
||||||
qsl("call_busy"),
|
u"call_busy"_q,
|
||||||
qsl("call_connect"),
|
u"call_connect"_q,
|
||||||
qsl("call_end"),
|
u"call_end"_q,
|
||||||
};
|
};
|
||||||
for (auto &key : audioKeys) {
|
for (auto &key : audioKeys) {
|
||||||
codes.emplace(key, [=](SessionController *window) {
|
codes.emplace(key, [=](SessionController *window) {
|
||||||
|
@ -228,12 +229,12 @@ auto GenerateCodes() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
codes.emplace(qsl("sounds_reset"), [](SessionController *window) {
|
codes.emplace(u"sounds_reset"_q, [](SessionController *window) {
|
||||||
Core::App().settings().clearSoundOverrides();
|
Core::App().settings().clearSoundOverrides();
|
||||||
Core::App().saveSettingsDelayed();
|
Core::App().saveSettingsDelayed();
|
||||||
Ui::show(Ui::MakeInformBox("All sound overrides were reset."));
|
Ui::show(Ui::MakeInformBox("All sound overrides were reset."));
|
||||||
});
|
});
|
||||||
codes.emplace(qsl("unpacklog"), [](SessionController *window) {
|
codes.emplace(u"unpacklog"_q, [](SessionController *window) {
|
||||||
FileDialog::GetOpenPath(Core::App().getFileDialogParent(), "Open crash log file", "Crash dump (*.txt)", [=](const FileDialog::OpenResult &result) {
|
FileDialog::GetOpenPath(Core::App().getFileDialogParent(), "Open crash log file", "Crash dump (*.txt)", [=](const FileDialog::OpenResult &result) {
|
||||||
if (result.paths.isEmpty()) {
|
if (result.paths.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
@ -277,15 +278,15 @@ auto GenerateCodes() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
codes.emplace(qsl("testchatcolors"), [](SessionController *window) {
|
codes.emplace(u"testchatcolors"_q, [](SessionController *window) {
|
||||||
const auto now = !Data::CloudThemes::TestingColors();
|
const auto now = !Data::CloudThemes::TestingColors();
|
||||||
Data::CloudThemes::SetTestingColors(now);
|
Data::CloudThemes::SetTestingColors(now);
|
||||||
Ui::Toast::Show(now ? "Testing chat theme colors!" : "Not testing..");
|
Ui::Toast::Show(now ? "Testing chat theme colors!" : "Not testing..");
|
||||||
});
|
});
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
codes.emplace(qsl("customicon"), [](SessionController *window) {
|
codes.emplace(u"customicon"_q, [](SessionController *window) {
|
||||||
const auto iconFilters = qsl("Icon files (*.icns *.png);;") + FileDialog::AllFilesFilter();
|
const auto iconFilters = u"Icon files (*.icns *.png);;"_q + FileDialog::AllFilesFilter();
|
||||||
const auto change = [](const QString &path) {
|
const auto change = [](const QString &path) {
|
||||||
const auto success = path.isEmpty()
|
const auto success = path.isEmpty()
|
||||||
? base::ClearCustomAppIcon()
|
? base::ClearCustomAppIcon()
|
||||||
|
|
|
@ -265,7 +265,7 @@ void SetupLanguageButton(
|
||||||
button->addClickHandler([=] {
|
button->addClickHandler([=] {
|
||||||
const auto m = button->clickModifiers();
|
const auto m = button->clickModifiers();
|
||||||
if ((m & Qt::ShiftModifier) && (m & Qt::AltModifier)) {
|
if ((m & Qt::ShiftModifier) && (m & Qt::AltModifier)) {
|
||||||
Lang::CurrentCloudManager().switchToLanguage({ qsl("#custom") });
|
Lang::CurrentCloudManager().switchToLanguage({ u"#custom"_q });
|
||||||
} else {
|
} else {
|
||||||
*guard = LanguageBox::Show();
|
*guard = LanguageBox::Show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,7 +309,7 @@ void NotificationsCount::prepareNotificationSampleLarge() {
|
||||||
p.setPen(st::dialogsNameFg);
|
p.setPen(st::dialogsNameFg);
|
||||||
p.setFont(st::msgNameFont);
|
p.setFont(st::msgNameFont);
|
||||||
|
|
||||||
auto notifyTitle = st::msgNameFont->elided(qsl("Telegram Desktop"), rectForName.width());
|
auto notifyTitle = st::msgNameFont->elided(u"Telegram Desktop"_q, rectForName.width());
|
||||||
p.drawText(rectForName.left(), rectForName.top() + st::msgNameFont->ascent, notifyTitle);
|
p.drawText(rectForName.left(), rectForName.top() + st::msgNameFont->ascent, notifyTitle);
|
||||||
|
|
||||||
st::notifyClose.icon.paint(p, w - st::notifyClosePos.x() - st::notifyClose.width + st::notifyClose.iconPosition.x(), st::notifyClosePos.y() + st::notifyClose.iconPosition.y(), w);
|
st::notifyClose.icon.paint(p, w - st::notifyClosePos.x() - st::notifyClose.width + st::notifyClose.iconPosition.x(), st::notifyClosePos.y() + st::notifyClose.iconPosition.y(), w);
|
||||||
|
|
|
@ -502,7 +502,7 @@ void Uploader::sendNext() {
|
||||||
}
|
}
|
||||||
const auto thumbFilename = uploadingData.file
|
const auto thumbFilename = uploadingData.file
|
||||||
? uploadingData.file->thumbname
|
? uploadingData.file->thumbname
|
||||||
: (qsl("thumb.") + uploadingData.media.thumbExt);
|
: (u"thumb."_q + uploadingData.media.thumbExt);
|
||||||
const auto thumbMd5 = uploadingData.file
|
const auto thumbMd5 = uploadingData.file
|
||||||
? uploadingData.file->thumbmd5
|
? uploadingData.file->thumbmd5
|
||||||
: uploadingData.media.jpeg_md5;
|
: uploadingData.media.jpeg_md5;
|
||||||
|
|
|
@ -113,7 +113,7 @@ struct PreparedFileThumbnail {
|
||||||
const QString &filemime,
|
const QString &filemime,
|
||||||
int64 filesize,
|
int64 filesize,
|
||||||
bool isSticker) {
|
bool isSticker) {
|
||||||
prepared.name = isSticker ? qsl("thumb.webp") : qsl("thumb.jpg");
|
prepared.name = isSticker ? u"thumb.webp"_q : u"thumb.jpg"_q;
|
||||||
if (FileThumbnailUploadRequired(filemime, filesize)) {
|
if (FileThumbnailUploadRequired(filemime, filesize)) {
|
||||||
const auto format = isSticker ? "WEBP" : "JPG";
|
const auto format = isSticker ? "WEBP" : "JPG";
|
||||||
auto buffer = QBuffer(&prepared.bytes);
|
auto buffer = QBuffer(&prepared.bytes);
|
||||||
|
@ -784,7 +784,7 @@ void FileLoadTask::process(Args &&args) {
|
||||||
} else if (!_content.isEmpty()) {
|
} else if (!_content.isEmpty()) {
|
||||||
filesize = _content.size();
|
filesize = _content.size();
|
||||||
if (isVoice) {
|
if (isVoice) {
|
||||||
filename = filedialogDefaultName(qsl("audio"), qsl(".ogg"), QString(), true);
|
filename = filedialogDefaultName(u"audio"_q, u".ogg"_q, QString(), true);
|
||||||
filemime = "audio/ogg";
|
filemime = "audio/ogg";
|
||||||
} else {
|
} else {
|
||||||
if (_information) {
|
if (_information) {
|
||||||
|
@ -803,16 +803,16 @@ void FileLoadTask::process(Args &&args) {
|
||||||
fullimagebytes = fullimageformat = QByteArray();
|
fullimagebytes = fullimageformat = QByteArray();
|
||||||
}
|
}
|
||||||
if (filemime == "image/jpeg") {
|
if (filemime == "image/jpeg") {
|
||||||
filename = filedialogDefaultName(qsl("photo"), qsl(".jpg"), QString(), true);
|
filename = filedialogDefaultName(u"photo"_q, u".jpg"_q, QString(), true);
|
||||||
} else if (filemime == "image/png") {
|
} else if (filemime == "image/png") {
|
||||||
filename = filedialogDefaultName(qsl("image"), qsl(".png"), QString(), true);
|
filename = filedialogDefaultName(u"image"_q, u".png"_q, QString(), true);
|
||||||
} else {
|
} else {
|
||||||
QString ext;
|
QString ext;
|
||||||
QStringList patterns = mimeType.globPatterns();
|
QStringList patterns = mimeType.globPatterns();
|
||||||
if (!patterns.isEmpty()) {
|
if (!patterns.isEmpty()) {
|
||||||
ext = patterns.front().replace('*', QString());
|
ext = patterns.front().replace('*', QString());
|
||||||
}
|
}
|
||||||
filename = filedialogDefaultName(qsl("file"), ext, QString(), true);
|
filename = filedialogDefaultName(u"file"_q, ext, QString(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -829,14 +829,14 @@ void FileLoadTask::process(Args &&args) {
|
||||||
if (ValidateThumbDimensions(fullimage.width(), fullimage.height())) {
|
if (ValidateThumbDimensions(fullimage.width(), fullimage.height())) {
|
||||||
filesize = -1; // Fill later.
|
filesize = -1; // Fill later.
|
||||||
filemime = Core::MimeTypeForName("image/jpeg").name();
|
filemime = Core::MimeTypeForName("image/jpeg").name();
|
||||||
filename = filedialogDefaultName(qsl("image"), qsl(".jpg"), QString(), true);
|
filename = filedialogDefaultName(u"image"_q, u".jpg"_q, QString(), true);
|
||||||
} else {
|
} else {
|
||||||
_type = SendMediaType::File;
|
_type = SendMediaType::File;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_type == SendMediaType::File) {
|
if (_type == SendMediaType::File) {
|
||||||
filemime = Core::MimeTypeForName("image/png").name();
|
filemime = Core::MimeTypeForName("image/png").name();
|
||||||
filename = filedialogDefaultName(qsl("image"), qsl(".png"), QString(), true);
|
filename = filedialogDefaultName(u"image"_q, u".png"_q, QString(), true);
|
||||||
{
|
{
|
||||||
QBuffer buffer(&_content);
|
QBuffer buffer(&_content);
|
||||||
fullimage.save(&buffer, "PNG");
|
fullimage.save(&buffer, "PNG");
|
||||||
|
|
|
@ -143,7 +143,7 @@ void applyReadContext(ReadSettingsContext &&context) {
|
||||||
|
|
||||||
bool _readOldSettings(bool remove, ReadSettingsContext &context) {
|
bool _readOldSettings(bool remove, ReadSettingsContext &context) {
|
||||||
bool result = false;
|
bool result = false;
|
||||||
QFile file(cWorkingDir() + qsl("tdata/config"));
|
auto file = QFile(cWorkingDir() + u"tdata/config"_q);
|
||||||
if (file.open(QIODevice::ReadOnly)) {
|
if (file.open(QIODevice::ReadOnly)) {
|
||||||
LOG(("App Info: reading old config..."));
|
LOG(("App Info: reading old config..."));
|
||||||
QDataStream stream(&file);
|
QDataStream stream(&file);
|
||||||
|
@ -240,9 +240,9 @@ void _readOldUserSettingsFields(
|
||||||
bool _readOldUserSettings(bool remove, ReadSettingsContext &context) {
|
bool _readOldUserSettings(bool remove, ReadSettingsContext &context) {
|
||||||
bool result = false;
|
bool result = false;
|
||||||
// We dropped old test authorizations when migrated to multi auth.
|
// We dropped old test authorizations when migrated to multi auth.
|
||||||
//const auto testPrefix = (cTestMode() ? qsl("_test") : QString());
|
//const auto testPrefix = (cTestMode() ? u"_test"_q : QString());
|
||||||
const auto testPrefix = QString();
|
const auto testPrefix = QString();
|
||||||
QFile file(cWorkingDir() + cDataFile() + testPrefix + qsl("_config"));
|
QFile file(cWorkingDir() + cDataFile() + testPrefix + u"_config"_q);
|
||||||
if (file.open(QIODevice::ReadOnly)) {
|
if (file.open(QIODevice::ReadOnly)) {
|
||||||
LOG(("App Info: reading old user config..."));
|
LOG(("App Info: reading old user config..."));
|
||||||
qint32 version = 0;
|
qint32 version = 0;
|
||||||
|
@ -321,7 +321,7 @@ void _readOldMtpDataFields(
|
||||||
bool _readOldMtpData(bool remove, ReadSettingsContext &context) {
|
bool _readOldMtpData(bool remove, ReadSettingsContext &context) {
|
||||||
bool result = false;
|
bool result = false;
|
||||||
// We dropped old test authorizations when migrated to multi auth.
|
// We dropped old test authorizations when migrated to multi auth.
|
||||||
//const auto testPostfix = (cTestMode() ? qsl("_test") : QString());
|
//const auto testPostfix = (cTestMode() ? u"_test"_q : QString());
|
||||||
const auto testPostfix = QString();
|
const auto testPostfix = QString();
|
||||||
QFile file(cWorkingDir() + cDataFile() + testPostfix);
|
QFile file(cWorkingDir() + cDataFile() + testPostfix);
|
||||||
if (file.open(QIODevice::ReadOnly)) {
|
if (file.open(QIODevice::ReadOnly)) {
|
||||||
|
@ -355,13 +355,13 @@ void start() {
|
||||||
|
|
||||||
_localLoader = new TaskQueue(kFileLoaderQueueStopTimeout);
|
_localLoader = new TaskQueue(kFileLoaderQueueStopTimeout);
|
||||||
|
|
||||||
_basePath = cWorkingDir() + qsl("tdata/");
|
_basePath = cWorkingDir() + u"tdata/"_q;
|
||||||
if (!QDir().exists(_basePath)) QDir().mkpath(_basePath);
|
if (!QDir().exists(_basePath)) QDir().mkpath(_basePath);
|
||||||
|
|
||||||
ReadSettingsContext context;
|
ReadSettingsContext context;
|
||||||
FileReadDescriptor settingsData;
|
FileReadDescriptor settingsData;
|
||||||
// We dropped old test authorizations when migrated to multi auth.
|
// We dropped old test authorizations when migrated to multi auth.
|
||||||
//const auto name = cTestMode() ? qsl("settings_test") : qsl("settings");
|
//const auto name = cTestMode() ? u"settings_test"_q : u"settings"_q;
|
||||||
const auto name = u"settings"_q;
|
const auto name = u"settings"_q;
|
||||||
if (!ReadFile(settingsData, name, _basePath)) {
|
if (!ReadFile(settingsData, name, _basePath)) {
|
||||||
_readOldSettings(true, context);
|
_readOldSettings(true, context);
|
||||||
|
@ -442,7 +442,7 @@ void writeSettings() {
|
||||||
if (!QDir().exists(_basePath)) QDir().mkpath(_basePath);
|
if (!QDir().exists(_basePath)) QDir().mkpath(_basePath);
|
||||||
|
|
||||||
// We dropped old test authorizations when migrated to multi auth.
|
// We dropped old test authorizations when migrated to multi auth.
|
||||||
//const auto name = cTestMode() ? qsl("settings_test") : qsl("settings");
|
//const auto name = cTestMode() ? u"settings_test"_q : u"settings"_q;
|
||||||
const auto name = u"settings"_q;
|
const auto name = u"settings"_q;
|
||||||
FileWriteDescriptor settings(name, _basePath);
|
FileWriteDescriptor settings(name, _basePath);
|
||||||
if (_settingsSalt.isEmpty() || !SettingsKey) {
|
if (_settingsSalt.isEmpty() || !SettingsKey) {
|
||||||
|
|
|
@ -97,7 +97,7 @@ auto EmptyMessageDraftSources()
|
||||||
|
|
||||||
[[nodiscard]] FileKey ComputeDataNameKey(const QString &dataName) {
|
[[nodiscard]] FileKey ComputeDataNameKey(const QString &dataName) {
|
||||||
// We dropped old test authorizations when migrated to multi auth.
|
// We dropped old test authorizations when migrated to multi auth.
|
||||||
//const auto testAddition = (cTestMode() ? qsl(":/test/") : QString());
|
//const auto testAddition = (cTestMode() ? u":/test/"_q : QString());
|
||||||
const auto testAddition = QString();
|
const auto testAddition = QString();
|
||||||
const auto dataNameUtf8 = (dataName + testAddition).toUtf8();
|
const auto dataNameUtf8 = (dataName + testAddition).toUtf8();
|
||||||
FileKey dataNameHash[2] = { 0 };
|
FileKey dataNameHash[2] = { 0 };
|
||||||
|
@ -106,7 +106,7 @@ auto EmptyMessageDraftSources()
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] QString BaseGlobalPath() {
|
[[nodiscard]] QString BaseGlobalPath() {
|
||||||
return cWorkingDir() + qsl("tdata/");
|
return cWorkingDir() + u"tdata/"_q;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] QString ComputeDatabasePath(const QString &dataName) {
|
[[nodiscard]] QString ComputeDatabasePath(const QString &dataName) {
|
||||||
|
@ -118,7 +118,7 @@ auto EmptyMessageDraftSources()
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] QString LegacyTempDirectory() {
|
[[nodiscard]] QString LegacyTempDirectory() {
|
||||||
return cWorkingDir() + qsl("tdata/tdld/");
|
return cWorkingDir() + u"tdata/tdld/"_q;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -243,7 +243,7 @@ Account::ReadMapResult Account::readMapWith(
|
||||||
auto ms = crl::now();
|
auto ms = crl::now();
|
||||||
|
|
||||||
FileReadDescriptor mapData;
|
FileReadDescriptor mapData;
|
||||||
if (!ReadFile(mapData, qsl("map"), _basePath)) {
|
if (!ReadFile(mapData, u"map"_q, _basePath)) {
|
||||||
return ReadMapResult::Failed;
|
return ReadMapResult::Failed;
|
||||||
}
|
}
|
||||||
LOG(("App Info: reading map..."));
|
LOG(("App Info: reading map..."));
|
||||||
|
@ -1839,7 +1839,7 @@ void Account::readStickerSets(
|
||||||
setTitle = tr::lng_stickers_default_set(tr::now);
|
setTitle = tr::lng_stickers_default_set(tr::now);
|
||||||
setFlags |= SetFlag::Official | SetFlag::Special;
|
setFlags |= SetFlag::Official | SetFlag::Special;
|
||||||
} else if (setId == Data::Stickers::CustomSetId) {
|
} else if (setId == Data::Stickers::CustomSetId) {
|
||||||
setTitle = qsl("Custom stickers");
|
setTitle = u"Custom stickers"_q;
|
||||||
setFlags |= SetFlag::Special;
|
setFlags |= SetFlag::Special;
|
||||||
} else if ((setId == Data::Stickers::CloudRecentSetId)
|
} else if ((setId == Data::Stickers::CloudRecentSetId)
|
||||||
|| (setId == Data::Stickers::CloudRecentAttachedSetId)) {
|
|| (setId == Data::Stickers::CloudRecentAttachedSetId)) {
|
||||||
|
@ -2199,7 +2199,7 @@ void Account::importOldRecentStickers() {
|
||||||
Data::Stickers::CustomSetId,
|
Data::Stickers::CustomSetId,
|
||||||
uint64(0), // accessHash
|
uint64(0), // accessHash
|
||||||
uint64(0), // hash
|
uint64(0), // hash
|
||||||
qsl("Custom stickers"),
|
u"Custom stickers"_q,
|
||||||
QString(),
|
QString(),
|
||||||
0, // count
|
0, // count
|
||||||
(SetFlag::Installed | SetFlag::Special),
|
(SetFlag::Installed | SetFlag::Special),
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace {
|
||||||
using namespace details;
|
using namespace details;
|
||||||
|
|
||||||
[[nodiscard]] QString BaseGlobalPath() {
|
[[nodiscard]] QString BaseGlobalPath() {
|
||||||
return cWorkingDir() + qsl("tdata/");
|
return cWorkingDir() + u"tdata/"_q;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] QString ComputeKeyName(const QString &dataName) {
|
[[nodiscard]] QString ComputeKeyName(const QString &dataName) {
|
||||||
|
|
|
@ -132,7 +132,7 @@ bool ValidateEditMediaDragData(
|
||||||
}
|
}
|
||||||
|
|
||||||
MimeDataState ComputeMimeDataState(const QMimeData *data) {
|
MimeDataState ComputeMimeDataState(const QMimeData *data) {
|
||||||
if (!data || data->hasFormat(qsl("application/x-td-forward"))) {
|
if (!data || data->hasFormat(u"application/x-td-forward"_q)) {
|
||||||
return MimeDataState::None;
|
return MimeDataState::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -398,7 +398,7 @@ void Autocomplete::setupContent() {
|
||||||
object_ptr<Ui::InputField>(
|
object_ptr<Ui::InputField>(
|
||||||
this,
|
this,
|
||||||
st::gifsSearchField,
|
st::gifsSearchField,
|
||||||
rpl::single(qsl("Search for templates"))), // #TODO hard_lang
|
rpl::single(u"Search for templates"_q)), // #TODO hard_lang
|
||||||
st::autocompleteSearchPadding);
|
st::autocompleteSearchPadding);
|
||||||
const auto input = inputWrap->entity();
|
const auto input = inputWrap->entity();
|
||||||
const auto scroll = Ui::CreateChild<Ui::ScrollArea>(this);
|
const auto scroll = Ui::CreateChild<Ui::ScrollArea>(this);
|
||||||
|
@ -510,7 +510,7 @@ ConfirmContactBox::ConfirmContactBox(
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfirmContactBox::prepare() {
|
void ConfirmContactBox::prepare() {
|
||||||
setTitle(rpl::single(qsl("Confirmation"))); // #TODO hard_lang
|
setTitle(rpl::single(u"Confirmation"_q)); // #TODO hard_lang
|
||||||
|
|
||||||
auto maxWidth = 0;
|
auto maxWidth = 0;
|
||||||
if (_comment) {
|
if (_comment) {
|
||||||
|
|
|
@ -77,7 +77,7 @@ EditInfoBox::EditInfoBox(
|
||||||
this,
|
this,
|
||||||
st::supportInfoField,
|
st::supportInfoField,
|
||||||
Ui::InputField::Mode::MultiLine,
|
Ui::InputField::Mode::MultiLine,
|
||||||
rpl::single(qsl("Support information")), // #TODO hard_lang
|
rpl::single(u"Support information"_q), // #TODO hard_lang
|
||||||
text)
|
text)
|
||||||
, _submit(std::move(submit)) {
|
, _submit(std::move(submit)) {
|
||||||
_field->setMaxLength(kMaxSupportInfoLength);
|
_field->setMaxLength(kMaxSupportInfoLength);
|
||||||
|
@ -95,7 +95,7 @@ EditInfoBox::EditInfoBox(
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditInfoBox::prepare() {
|
void EditInfoBox::prepare() {
|
||||||
setTitle(rpl::single(qsl("Edit support information"))); // #TODO hard_lang
|
setTitle(rpl::single(u"Edit support information"_q)); // #TODO hard_lang
|
||||||
|
|
||||||
const auto save = [=] {
|
const auto save = [=] {
|
||||||
const auto done = crl::guard(this, [=](bool success) {
|
const auto done = crl::guard(this, [=](bool success) {
|
||||||
|
@ -270,7 +270,7 @@ Helper::Helper(not_null<Main::Session*> session)
|
||||||
});
|
});
|
||||||
}).fail([=] {
|
}).fail([=] {
|
||||||
setSupportName(
|
setSupportName(
|
||||||
qsl("[rand^")
|
u"[rand^"_q
|
||||||
+ QString::number(Core::Sandbox::Instance().installationTag())
|
+ QString::number(Core::Sandbox::Instance().installationTag())
|
||||||
+ ']');
|
+ ']');
|
||||||
}).send();
|
}).send();
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue