mirror of https://github.com/procxx/kepka.git
Replace str_const with base::const_string.
This commit is contained in:
parent
c03df169b3
commit
74d848311b
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "chat_helpers/gifs_list_widget.h"
|
||||
|
||||
#include "base/const_string.h"
|
||||
#include "data/data_photo.h"
|
||||
#include "data/data_document.h"
|
||||
#include "data/data_session.h"
|
||||
|
@ -37,7 +38,7 @@ namespace {
|
|||
constexpr auto kSaveChosenTabTimeout = 1000;
|
||||
constexpr auto kSearchRequestDelay = 400;
|
||||
constexpr auto kInlineItemsMaxPerRow = 5;
|
||||
constexpr auto kSearchBotUsername = str_const("gif");
|
||||
constexpr auto kSearchBotUsername = "gif"_cs;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -857,7 +858,7 @@ void GifsListWidget::searchForGifs(const QString &query) {
|
|||
}
|
||||
|
||||
if (!_searchBot && !_searchBotRequestId) {
|
||||
auto username = str_const_toString(kSearchBotUsername);
|
||||
auto username = kSearchBotUsername.utf16();
|
||||
_searchBotRequestId = _api.request(MTPcontacts_ResolveUsername(
|
||||
MTP_string(username)
|
||||
)).done([=](const MTPcontacts_ResolvedPeer &result) {
|
||||
|
|
|
@ -10,12 +10,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "core/version.h"
|
||||
#include "settings.h"
|
||||
|
||||
constexpr str_const AppNameOld = "Telegram Win (Unofficial)";
|
||||
constexpr str_const AppName = "Telegram Desktop";
|
||||
|
||||
constexpr str_const AppId = "{53F49750-6209-4FBF-9CA8-7A333C87D1ED}"; // used in updater.cpp and Setup.iss for Windows
|
||||
constexpr str_const AppFile = "Telegram";
|
||||
|
||||
enum {
|
||||
MaxSelectedItems = 100,
|
||||
|
||||
|
|
|
@ -155,8 +155,8 @@ QString DefaultDownloadPath() {
|
|||
QStandardPaths::DownloadLocation)
|
||||
+ '/'
|
||||
+ (Main::Session::Exists() && Auth().supportMode()
|
||||
? "Tsupport Desktop"
|
||||
: str_const_toString(AppName))
|
||||
? "Tsupport Desktop"_cs
|
||||
: AppName).utf16()
|
||||
+ '/';
|
||||
}
|
||||
|
||||
|
|
|
@ -47,41 +47,6 @@ T *SharedMemoryLocation() {
|
|||
return reinterpret_cast<T*>(_SharedMemoryLocation + N);
|
||||
}
|
||||
|
||||
// see https://github.com/boostcon/cppnow_presentations_2012/blob/master/wed/schurr_cpp11_tools_for_class_authors.pdf
|
||||
class str_const { // constexpr string
|
||||
public:
|
||||
constexpr str_const(const char *str, std::size_t size)
|
||||
: _str(str)
|
||||
, _size(size) {
|
||||
}
|
||||
template <std::size_t N>
|
||||
constexpr str_const(const char(&a)[N]) : str_const(a, N - 1) {
|
||||
}
|
||||
constexpr char operator[](std::size_t n) const {
|
||||
return (n < _size) ? _str[n] :
|
||||
#ifndef OS_MAC_OLD
|
||||
throw std::out_of_range("");
|
||||
#else // OS_MAC_OLD
|
||||
throw std::exception();
|
||||
#endif // OS_MAC_OLD
|
||||
}
|
||||
constexpr std::size_t size() const { return _size; }
|
||||
constexpr const char *c_str() const { return _str; }
|
||||
|
||||
private:
|
||||
const char* const _str;
|
||||
const std::size_t _size;
|
||||
|
||||
};
|
||||
|
||||
inline QString str_const_toString(const str_const &str) {
|
||||
return QString::fromUtf8(str.c_str(), str.size());
|
||||
}
|
||||
|
||||
inline QByteArray str_const_toByteArray(const str_const &str) {
|
||||
return QByteArray::fromRawData(str.c_str(), str.size());
|
||||
}
|
||||
|
||||
inline void mylocaltime(struct tm * _Tm, const time_t * _Time) {
|
||||
#ifdef Q_OS_WIN
|
||||
localtime_s(_Tm, _Time);
|
||||
|
|
|
@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "base/const_string.h"
|
||||
|
||||
#define TDESKTOP_REQUESTED_ALPHA_VERSION (0ULL)
|
||||
|
||||
#ifdef TDESKTOP_ALLOW_CLOSED_ALPHA
|
||||
|
@ -15,6 +17,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#define TDESKTOP_ALPHA_VERSION (0ULL)
|
||||
#endif // TDESKTOP_ALLOW_CLOSED_ALPHA
|
||||
|
||||
// used in Updater.cpp and Setup.iss for Windows
|
||||
constexpr auto AppId = "{53F49750-6209-4FBF-9CA8-7A333C87D1ED}"_cs;
|
||||
constexpr auto AppNameOld = "Telegram Win (Unofficial)"_cs;
|
||||
constexpr auto AppName = "Telegram Desktop"_cs;
|
||||
constexpr auto AppFile = "Telegram"_cs;
|
||||
constexpr auto AppVersion = 1009009;
|
||||
constexpr auto AppVersionStr = "1.9.9";
|
||||
constexpr auto AppBetaVersion = false;
|
||||
|
|
|
@ -20,9 +20,9 @@ namespace {
|
|||
|
||||
const auto kSerializeVersionTag = qsl("#new");
|
||||
constexpr auto kSerializeVersion = 1;
|
||||
constexpr auto kDefaultLanguage = str_const("en");
|
||||
constexpr auto kCloudLangPackName = str_const("tdesktop");
|
||||
constexpr auto kCustomLanguage = str_const("#custom");
|
||||
constexpr auto kDefaultLanguage = "en"_cs;
|
||||
constexpr auto kCloudLangPackName = "tdesktop"_cs;
|
||||
constexpr auto kCustomLanguage = "#custom"_cs;
|
||||
constexpr auto kLangValuesLimit = 20000;
|
||||
|
||||
std::vector<QString> PrepareDefaultValues() {
|
||||
|
@ -213,7 +213,7 @@ void ParseKeyValue(
|
|||
} // namespace
|
||||
|
||||
QString DefaultLanguageId() {
|
||||
return str_const_toString(kDefaultLanguage);
|
||||
return kDefaultLanguage.utf16();
|
||||
}
|
||||
|
||||
QString LanguageIdOrDefault(const QString &id) {
|
||||
|
@ -221,11 +221,11 @@ QString LanguageIdOrDefault(const QString &id) {
|
|||
}
|
||||
|
||||
QString CloudLangPackName() {
|
||||
return str_const_toString(kCloudLangPackName);
|
||||
return kCloudLangPackName.utf16();
|
||||
}
|
||||
|
||||
QString CustomLanguageId() {
|
||||
return str_const_toString(kCustomLanguage);
|
||||
return kCustomLanguage.utf16();
|
||||
}
|
||||
|
||||
Language DefaultLanguage() {
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace {
|
|||
|
||||
constexpr auto kSendNextTimeout = crl::time(800);
|
||||
|
||||
constexpr auto kPublicKey = str_const("\
|
||||
constexpr auto kPublicKey = "\
|
||||
-----BEGIN RSA PUBLIC KEY-----\n\
|
||||
MIIBCgKCAQEAyr+18Rex2ohtVy8sroGPBwXD3DOoKCSpjDqYoXgCqB7ioln4eDCF\n\
|
||||
fOBUlfXUEvM/fnKCpF46VkAftlb4VuPDeQSS/ZxZYEGqHaywlroVnXHIjgqoxiAd\n\
|
||||
|
@ -33,7 +33,7 @@ fOBUlfXUEvM/fnKCpF46VkAftlb4VuPDeQSS/ZxZYEGqHaywlroVnXHIjgqoxiAd\n\
|
|||
fDK/NWcvGqa0w/nriMD6mDjKOryamw0OP9QuYgMN0C9xMW9y8SmP4h92OAWodTYg\n\
|
||||
Y1hZCxdv6cs5UnW9+PWvS+WIbkh+GaWYxwIDAQAB\n\
|
||||
-----END RSA PUBLIC KEY-----\
|
||||
");
|
||||
"_cs;
|
||||
|
||||
const auto kRemoteProject = "peak-vista-421";
|
||||
const auto kFireProject = "reserve-5a846";
|
||||
|
@ -436,9 +436,7 @@ bool SpecialConfigRequest::decryptSimpleConfig(const QByteArray &bytes) {
|
|||
return false;
|
||||
}
|
||||
|
||||
auto publicKey = details::RSAPublicKey(bytes::make_span(
|
||||
kPublicKey.c_str(),
|
||||
kPublicKey.size()));
|
||||
auto publicKey = details::RSAPublicKey(bytes::make_span(kPublicKey));
|
||||
auto decrypted = publicKey.decrypt(bytes::make_span(decodedBytes));
|
||||
auto decryptedBytes = gsl::make_span(decrypted);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
namespace Platform {
|
||||
namespace {
|
||||
|
||||
constexpr auto kLauncherBasename = str_const(MACRO_TO_STRING(TDESKTOP_LAUNCHER_BASENAME) ".desktop");
|
||||
constexpr auto kLauncherBasename = MACRO_TO_STRING(TDESKTOP_LAUNCHER_BASENAME) ".desktop"_cs;
|
||||
|
||||
bool noQtTrayIcon = false, tryAppIndicator = false;
|
||||
bool useGtkBase = false, useAppIndicator = false, useStatusIcon = false, trayIconChecked = false, useUnityCount = false;
|
||||
|
@ -557,9 +557,9 @@ void MainWindow::psFirstShow() {
|
|||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
if (QDBusInterface("com.canonical.Unity", "/").isValid()) {
|
||||
auto snapName = QString::fromLatin1(qgetenv("SNAP_NAME"));
|
||||
if(snapName.isEmpty()) {
|
||||
if (snapName.isEmpty()) {
|
||||
std::vector<QString> possibleDesktopFiles = {
|
||||
str_const_toString(kLauncherBasename),
|
||||
kLauncherBasename.utf16(),
|
||||
"Telegram.desktop"
|
||||
};
|
||||
|
||||
|
@ -577,10 +577,10 @@ void MainWindow::psFirstShow() {
|
|||
} else {
|
||||
LOG(("SNAP Environment detected, setting Launcher entry to %1_%2.desktop!")
|
||||
.arg(snapName)
|
||||
.arg(str_const_toString(kLauncherBasename)));
|
||||
.arg(kLauncherBasename.utf16()));
|
||||
_desktopFile = snapName
|
||||
+ '_'
|
||||
+ str_const_toString(kLauncherBasename);
|
||||
+ kLauncherBasename.utf16();
|
||||
useUnityCount=true;
|
||||
}
|
||||
_dbusPath = "/com/canonical/unity/launcherentry/" + QString::number(djbStringHash("application://" + _desktopFile));
|
||||
|
|
|
@ -23,8 +23,8 @@ namespace Notifications {
|
|||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
namespace {
|
||||
|
||||
constexpr auto kService = str_const("org.freedesktop.Notifications");
|
||||
constexpr auto kObjectPath = str_const("/org/freedesktop/Notifications");
|
||||
constexpr auto kService = "org.freedesktop.Notifications"_cs;
|
||||
constexpr auto kObjectPath = "/org/freedesktop/Notifications"_cs;
|
||||
constexpr auto kInterface = kService;
|
||||
|
||||
std::vector<QString> GetServerInformation(
|
||||
|
@ -112,9 +112,9 @@ NotificationData::NotificationData(
|
|||
_actions << qsl("default") << QString();
|
||||
|
||||
_notificationInterface->connection().connect(
|
||||
str_const_toString(kService),
|
||||
str_const_toString(kObjectPath),
|
||||
str_const_toString(kInterface),
|
||||
kService.utf16(),
|
||||
kObjectPath.utf16(),
|
||||
kInterface.utf16(),
|
||||
qsl("ActionInvoked"),
|
||||
this,
|
||||
SLOT(notificationClicked(uint)));
|
||||
|
@ -124,9 +124,9 @@ NotificationData::NotificationData(
|
|||
<< tr::lng_notification_reply(tr::now);
|
||||
|
||||
_notificationInterface->connection().connect(
|
||||
str_const_toString(kService),
|
||||
str_const_toString(kObjectPath),
|
||||
str_const_toString(kInterface),
|
||||
kService.utf16(),
|
||||
kObjectPath.utf16(),
|
||||
kInterface.utf16(),
|
||||
qsl("NotificationReplied"),
|
||||
this,
|
||||
SLOT(notificationReplied(uint,QString)));
|
||||
|
@ -161,9 +161,9 @@ NotificationData::NotificationData(
|
|||
qsl(MACRO_TO_STRING(TDESKTOP_LAUNCHER_BASENAME));
|
||||
|
||||
_notificationInterface->connection().connect(
|
||||
str_const_toString(kService),
|
||||
str_const_toString(kObjectPath),
|
||||
str_const_toString(kInterface),
|
||||
kService.utf16(),
|
||||
kObjectPath.utf16(),
|
||||
kInterface.utf16(),
|
||||
qsl("NotificationClosed"),
|
||||
this,
|
||||
SLOT(notificationClosed(uint)));
|
||||
|
@ -172,7 +172,7 @@ NotificationData::NotificationData(
|
|||
bool NotificationData::show() {
|
||||
const QDBusReply<uint> notifyReply = _notificationInterface->call(
|
||||
qsl("Notify"),
|
||||
str_const_toString(AppName),
|
||||
AppName.utf16(),
|
||||
uint(0),
|
||||
QString(),
|
||||
_title,
|
||||
|
@ -311,9 +311,10 @@ const QDBusArgument &operator>>(const QDBusArgument &argument,
|
|||
bool Supported() {
|
||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
static const auto Available = QDBusInterface(
|
||||
str_const_toString(kService),
|
||||
str_const_toString(kObjectPath),
|
||||
str_const_toString(kInterface)).isValid();
|
||||
kService.utf16(),
|
||||
kObjectPath.utf16(),
|
||||
kInterface.utf16()
|
||||
).isValid();
|
||||
|
||||
return Available;
|
||||
#else
|
||||
|
@ -335,10 +336,11 @@ std::unique_ptr<Window::Notifications::Manager> Create(
|
|||
Manager::Private::Private(Manager *manager, Type type)
|
||||
: _cachedUserpics(type)
|
||||
, _manager(manager)
|
||||
, _notificationInterface(std::make_shared<QDBusInterface>(
|
||||
str_const_toString(kService),
|
||||
str_const_toString(kObjectPath),
|
||||
str_const_toString(kInterface))) {
|
||||
, _notificationInterface(
|
||||
std::make_shared<QDBusInterface>(
|
||||
kService.utf16(),
|
||||
kObjectPath.utf16(),
|
||||
kInterface.utf16())) {
|
||||
qDBusRegisterMetaType<NotificationData::ImageData>();
|
||||
|
||||
const auto specificationVersion = ParseSpecificationVersion(
|
||||
|
|
|
@ -42,7 +42,7 @@ using Platform::File::internal::EscapeShell;
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr auto kDesktopFile = str_const(":/misc/telegramdesktop.desktop");
|
||||
constexpr auto kDesktopFile = ":/misc/telegramdesktop.desktop"_cs;
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||
void SandboxAutostart(bool autostart) {
|
||||
|
@ -121,14 +121,14 @@ bool GenerateDesktopFile(const QString &targetPath, const QString &args) {
|
|||
|
||||
QString fileText;
|
||||
|
||||
QFile source(str_const_toString(kDesktopFile));
|
||||
QFile source(kDesktopFile.utf16());
|
||||
if (source.open(QIODevice::ReadOnly)) {
|
||||
QTextStream s(&source);
|
||||
fileText = s.readAll();
|
||||
source.close();
|
||||
} else {
|
||||
LOG(("App Error: Could not open '%1' for read")
|
||||
.arg(str_const_toString(kDesktopFile)));
|
||||
.arg(kDesktopFile.utf16()));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -377,7 +377,7 @@ QString objc_documentsPath() {
|
|||
QString objc_appDataPath() {
|
||||
NSURL *url = [[NSFileManager defaultManager] URLForDirectory:NSApplicationSupportDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:nil];
|
||||
if (url) {
|
||||
return QString::fromUtf8([[url path] fileSystemRepresentation]) + '/' + str_const_toString(AppName) + '/';
|
||||
return QString::fromUtf8([[url path] fileSystemRepresentation]) + '/' + AppName.utf16() + '/';
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
|
|
@ -698,7 +698,11 @@ void MainWindow::psSetupTrayIcon() {
|
|||
|
||||
void MainWindow::showTrayTooltip() {
|
||||
if (trayIcon && !cSeenTrayTooltip()) {
|
||||
trayIcon->showMessage(str_const_toString(AppName), tr::lng_tray_icon_text(tr::now), QSystemTrayIcon::Information, 10000);
|
||||
trayIcon->showMessage(
|
||||
AppName.utf16(),
|
||||
tr::lng_tray_icon_text(tr::now),
|
||||
QSystemTrayIcon::Information,
|
||||
10000);
|
||||
cSetSeenTrayTooltip(true);
|
||||
Local::writeSettings();
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ QString psAppDataPath() {
|
|||
#ifdef OS_WIN_STORE
|
||||
return appData.absolutePath() + qsl("/Telegram Desktop UWP/");
|
||||
#else // OS_WIN_STORE
|
||||
return appData.absolutePath() + '/' + str_const_toString(AppName) + '/';
|
||||
return appData.absolutePath() + '/' + AppName.utf16() + '/';
|
||||
#endif // OS_WIN_STORE
|
||||
}
|
||||
return QString();
|
||||
|
@ -164,7 +164,7 @@ QString psAppDataPathOld() {
|
|||
WCHAR wstrPath[maxFileLen];
|
||||
if (GetEnvironmentVariable(L"APPDATA", wstrPath, maxFileLen)) {
|
||||
QDir appData(QString::fromStdWString(std::wstring(wstrPath)));
|
||||
return appData.absolutePath() + '/' + str_const_toString(AppNameOld) + '/';
|
||||
return appData.absolutePath() + '/' + AppNameOld.utf16() + '/';
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
@ -217,24 +217,28 @@ int psCleanup() {
|
|||
void psDoFixPrevious() {
|
||||
try {
|
||||
static const int bufSize = 4096;
|
||||
DWORD checkType, checkSize = bufSize * 2;
|
||||
WCHAR checkStr[bufSize];
|
||||
DWORD checkType = 0;
|
||||
DWORD checkSize = bufSize * 2;
|
||||
WCHAR checkStr[bufSize] = { 0 };
|
||||
HKEY newKey1 = nullptr;
|
||||
HKEY newKey2 = nullptr;
|
||||
HKEY oldKey1 = nullptr;
|
||||
HKEY oldKey2 = nullptr;
|
||||
|
||||
QString appId = str_const_toString(AppId);
|
||||
QString newKeyStr1 = QString("Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%1_is1").arg(appId);
|
||||
QString newKeyStr2 = QString("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%1_is1").arg(appId);
|
||||
QString oldKeyStr1 = QString("SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%1_is1").arg(appId);
|
||||
QString oldKeyStr2 = QString("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%1_is1").arg(appId);
|
||||
HKEY newKey1, newKey2, oldKey1, oldKey2;
|
||||
LSTATUS newKeyRes1 = RegOpenKeyEx(HKEY_CURRENT_USER, newKeyStr1.toStdWString().c_str(), 0, KEY_READ, &newKey1);
|
||||
LSTATUS newKeyRes2 = RegOpenKeyEx(HKEY_CURRENT_USER, newKeyStr2.toStdWString().c_str(), 0, KEY_READ, &newKey2);
|
||||
LSTATUS oldKeyRes1 = RegOpenKeyEx(HKEY_LOCAL_MACHINE, oldKeyStr1.toStdWString().c_str(), 0, KEY_READ, &oldKey1);
|
||||
LSTATUS oldKeyRes2 = RegOpenKeyEx(HKEY_LOCAL_MACHINE, oldKeyStr2.toStdWString().c_str(), 0, KEY_READ, &oldKey2);
|
||||
const auto appId = AppId.utf16();
|
||||
const auto newKeyStr1 = QString("Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%1_is1").arg(appId).toStdWString();
|
||||
const auto newKeyStr2 = QString("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%1_is1").arg(appId).toStdWString();
|
||||
const auto oldKeyStr1 = QString("SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%1_is1").arg(appId).toStdWString();
|
||||
const auto oldKeyStr2 = QString("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%1_is1").arg(appId).toStdWString();
|
||||
const auto newKeyRes1 = RegOpenKeyEx(HKEY_CURRENT_USER, newKeyStr1.c_str(), 0, KEY_READ, &newKey1);
|
||||
const auto newKeyRes2 = RegOpenKeyEx(HKEY_CURRENT_USER, newKeyStr2.c_str(), 0, KEY_READ, &newKey2);
|
||||
const auto oldKeyRes1 = RegOpenKeyEx(HKEY_LOCAL_MACHINE, oldKeyStr1.c_str(), 0, KEY_READ, &oldKey1);
|
||||
const auto oldKeyRes2 = RegOpenKeyEx(HKEY_LOCAL_MACHINE, oldKeyStr2.c_str(), 0, KEY_READ, &oldKey2);
|
||||
|
||||
bool existNew1 = (newKeyRes1 == ERROR_SUCCESS) && (RegQueryValueEx(newKey1, L"InstallDate", 0, &checkType, (BYTE*)checkStr, &checkSize) == ERROR_SUCCESS); checkSize = bufSize * 2;
|
||||
bool existNew2 = (newKeyRes2 == ERROR_SUCCESS) && (RegQueryValueEx(newKey2, L"InstallDate", 0, &checkType, (BYTE*)checkStr, &checkSize) == ERROR_SUCCESS); checkSize = bufSize * 2;
|
||||
bool existOld1 = (oldKeyRes1 == ERROR_SUCCESS) && (RegQueryValueEx(oldKey1, L"InstallDate", 0, &checkType, (BYTE*)checkStr, &checkSize) == ERROR_SUCCESS); checkSize = bufSize * 2;
|
||||
bool existOld2 = (oldKeyRes2 == ERROR_SUCCESS) && (RegQueryValueEx(oldKey2, L"InstallDate", 0, &checkType, (BYTE*)checkStr, &checkSize) == ERROR_SUCCESS); checkSize = bufSize * 2;
|
||||
const auto existNew1 = (newKeyRes1 == ERROR_SUCCESS) && (RegQueryValueEx(newKey1, L"InstallDate", 0, &checkType, (BYTE*)checkStr, &checkSize) == ERROR_SUCCESS); checkSize = bufSize * 2;
|
||||
const auto existNew2 = (newKeyRes2 == ERROR_SUCCESS) && (RegQueryValueEx(newKey2, L"InstallDate", 0, &checkType, (BYTE*)checkStr, &checkSize) == ERROR_SUCCESS); checkSize = bufSize * 2;
|
||||
const auto existOld1 = (oldKeyRes1 == ERROR_SUCCESS) && (RegQueryValueEx(oldKey1, L"InstallDate", 0, &checkType, (BYTE*)checkStr, &checkSize) == ERROR_SUCCESS); checkSize = bufSize * 2;
|
||||
const auto existOld2 = (oldKeyRes2 == ERROR_SUCCESS) && (RegQueryValueEx(oldKey2, L"InstallDate", 0, &checkType, (BYTE*)checkStr, &checkSize) == ERROR_SUCCESS); checkSize = bufSize * 2;
|
||||
|
||||
if (newKeyRes1 == ERROR_SUCCESS) RegCloseKey(newKey1);
|
||||
if (newKeyRes2 == ERROR_SUCCESS) RegCloseKey(newKey2);
|
||||
|
@ -242,8 +246,8 @@ void psDoFixPrevious() {
|
|||
if (oldKeyRes2 == ERROR_SUCCESS) RegCloseKey(oldKey2);
|
||||
|
||||
if (existNew1 || existNew2) {
|
||||
oldKeyRes1 = existOld1 ? RegDeleteKey(HKEY_LOCAL_MACHINE, oldKeyStr1.toStdWString().c_str()) : ERROR_SUCCESS;
|
||||
oldKeyRes2 = existOld2 ? RegDeleteKey(HKEY_LOCAL_MACHINE, oldKeyStr2.toStdWString().c_str()) : ERROR_SUCCESS;
|
||||
const auto deleteKeyRes1 = existOld1 ? RegDeleteKey(HKEY_LOCAL_MACHINE, oldKeyStr1.c_str()) : ERROR_SUCCESS;
|
||||
const auto deleteKeyRes2 = existOld2 ? RegDeleteKey(HKEY_LOCAL_MACHINE, oldKeyStr2.c_str()) : ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
QString userDesktopLnk, commonDesktopLnk;
|
||||
|
@ -515,7 +519,7 @@ void _manageAppLnk(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) + '\\' + str_const_toString(AppFile) + qsl(".lnk");
|
||||
QString lnk = QString::fromWCharArray(startupFolder) + '\\' + AppFile.utf16() + qsl(".lnk");
|
||||
if (create) {
|
||||
ComPtr<IShellLink> shellLink;
|
||||
hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&shellLink));
|
||||
|
|
|
@ -458,7 +458,7 @@ void MainWindow::setPositionInited() {
|
|||
}
|
||||
|
||||
void MainWindow::attachToTrayIcon(not_null<QSystemTrayIcon*> icon) {
|
||||
icon->setToolTip(str_const_toString(AppName));
|
||||
icon->setToolTip(AppName.utf16());
|
||||
connect(icon, &QSystemTrayIcon::activated, this, [=](
|
||||
QSystemTrayIcon::ActivationReason reason) {
|
||||
Core::Sandbox::Instance().customEnterFromEventLoop([&] {
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace {
|
|||
|
||||
constexpr auto kThemeFileSizeLimit = 5 * 1024 * 1024;
|
||||
constexpr auto kBackgroundSizeLimit = 25 * 1024 * 1024;
|
||||
constexpr auto kNightThemeFile = str_const(":/gui/night.tdesktop-theme");
|
||||
constexpr auto kNightThemeFile = ":/gui/night.tdesktop-theme"_cs;
|
||||
constexpr auto kMinimumTiledSize = 512;
|
||||
|
||||
struct Applying {
|
||||
|
@ -1254,7 +1254,7 @@ void Revert() {
|
|||
}
|
||||
|
||||
QString NightThemePath() {
|
||||
return str_const_toString(kNightThemeFile);
|
||||
return kNightThemeFile.utf16();
|
||||
}
|
||||
|
||||
bool IsNonDefaultBackground() {
|
||||
|
|
|
@ -558,7 +558,7 @@ bool Editor::Inner::readData() {
|
|||
auto result = readColor(name, row.value.data() + 1, row.value.size() - 1);
|
||||
Assert(!result.error);
|
||||
_newRows->feed(name, result.color);
|
||||
//if (!_newRows->feedFallbackName(name, str_const_toString(row.fallback))) {
|
||||
//if (!_newRows->feedFallbackName(name, row.fallback.utf16())) {
|
||||
// Unexpected("Row for fallback not found");
|
||||
//}
|
||||
} else {
|
||||
|
|
|
@ -68,7 +68,7 @@ const auto kColorizeIgnoredKeys = base::flat_set<QLatin1String>{ {
|
|||
qstr("mediaviewFileBlueCornerFg"),
|
||||
} };
|
||||
|
||||
QColor qColor(str_const hex) {
|
||||
QColor qColor(std::string_view hex) {
|
||||
Expects(hex.size() == 6);
|
||||
|
||||
const auto component = [](char a, char b) {
|
||||
|
@ -90,7 +90,7 @@ QColor qColor(str_const hex) {
|
|||
component(hex[4], hex[5]));
|
||||
};
|
||||
|
||||
Colorizer::Color cColor(str_const hex) {
|
||||
Colorizer::Color cColor(std::string_view hex) {
|
||||
const auto q = qColor(hex);
|
||||
auto hue = int();
|
||||
auto saturation = int();
|
||||
|
@ -338,7 +338,7 @@ QByteArray Colorize(
|
|||
const Colorizer &colorizer) {
|
||||
Expects(hexColor.size() == 7 || hexColor.size() == 9);
|
||||
|
||||
auto color = qColor(str_const(hexColor.data() + 1, 6));
|
||||
auto color = qColor(std::string_view(hexColor.data() + 1, 6));
|
||||
const auto changed = Colorize(color, colorizer).value_or(color).toRgb();
|
||||
|
||||
auto result = QByteArray();
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit db99f556f328f8e1fdc44ab30041f655b68b8312
|
||||
Subproject commit 1720a5b4eebc794ff05d7223d79d42e00e39062e
|
Loading…
Reference in New Issue