ladybird/Ladybird/Qt/InspectorWidget.h
Daniel Bertalan c62240aa80 Everywhere: Warn on function definitions without prototypes
If no header includes the prototype of a function, then it cannot be
used from outside the translation unit it was defined in. In that case,
it should be marked as `static`, in order to avoid possible ODR
problems, unnecessary exported symbols, and allow the compiler to better
optimize those.

If this warning triggers in a function defined in a header, `inline`
needs to be added, otherwise if the header is included in more than one
TU, it will fail to link with a duplicate definition error.

The reason this diff got so big is that Lagom-only code wasn't built
with this flag even in Serenity times.
2024-07-17 21:51:29 +02:00

64 lines
1.5 KiB
C++

/*
* Copyright (c) 2022, MacDue <macdue@dueutil.tech>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "WebContentView.h"
#include <LibGfx/Point.h>
#include <LibWebView/Forward.h>
#include <QWidget>
class QAction;
class QMenu;
namespace Ladybird {
class WebContentView;
class InspectorWidget final : public QWidget {
Q_OBJECT
public:
InspectorWidget(QWidget* tab, WebContentView& content_view);
virtual ~InspectorWidget() override;
void inspect();
void reset();
void select_hovered_node();
void select_default_node();
public slots:
void device_pixel_ratio_changed(qreal dpi);
private:
virtual bool event(QEvent*) override;
void closeEvent(QCloseEvent*) override;
QScreen* m_current_screen;
double m_device_pixel_ratio { 0 };
WebContentView* m_inspector_view;
OwnPtr<WebView::InspectorClient> m_inspector_client;
QMenu* m_dom_node_text_context_menu { nullptr };
QMenu* m_dom_node_tag_context_menu { nullptr };
QMenu* m_dom_node_attribute_context_menu { nullptr };
QAction* m_edit_node_action { nullptr };
QAction* m_copy_node_action { nullptr };
QAction* m_screenshot_node_action { nullptr };
QAction* m_create_child_element_action { nullptr };
QAction* m_create_child_text_node_action { nullptr };
QAction* m_clone_node_action { nullptr };
QAction* m_delete_node_action { nullptr };
QAction* m_add_attribute_action { nullptr };
QAction* m_remove_attribute_action { nullptr };
QAction* m_copy_attribute_value_action { nullptr };
};
}