mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:37:46 +00:00
Userland: Prefer non-fallible construction for LibGUI objects
This commit is contained in:
parent
a4a94de942
commit
a6f6a1afd2
54 changed files with 69 additions and 70 deletions
|
@ -200,7 +200,7 @@ void BrushTool::draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint s
|
|||
ErrorOr<GUI::Widget*> BrushTool::get_properties_widget()
|
||||
{
|
||||
if (!m_properties_widget) {
|
||||
auto properties_widget = TRY(GUI::Widget::try_create());
|
||||
auto properties_widget = GUI::Widget::construct();
|
||||
properties_widget->set_layout<GUI::VerticalBoxLayout>();
|
||||
|
||||
auto mode_container = TRY(properties_widget->try_add<GUI::Widget>());
|
||||
|
|
|
@ -64,7 +64,7 @@ void BucketTool::on_mousedown(Layer* layer, MouseEvent& event)
|
|||
ErrorOr<GUI::Widget*> BucketTool::get_properties_widget()
|
||||
{
|
||||
if (!m_properties_widget) {
|
||||
auto properties_widget = TRY(GUI::Widget::try_create());
|
||||
auto properties_widget = GUI::Widget::construct();
|
||||
properties_widget->set_layout<GUI::VerticalBoxLayout>();
|
||||
|
||||
auto threshold_container = TRY(properties_widget->try_add<GUI::Widget>());
|
||||
|
|
|
@ -128,7 +128,7 @@ void CloneTool::on_keyup(GUI::KeyEvent& event)
|
|||
ErrorOr<GUI::Widget*> CloneTool::get_properties_widget()
|
||||
{
|
||||
if (!m_properties_widget) {
|
||||
auto properties_widget = TRY(GUI::Widget::try_create());
|
||||
auto properties_widget = GUI::Widget::construct();
|
||||
properties_widget->set_layout<GUI::VerticalBoxLayout>();
|
||||
|
||||
auto size_container = TRY(properties_widget->try_add<GUI::Widget>());
|
||||
|
|
|
@ -129,7 +129,7 @@ bool EllipseTool::on_keydown(GUI::KeyEvent& event)
|
|||
ErrorOr<GUI::Widget*> EllipseTool::get_properties_widget()
|
||||
{
|
||||
if (!m_properties_widget) {
|
||||
auto properties_widget = TRY(GUI::Widget::try_create());
|
||||
auto properties_widget = GUI::Widget::construct();
|
||||
properties_widget->set_layout<GUI::VerticalBoxLayout>();
|
||||
|
||||
auto thickness_container = TRY(properties_widget->try_add<GUI::Widget>());
|
||||
|
|
|
@ -57,7 +57,7 @@ void EraseTool::draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint
|
|||
ErrorOr<GUI::Widget*> EraseTool::get_properties_widget()
|
||||
{
|
||||
if (!m_properties_widget) {
|
||||
auto properties_widget = TRY(GUI::Widget::try_create());
|
||||
auto properties_widget = GUI::Widget::construct();
|
||||
properties_widget->set_layout<GUI::VerticalBoxLayout>();
|
||||
|
||||
auto size_container = TRY(properties_widget->try_add<GUI::Widget>());
|
||||
|
|
|
@ -201,7 +201,7 @@ void GradientTool::on_tool_activation()
|
|||
ErrorOr<GUI::Widget*> GradientTool::get_properties_widget()
|
||||
{
|
||||
if (!m_properties_widget) {
|
||||
auto properties_widget = TRY(GUI::Widget::try_create());
|
||||
auto properties_widget = GUI::Widget::construct();
|
||||
properties_widget->set_layout<GUI::VerticalBoxLayout>();
|
||||
|
||||
auto mode_container = TRY(properties_widget->try_add<GUI::Widget>());
|
||||
|
|
|
@ -179,7 +179,7 @@ void GuideTool::on_tool_activation()
|
|||
ErrorOr<GUI::Widget*> GuideTool::get_properties_widget()
|
||||
{
|
||||
if (!m_properties_widget) {
|
||||
auto properties_widget = TRY(GUI::Widget::try_create());
|
||||
auto properties_widget = GUI::Widget::construct();
|
||||
properties_widget->set_layout<GUI::VerticalBoxLayout>();
|
||||
|
||||
auto snapping_container = TRY(properties_widget->try_add<GUI::Widget>());
|
||||
|
|
|
@ -160,7 +160,7 @@ ErrorOr<GUI::Widget*> LassoSelectTool::get_properties_widget()
|
|||
return m_properties_widget.ptr();
|
||||
}
|
||||
|
||||
auto properties_widget = TRY(GUI::Widget::try_create());
|
||||
auto properties_widget = GUI::Widget::construct();
|
||||
properties_widget->set_layout<GUI::VerticalBoxLayout>();
|
||||
|
||||
auto mode_container = TRY(properties_widget->try_add<GUI::Widget>());
|
||||
|
|
|
@ -122,7 +122,7 @@ bool LineTool::on_keydown(GUI::KeyEvent& event)
|
|||
ErrorOr<GUI::Widget*> LineTool::get_properties_widget()
|
||||
{
|
||||
if (!m_properties_widget) {
|
||||
auto properties_widget = TRY(GUI::Widget::try_create());
|
||||
auto properties_widget = GUI::Widget::construct();
|
||||
properties_widget->set_layout<GUI::VerticalBoxLayout>();
|
||||
|
||||
auto thickness_container = TRY(properties_widget->try_add<GUI::Widget>());
|
||||
|
|
|
@ -292,7 +292,7 @@ Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap const>> MoveTool::cursor(
|
|||
ErrorOr<GUI::Widget*> MoveTool::get_properties_widget()
|
||||
{
|
||||
if (!m_properties_widget) {
|
||||
auto properties_widget = TRY(GUI::Widget::try_create());
|
||||
auto properties_widget = GUI::Widget::construct();
|
||||
properties_widget->set_layout<GUI::VerticalBoxLayout>();
|
||||
|
||||
auto selection_mode_container = TRY(properties_widget->try_add<GUI::Widget>());
|
||||
|
|
|
@ -38,7 +38,7 @@ void PenTool::draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint sta
|
|||
ErrorOr<GUI::Widget*> PenTool::get_properties_widget()
|
||||
{
|
||||
if (!m_properties_widget) {
|
||||
auto properties_widget = TRY(GUI::Widget::try_create());
|
||||
auto properties_widget = GUI::Widget::construct();
|
||||
properties_widget->set_layout<GUI::VerticalBoxLayout>();
|
||||
|
||||
auto size_container = TRY(properties_widget->try_add<GUI::Widget>());
|
||||
|
|
|
@ -44,7 +44,7 @@ void PickerTool::on_mousemove(Layer* layer, MouseEvent& event)
|
|||
ErrorOr<GUI::Widget*> PickerTool::get_properties_widget()
|
||||
{
|
||||
if (!m_properties_widget) {
|
||||
auto properties_widget = TRY(GUI::Widget::try_create());
|
||||
auto properties_widget = GUI::Widget::construct();
|
||||
properties_widget->set_layout<GUI::VerticalBoxLayout>();
|
||||
|
||||
auto sample_checkbox = TRY(properties_widget->try_add<GUI::CheckBox>("Sample all layers"_string));
|
||||
|
|
|
@ -189,7 +189,7 @@ ErrorOr<GUI::Widget*> PolygonalSelectTool::get_properties_widget()
|
|||
if (m_properties_widget)
|
||||
return m_properties_widget.ptr();
|
||||
|
||||
auto properties_widget = TRY(GUI::Widget::try_create());
|
||||
auto properties_widget = GUI::Widget::construct();
|
||||
properties_widget->set_layout<GUI::VerticalBoxLayout>();
|
||||
|
||||
auto mode_container = TRY(properties_widget->try_add<GUI::Widget>());
|
||||
|
|
|
@ -157,7 +157,7 @@ ErrorOr<GUI::Widget*> RectangleSelectTool::get_properties_widget()
|
|||
return m_properties_widget.ptr();
|
||||
}
|
||||
|
||||
auto properties_widget = TRY(GUI::Widget::try_create());
|
||||
auto properties_widget = GUI::Widget::construct();
|
||||
properties_widget->set_layout<GUI::VerticalBoxLayout>();
|
||||
|
||||
auto feather_container = TRY(properties_widget->try_add<GUI::Widget>());
|
||||
|
|
|
@ -143,7 +143,7 @@ bool RectangleTool::on_keydown(GUI::KeyEvent& event)
|
|||
ErrorOr<GUI::Widget*> RectangleTool::get_properties_widget()
|
||||
{
|
||||
if (!m_properties_widget) {
|
||||
auto properties_widget = TRY(GUI::Widget::try_create());
|
||||
auto properties_widget = GUI::Widget::construct();
|
||||
properties_widget->set_layout<GUI::VerticalBoxLayout>();
|
||||
|
||||
auto thickness_or_radius_container = TRY(properties_widget->try_add<GUI::Widget>());
|
||||
|
|
|
@ -93,7 +93,7 @@ void SprayTool::on_mouseup(Layer*, MouseEvent&)
|
|||
ErrorOr<GUI::Widget*> SprayTool::get_properties_widget()
|
||||
{
|
||||
if (!m_properties_widget) {
|
||||
auto properties_widget = TRY(GUI::Widget::try_create());
|
||||
auto properties_widget = GUI::Widget::construct();
|
||||
properties_widget->set_layout<GUI::VerticalBoxLayout>();
|
||||
|
||||
auto size_container = TRY(properties_widget->try_add<GUI::Widget>());
|
||||
|
|
|
@ -108,7 +108,7 @@ ErrorOr<GUI::Widget*> TextTool::get_properties_widget()
|
|||
if (m_properties_widget)
|
||||
return m_properties_widget.ptr();
|
||||
|
||||
auto properties_widget = TRY(GUI::Widget::try_create());
|
||||
auto properties_widget = GUI::Widget::construct();
|
||||
properties_widget->set_layout<GUI::VerticalBoxLayout>();
|
||||
|
||||
auto font_header = TRY(properties_widget->try_add<GUI::Label>("Current Font:"_string));
|
||||
|
|
|
@ -72,7 +72,7 @@ ErrorOr<GUI::Widget*> WandSelectTool::get_properties_widget()
|
|||
return m_properties_widget.ptr();
|
||||
}
|
||||
|
||||
auto properties_widget = TRY(GUI::Widget::try_create());
|
||||
auto properties_widget = GUI::Widget::construct();
|
||||
properties_widget->set_layout<GUI::VerticalBoxLayout>();
|
||||
|
||||
auto threshold_container = TRY(properties_widget->try_add<GUI::Widget>());
|
||||
|
|
|
@ -26,7 +26,7 @@ void ZoomTool::on_mousedown(Layer*, MouseEvent& event)
|
|||
ErrorOr<GUI::Widget*> ZoomTool::get_properties_widget()
|
||||
{
|
||||
if (!m_properties_widget) {
|
||||
auto properties_widget = TRY(GUI::Widget::try_create());
|
||||
auto properties_widget = GUI::Widget::construct();
|
||||
properties_widget->set_layout<GUI::VerticalBoxLayout>();
|
||||
|
||||
auto sensitivity_container = TRY(properties_widget->try_add<GUI::Widget>());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue