mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:37:45 +00:00
LibGUI: Remove Label icons and replace instances with ImageWidget
These icons are a relic of GLabel and were never implemented to accomodate both image and text. This convenience can always be added in the future, but no current instance assumes or needs it, so let's replace them all with ImageWidget to show clearer intent.
This commit is contained in:
parent
59483b0654
commit
4c9933bfb7
16 changed files with 69 additions and 102 deletions
|
@ -17,10 +17,10 @@
|
|||
spacing: 16
|
||||
}
|
||||
|
||||
@GUI::Label {
|
||||
@GUI::ImageWidget {
|
||||
fixed_width: 32
|
||||
fixed_height: 32
|
||||
icon: "/res/icons/32x32/home.png"
|
||||
bitmap: "/res/icons/32x32/home.png"
|
||||
}
|
||||
|
||||
@GUI::Widget {
|
||||
|
@ -76,10 +76,10 @@
|
|||
spacing: 16
|
||||
}
|
||||
|
||||
@GUI::Label {
|
||||
@GUI::ImageWidget {
|
||||
fixed_width: 32
|
||||
fixed_height: 32
|
||||
icon: "/res/icons/32x32/color-chooser.png"
|
||||
bitmap: "/res/icons/32x32/color-chooser.png"
|
||||
}
|
||||
|
||||
@GUI::Label {
|
||||
|
@ -122,10 +122,10 @@
|
|||
spacing: 16
|
||||
}
|
||||
|
||||
@GUI::Label {
|
||||
@GUI::ImageWidget {
|
||||
fixed_width: 32
|
||||
fixed_height: 32
|
||||
icon: "/res/icons/32x32/search-engine.png"
|
||||
bitmap: "/res/icons/32x32/search-engine.png"
|
||||
}
|
||||
|
||||
@GUI::CheckBox {
|
||||
|
@ -191,10 +191,10 @@
|
|||
spacing: 16
|
||||
}
|
||||
|
||||
@GUI::Label {
|
||||
@GUI::ImageWidget {
|
||||
fixed_width: 32
|
||||
fixed_height: 32
|
||||
icon: "/res/icons/32x32/downloads.png"
|
||||
bitmap: "/res/icons/32x32/downloads.png"
|
||||
}
|
||||
|
||||
@GUI::CheckBox {
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
fixed_width: 32
|
||||
layout: @GUI::VerticalBoxLayout {}
|
||||
|
||||
@GUI::Label {
|
||||
@GUI::ImageWidget {
|
||||
fixed_width: 32
|
||||
fixed_height: 32
|
||||
icon: "/res/icons/32x32/app-keyboard-mapper.png"
|
||||
bitmap: "/res/icons/32x32/app-keyboard-mapper.png"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,10 +69,10 @@
|
|||
fixed_width: 32
|
||||
layout: @GUI::VerticalBoxLayout {}
|
||||
|
||||
@GUI::Label {
|
||||
@GUI::ImageWidget {
|
||||
fixed_width: 32
|
||||
fixed_height: 32
|
||||
icon: "/res/icons/32x32/app-keyboard-settings.png"
|
||||
bitmap: "/res/icons/32x32/app-keyboard-settings.png"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,10 +113,10 @@
|
|||
spacing: 16
|
||||
}
|
||||
|
||||
@GUI::Label {
|
||||
@GUI::ImageWidget {
|
||||
fixed_width: 32
|
||||
fixed_height: 32
|
||||
icon: "/res/icons/32x32/app-calculator.png"
|
||||
bitmap: "/res/icons/32x32/app-calculator.png"
|
||||
}
|
||||
|
||||
@GUI::CheckBox {
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
spacing: 16
|
||||
}
|
||||
|
||||
@GUI::Label {
|
||||
@GUI::ImageWidget {
|
||||
fixed_width: 32
|
||||
fixed_height: 32
|
||||
icon: "/res/graphics/mail-server-settings.png"
|
||||
bitmap: "/res/graphics/mail-server-settings.png"
|
||||
}
|
||||
|
||||
@GUI::Label {
|
||||
|
@ -100,10 +100,10 @@
|
|||
spacing: 16
|
||||
}
|
||||
|
||||
@GUI::Label {
|
||||
@GUI::ImageWidget {
|
||||
fixed_width: 32
|
||||
fixed_height: 32
|
||||
icon: "/res/graphics/mail-user-settings.png"
|
||||
bitmap: "/res/graphics/mail-user-settings.png"
|
||||
}
|
||||
|
||||
@GUI::Label {
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
spacing: 16
|
||||
}
|
||||
|
||||
@GUI::Label {
|
||||
@GUI::ImageWidget {
|
||||
fixed_width: 32
|
||||
fixed_height: 32
|
||||
icon: "/res/graphics/mouse-cursor-speed.png"
|
||||
bitmap: "/res/graphics/mouse-cursor-speed.png"
|
||||
}
|
||||
|
||||
@GUI::Label {
|
||||
|
@ -65,10 +65,10 @@
|
|||
spacing: 16
|
||||
}
|
||||
|
||||
@GUI::Label {
|
||||
@GUI::ImageWidget {
|
||||
fixed_width: 32
|
||||
fixed_height: 32
|
||||
icon: "/res/graphics/scroll-wheel-step-size.png"
|
||||
bitmap: "/res/graphics/scroll-wheel-step-size.png"
|
||||
}
|
||||
|
||||
@GUI::Label {
|
||||
|
@ -175,10 +175,10 @@
|
|||
spacing: 16
|
||||
}
|
||||
|
||||
@GUI::Label {
|
||||
@GUI::ImageWidget {
|
||||
fixed_width: 32
|
||||
fixed_height: 32
|
||||
name: "switch_buttons_image_label"
|
||||
name: "switch_buttons_image"
|
||||
}
|
||||
|
||||
@GUI::CheckBox {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <Applications/MouseSettings/MouseWidgetGML.h>
|
||||
#include <LibGUI/ConnectionToWindowServer.h>
|
||||
#include <LibGUI/ImageWidget.h>
|
||||
#include <LibGUI/Label.h>
|
||||
#include <LibGUI/Slider.h>
|
||||
#include <LibGUI/SpinBox.h>
|
||||
|
@ -51,7 +52,7 @@ MouseWidget::MouseWidget()
|
|||
set_modified(true);
|
||||
};
|
||||
|
||||
m_switch_buttons_image_label = *find_descendant_of_type_named<GUI::Label>("switch_buttons_image_label");
|
||||
m_switch_buttons_image = *find_descendant_of_type_named<GUI::ImageWidget>("switch_buttons_image");
|
||||
m_switch_buttons_checkbox = *find_descendant_of_type_named<GUI::CheckBox>("switch_buttons_checkbox");
|
||||
m_switch_buttons_checkbox->set_checked(GUI::ConnectionToWindowServer::the().are_mouse_buttons_switched(), GUI::AllowCallback::No);
|
||||
m_switch_buttons_checkbox->on_checked = [&](auto) {
|
||||
|
@ -103,8 +104,8 @@ void MouseWidget::update_double_click_speed_label()
|
|||
void MouseWidget::update_switch_buttons_image_label()
|
||||
{
|
||||
if (m_switch_buttons_checkbox->is_checked()) {
|
||||
m_switch_buttons_image_label->set_icon_from_path("/res/graphics/mouse-button-right.png"sv);
|
||||
m_switch_buttons_image->load_from_file("/res/graphics/mouse-button-right.png"sv);
|
||||
} else {
|
||||
m_switch_buttons_image_label->set_icon_from_path("/res/graphics/mouse-button-left.png"sv);
|
||||
m_switch_buttons_image->load_from_file("/res/graphics/mouse-button-left.png"sv);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ private:
|
|||
RefPtr<GUI::HorizontalSlider> m_double_click_speed_slider;
|
||||
RefPtr<GUI::Label> m_double_click_speed_label;
|
||||
RefPtr<GUI::CheckBox> m_switch_buttons_checkbox;
|
||||
RefPtr<GUI::Label> m_switch_buttons_image_label;
|
||||
RefPtr<GUI::ImageWidget> m_switch_buttons_image;
|
||||
RefPtr<GUI::CheckBox> m_natural_scroll_checkbox;
|
||||
RefPtr<MouseSettings::DoubleClickArrowWidget> m_double_click_arrow_widget;
|
||||
};
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
}
|
||||
fixed_height: 40
|
||||
|
||||
@GUI::Label {
|
||||
@GUI::ImageWidget {
|
||||
fixed_width: 32
|
||||
fixed_height: 32
|
||||
icon: "/res/icons/32x32/network.png"
|
||||
bitmap: "/res/icons/32x32/network.png"
|
||||
}
|
||||
|
||||
@GUI::Label {
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
spacing: 8
|
||||
}
|
||||
|
||||
@GUI::Label {
|
||||
name: "icon_label"
|
||||
@GUI::ImageWidget {
|
||||
name: "process_icon"
|
||||
fixed_size: [32, 32]
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <LibGUI/FileIconProvider.h>
|
||||
#include <LibGUI/GroupBox.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/ImageWidget.h>
|
||||
#include <LibGUI/JsonArrayModel.h>
|
||||
#include <LibGUI/Label.h>
|
||||
#include <LibGUI/LazyWidget.h>
|
||||
|
@ -539,7 +540,7 @@ ErrorOr<NonnullRefPtr<GUI::Window>> build_process_window(pid_t pid)
|
|||
|
||||
VERIFY(process_index.is_valid());
|
||||
if (auto icon_data = process_index.sibling_at_column(ProcessModel::Column::Icon).data(); icon_data.is_icon()) {
|
||||
main_widget->find_descendant_of_type_named<GUI::Label>("icon_label")->set_icon(icon_data.as_icon().bitmap_for_size(32));
|
||||
main_widget->find_descendant_of_type_named<GUI::ImageWidget>("process_icon")->set_bitmap(icon_data.as_icon().bitmap_for_size(32));
|
||||
}
|
||||
|
||||
main_widget->find_descendant_of_type_named<GUI::Label>("process_name")->set_text(String::formatted("{} (PID {})", process_index.sibling_at_column(ProcessModel::Column::Name).data().to_deprecated_string(), pid).release_value_but_fixme_should_propagate_errors());
|
||||
|
|
|
@ -34,10 +34,10 @@
|
|||
fixed_width: 60
|
||||
layout: @GUI::VerticalBoxLayout {}
|
||||
|
||||
@GUI::Label {
|
||||
name: "light_bulb_label"
|
||||
@GUI::ImageWidget {
|
||||
fixed_height: 60
|
||||
icon: "/res/icons/32x32/app-welcome.png"
|
||||
auto_resize: false
|
||||
bitmap: "/res/icons/32x32/app-welcome.png"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue