2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Add call settings (#5540)

This commit is contained in:
Gregory K
2019-01-05 14:08:02 +03:00
committed by John Preston
parent 8306e58b75
commit 11b991cddc
26 changed files with 728 additions and 50 deletions

View File

@@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "application.h"
#include "mainwidget.h"
#include "mainwindow.h"
#include "platform/linux/linux_desktop_environment.h"
#include "platform/linux/file_utilities_linux.h"
#include "platform/platform_notifications_manager.h"
#include "storage/localstorage.h"
@@ -488,6 +489,30 @@ void RequestPermission(PermissionType type, Fn<void(PermissionStatus)> resultCal
void OpenSystemSettingsForPermission(PermissionType type) {
}
bool OpenSystemSettings(SystemSettingsType type) {
if (type == SystemSettingsType::Audio) {
bool succeeded = false;
if (DesktopEnvironment::IsUnity()) {
succeeded |= QProcess::startDetached(qsl("unity-control-center sound"));
} else if (DesktopEnvironment::IsKDE()) {
succeeded |= QProcess::startDetached(qsl("kcmshell5 kcm_pulseaudio"));
if (!succeeded) {
succeeded |= QProcess::startDetached(qsl("kcmshell4 phonon"));
}
} else if (DesktopEnvironment::IsGnome()) {
succeeded |= QProcess::startDetached(qsl("gnome-control-center sound"));
}
if (!succeeded) {
succeeded |= QProcess::startDetached(qsl("pavucontrol"));
}
if (!succeeded) {
succeeded |= QProcess::startDetached(qsl("alsamixergui"));
}
return succeeded;
}
return true;
}
namespace ThirdParty {
void start() {

View File

@@ -332,6 +332,15 @@ void OpenSystemSettingsForPermission(PermissionType type) {
#endif // OS_MAC_OLD
}
bool OpenSystemSettings(SystemSettingsType type) {
switch (type) {
case SystemSettingsType::Audio:
[[NSWorkspace sharedWorkspace] openFile:@"/System/Library/PreferencePanes/Sound.prefPane"];
break;
}
return true;
}
} // namespace Platform
void psNewVersion() {

View File

@@ -22,6 +22,10 @@ enum class PermissionType {
Microphone,
};
enum class SystemSettingsType {
Audio,
};
void SetWatchingMediaKeys(bool watching);
bool IsApplicationActive();
void SetApplicationIcon(const QIcon &icon);
@@ -34,6 +38,7 @@ void RegisterCustomScheme();
PermissionStatus GetPermissionStatus(PermissionType type);
void RequestPermission(PermissionType type, Fn<void(PermissionStatus)> resultCallback);
void OpenSystemSettingsForPermission(PermissionType type);
bool OpenSystemSettings(SystemSettingsType type);
QString SystemLanguage();
QString SystemCountry();

View File

@@ -657,6 +657,13 @@ void OpenSystemSettingsForPermission(PermissionType type) {
}
}
bool OpenSystemSettings(SystemSettingsType type) {
if (type == SystemSettingsType::Audio) {
WinExec("control.exe mmsys.cpl", SW_SHOW);
}
return true;
}
} // namespace Platform
void psNewVersion() {