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