Hide Video Conferencing when muted (#19175)

This commit is contained in:
akabhirav
2022-10-19 14:48:58 +05:30
committed by GitHub
parent 16c28c788d
commit 1cfce6182d
9 changed files with 134 additions and 32 deletions

View File

@@ -154,18 +154,27 @@ LRESULT Toolbar::WindowProcessMessages(HWND hwnd, UINT msg, WPARAM wparam, LPARA
static bool previousShow = false;
bool show = false;
if (toolbar->cameraInUse)
if (toolbar->ToolbarHide == L"Never")
{
show = toolbar->HideToolbarWhenUnmuted ? toolbar->microphoneMuted || toolbar->cameraMuted : true;
show = true;
}
else if (toolbar->previouscameraInUse)
else if (toolbar->ToolbarHide == L"When both camera and microphone are muted")
{
VideoConferenceModule::unmuteAll();
if(!toolbar->previouscameraInUse && toolbar->cameraInUse && !toolbar->moduleSettingsUpdateScheduled)
{
VideoConferenceModule::muteAll();
}
show = !(toolbar->microphoneMuted && (toolbar->cameraMuted || !toolbar->cameraInUse));
}
else
else if (toolbar->ToolbarHide == L"When both camera and microphone are unmuted")
{
show = toolbar->microphoneMuted;
if(!toolbar->previouscameraInUse && toolbar->cameraInUse && !toolbar->moduleSettingsUpdateScheduled)
{
VideoConferenceModule::unmuteAll();
}
show = toolbar->microphoneMuted || toolbar->cameraMuted;
}
show = show || !showOverlayTimeout;
if (show)
{
@@ -332,9 +341,9 @@ void Toolbar::setMicrophoneMute(bool mute)
microphoneMuted = mute;
}
void Toolbar::setHideToolbarWhenUnmuted(bool hide)
void Toolbar::setToolbarHide(std::wstring hide)
{
HideToolbarWhenUnmuted = hide;
ToolbarHide = hide;
}
void Toolbar::setTheme(std::wstring theme)

View File

@@ -35,7 +35,7 @@ public:
void setMicrophoneMute(bool mute);
void setTheme(std::wstring theme);
void setHideToolbarWhenUnmuted(bool hide);
void setToolbarHide(std::wstring hide);
private:
static LRESULT CALLBACK WindowProcessMessages(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
@@ -54,7 +54,7 @@ private:
std::wstring theme = L"system";
bool HideToolbarWhenUnmuted = true;
std::wstring ToolbarHide = L"Never";
uint64_t lastTimeCamOrMicMuteStateChanged{};

View File

@@ -250,9 +250,9 @@ void VideoConferenceModule::onModuleSettingsChanged()
settings.imageOverlayPath = val.value();
sendOverlayImageUpdate();
}
if (const auto val = values.get_bool_value(L"hide_toolbar_when_unmuted"))
if (const auto val = values.get_string_value(L"toolbar_hide"))
{
toolbar.setHideToolbarWhenUnmuted(val.value());
toolbar.setToolbarHide(val.value());
}
const auto selectedMic = values.get_string_value(L"selected_mic");
@@ -397,9 +397,9 @@ void VideoConferenceModule::init_settings()
{
settings.imageOverlayPath = val.value();
}
if (const auto val = powerToysSettings.get_bool_value(L"hide_toolbar_when_unmuted"))
if (const auto val = powerToysSettings.get_string_value(L"toolbar_hide"))
{
toolbar.setHideToolbarWhenUnmuted(val.value());
toolbar.setToolbarHide(val.value());
}
if (const auto val = powerToysSettings.get_string_value(L"selected_mic"); val && *val != settings.selectedMicrophone)
{
@@ -549,6 +549,19 @@ void VideoConferenceModule::unmuteAll()
}
}
void VideoConferenceModule::muteAll()
{
if (!getVirtualCameraMuteState())
{
reverseVirtualCameraMuteState();
}
if (!getMicrophoneMuteState())
{
reverseMicrophoneMute();
}
}
void VideoConferenceModule::disable()
{
if (_enabled)

View File

@@ -53,6 +53,7 @@ public:
void sendOverlayImageUpdate();
static void unmuteAll();
static void muteAll();
static void reverseMicrophoneMute();
static bool getMicrophoneMuteState();
static void reverseVirtualCameraMuteState();