Skip to content

Truly independent web browser

LibWebView+UI/Qt: Add a setting to hide the feedback button

Andreas Kling84f06786a35e
diff --git a/Libraries/LibWebView/Settings.cpp b/Libraries/LibWebView/Settings.cpp
index d7e5a92189c..01e745a3efc 100644
--- a/Libraries/LibWebView/Settings.cpp
+++ b/Libraries/LibWebView/Settings.cpp
@@ -135,6 +135,14 @@ static auto const& CONFIG_VARIABLE_DEFINITIONS = *new Array<ConfigVariableDefini
.default_value = false,
.array_element_type = {},
},
+ {
+ .id = ConfigVariableID::ShowFeedbackButton,
+ .name = "ui.toolbar.show_feedback_button"sv,
+ .title = "Show feedback button"sv,
+ .description = "Show the button for sending feedback at the end of the toolbar."sv,
+ .default_value = true,
+ .array_element_type = {},
+ },
{
.id = ConfigVariableID::UseClientSideWindowDecorations,
.name = "ui.window.use_client_side_decorations"sv,
diff --git a/Libraries/LibWebView/Settings.h b/Libraries/LibWebView/Settings.h
index d63a27a720c..1a1a2ec3555 100644
--- a/Libraries/LibWebView/Settings.h
+++ b/Libraries/LibWebView/Settings.h
@@ -123,6 +123,7 @@ enum class ConfigVariableID : u8 {
ShowWebContentProcessIDInTabTitle,
ShowAdvancedDebugMenu,
ShowTabPerformanceMonitor,
+ ShowFeedbackButton,
UseClientSideWindowDecorations,
VerticalTabsHoverExpandDelay,
VerticalTabsHoverExpandAnimationDuration,
diff --git a/Libraries/LibWebView/WebUI/SettingsUI.cpp b/Libraries/LibWebView/WebUI/SettingsUI.cpp
index 7ba7223281c..b4f85e5880e 100644
--- a/Libraries/LibWebView/WebUI/SettingsUI.cpp
+++ b/Libraries/LibWebView/WebUI/SettingsUI.cpp
@@ -7,6 +7,7 @@
#include <AK/JsonArray.h>
#include <AK/Platform.h>
#include <AK/Utf16String.h>
+#include <LibCore/BrowserVersion.h>
#include <LibCore/EventLoop.h>
#include <LibCore/GeolocationProvider.h>
#include <LibCore/Promise.h>
@@ -45,6 +46,8 @@ static StringView config_variable_type_to_string(JsonValue::Type type)
static bool should_show_config_variable(ConfigVariableID id)
{
+ if (id == ConfigVariableID::ShowFeedbackButton)
+ return !BROWSER_IS_FINAL_RELEASE;
if (id == ConfigVariableID::UseClientSideWindowDecorations)
return Application::the().supports_client_side_window_decorations();
if (id == ConfigVariableID::VerticalTabsHoverExpandDelay || id == ConfigVariableID::VerticalTabsHoverExpandAnimationDuration)
diff --git a/UI/Qt/WindowToolbar.cpp b/UI/Qt/WindowToolbar.cpp
index e6aae48b31c..ca1a6469557 100644
--- a/UI/Qt/WindowToolbar.cpp
+++ b/UI/Qt/WindowToolbar.cpp
@@ -1171,6 +1171,7 @@ WindowToolbar::WindowToolbar(WebView::IsPrivate is_private, QWidget* parent)
update_chrome_style();
set_window_controls_visible(false);
update_feedback_button();
+ config_variable_changed(WebView::ConfigVariableID::ShowFeedbackButton);
}
WindowToolbar::~WindowToolbar() = default;
@@ -1382,6 +1383,12 @@ void WindowToolbar::tab_settings_changed()
void WindowToolbar::config_variable_changed(WebView::ConfigVariableID variable)
{
+ if (variable == WebView::ConfigVariableID::ShowFeedbackButton && m_feedback_button) {
+ auto show_button = WebView::Application::settings().config_variable_as_bool(variable);
+ if (!show_button && m_feedback_popover)
+ m_feedback_popover->close();
+ m_feedback_button->setVisible(show_button);
+ }
if (variable == WebView::ConfigVariableID::ShowTabPerformanceMonitor)
m_performance_monitor->setVisible(WebView::Application::settings().config_variable_as_bool(variable));
}