mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
Applications: Fix visibility of Object-derivative constructors
Derivatives of Core::Object should be constructed through ClassName::construct(), to avoid handling ref-counted objects with refcount zero. Fixing the visibility means that misuses like this are more difficult.
This commit is contained in:
parent
6b75a4dfc3
commit
465af4c4d4
Notes:
sideshowbarker
2024-07-18 01:33:10 +09:00
Author: https://github.com/BenWiederhake Commit: https://github.com/SerenityOS/serenity/commit/465af4c4d4f Pull-request: https://github.com/SerenityOS/serenity/pull/10745 Reviewed-by: https://github.com/PeterBindels-TomTom Reviewed-by: https://github.com/sin-ack ✅
@ -20,7 +20,7 @@
|
||||
class NetworkWidget final : public GUI::ImageWidget {
|
||||
C_OBJECT(NetworkWidget);
|
||||
|
||||
public:
|
||||
private:
|
||||
NetworkWidget(bool notifications)
|
||||
{
|
||||
m_notifications = notifications;
|
||||
@ -28,7 +28,6 @@ public:
|
||||
start_timer(5000);
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void timer_event(Core::TimerEvent&) override
|
||||
{
|
||||
update_widget();
|
||||
|
@ -30,6 +30,7 @@ class GraphWidget final : public GUI::Frame {
|
||||
public:
|
||||
static constexpr size_t history_size = 24;
|
||||
|
||||
private:
|
||||
GraphWidget(GraphType graph_type, Optional<Gfx::Color> graph_color, Optional<Gfx::Color> graph_error_color)
|
||||
: m_graph_type(graph_type)
|
||||
{
|
||||
@ -39,7 +40,6 @@ public:
|
||||
start_timer(1000);
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void timer_event(Core::TimerEvent&) override
|
||||
{
|
||||
switch (m_graph_type) {
|
||||
|
@ -35,26 +35,6 @@ struct AppState {
|
||||
class ResultRow final : public GUI::Widget {
|
||||
C_OBJECT(ResultRow)
|
||||
public:
|
||||
ResultRow()
|
||||
{
|
||||
auto& layout = set_layout<GUI::HorizontalBoxLayout>();
|
||||
layout.set_spacing(12);
|
||||
layout.set_margins(4);
|
||||
|
||||
m_image = add<GUI::ImageWidget>();
|
||||
|
||||
m_label_container = add<GUI::Widget>();
|
||||
m_label_container->set_layout<GUI::VerticalBoxLayout>();
|
||||
m_label_container->set_fixed_height(30);
|
||||
|
||||
m_title = m_label_container->add<GUI::Label>();
|
||||
m_title->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
|
||||
set_shrink_to_fit(true);
|
||||
set_fill_with_background_color(true);
|
||||
set_greedy_for_hits(true);
|
||||
}
|
||||
|
||||
void set_image(RefPtr<Gfx::Bitmap> bitmap)
|
||||
{
|
||||
m_image->set_bitmap(bitmap);
|
||||
@ -89,6 +69,26 @@ public:
|
||||
Function<void()> on_selected;
|
||||
|
||||
private:
|
||||
ResultRow()
|
||||
{
|
||||
auto& layout = set_layout<GUI::HorizontalBoxLayout>();
|
||||
layout.set_spacing(12);
|
||||
layout.set_margins(4);
|
||||
|
||||
m_image = add<GUI::ImageWidget>();
|
||||
|
||||
m_label_container = add<GUI::Widget>();
|
||||
m_label_container->set_layout<GUI::VerticalBoxLayout>();
|
||||
m_label_container->set_fixed_height(30);
|
||||
|
||||
m_title = m_label_container->add<GUI::Label>();
|
||||
m_title->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
|
||||
set_shrink_to_fit(true);
|
||||
set_fill_with_background_color(true);
|
||||
set_greedy_for_hits(true);
|
||||
}
|
||||
|
||||
void mousedown_event(GUI::MouseEvent&) override
|
||||
{
|
||||
set_background_role(ColorRole::MenuBase);
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include <LibGUI/AbstractButton.h>
|
||||
|
||||
class KeyButton : public GUI::AbstractButton {
|
||||
class KeyButton final : public GUI::AbstractButton {
|
||||
C_OBJECT(KeyButton)
|
||||
|
||||
public:
|
||||
@ -25,5 +25,7 @@ protected:
|
||||
virtual void paint_event(GUI::PaintEvent&) override;
|
||||
|
||||
private:
|
||||
KeyButton() = default;
|
||||
|
||||
bool m_pressed { false };
|
||||
};
|
||||
|
@ -10,11 +10,10 @@
|
||||
#include <LibGUI/Button.h>
|
||||
#include <LibKeyboard/CharacterMapData.h>
|
||||
|
||||
class KeyboardMapperWidget : public GUI::Widget {
|
||||
class KeyboardMapperWidget final : public GUI::Widget {
|
||||
C_OBJECT(KeyboardMapperWidget)
|
||||
|
||||
public:
|
||||
KeyboardMapperWidget();
|
||||
virtual ~KeyboardMapperWidget() override;
|
||||
|
||||
void create_frame();
|
||||
@ -31,6 +30,8 @@ protected:
|
||||
void update_window_title();
|
||||
|
||||
private:
|
||||
KeyboardMapperWidget();
|
||||
|
||||
Vector<KeyButton*> m_keys;
|
||||
RefPtr<GUI::Widget> m_map_group;
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
class NumericInput final : public GUI::TextBox {
|
||||
C_OBJECT(NumericInput)
|
||||
public:
|
||||
NumericInput();
|
||||
virtual ~NumericInput() override = default;
|
||||
|
||||
Function<void(i32)> on_number_changed;
|
||||
@ -22,6 +21,7 @@ public:
|
||||
void set_current_number(i32 number, bool call_change_handler = true);
|
||||
|
||||
private:
|
||||
NumericInput();
|
||||
void on_focus_lost();
|
||||
|
||||
bool m_needs_text_reset { false };
|
||||
|
@ -17,17 +17,17 @@ class TrackManager;
|
||||
|
||||
// Wrapper class accepting custom events to advance the track playing and forward audio data to the system.
|
||||
// This does not run on a separate thread, preventing IPC multithreading madness.
|
||||
class AudioPlayerLoop : public Core::Object {
|
||||
class AudioPlayerLoop final : public Core::Object {
|
||||
C_OBJECT(AudioPlayerLoop)
|
||||
public:
|
||||
AudioPlayerLoop(TrackManager& track_manager, bool& need_to_write_wav, Audio::WavWriter& wav_writer);
|
||||
|
||||
void enqueue_audio();
|
||||
|
||||
void toggle_paused();
|
||||
bool is_playing() { return m_should_play_audio; }
|
||||
|
||||
private:
|
||||
AudioPlayerLoop(TrackManager& track_manager, bool& need_to_write_wav, Audio::WavWriter& wav_writer);
|
||||
|
||||
TrackManager& m_track_manager;
|
||||
Array<Sample, sample_count> m_buffer;
|
||||
Optional<Audio::ResampleHelper<double>> m_resampler;
|
||||
|
@ -24,13 +24,6 @@ class ColorWidget : public GUI::Frame {
|
||||
C_OBJECT(ColorWidget);
|
||||
|
||||
public:
|
||||
explicit ColorWidget(Color color, PaletteWidget& palette_widget)
|
||||
: m_palette_widget(palette_widget)
|
||||
, m_color(color)
|
||||
{
|
||||
set_fixed_width(16);
|
||||
}
|
||||
|
||||
virtual ~ColorWidget() override
|
||||
{
|
||||
}
|
||||
@ -57,6 +50,13 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
explicit ColorWidget(Color color, PaletteWidget& palette_widget)
|
||||
: m_palette_widget(palette_widget)
|
||||
, m_color(color)
|
||||
{
|
||||
set_fixed_width(16);
|
||||
}
|
||||
|
||||
PaletteWidget& m_palette_widget;
|
||||
Color m_color;
|
||||
};
|
||||
@ -87,6 +87,9 @@ public:
|
||||
|
||||
Function<void(Color const&)> on_color_change;
|
||||
Color m_color = Color::White;
|
||||
|
||||
private:
|
||||
SelectedColorWidget() = default;
|
||||
};
|
||||
|
||||
PaletteWidget::PaletteWidget()
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
|
||||
bool mouse_is_down() const { return m_mouse_is_down; }
|
||||
|
||||
protected:
|
||||
private:
|
||||
AutoSlider(Orientation orientation)
|
||||
: GUI::Slider(orientation)
|
||||
{
|
||||
@ -42,6 +42,5 @@ protected:
|
||||
GUI::Slider::mouseup_event(event);
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_mouse_is_down { false };
|
||||
};
|
||||
|
@ -92,6 +92,8 @@ String PlaylistModel::column_name(int column) const
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
PlaylistTableView::PlaylistTableView() = default;
|
||||
|
||||
void PlaylistTableView::doubleclick_event(GUI::MouseEvent& event)
|
||||
{
|
||||
AbstractView::doubleclick_event(event);
|
||||
|
@ -40,19 +40,22 @@ public:
|
||||
void doubleclick_event(GUI::MouseEvent& event) override;
|
||||
|
||||
Function<void(const Gfx::Point<int>&)> on_doubleclick;
|
||||
|
||||
private:
|
||||
PlaylistTableView();
|
||||
};
|
||||
|
||||
class PlaylistWidget : public GUI::Widget {
|
||||
C_OBJECT(PlaylistWidget)
|
||||
public:
|
||||
PlaylistWidget();
|
||||
void set_data_model(RefPtr<PlaylistModel> model)
|
||||
{
|
||||
m_table_view->set_model(model);
|
||||
m_table_view->update();
|
||||
}
|
||||
|
||||
protected:
|
||||
private:
|
||||
PlaylistWidget();
|
||||
|
||||
RefPtr<PlaylistTableView> m_table_view;
|
||||
};
|
||||
|
@ -21,8 +21,6 @@ class SoundPlayerWidgetAdvancedView final : public GUI::Widget
|
||||
C_OBJECT(SoundPlayerWidgetAdvancedView)
|
||||
|
||||
public:
|
||||
explicit SoundPlayerWidgetAdvancedView(GUI::Window&, Audio::ClientConnection&);
|
||||
|
||||
void set_nonlinear_volume_slider(bool nonlinear);
|
||||
void set_playlist_visible(bool visible);
|
||||
|
||||
@ -51,6 +49,8 @@ protected:
|
||||
void keydown_event(GUI::KeyEvent&) override;
|
||||
|
||||
private:
|
||||
SoundPlayerWidgetAdvancedView(GUI::Window&, Audio::ClientConnection&);
|
||||
|
||||
void sync_previous_next_buttons();
|
||||
|
||||
void drop_event(GUI::DropEvent& event) override;
|
||||
|
@ -17,5 +17,6 @@ public:
|
||||
virtual void set_samplerate(int) { }
|
||||
|
||||
protected:
|
||||
VisualizationWidget() = default;
|
||||
virtual ~VisualizationWidget() = default;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user