summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-09-21 16:13:04 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-09-21 16:13:33 +0200
commit83b5f6c11a7bd3da5c771b2182b4096e23a75287 (patch)
treeb7f8666eddec52c33ad1c2462efb2b03be5d3af7
parent4f4438c04c8cd5d52e367d1fda65b469c72c75c4 (diff)
downloadserenity-83b5f6c11a7bd3da5c771b2182b4096e23a75287.zip
LibGUI: Convert GGroupBox to ObjectPtr
-rw-r--r--Applications/SystemMonitor/NetworkStatisticsWidget.cpp4
-rw-r--r--Applications/SystemMonitor/main.cpp4
-rw-r--r--Applications/Terminal/main.cpp4
-rw-r--r--DevTools/VisualBuilder/VBWidgetRegistry.cpp2
-rw-r--r--Libraries/LibGUI/GGroupBox.h5
5 files changed, 10 insertions, 9 deletions
diff --git a/Applications/SystemMonitor/NetworkStatisticsWidget.cpp b/Applications/SystemMonitor/NetworkStatisticsWidget.cpp
index 72081ce7fe..ae4573aa75 100644
--- a/Applications/SystemMonitor/NetworkStatisticsWidget.cpp
+++ b/Applications/SystemMonitor/NetworkStatisticsWidget.cpp
@@ -12,7 +12,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget(GWidget* parent)
set_fill_with_background_color(true);
set_background_color(Color::WarmGray);
- auto* adapters_group_box = new GGroupBox("Adapters", this);
+ auto adapters_group_box = GGroupBox::construct("Adapters", this);
adapters_group_box->set_layout(make<GBoxLayout>(Orientation::Vertical));
adapters_group_box->layout()->set_margins({ 6, 16, 6, 6 });
adapters_group_box->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
@@ -32,7 +32,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget(GWidget* parent)
net_adapters_fields.empend("bytes_out", "Bytes Out", TextAlignment::CenterRight);
m_adapter_table_view->set_model(GJsonArrayModel::create("/proc/net/adapters", move(net_adapters_fields)));
- auto* sockets_group_box = new GGroupBox("Sockets", this);
+ auto sockets_group_box = GGroupBox::construct("Sockets", this);
sockets_group_box->set_layout(make<GBoxLayout>(Orientation::Vertical));
sockets_group_box->layout()->set_margins({ 6, 16, 6, 6 });
sockets_group_box->set_size_policy(SizePolicy::Fill, SizePolicy::Fill);
diff --git a/Applications/SystemMonitor/main.cpp b/Applications/SystemMonitor/main.cpp
index 587812a1d2..964232e0fe 100644
--- a/Applications/SystemMonitor/main.cpp
+++ b/Applications/SystemMonitor/main.cpp
@@ -66,7 +66,7 @@ int main(int argc, char** argv)
graphs_container->set_layout(make<GBoxLayout>(Orientation::Vertical));
graphs_container->layout()->set_margins({ 4, 4, 4, 4 });
- auto* cpu_graph_group_box = new GGroupBox("CPU usage", graphs_container);
+ auto cpu_graph_group_box = GGroupBox::construct("CPU usage", graphs_container);
cpu_graph_group_box->set_layout(make<GBoxLayout>(Orientation::Vertical));
cpu_graph_group_box->layout()->set_margins({ 6, 16, 6, 6 });
cpu_graph_group_box->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
@@ -79,7 +79,7 @@ int main(int argc, char** argv)
return String::format("%d%%", value);
};
- auto* memory_graph_group_box = new GGroupBox("Memory usage", graphs_container);
+ auto memory_graph_group_box = GGroupBox::construct("Memory usage", graphs_container);
memory_graph_group_box->set_layout(make<GBoxLayout>(Orientation::Vertical));
memory_graph_group_box->layout()->set_margins({ 6, 16, 6, 6 });
memory_graph_group_box->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
diff --git a/Applications/Terminal/main.cpp b/Applications/Terminal/main.cpp
index f960d4538f..87fa692d02 100644
--- a/Applications/Terminal/main.cpp
+++ b/Applications/Terminal/main.cpp
@@ -100,7 +100,7 @@ GWindow* create_settings_window(TerminalWidget& terminal, RefPtr<CConfigFile> co
settings->set_layout(make<GBoxLayout>(Orientation::Vertical));
settings->layout()->set_margins({ 4, 4, 4, 4 });
- auto* radio_container = new GGroupBox("Bell Mode", settings);
+ auto radio_container = GGroupBox::construct("Bell Mode", settings);
radio_container->set_layout(make<GBoxLayout>(Orientation::Vertical));
radio_container->layout()->set_margins({ 6, 16, 6, 6 });
radio_container->set_fill_with_background_color(true);
@@ -115,7 +115,7 @@ GWindow* create_settings_window(TerminalWidget& terminal, RefPtr<CConfigFile> co
terminal.set_should_beep(checked);
};
- auto* slider_container = new GGroupBox("Background Opacity", settings);
+ auto slider_container = GGroupBox::construct("Background Opacity", settings);
slider_container->set_layout(make<GBoxLayout>(Orientation::Vertical));
slider_container->layout()->set_margins({ 6, 16, 6, 6 });
slider_container->set_fill_with_background_color(true);
diff --git a/DevTools/VisualBuilder/VBWidgetRegistry.cpp b/DevTools/VisualBuilder/VBWidgetRegistry.cpp
index 341e3b0180..86b68b9159 100644
--- a/DevTools/VisualBuilder/VBWidgetRegistry.cpp
+++ b/DevTools/VisualBuilder/VBWidgetRegistry.cpp
@@ -76,7 +76,7 @@ static GWidget* build_gwidget(VBWidgetType type, GWidget* parent)
case VBWidgetType::GScrollBar:
return GScrollBar::construct(Orientation::Vertical, parent);
case VBWidgetType::GGroupBox:
- return new GGroupBox("groupbox_1", parent);
+ return GGroupBox::construct("groupbox_1", parent);
case VBWidgetType::GLabel: {
auto label = GLabel::construct(parent);
label->set_fill_with_background_color(true);
diff --git a/Libraries/LibGUI/GGroupBox.h b/Libraries/LibGUI/GGroupBox.h
index 04cfed5611..49c03870ff 100644
--- a/Libraries/LibGUI/GGroupBox.h
+++ b/Libraries/LibGUI/GGroupBox.h
@@ -5,14 +5,15 @@
class GGroupBox : public GWidget {
C_OBJECT(GGroupBox)
public:
- explicit GGroupBox(GWidget* parent);
- GGroupBox(const StringView& title, GWidget* parent);
virtual ~GGroupBox() override;
String title() const { return m_title; }
void set_title(const StringView&);
protected:
+ explicit GGroupBox(GWidget* parent);
+ GGroupBox(const StringView& title, GWidget* parent);
+
virtual void paint_event(GPaintEvent&) override;
private: