2014-05-30 08:53:19 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2014-05-30 08:53:19 +00:00
|
|
|
*/
|
2017-03-04 10:23:56 +00:00
|
|
|
#include "platform/win/specific_win.h"
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-06-16 12:59:54 +00:00
|
|
|
#include "platform/win/main_window_win.h"
|
2016-10-02 16:32:46 +00:00
|
|
|
#include "platform/win/notifications_manager_win.h"
|
2016-06-16 12:59:54 +00:00
|
|
|
#include "platform/win/windows_app_user_model_id.h"
|
|
|
|
#include "platform/win/windows_dlls.h"
|
2020-06-02 08:26:58 +00:00
|
|
|
#include "base/platform/base_platform_info.h"
|
2020-04-14 11:37:48 +00:00
|
|
|
#include "base/call_delayed.h"
|
2017-04-13 08:27:10 +00:00
|
|
|
#include "lang/lang_keys.h"
|
2017-02-23 10:59:19 +00:00
|
|
|
#include "mainwindow.h"
|
2014-05-30 08:53:19 +00:00
|
|
|
#include "mainwidget.h"
|
2016-09-27 13:37:18 +00:00
|
|
|
#include "history/history_location_manager.h"
|
2017-03-04 10:23:56 +00:00
|
|
|
#include "storage/localstorage.h"
|
2017-12-11 14:45:29 +00:00
|
|
|
#include "core/crash_reports.h"
|
2015-08-11 19:50:48 +00:00
|
|
|
|
2020-07-14 16:36:55 +00:00
|
|
|
#include <QtCore/QOperatingSystemVersion>
|
2019-09-04 07:19:15 +00:00
|
|
|
#include <QtWidgets/QApplication>
|
|
|
|
#include <QtWidgets/QDesktopWidget>
|
|
|
|
#include <QtGui/QDesktopServices>
|
2020-08-11 13:30:12 +00:00
|
|
|
#include <QtGui/QWindow>
|
2019-09-04 07:19:15 +00:00
|
|
|
#include <qpa/qplatformnativeinterface.h>
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
#include <Shobjidl.h>
|
|
|
|
#include <shellapi.h>
|
2015-08-16 16:37:56 +00:00
|
|
|
|
|
|
|
#include <roapi.h>
|
2019-02-15 11:24:58 +00:00
|
|
|
#include <wrl/client.h>
|
2015-08-16 16:37:56 +00:00
|
|
|
|
2019-06-24 10:49:37 +00:00
|
|
|
#include <openssl/conf.h>
|
2019-06-24 12:23:08 +00:00
|
|
|
#include <openssl/engine.h>
|
|
|
|
#include <openssl/err.h>
|
2019-06-24 10:49:37 +00:00
|
|
|
|
2015-08-16 16:37:56 +00:00
|
|
|
#include <dbghelp.h>
|
2016-02-08 10:56:18 +00:00
|
|
|
#include <shlobj.h>
|
2015-01-22 21:59:07 +00:00
|
|
|
#include <Shlwapi.h>
|
2014-05-30 08:53:19 +00:00
|
|
|
#include <Strsafe.h>
|
|
|
|
#include <Windowsx.h>
|
2015-01-27 16:58:58 +00:00
|
|
|
#include <WtsApi32.h>
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-08-11 19:50:48 +00:00
|
|
|
#include <SDKDDKVer.h>
|
|
|
|
|
|
|
|
#include <sal.h>
|
|
|
|
#include <Psapi.h>
|
|
|
|
#include <strsafe.h>
|
|
|
|
#include <ObjBase.h>
|
|
|
|
#include <propvarutil.h>
|
|
|
|
#include <functiondiscoverykeys.h>
|
|
|
|
#include <intsafe.h>
|
|
|
|
#include <guiddef.h>
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
#ifndef DCX_USESTYLE
|
|
|
|
#define DCX_USESTYLE 0x00010000
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef WM_NCPOINTERUPDATE
|
2020-01-02 11:25:52 +00:00
|
|
|
#define WM_NCPOINTERUPDATE 0x0241
|
|
|
|
#define WM_NCPOINTERDOWN 0x0242
|
|
|
|
#define WM_NCPOINTERUP 0x0243
|
2014-05-30 08:53:19 +00:00
|
|
|
#endif
|
|
|
|
|
2015-08-11 19:50:48 +00:00
|
|
|
using namespace Microsoft::WRL;
|
2016-06-16 12:59:54 +00:00
|
|
|
using namespace Platform;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
namespace {
|
2015-01-18 09:23:03 +00:00
|
|
|
|
2020-04-14 11:37:48 +00:00
|
|
|
constexpr auto kRefreshBadLastUserInputTimeout = 10 * crl::time(1000);
|
|
|
|
|
2020-01-02 11:25:52 +00:00
|
|
|
QStringList _initLogs;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2020-01-02 11:25:52 +00:00
|
|
|
bool themeInited = false;
|
|
|
|
bool finished = true;
|
|
|
|
QMargins simpleMargins, margins;
|
|
|
|
HICON bigIcon = 0, smallIcon = 0, overlayIcon = 0;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2020-01-02 11:25:52 +00:00
|
|
|
class _PsInitializer {
|
|
|
|
public:
|
|
|
|
_PsInitializer() {
|
|
|
|
Dlls::start();
|
|
|
|
}
|
2014-05-30 08:53:19 +00:00
|
|
|
};
|
2020-01-02 11:25:52 +00:00
|
|
|
_PsInitializer _psInitializer;
|
|
|
|
|
|
|
|
} // namespace
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-06-03 18:13:01 +00:00
|
|
|
void psDeleteDir(const QString &dir) {
|
2014-05-30 08:53:19 +00:00
|
|
|
std::wstring wDir = QDir::toNativeSeparators(dir).toStdWString();
|
|
|
|
WCHAR path[4096];
|
|
|
|
memcpy(path, wDir.c_str(), (wDir.size() + 1) * sizeof(WCHAR));
|
|
|
|
path[wDir.size() + 1] = 0;
|
|
|
|
SHFILEOPSTRUCT file_op = {
|
|
|
|
NULL,
|
|
|
|
FO_DELETE,
|
|
|
|
path,
|
|
|
|
L"",
|
|
|
|
FOF_NOCONFIRMATION |
|
|
|
|
FOF_NOERRORUI |
|
|
|
|
FOF_SILENT,
|
|
|
|
false,
|
|
|
|
0,
|
|
|
|
L""
|
|
|
|
};
|
|
|
|
int res = SHFileOperation(&file_op);
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
BOOL CALLBACK _ActivateProcess(HWND hWnd, LPARAM lParam) {
|
|
|
|
uint64 &processId(*(uint64*)lParam);
|
|
|
|
|
|
|
|
DWORD dwProcessId;
|
|
|
|
::GetWindowThreadProcessId(hWnd, &dwProcessId);
|
|
|
|
|
|
|
|
if ((uint64)dwProcessId == processId) { // found top-level window
|
|
|
|
static const int32 nameBufSize = 1024;
|
|
|
|
WCHAR nameBuf[nameBufSize];
|
|
|
|
int32 len = GetWindowText(hWnd, nameBuf, nameBufSize);
|
|
|
|
if (len && len < nameBufSize) {
|
|
|
|
if (QRegularExpression(qsl("^Telegram(\\s*\\(\\d+\\))?$")).match(QString::fromStdWString(nameBuf)).hasMatch()) {
|
|
|
|
BOOL res = ::SetForegroundWindow(hWnd);
|
2015-03-02 12:34:16 +00:00
|
|
|
::SetFocus(hWnd);
|
2014-05-30 08:53:19 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-18 09:23:03 +00:00
|
|
|
QStringList psInitLogs() {
|
2020-01-02 11:25:52 +00:00
|
|
|
return _initLogs;
|
2015-01-18 09:23:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void psClearInitLogs() {
|
2020-01-02 11:25:52 +00:00
|
|
|
_initLogs = QStringList();
|
2015-01-16 16:46:01 +00:00
|
|
|
}
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void psActivateProcess(uint64 pid) {
|
2014-09-26 23:48:19 +00:00
|
|
|
if (pid) {
|
|
|
|
::EnumWindows((WNDENUMPROC)_ActivateProcess, (LPARAM)&pid);
|
|
|
|
}
|
2014-05-30 08:53:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QString psAppDataPath() {
|
|
|
|
static const int maxFileLen = MAX_PATH * 10;
|
|
|
|
WCHAR wstrPath[maxFileLen];
|
|
|
|
if (GetEnvironmentVariable(L"APPDATA", wstrPath, maxFileLen)) {
|
|
|
|
QDir appData(QString::fromStdWString(std::wstring(wstrPath)));
|
2017-02-01 10:12:52 +00:00
|
|
|
#ifdef OS_WIN_STORE
|
|
|
|
return appData.absolutePath() + qsl("/Telegram Desktop UWP/");
|
|
|
|
#else // OS_WIN_STORE
|
2020-01-29 09:44:37 +00:00
|
|
|
return appData.absolutePath() + '/' + AppName.utf16() + '/';
|
2017-02-01 10:12:52 +00:00
|
|
|
#endif // OS_WIN_STORE
|
2014-05-30 08:53:19 +00:00
|
|
|
}
|
|
|
|
return QString();
|
|
|
|
}
|
|
|
|
|
2014-09-30 14:11:09 +00:00
|
|
|
QString psAppDataPathOld() {
|
|
|
|
static const int maxFileLen = MAX_PATH * 10;
|
|
|
|
WCHAR wstrPath[maxFileLen];
|
|
|
|
if (GetEnvironmentVariable(L"APPDATA", wstrPath, maxFileLen)) {
|
|
|
|
QDir appData(QString::fromStdWString(std::wstring(wstrPath)));
|
2020-01-29 09:44:37 +00:00
|
|
|
return appData.absolutePath() + '/' + AppNameOld.utf16() + '/';
|
2014-09-30 14:11:09 +00:00
|
|
|
}
|
|
|
|
return QString();
|
|
|
|
}
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void psDoCleanup() {
|
|
|
|
try {
|
|
|
|
psAutoStart(false, true);
|
2014-07-18 10:37:34 +00:00
|
|
|
psSendToMenu(false, true);
|
2016-06-16 12:59:54 +00:00
|
|
|
AppUserModelId::cleanupShortcut();
|
2014-05-30 08:53:19 +00:00
|
|
|
} catch (...) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-16 12:59:54 +00:00
|
|
|
namespace {
|
2016-12-01 19:20:33 +00:00
|
|
|
|
2016-06-16 12:59:54 +00:00
|
|
|
QRect _monitorRect;
|
2019-02-19 06:57:53 +00:00
|
|
|
crl::time _monitorLastGot = 0;
|
2016-12-01 19:20:33 +00:00
|
|
|
|
|
|
|
} // namespace
|
2016-06-16 12:59:54 +00:00
|
|
|
|
|
|
|
QRect psDesktopRect() {
|
2019-02-19 06:57:53 +00:00
|
|
|
auto tnow = crl::now();
|
2016-12-01 19:20:33 +00:00
|
|
|
if (tnow > _monitorLastGot + 1000LL || tnow < _monitorLastGot) {
|
2016-06-16 12:59:54 +00:00
|
|
|
_monitorLastGot = tnow;
|
|
|
|
HMONITOR hMonitor = MonitorFromWindow(App::wnd()->psHwnd(), MONITOR_DEFAULTTONEAREST);
|
|
|
|
if (hMonitor) {
|
|
|
|
MONITORINFOEX info;
|
|
|
|
info.cbSize = sizeof(info);
|
|
|
|
GetMonitorInfo(hMonitor, &info);
|
|
|
|
_monitorRect = QRect(info.rcWork.left, info.rcWork.top, info.rcWork.right - info.rcWork.left, info.rcWork.bottom - info.rcWork.top);
|
|
|
|
} else {
|
|
|
|
_monitorRect = QApplication::desktop()->availableGeometry(App::wnd());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return _monitorRect;
|
|
|
|
}
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
int psCleanup() {
|
|
|
|
__try
|
|
|
|
{
|
|
|
|
psDoCleanup();
|
|
|
|
}
|
|
|
|
__except(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void psDoFixPrevious() {
|
|
|
|
try {
|
|
|
|
static const int bufSize = 4096;
|
2020-01-29 09:44:37 +00:00
|
|
|
DWORD checkType = 0;
|
|
|
|
DWORD checkSize = bufSize * 2;
|
|
|
|
WCHAR checkStr[bufSize] = { 0 };
|
|
|
|
HKEY newKey1 = nullptr;
|
|
|
|
HKEY newKey2 = nullptr;
|
|
|
|
HKEY oldKey1 = nullptr;
|
|
|
|
HKEY oldKey2 = nullptr;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
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;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
if (newKeyRes1 == ERROR_SUCCESS) RegCloseKey(newKey1);
|
|
|
|
if (newKeyRes2 == ERROR_SUCCESS) RegCloseKey(newKey2);
|
|
|
|
if (oldKeyRes1 == ERROR_SUCCESS) RegCloseKey(oldKey1);
|
|
|
|
if (oldKeyRes2 == ERROR_SUCCESS) RegCloseKey(oldKey2);
|
|
|
|
|
|
|
|
if (existNew1 || existNew2) {
|
2020-01-29 09:44:37 +00:00
|
|
|
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;
|
2014-05-30 08:53:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QString userDesktopLnk, commonDesktopLnk;
|
|
|
|
WCHAR userDesktopFolder[MAX_PATH], commonDesktopFolder[MAX_PATH];
|
|
|
|
HRESULT userDesktopRes = SHGetFolderPath(0, CSIDL_DESKTOPDIRECTORY, 0, SHGFP_TYPE_CURRENT, userDesktopFolder);
|
|
|
|
HRESULT commonDesktopRes = SHGetFolderPath(0, CSIDL_COMMON_DESKTOPDIRECTORY, 0, SHGFP_TYPE_CURRENT, commonDesktopFolder);
|
|
|
|
if (SUCCEEDED(userDesktopRes)) {
|
|
|
|
userDesktopLnk = QString::fromWCharArray(userDesktopFolder) + "\\Telegram.lnk";
|
|
|
|
}
|
|
|
|
if (SUCCEEDED(commonDesktopRes)) {
|
|
|
|
commonDesktopLnk = QString::fromWCharArray(commonDesktopFolder) + "\\Telegram.lnk";
|
|
|
|
}
|
|
|
|
QFile userDesktopFile(userDesktopLnk), commonDesktopFile(commonDesktopLnk);
|
|
|
|
if (QFile::exists(userDesktopLnk) && QFile::exists(commonDesktopLnk) && userDesktopLnk != commonDesktopLnk) {
|
|
|
|
bool removed = QFile::remove(commonDesktopLnk);
|
|
|
|
}
|
|
|
|
} catch (...) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int psFixPrevious() {
|
|
|
|
__try
|
|
|
|
{
|
|
|
|
psDoFixPrevious();
|
|
|
|
}
|
|
|
|
__except(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-06-16 12:59:54 +00:00
|
|
|
namespace Platform {
|
2019-06-24 10:49:37 +00:00
|
|
|
namespace ThirdParty {
|
2019-06-24 12:23:08 +00:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
void StartOpenSSL() {
|
|
|
|
// Don't use dynamic OpenSSL config, it can load unwanted DLLs.
|
|
|
|
OPENSSL_load_builtin_modules();
|
|
|
|
ENGINE_load_builtin_engines();
|
|
|
|
ERR_clear_error();
|
|
|
|
OPENSSL_no_config();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
2019-06-24 10:49:37 +00:00
|
|
|
|
|
|
|
void start() {
|
2019-06-24 12:23:08 +00:00
|
|
|
StartOpenSSL();
|
2019-06-24 10:49:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace ThirdParty
|
2016-01-11 15:43:29 +00:00
|
|
|
|
2016-06-16 12:59:54 +00:00
|
|
|
void start() {
|
2016-08-14 18:55:59 +00:00
|
|
|
Dlls::init();
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
2016-01-11 15:43:29 +00:00
|
|
|
|
2016-06-16 12:59:54 +00:00
|
|
|
void finish() {
|
|
|
|
}
|
2016-01-11 15:43:29 +00:00
|
|
|
|
2018-10-24 08:28:11 +00:00
|
|
|
void SetApplicationIcon(const QIcon &icon) {
|
2019-01-21 13:42:21 +00:00
|
|
|
QApplication::setWindowIcon(icon);
|
2018-10-24 08:28:11 +00:00
|
|
|
}
|
|
|
|
|
2017-08-15 17:12:57 +00:00
|
|
|
QString CurrentExecutablePath(int argc, char *argv[]) {
|
|
|
|
WCHAR result[MAX_PATH + 1] = { 0 };
|
|
|
|
auto count = GetModuleFileName(nullptr, result, MAX_PATH + 1);
|
|
|
|
if (count < MAX_PATH + 1) {
|
|
|
|
auto info = QFileInfo(QDir::fromNativeSeparators(QString::fromWCharArray(result)));
|
|
|
|
return info.absoluteFilePath();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fallback to the first command line argument.
|
|
|
|
auto argsCount = 0;
|
|
|
|
if (auto args = CommandLineToArgvW(GetCommandLine(), &argsCount)) {
|
|
|
|
auto info = QFileInfo(QDir::fromNativeSeparators(QString::fromWCharArray(args[0])));
|
|
|
|
LocalFree(args);
|
|
|
|
return info.absoluteFilePath();
|
|
|
|
}
|
|
|
|
return QString();
|
|
|
|
}
|
|
|
|
|
2020-01-22 03:12:07 +00:00
|
|
|
QString SingleInstanceLocalServerName(const QString &hash) {
|
|
|
|
return qsl("Global\\") + hash + '-' + cGUIDStr();
|
|
|
|
}
|
|
|
|
|
2019-03-14 17:59:10 +00:00
|
|
|
std::optional<crl::time> LastUserInputTime() {
|
|
|
|
auto lii = LASTINPUTINFO{ 0 };
|
2019-03-09 17:10:51 +00:00
|
|
|
lii.cbSize = sizeof(LASTINPUTINFO);
|
2020-04-14 11:37:48 +00:00
|
|
|
if (!GetLastInputInfo(&lii)) {
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
const auto now = crl::now();
|
|
|
|
const auto input = crl::time(lii.dwTime);
|
|
|
|
static auto LastTrackedInput = input;
|
|
|
|
static auto LastTrackedWhen = now;
|
|
|
|
|
|
|
|
const auto ticks32 = crl::time(GetTickCount());
|
|
|
|
const auto ticks64 = crl::time(GetTickCount64());
|
|
|
|
const auto elapsed = std::max(ticks32, ticks64) - input;
|
|
|
|
const auto good = (std::abs(ticks32 - ticks64) <= crl::time(1000))
|
|
|
|
&& (elapsed >= 0);
|
|
|
|
if (good) {
|
|
|
|
LastTrackedInput = input;
|
|
|
|
LastTrackedWhen = now;
|
|
|
|
return (now > elapsed) ? (now - elapsed) : crl::time(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static auto WaitingDelayed = false;
|
|
|
|
if (!WaitingDelayed) {
|
|
|
|
WaitingDelayed = true;
|
|
|
|
base::call_delayed(kRefreshBadLastUserInputTimeout, [=] {
|
|
|
|
WaitingDelayed = false;
|
|
|
|
[[maybe_unused]] const auto cheked = LastUserInputTime();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
constexpr auto OverrunLimit = std::numeric_limits<DWORD>::max();
|
|
|
|
constexpr auto OverrunThreshold = OverrunLimit / 4;
|
|
|
|
if (LastTrackedInput == input) {
|
|
|
|
return LastTrackedWhen;
|
|
|
|
}
|
|
|
|
const auto guard = gsl::finally([&] {
|
|
|
|
LastTrackedInput = input;
|
|
|
|
LastTrackedWhen = now;
|
|
|
|
});
|
|
|
|
if (input > LastTrackedInput) {
|
|
|
|
const auto add = input - LastTrackedInput;
|
|
|
|
return std::min(LastTrackedWhen + add, now);
|
|
|
|
} else if (crl::time(OverrunLimit) + input - LastTrackedInput
|
|
|
|
< crl::time(OverrunThreshold)) {
|
|
|
|
const auto add = crl::time(OverrunLimit) + input - LastTrackedInput;
|
|
|
|
return std::min(LastTrackedWhen + add, now);
|
|
|
|
}
|
|
|
|
return LastTrackedWhen;
|
2019-03-09 17:10:51 +00:00
|
|
|
}
|
|
|
|
|
2020-07-14 16:36:55 +00:00
|
|
|
std::optional<bool> IsDarkMode() {
|
2020-07-22 12:10:17 +00:00
|
|
|
static const auto kSystemVersion = QOperatingSystemVersion::current();
|
|
|
|
static const auto kDarkModeAddedVersion = QOperatingSystemVersion(
|
|
|
|
QOperatingSystemVersion::Windows,
|
|
|
|
10,
|
|
|
|
0,
|
|
|
|
17763);
|
|
|
|
static const auto kSupported = (kSystemVersion >= kDarkModeAddedVersion);
|
|
|
|
if (!kSupported) {
|
2020-07-14 16:36:55 +00:00
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
|
2020-07-22 12:10:17 +00:00
|
|
|
const auto keyName = L""
|
|
|
|
"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize";
|
|
|
|
const auto valueName = L"AppsUseLightTheme";
|
|
|
|
auto key = HKEY();
|
|
|
|
auto result = RegOpenKeyEx(HKEY_CURRENT_USER, keyName, 0, KEY_READ, &key);
|
2020-07-14 16:36:55 +00:00
|
|
|
if (result != ERROR_SUCCESS) {
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD value = 0, type = 0, size = sizeof(value);
|
2020-07-22 12:10:17 +00:00
|
|
|
result = RegQueryValueEx(key, valueName, 0, &type, (LPBYTE)&value, &size);
|
2020-07-14 16:36:55 +00:00
|
|
|
RegCloseKey(key);
|
|
|
|
if (result != ERROR_SUCCESS) {
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
|
2020-07-22 12:10:17 +00:00
|
|
|
return (value == 0);
|
2020-07-14 16:36:55 +00:00
|
|
|
}
|
|
|
|
|
2020-05-29 17:49:39 +00:00
|
|
|
bool AutostartSupported() {
|
|
|
|
return !IsWindowsStoreBuild();
|
|
|
|
}
|
|
|
|
|
2020-08-07 21:59:45 +00:00
|
|
|
bool ShowWindowMenu(QWindow *window) {
|
|
|
|
const auto pos = QCursor::pos();
|
|
|
|
|
|
|
|
SendMessage(
|
2020-08-11 13:30:12 +00:00
|
|
|
HWND(window->winId()),
|
2020-08-07 21:59:45 +00:00
|
|
|
WM_SYSCOMMAND,
|
|
|
|
SC_MOUSEMENU,
|
|
|
|
MAKELPARAM(pos.x(), pos.y()));
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-07-18 05:06:29 +00:00
|
|
|
Window::ControlsLayout WindowControlsLayout() {
|
|
|
|
Window::ControlsLayout controls;
|
|
|
|
controls.right = {
|
|
|
|
Window::Control::Minimize,
|
|
|
|
Window::Control::Maximize,
|
|
|
|
Window::Control::Close,
|
|
|
|
};
|
|
|
|
|
|
|
|
return controls;
|
|
|
|
}
|
|
|
|
|
2016-06-16 12:59:54 +00:00
|
|
|
} // namespace Platform
|
|
|
|
|
2014-12-03 13:10:32 +00:00
|
|
|
namespace {
|
|
|
|
void _psLogError(const char *str, LSTATUS code) {
|
2017-11-11 17:53:23 +00:00
|
|
|
LPWSTR errorTextFormatted = nullptr;
|
|
|
|
auto formatFlags = FORMAT_MESSAGE_FROM_SYSTEM
|
|
|
|
| FORMAT_MESSAGE_ALLOCATE_BUFFER
|
|
|
|
| FORMAT_MESSAGE_IGNORE_INSERTS;
|
|
|
|
FormatMessage(
|
|
|
|
formatFlags,
|
|
|
|
NULL,
|
|
|
|
code,
|
|
|
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
|
|
|
(LPTSTR)&errorTextFormatted,
|
|
|
|
0,
|
|
|
|
0);
|
|
|
|
auto errorText = errorTextFormatted
|
|
|
|
? errorTextFormatted
|
|
|
|
: L"(Unknown error)";
|
2014-12-03 13:10:32 +00:00
|
|
|
LOG((str).arg(code).arg(QString::fromStdWString(errorText)));
|
2017-11-11 17:53:23 +00:00
|
|
|
LocalFree(errorTextFormatted);
|
2014-12-03 13:10:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool _psOpenRegKey(LPCWSTR key, PHKEY rkey) {
|
2016-03-24 15:07:13 +00:00
|
|
|
DEBUG_LOG(("App Info: opening reg key %1...").arg(QString::fromStdWString(key)));
|
2014-12-03 13:10:32 +00:00
|
|
|
LSTATUS status = RegOpenKeyEx(HKEY_CURRENT_USER, key, 0, KEY_QUERY_VALUE | KEY_WRITE, rkey);
|
|
|
|
if (status != ERROR_SUCCESS) {
|
|
|
|
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"));
|
|
|
|
_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"));
|
|
|
|
_psLogError(msg.toUtf8().constData(), status);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2016-01-10 06:05:23 +00:00
|
|
|
|
2014-12-03 13:10:32 +00:00
|
|
|
bool _psSetKeyValue(HKEY rkey, LPCWSTR value, QString v) {
|
|
|
|
static const int bufSize = 4096;
|
|
|
|
DWORD defaultType, defaultSize = bufSize * 2;
|
|
|
|
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 };
|
2020-05-09 18:07:18 +00:00
|
|
|
if (!v.isEmpty()) StringCbPrintf(tmp, bufSize, v.replace(QChar('%'), qsl("%%")).toStdWString().c_str());
|
2014-12-08 15:25:20 +00:00
|
|
|
LSTATUS status = RegSetValueEx(rkey, value, 0, REG_SZ, (BYTE*)tmp, (wcslen(tmp) + 1) * sizeof(WCHAR));
|
2014-12-03 13:10:32 +00:00
|
|
|
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");
|
|
|
|
_psLogError(msg.toUtf8().constData(), status);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-18 08:51:14 +00:00
|
|
|
namespace Platform {
|
|
|
|
|
2020-02-25 02:39:14 +00:00
|
|
|
void RegisterCustomScheme(bool force) {
|
2017-08-15 17:12:57 +00:00
|
|
|
if (cExeName().isEmpty()) {
|
|
|
|
return;
|
|
|
|
}
|
2016-03-24 15:07:13 +00:00
|
|
|
DEBUG_LOG(("App Info: Checking custom scheme 'tg'..."));
|
2014-12-03 13:10:32 +00:00
|
|
|
|
|
|
|
HKEY rkey;
|
2015-08-11 19:50:48 +00:00
|
|
|
QString exe = QDir::toNativeSeparators(cExeDir() + cExeName());
|
2014-12-03 13:10:32 +00:00
|
|
|
|
2017-02-09 19:28:46 +00:00
|
|
|
// Legacy URI scheme registration
|
2014-12-03 13:10:32 +00:00
|
|
|
if (!_psOpenRegKey(L"Software\\Classes\\tg", &rkey)) return;
|
|
|
|
if (!_psSetKeyValue(rkey, L"URL Protocol", QString())) return;
|
|
|
|
if (!_psSetKeyValue(rkey, 0, qsl("URL:Telegram Link"))) return;
|
|
|
|
|
|
|
|
if (!_psOpenRegKey(L"Software\\Classes\\tg\\DefaultIcon", &rkey)) return;
|
|
|
|
if (!_psSetKeyValue(rkey, 0, '"' + exe + qsl(",1\""))) return;
|
|
|
|
|
|
|
|
if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell", &rkey)) return;
|
|
|
|
if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell\\open", &rkey)) return;
|
|
|
|
if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell\\open\\command", &rkey)) return;
|
|
|
|
if (!_psSetKeyValue(rkey, 0, '"' + exe + qsl("\" -workdir \"") + cWorkingDir() + qsl("\" -- \"%1\""))) return;
|
2017-02-09 19:28:46 +00:00
|
|
|
|
|
|
|
// URI scheme registration as Default Program - Windows Vista and above
|
|
|
|
if (!_psOpenRegKey(L"Software\\Classes\\tdesktop.tg", &rkey)) return;
|
|
|
|
if (!_psOpenRegKey(L"Software\\Classes\\tdesktop.tg\\DefaultIcon", &rkey)) return;
|
|
|
|
if (!_psSetKeyValue(rkey, 0, '"' + exe + qsl(",1\""))) return;
|
|
|
|
|
|
|
|
if (!_psOpenRegKey(L"Software\\Classes\\tdesktop.tg\\shell", &rkey)) return;
|
|
|
|
if (!_psOpenRegKey(L"Software\\Classes\\tdesktop.tg\\shell\\open", &rkey)) return;
|
|
|
|
if (!_psOpenRegKey(L"Software\\Classes\\tdesktop.tg\\shell\\open\\command", &rkey)) return;
|
|
|
|
if (!_psSetKeyValue(rkey, 0, '"' + exe + qsl("\" -workdir \"") + cWorkingDir() + qsl("\" -- \"%1\""))) return;
|
|
|
|
|
|
|
|
if (!_psOpenRegKey(L"Software\\TelegramDesktop", &rkey)) return;
|
|
|
|
if (!_psOpenRegKey(L"Software\\TelegramDesktop\\Capabilities", &rkey)) return;
|
2017-02-09 22:29:20 +00:00
|
|
|
if (!_psSetKeyValue(rkey, L"ApplicationName", qsl("Telegram Desktop"))) return;
|
|
|
|
if (!_psSetKeyValue(rkey, L"ApplicationDescription", qsl("Telegram Desktop"))) return;
|
2017-02-09 19:28:46 +00:00
|
|
|
if (!_psOpenRegKey(L"Software\\TelegramDesktop\\Capabilities\\UrlAssociations", &rkey)) return;
|
2017-02-09 22:29:20 +00:00
|
|
|
if (!_psSetKeyValue(rkey, L"tg", qsl("tdesktop.tg"))) return;
|
2017-02-09 19:28:46 +00:00
|
|
|
|
|
|
|
if (!_psOpenRegKey(L"Software\\RegisteredApplications", &rkey)) return;
|
2017-02-09 22:29:20 +00:00
|
|
|
if (!_psSetKeyValue(rkey, L"Telegram Desktop", qsl("SOFTWARE\\TelegramDesktop\\Capabilities"))) return;
|
2014-12-03 13:10:32 +00:00
|
|
|
}
|
|
|
|
|
2018-09-30 15:42:50 +00:00
|
|
|
PermissionStatus GetPermissionStatus(PermissionType type) {
|
2018-10-17 06:09:59 +00:00
|
|
|
if (type==PermissionType::Microphone) {
|
2018-09-30 15:42:50 +00:00
|
|
|
PermissionStatus result=PermissionStatus::Granted;
|
|
|
|
HKEY hKey;
|
|
|
|
LSTATUS res=RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\CapabilityAccessManager\\ConsentStore\\microphone", 0, KEY_QUERY_VALUE, &hKey);
|
|
|
|
if(res==ERROR_SUCCESS) {
|
|
|
|
wchar_t buf[20];
|
|
|
|
DWORD length=sizeof(buf);
|
|
|
|
res=RegQueryValueEx(hKey, L"Value", NULL, NULL, (LPBYTE)buf, &length);
|
|
|
|
if(res==ERROR_SUCCESS) {
|
|
|
|
if(wcscmp(buf, L"Deny")==0) {
|
|
|
|
result=PermissionStatus::Denied;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
return PermissionStatus::Granted;
|
|
|
|
}
|
|
|
|
|
|
|
|
void RequestPermission(PermissionType type, Fn<void(PermissionStatus)> resultCallback) {
|
2018-10-17 06:09:59 +00:00
|
|
|
resultCallback(PermissionStatus::Granted);
|
2018-09-30 15:42:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void OpenSystemSettingsForPermission(PermissionType type) {
|
2019-01-11 10:07:56 +00:00
|
|
|
if (type == PermissionType::Microphone) {
|
|
|
|
crl::on_main([] {
|
|
|
|
ShellExecute(
|
|
|
|
nullptr,
|
|
|
|
L"open",
|
|
|
|
L"ms-settings:privacy-microphone",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
SW_SHOWDEFAULT);
|
|
|
|
});
|
2018-09-30 15:42:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-05 11:08:02 +00:00
|
|
|
bool OpenSystemSettings(SystemSettingsType type) {
|
|
|
|
if (type == SystemSettingsType::Audio) {
|
2019-01-11 10:07:56 +00:00
|
|
|
crl::on_main([] {
|
|
|
|
WinExec("control.exe mmsys.cpl", SW_SHOW);
|
2020-08-18 07:23:45 +00:00
|
|
|
//QDesktopServices::openUrl(QUrl("ms-settings:sound"));
|
2019-01-11 10:07:56 +00:00
|
|
|
});
|
2019-01-05 11:08:02 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-03-18 08:51:14 +00:00
|
|
|
} // namespace Platform
|
|
|
|
|
2015-08-13 15:11:07 +00:00
|
|
|
void psNewVersion() {
|
2018-03-18 08:51:14 +00:00
|
|
|
Platform::RegisterCustomScheme();
|
2015-08-16 16:37:56 +00:00
|
|
|
if (Local::oldSettingsVersion() < 8051) {
|
2016-06-16 12:59:54 +00:00
|
|
|
AppUserModelId::checkPinned();
|
2015-08-16 14:42:41 +00:00
|
|
|
}
|
2016-12-19 16:51:29 +00:00
|
|
|
if (Local::oldSettingsVersion() > 0 && Local::oldSettingsVersion() < 10021) {
|
|
|
|
// Reset icons cache, because we've changed the application icon.
|
|
|
|
if (Dlls::SHChangeNotify) {
|
|
|
|
Dlls::SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nullptr, nullptr);
|
|
|
|
}
|
|
|
|
}
|
2015-08-13 15:11:07 +00:00
|
|
|
}
|
|
|
|
|
2014-07-18 10:37:34 +00:00
|
|
|
void _manageAppLnk(bool create, bool silent, int path_csidl, const wchar_t *args, const wchar_t *description) {
|
2017-08-15 17:12:57 +00:00
|
|
|
if (cExeName().isEmpty()) {
|
|
|
|
return;
|
|
|
|
}
|
2014-05-30 08:53:19 +00:00
|
|
|
WCHAR startupFolder[MAX_PATH];
|
2015-08-11 19:50:48 +00:00
|
|
|
HRESULT hr = SHGetFolderPath(0, path_csidl, 0, SHGFP_TYPE_CURRENT, startupFolder);
|
|
|
|
if (SUCCEEDED(hr)) {
|
2020-01-29 09:44:37 +00:00
|
|
|
QString lnk = QString::fromWCharArray(startupFolder) + '\\' + AppFile.utf16() + qsl(".lnk");
|
2014-07-18 10:37:34 +00:00
|
|
|
if (create) {
|
2015-08-11 19:50:48 +00:00
|
|
|
ComPtr<IShellLink> shellLink;
|
|
|
|
hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&shellLink));
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
ComPtr<IPersistFile> persistFile;
|
|
|
|
|
|
|
|
QString exe = QDir::toNativeSeparators(cExeDir() + cExeName()), dir = QDir::toNativeSeparators(QDir(cWorkingDir()).absolutePath());
|
|
|
|
shellLink->SetArguments(args);
|
|
|
|
shellLink->SetPath(exe.toStdWString().c_str());
|
|
|
|
shellLink->SetWorkingDirectory(dir.toStdWString().c_str());
|
|
|
|
shellLink->SetDescription(description);
|
|
|
|
|
|
|
|
ComPtr<IPropertyStore> propertyStore;
|
|
|
|
hr = shellLink.As(&propertyStore);
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
PROPVARIANT appIdPropVar;
|
2016-06-16 12:59:54 +00:00
|
|
|
hr = InitPropVariantFromString(AppUserModelId::getId(), &appIdPropVar);
|
2015-08-11 19:50:48 +00:00
|
|
|
if (SUCCEEDED(hr)) {
|
2016-06-16 12:59:54 +00:00
|
|
|
hr = propertyStore->SetValue(AppUserModelId::getKey(), appIdPropVar);
|
2015-08-11 19:50:48 +00:00
|
|
|
PropVariantClear(&appIdPropVar);
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = propertyStore->Commit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = shellLink.As(&persistFile);
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = persistFile->Save(lnk.toStdWString().c_str(), TRUE);
|
2014-07-18 10:37:34 +00:00
|
|
|
} else {
|
2015-08-11 19:50:48 +00:00
|
|
|
if (!silent) LOG(("App Error: could not create interface IID_IPersistFile %1").arg(hr));
|
2014-05-30 08:53:19 +00:00
|
|
|
}
|
|
|
|
} else {
|
2015-08-11 19:50:48 +00:00
|
|
|
if (!silent) LOG(("App Error: could not create instance of IID_IShellLink %1").arg(hr));
|
2014-05-30 08:53:19 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
QFile::remove(lnk);
|
|
|
|
}
|
|
|
|
} else {
|
2015-08-11 19:50:48 +00:00
|
|
|
if (!silent) LOG(("App Error: could not get CSIDL %1 folder %2").arg(path_csidl).arg(hr));
|
2014-05-30 08:53:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-18 10:37:34 +00:00
|
|
|
void psAutoStart(bool start, bool silent) {
|
|
|
|
_manageAppLnk(start, silent, CSIDL_STARTUP, L"-autostart", L"Telegram autorun link.\nYou can disable autorun in Telegram settings.");
|
|
|
|
}
|
|
|
|
|
|
|
|
void psSendToMenu(bool send, bool silent) {
|
|
|
|
_manageAppLnk(send, silent, CSIDL_SENDTO, L"-sendpath", L"Telegram send to link.\nYou can disable send to menu item in Telegram settings.");
|
|
|
|
}
|
|
|
|
|
2016-01-25 10:22:58 +00:00
|
|
|
void psWriteDump() {
|
2019-11-07 10:53:55 +00:00
|
|
|
#ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS
|
2018-11-12 07:50:40 +00:00
|
|
|
PROCESS_MEMORY_COUNTERS data = { 0 };
|
|
|
|
if (Dlls::GetProcessMemoryInfo
|
|
|
|
&& Dlls::GetProcessMemoryInfo(
|
|
|
|
GetCurrentProcess(),
|
|
|
|
&data,
|
|
|
|
sizeof(data))) {
|
2018-12-11 12:26:33 +00:00
|
|
|
const auto mb = 1024 * 1024;
|
2018-11-12 07:50:40 +00:00
|
|
|
CrashReports::dump()
|
|
|
|
<< "Memory-usage: "
|
2018-12-11 12:26:33 +00:00
|
|
|
<< (data.PeakWorkingSetSize / mb)
|
|
|
|
<< " MB (peak), "
|
|
|
|
<< (data.WorkingSetSize / mb)
|
|
|
|
<< " MB (current)\n";
|
2018-11-12 07:50:40 +00:00
|
|
|
CrashReports::dump()
|
|
|
|
<< "Pagefile-usage: "
|
2018-12-11 12:26:33 +00:00
|
|
|
<< (data.PeakPagefileUsage / mb)
|
|
|
|
<< " MB (peak), "
|
|
|
|
<< (data.PagefileUsage / mb)
|
|
|
|
<< " MB (current)\n";
|
2018-11-12 07:50:40 +00:00
|
|
|
}
|
2019-11-07 10:53:55 +00:00
|
|
|
#endif // DESKTOP_APP_DISABLE_CRASH_REPORTS
|
2016-01-21 06:58:58 +00:00
|
|
|
}
|
|
|
|
|
2019-06-21 12:27:46 +00:00
|
|
|
bool psLaunchMaps(const Data::LocationPoint &point) {
|
|
|
|
return QDesktopServices::openUrl(qsl("bingmaps:?lvl=16&collection=point.%1_%2_Point").arg(point.latAsString()).arg(point.lonAsString()));
|
2016-02-17 16:37:21 +00:00
|
|
|
}
|