@@ -23,7 +23,7 @@ extern Browser::Settings* s_settings;
23
23
24
24
BrowserWindow::BrowserWindow ()
25
25
{
26
- m_tabs_container = new QTabWidget;
26
+ m_tabs_container = new QTabWidget ( this ) ;
27
27
m_tabs_container->setElideMode (Qt::TextElideMode::ElideRight);
28
28
m_tabs_container->setMovable (true );
29
29
m_tabs_container->setTabsClosable (true );
@@ -32,30 +32,30 @@ BrowserWindow::BrowserWindow()
32
32
33
33
auto * menu = menuBar ()->addMenu (" &File" );
34
34
35
- auto * new_tab_action = new QAction (" New &Tab" );
35
+ auto * new_tab_action = new QAction (" New &Tab" , this );
36
36
new_tab_action->setShortcut (QKeySequence (Qt::CTRL | Qt::Key_T));
37
37
menu->addAction (new_tab_action);
38
38
39
- auto * settings_action = new QAction (" &Settings" );
39
+ auto * settings_action = new QAction (" &Settings" , this );
40
40
settings_action->setShortcut (QKeySequence (Qt::CTRL | Qt::Key_Comma));
41
41
menu->addAction (settings_action);
42
42
43
- auto * close_current_tab_action = new QAction (" Close Current Tab" );
43
+ auto * close_current_tab_action = new QAction (" Close Current Tab" , this );
44
44
close_current_tab_action->setShortcut (QKeySequence (Qt::CTRL | Qt::Key_W));
45
45
menu->addAction (close_current_tab_action);
46
46
47
- auto * quit_action = new QAction (" &Quit" );
47
+ auto * quit_action = new QAction (" &Quit" , this );
48
48
quit_action->setShortcut (QKeySequence (Qt::CTRL | Qt::Key_Q));
49
49
menu->addAction (quit_action);
50
50
51
51
auto * view_menu = menuBar ()->addMenu (" &View" );
52
52
53
- auto * open_next_tab_action = new QAction (" Open &Next Tab" );
53
+ auto * open_next_tab_action = new QAction (" Open &Next Tab" , this );
54
54
open_next_tab_action->setShortcut (QKeySequence (Qt::CTRL | Qt::Key_PageDown));
55
55
view_menu->addAction (open_next_tab_action);
56
56
QObject::connect (open_next_tab_action, &QAction::triggered, this , &BrowserWindow::open_next_tab);
57
57
58
- auto * open_previous_tab_action = new QAction (" Open &Previous Tab" );
58
+ auto * open_previous_tab_action = new QAction (" Open &Previous Tab" , this );
59
59
open_previous_tab_action->setShortcut (QKeySequence (Qt::CTRL | Qt::Key_PageUp));
60
60
view_menu->addAction (open_previous_tab_action);
61
61
QObject::connect (open_previous_tab_action, &QAction::triggered, this , &BrowserWindow::open_previous_tab);
@@ -66,19 +66,19 @@ BrowserWindow::BrowserWindow()
66
66
67
67
auto * color_scheme_group = new QActionGroup (this );
68
68
69
- auto * auto_color_scheme = new QAction (" &Auto" );
69
+ auto * auto_color_scheme = new QAction (" &Auto" , this );
70
70
auto_color_scheme->setCheckable (true );
71
71
color_scheme_group->addAction (auto_color_scheme);
72
72
color_scheme_menu->addAction (auto_color_scheme);
73
73
QObject::connect (auto_color_scheme, &QAction::triggered, this , &BrowserWindow::enable_auto_color_scheme);
74
74
75
- auto * light_color_scheme = new QAction (" &Light" );
75
+ auto * light_color_scheme = new QAction (" &Light" , this );
76
76
light_color_scheme->setCheckable (true );
77
77
color_scheme_group->addAction (light_color_scheme);
78
78
color_scheme_menu->addAction (light_color_scheme);
79
79
QObject::connect (light_color_scheme, &QAction::triggered, this , &BrowserWindow::enable_light_color_scheme);
80
80
81
- auto * dark_color_scheme = new QAction (" &Dark" );
81
+ auto * dark_color_scheme = new QAction (" &Dark" , this );
82
82
dark_color_scheme->setCheckable (true );
83
83
color_scheme_group->addAction (dark_color_scheme);
84
84
color_scheme_menu->addAction (dark_color_scheme);
@@ -88,23 +88,23 @@ BrowserWindow::BrowserWindow()
88
88
89
89
auto * inspect_menu = menuBar ()->addMenu (" &Inspect" );
90
90
91
- auto * view_source_action = new QAction (" View &Source" );
91
+ auto * view_source_action = new QAction (" View &Source" , this );
92
92
view_source_action->setIcon (QIcon (QString (" %1/res/icons/16x16/filetype-html.png" ).arg (s_serenity_resource_root.characters ())));
93
93
view_source_action->setShortcut (QKeySequence (Qt::CTRL | Qt::Key_U));
94
94
inspect_menu->addAction (view_source_action);
95
95
QObject::connect (view_source_action, &QAction::triggered, this , [this ] {
96
96
if (m_current_tab) {
97
97
auto source = m_current_tab->view ().source ();
98
98
99
- auto * text_edit = new QPlainTextEdit;
99
+ auto * text_edit = new QPlainTextEdit ( this ) ;
100
100
text_edit->setFont (QFontDatabase::systemFont (QFontDatabase::SystemFont::FixedFont));
101
101
text_edit->resize (800 , 600 );
102
102
text_edit->setPlainText (source.characters ());
103
103
text_edit->show ();
104
104
}
105
105
});
106
106
107
- auto * js_console_action = new QAction (" Show &JS Console" );
107
+ auto * js_console_action = new QAction (" Show &JS Console" , this );
108
108
js_console_action->setIcon (QIcon (QString (" %1/res/icons/16x16/filetype-javascript.png" ).arg (s_serenity_resource_root.characters ())));
109
109
js_console_action->setShortcut (QKeySequence (Qt::CTRL | Qt::SHIFT | Qt::Key_J));
110
110
inspect_menu->addAction (js_console_action);
@@ -126,49 +126,49 @@ BrowserWindow::BrowserWindow()
126
126
127
127
auto * debug_menu = menuBar ()->addMenu (" &Debug" );
128
128
129
- auto * dump_dom_tree_action = new QAction (" Dump DOM Tree" );
129
+ auto * dump_dom_tree_action = new QAction (" Dump DOM Tree" , this );
130
130
dump_dom_tree_action->setIcon (QIcon (QString (" %1/res/icons/browser/dom-tree.png" ).arg (s_serenity_resource_root.characters ())));
131
131
debug_menu->addAction (dump_dom_tree_action);
132
132
QObject::connect (dump_dom_tree_action, &QAction::triggered, this , [this ] {
133
133
debug_request (" dump-dom-tree" );
134
134
});
135
135
136
- auto * dump_layout_tree_action = new QAction (" Dump Layout Tree" );
136
+ auto * dump_layout_tree_action = new QAction (" Dump Layout Tree" , this );
137
137
dump_layout_tree_action->setIcon (QIcon (QString (" %1/res/icons/16x16/layout.png" ).arg (s_serenity_resource_root.characters ())));
138
138
debug_menu->addAction (dump_layout_tree_action);
139
139
QObject::connect (dump_layout_tree_action, &QAction::triggered, this , [this ] {
140
140
debug_request (" dump-layout-tree" );
141
141
});
142
142
143
- auto * dump_stacking_context_tree_action = new QAction (" Dump Stacking Context Tree" );
143
+ auto * dump_stacking_context_tree_action = new QAction (" Dump Stacking Context Tree" , this );
144
144
dump_stacking_context_tree_action->setIcon (QIcon (QString (" %1/res/icons/16x16/layers.png" ).arg (s_serenity_resource_root.characters ())));
145
145
debug_menu->addAction (dump_stacking_context_tree_action);
146
146
QObject::connect (dump_stacking_context_tree_action, &QAction::triggered, this , [this ] {
147
147
debug_request (" dump-stacking-context-tree" );
148
148
});
149
149
150
- auto * dump_style_sheets_action = new QAction (" Dump Style Sheets" );
150
+ auto * dump_style_sheets_action = new QAction (" Dump Style Sheets" , this );
151
151
dump_style_sheets_action->setIcon (QIcon (QString (" %1/res/icons/16x16/filetype-css.png" ).arg (s_serenity_resource_root.characters ())));
152
152
debug_menu->addAction (dump_style_sheets_action);
153
153
QObject::connect (dump_style_sheets_action, &QAction::triggered, this , [this ] {
154
154
debug_request (" dump-style-sheets" );
155
155
});
156
156
157
- auto * dump_history_action = new QAction (" Dump History" );
157
+ auto * dump_history_action = new QAction (" Dump History" , this );
158
158
dump_history_action->setIcon (QIcon (QString (" %1/res/icons/16x16/history.png" ).arg (s_serenity_resource_root.characters ())));
159
159
debug_menu->addAction (dump_history_action);
160
160
QObject::connect (dump_history_action, &QAction::triggered, this , [this ] {
161
161
debug_request (" dump-history" );
162
162
});
163
163
164
- auto * dump_cookies_action = new QAction (" Dump Cookies" );
164
+ auto * dump_cookies_action = new QAction (" Dump Cookies" , this );
165
165
dump_cookies_action->setIcon (QIcon (QString (" %1/res/icons/browser/cookie.png" ).arg (s_serenity_resource_root.characters ())));
166
166
debug_menu->addAction (dump_cookies_action);
167
167
QObject::connect (dump_cookies_action, &QAction::triggered, this , [this ] {
168
168
debug_request (" dump-cookies" );
169
169
});
170
170
171
- auto * dump_local_storage_action = new QAction (" Dump Local Storage" );
171
+ auto * dump_local_storage_action = new QAction (" Dump Local Storage" , this );
172
172
dump_local_storage_action->setIcon (QIcon (QString (" %1/res/icons/browser/local-storage.png" ).arg (s_serenity_resource_root.characters ())));
173
173
debug_menu->addAction (dump_local_storage_action);
174
174
QObject::connect (dump_local_storage_action, &QAction::triggered, this , [this ] {
@@ -177,7 +177,7 @@ BrowserWindow::BrowserWindow()
177
177
178
178
debug_menu->addSeparator ();
179
179
180
- auto * show_line_box_borders_action = new QAction (" Show Line Box Borders" );
180
+ auto * show_line_box_borders_action = new QAction (" Show Line Box Borders" , this );
181
181
show_line_box_borders_action->setCheckable (true );
182
182
debug_menu->addAction (show_line_box_borders_action);
183
183
QObject::connect (show_line_box_borders_action, &QAction::triggered, this , [this , show_line_box_borders_action] {
@@ -187,14 +187,14 @@ BrowserWindow::BrowserWindow()
187
187
188
188
debug_menu->addSeparator ();
189
189
190
- auto * collect_garbage_action = new QAction (" Collect Garbage" );
190
+ auto * collect_garbage_action = new QAction (" Collect Garbage" , this );
191
191
collect_garbage_action->setIcon (QIcon (QString (" %1/res/icons/16x16/trash-can.png" ).arg (s_serenity_resource_root.characters ())));
192
192
debug_menu->addAction (collect_garbage_action);
193
193
QObject::connect (collect_garbage_action, &QAction::triggered, this , [this ] {
194
194
debug_request (" collect-garbage" );
195
195
});
196
196
197
- auto * clear_cache_action = new QAction (" Clear Cache" );
197
+ auto * clear_cache_action = new QAction (" Clear Cache" , this );
198
198
clear_cache_action->setIcon (QIcon (QString (" %1/res/icons/browser/clear-cache.png" ).arg (s_serenity_resource_root.characters ())));
199
199
debug_menu->addAction (clear_cache_action);
200
200
QObject::connect (clear_cache_action, &QAction::triggered, this , [this ] {
@@ -243,7 +243,7 @@ BrowserWindow::BrowserWindow()
243
243
244
244
debug_menu->addSeparator ();
245
245
246
- auto * enable_scripting_action = new QAction (" Enable Scripting" );
246
+ auto * enable_scripting_action = new QAction (" Enable Scripting" , this );
247
247
enable_scripting_action->setCheckable (true );
248
248
enable_scripting_action->setChecked (true );
249
249
debug_menu->addAction (enable_scripting_action);
@@ -252,7 +252,7 @@ BrowserWindow::BrowserWindow()
252
252
debug_request (" scripting" , state ? " on" : " off" );
253
253
});
254
254
255
- auto * enable_same_origin_policy_action = new QAction (" Enable Same-Origin Policy" );
255
+ auto * enable_same_origin_policy_action = new QAction (" Enable Same-Origin Policy" , this );
256
256
enable_same_origin_policy_action->setCheckable (true );
257
257
debug_menu->addAction (enable_same_origin_policy_action);
258
258
QObject::connect (enable_same_origin_policy_action, &QAction::triggered, this , [this , enable_same_origin_policy_action] {
0 commit comments