mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:07:34 +00:00
ThemeEditor: Add a Statusbar
This commit is contained in:
parent
ae6bde6847
commit
16240942ba
3 changed files with 54 additions and 38 deletions
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
||||||
* Copyright (c) 2021-2022, networkException <networkexception@serenityos.org>
|
* Copyright (c) 2021-2022, networkException <networkexception@serenityos.org>
|
||||||
* Copyright (c) 2021-2022, Sam Atkins <atkinssj@serenityos.org>
|
* Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
|
||||||
* Copyright (c) 2021, Antonio Di Stefano <tonio9681@gmail.com>
|
* Copyright (c) 2021, Antonio Di Stefano <tonio9681@gmail.com>
|
||||||
* Copyright (c) 2022, Filiph Sandström <filiph.sandstrom@filfatstudios.com>
|
* Copyright (c) 2022, Filiph Sandström <filiph.sandstrom@filfatstudios.com>
|
||||||
*
|
*
|
||||||
|
@ -31,11 +31,11 @@
|
||||||
#include <LibGUI/Menubar.h>
|
#include <LibGUI/Menubar.h>
|
||||||
#include <LibGUI/MessageBox.h>
|
#include <LibGUI/MessageBox.h>
|
||||||
#include <LibGUI/ScrollableContainerWidget.h>
|
#include <LibGUI/ScrollableContainerWidget.h>
|
||||||
#include <LibGfx/Filters/ColorBlindnessFilter.h>
|
#include <LibGUI/Statusbar.h>
|
||||||
|
|
||||||
namespace ThemeEditor {
|
namespace ThemeEditor {
|
||||||
|
|
||||||
static const PropertyTab window_tab {
|
static PropertyTab const window_tab {
|
||||||
"Windows"sv,
|
"Windows"sv,
|
||||||
{
|
{
|
||||||
{ "General",
|
{ "General",
|
||||||
|
@ -91,7 +91,7 @@ static const PropertyTab window_tab {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const PropertyTab widgets_tab {
|
static PropertyTab const widgets_tab {
|
||||||
"Widgets"sv,
|
"Widgets"sv,
|
||||||
{
|
{
|
||||||
{ "General",
|
{ "General",
|
||||||
|
@ -160,7 +160,7 @@ static const PropertyTab widgets_tab {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const PropertyTab syntax_highlighting_tab {
|
static PropertyTab const syntax_highlighting_tab {
|
||||||
"Syntax Highlighting"sv,
|
"Syntax Highlighting"sv,
|
||||||
{
|
{
|
||||||
{ "General",
|
{ "General",
|
||||||
|
@ -184,7 +184,7 @@ static const PropertyTab syntax_highlighting_tab {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const PropertyTab color_scheme_tab {
|
static PropertyTab const color_scheme_tab {
|
||||||
"Color Scheme"sv,
|
"Color Scheme"sv,
|
||||||
{
|
{
|
||||||
{ "General",
|
{ "General",
|
||||||
|
@ -219,6 +219,7 @@ ErrorOr<NonnullRefPtr<MainWidget>> MainWidget::try_create()
|
||||||
TRY(main_widget->load_from_gml(theme_editor_gml));
|
TRY(main_widget->load_from_gml(theme_editor_gml));
|
||||||
main_widget->m_preview_widget = main_widget->find_descendant_of_type_named<ThemeEditor::PreviewWidget>("preview_widget");
|
main_widget->m_preview_widget = main_widget->find_descendant_of_type_named<ThemeEditor::PreviewWidget>("preview_widget");
|
||||||
main_widget->m_property_tabs = main_widget->find_descendant_of_type_named<GUI::TabWidget>("property_tabs");
|
main_widget->m_property_tabs = main_widget->find_descendant_of_type_named<GUI::TabWidget>("property_tabs");
|
||||||
|
main_widget->m_statusbar = main_widget->find_descendant_of_type_named<GUI::Statusbar>("statusbar");
|
||||||
|
|
||||||
TRY(main_widget->add_property_tab(window_tab));
|
TRY(main_widget->add_property_tab(window_tab));
|
||||||
TRY(main_widget->add_property_tab(widgets_tab));
|
TRY(main_widget->add_property_tab(widgets_tab));
|
||||||
|
@ -234,6 +235,12 @@ MainWidget::MainWidget(NonnullRefPtr<AlignmentModel> alignment_model)
|
||||||
: m_current_palette(GUI::Application::the()->palette())
|
: m_current_palette(GUI::Application::the()->palette())
|
||||||
, m_alignment_model(move(alignment_model))
|
, m_alignment_model(move(alignment_model))
|
||||||
{
|
{
|
||||||
|
GUI::Application::the()->on_action_enter = [this](GUI::Action& action) {
|
||||||
|
m_statusbar->set_override_text(action.status_tip());
|
||||||
|
};
|
||||||
|
GUI::Application::the()->on_action_leave = [this](GUI::Action&) {
|
||||||
|
m_statusbar->set_override_text({});
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
|
ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
|
* Copyright (c) 2022-2023, Sam Atkins <atkinssj@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -117,6 +117,7 @@ private:
|
||||||
|
|
||||||
RefPtr<PreviewWidget> m_preview_widget;
|
RefPtr<PreviewWidget> m_preview_widget;
|
||||||
RefPtr<GUI::TabWidget> m_property_tabs;
|
RefPtr<GUI::TabWidget> m_property_tabs;
|
||||||
|
RefPtr<GUI::Statusbar> m_statusbar;
|
||||||
RefPtr<GUI::Action> m_save_action;
|
RefPtr<GUI::Action> m_save_action;
|
||||||
|
|
||||||
RefPtr<GUI::Button> m_theme_override_apply;
|
RefPtr<GUI::Button> m_theme_override_apply;
|
||||||
|
|
|
@ -1,44 +1,52 @@
|
||||||
@GUI::Widget {
|
@GUI::Widget {
|
||||||
layout: @GUI::VerticalBoxLayout {
|
layout: @GUI::VerticalBoxLayout {}
|
||||||
margins: [0, 4, 4]
|
|
||||||
spacing: 6
|
|
||||||
}
|
|
||||||
fill_with_background_color: true
|
fill_with_background_color: true
|
||||||
|
|
||||||
@GUI::Widget {
|
@GUI::Widget {
|
||||||
layout: @GUI::HorizontalBoxLayout {
|
layout: @GUI::VerticalBoxLayout {
|
||||||
spacing: 4
|
margins: [0, 4, 4]
|
||||||
}
|
|
||||||
|
|
||||||
@ThemeEditor::PreviewWidget {
|
|
||||||
name: "preview_widget"
|
|
||||||
}
|
|
||||||
|
|
||||||
@GUI::TabWidget {
|
|
||||||
name: "property_tabs"
|
|
||||||
container_margins: [5]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@GUI::Widget {
|
|
||||||
name: "theme_override_controls"
|
|
||||||
layout: @GUI::HorizontalBoxLayout {
|
|
||||||
spacing: 6
|
spacing: 6
|
||||||
}
|
}
|
||||||
preferred_height: "shrink"
|
|
||||||
|
|
||||||
@GUI::Layout::Spacer {}
|
@GUI::Widget {
|
||||||
|
layout: @GUI::HorizontalBoxLayout {
|
||||||
|
spacing: 4
|
||||||
|
}
|
||||||
|
|
||||||
@GUI::DialogButton {
|
@ThemeEditor::PreviewWidget {
|
||||||
name: "reset_button"
|
name: "preview_widget"
|
||||||
text: "Reset"
|
}
|
||||||
enabled: false
|
|
||||||
|
@GUI::TabWidget {
|
||||||
|
name: "property_tabs"
|
||||||
|
container_margins: [5]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GUI::DialogButton {
|
@GUI::Widget {
|
||||||
name: "apply_button"
|
name: "theme_override_controls"
|
||||||
text: "Apply"
|
layout: @GUI::HorizontalBoxLayout {
|
||||||
enabled: false
|
spacing: 6
|
||||||
|
}
|
||||||
|
preferred_height: "shrink"
|
||||||
|
|
||||||
|
@GUI::Layout::Spacer {}
|
||||||
|
|
||||||
|
@GUI::DialogButton {
|
||||||
|
name: "reset_button"
|
||||||
|
text: "Reset"
|
||||||
|
enabled: false
|
||||||
|
}
|
||||||
|
|
||||||
|
@GUI::DialogButton {
|
||||||
|
name: "apply_button"
|
||||||
|
text: "Apply"
|
||||||
|
enabled: false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GUI::Statusbar {
|
||||||
|
name: "statusbar"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue