diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-09-21 14:21:34 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-09-21 15:25:08 +0200 |
commit | 2e76ac3aff4e1e372159f7f2d9857e5f59fe77cd (patch) | |
tree | d4ebea6c3b40e2c6a5d90d245bfca8619fae1dbd /DevTools | |
parent | c7437f9caa5485d99e0101bfac98d968e767741f (diff) | |
download | serenity-2e76ac3aff4e1e372159f7f2d9857e5f59fe77cd.zip |
FormCompiler: Generate code that uses ObjectPtr for widgets
Diffstat (limited to 'DevTools')
-rw-r--r-- | DevTools/FormCompiler/main.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/DevTools/FormCompiler/main.cpp b/DevTools/FormCompiler/main.cpp index 5e62bd149e..2e86550ff5 100644 --- a/DevTools/FormCompiler/main.cpp +++ b/DevTools/FormCompiler/main.cpp @@ -44,14 +44,14 @@ int main(int argc, char** argv) }); dbg() << "struct UI_" << name << " {"; - dbg() << " GWidget* main_widget;"; + dbg() << " ObjectPtr<GWidget> main_widget;"; widgets.as_array().for_each([&](auto& value) { ASSERT(value.is_object()); const JsonObject& widget_object = value.as_object(); auto name = widget_object.get("name").to_string(); auto class_name = widget_object.get("class").to_string(); - dbg() << " " << class_name << "* " << name << ";"; + dbg() << " ObjectPtr<" << class_name << "> " << name << ";"; }); dbg() << " UI_" << name << "();"; @@ -61,7 +61,7 @@ int main(int argc, char** argv) dbg() << "UI_" << name << "::UI_" << name << "()"; dbg() << "{"; - dbg() << " main_widget = new GWidget(nullptr);"; + dbg() << " main_widget = GWidget::construct(nullptr);"; dbg() << " main_widget->set_fill_with_background_color(true);"; widgets.as_array().for_each([&](auto& value) { @@ -69,7 +69,7 @@ int main(int argc, char** argv) const JsonObject& widget_object = value.as_object(); auto name = widget_object.get("name").to_string(); auto class_name = widget_object.get("class").to_string(); - dbg() << " " << name << " = new " << class_name << "(main_widget);"; + dbg() << " " << name << " = " << class_name << "::construct(main_widget);"; widget_object.for_each_member([&](auto& property_name, const JsonValue& property_value) { if (property_name == "class") |