platform_specific.h 1.9 KB

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