1 /*
2 This file is part of Telegram Desktop,
3 the official desktop application for the Telegram messaging service.
4 
5 For license and copyright information please follow this link:
6 https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
7 */
8 #pragma once
9 
10 namespace Platform {
11 
12 void start();
13 void finish();
14 
15 enum class PermissionStatus {
16 	Granted,
17 	CanRequest,
18 	Denied,
19 };
20 
21 enum class PermissionType {
22 	Microphone,
23 	Camera,
24 };
25 
26 enum class SystemSettingsType {
27 	Audio,
28 };
29 
30 void SetApplicationIcon(const QIcon &icon);
31 QString SingleInstanceLocalServerName(const QString &hash);
32 PermissionStatus GetPermissionStatus(PermissionType type);
33 void RequestPermission(PermissionType type, Fn<void(PermissionStatus)> resultCallback);
34 void OpenSystemSettingsForPermission(PermissionType type);
35 bool OpenSystemSettings(SystemSettingsType type);
36 void IgnoreApplicationActivationRightNow();
37 [[nodiscard]] bool AutostartSupported();
38 void AutostartRequestStateFromSystem(Fn<void(bool)> callback);
39 void AutostartToggle(bool enabled, Fn<void(bool)> done = nullptr);
40 [[nodiscard]] bool AutostartSkip();
41 bool TrayIconSupported();
42 bool SkipTaskbarSupported();
43 void WriteCrashDumpDetails();
44 
45 [[nodiscard]] std::optional<bool> IsDarkMode();
IsDarkModeSupported()46 [[nodiscard]] inline bool IsDarkModeSupported() {
47 	return IsDarkMode().has_value();
48 }
49 
50 namespace ThirdParty {
51 
52 void start();
53 void finish();
54 
55 } // namespace ThirdParty
56 } // namespace Platform
57 
58 #ifdef Q_OS_MAC
59 #include "platform/mac/specific_mac.h"
60 #elif defined Q_OS_UNIX // Q_OS_MAC
61 #include "platform/linux/specific_linux.h"
62 #elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX
63 #include "platform/win/specific_win.h"
64 #endif // Q_OS_MAC || Q_OS_UNIX || Q_OS_WIN
65