mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 10:17:35 +00:00
ThemeEditor: Extract most logic into a MainWidget class
This commit is contained in:
parent
df7fd39fcc
commit
8915b3227c
4 changed files with 476 additions and 386 deletions
48
Userland/Applications/ThemeEditor/MainWidget.h
Normal file
48
Userland/Applications/ThemeEditor/MainWidget.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "PreviewWidget.h"
|
||||
#include <AK/Time.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/SystemTheme.h>
|
||||
|
||||
namespace ThemeEditor {
|
||||
|
||||
class MainWidget final : public GUI::Widget {
|
||||
C_OBJECT(MainWidget);
|
||||
|
||||
public:
|
||||
virtual ~MainWidget() override = default;
|
||||
|
||||
ErrorOr<void> initialize_menubar(GUI::Window&);
|
||||
GUI::Window::CloseRequestDecision request_close();
|
||||
void update_title();
|
||||
|
||||
private:
|
||||
explicit MainWidget(Optional<String> path, Gfx::Palette startup_preview_palette);
|
||||
|
||||
void save_to_file(Core::File&);
|
||||
void set_path(String);
|
||||
|
||||
RefPtr<PreviewWidget> m_preview_widget;
|
||||
RefPtr<GUI::Action> m_save_action;
|
||||
|
||||
Optional<String> m_path;
|
||||
Time m_last_modified_time { Time::now_monotonic() };
|
||||
|
||||
Vector<Gfx::AlignmentRole> m_alignment_roles;
|
||||
Vector<Gfx::ColorRole> m_color_roles;
|
||||
Vector<Gfx::FlagRole> m_flag_roles;
|
||||
Vector<Gfx::MetricRole> m_metric_roles;
|
||||
Vector<Gfx::PathRole> m_path_roles;
|
||||
|
||||
OwnPtr<GUI::ActionGroup> m_preview_type_action_group;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue