mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 06:52:45 +00:00 
			
		
		
		
	Userland: Fix remaining smart pointer const-correctness issues
This commit is contained in:
		
							parent
							
								
									faa1a09042
								
							
						
					
					
						commit
						33e87d1627
					
				
					 17 changed files with 23 additions and 23 deletions
				
			
		|  | @ -13,7 +13,7 @@ | |||
| 
 | ||||
| class UndoSelection : public RefCounted<UndoSelection> { | ||||
| public: | ||||
|     explicit UndoSelection(int const start, int const size, u32 const active_glyph, Gfx::BitmapFont const& font, NonnullRefPtr<GUI::GlyphMapWidget> glyph_map_widget) | ||||
|     explicit UndoSelection(int const start, int const size, u32 const active_glyph, Gfx::BitmapFont& font, NonnullRefPtr<GUI::GlyphMapWidget> glyph_map_widget) | ||||
|         : m_start(start) | ||||
|         , m_size(size) | ||||
|         , m_active_glyph(active_glyph) | ||||
|  |  | |||
|  | @ -149,7 +149,7 @@ GUI::ModelIndex ManualModel::parent_index(const GUI::ModelIndex& index) const | |||
|         return {}; | ||||
|     auto children = maybe_children.release_value(); | ||||
|     for (size_t row = 0; row < children.size(); row++) { | ||||
|         Manual::Node* child_at_row = children[row]; | ||||
|         Manual::Node const* child_at_row = children[row]; | ||||
|         if (child_at_row == parent) | ||||
|             return create_index(row, 0, parent); | ||||
|     } | ||||
|  |  | |||
|  | @ -66,7 +66,7 @@ private: | |||
|     Vector<DeprecatedString> load_files_from_directory(DeprecatedString const& path) const; | ||||
| 
 | ||||
|     DeprecatedString m_path; | ||||
|     RefPtr<Gfx::Bitmap> m_bitmap; | ||||
|     RefPtr<Gfx::Bitmap const> m_bitmap; | ||||
|     Optional<ImageDecoderClient::DecodedImage> m_decoded_image; | ||||
| 
 | ||||
|     size_t m_current_frame_index { 0 }; | ||||
|  |  | |||
|  | @ -53,7 +53,7 @@ private: | |||
|     RefPtr<Core::Timer> m_cursor_blink_timer; | ||||
|     RefPtr<PixelPaint::TextToolEditor> m_text_editor; | ||||
|     Gfx::IntPoint m_add_text_position { 0, 0 }; | ||||
|     RefPtr<Gfx::Font> m_selected_font; | ||||
|     RefPtr<Gfx::Font const> m_selected_font; | ||||
|     bool m_text_input_is_active { false }; | ||||
|     bool m_cursor_blink_state { false }; | ||||
|     bool m_mouse_is_over_text { false }; | ||||
|  |  | |||
|  | @ -47,13 +47,13 @@ private: | |||
|     TerminalSettingsViewWidget(); | ||||
|     void write_back_settings() const; | ||||
| 
 | ||||
|     RefPtr<Gfx::Font> m_font; | ||||
|     RefPtr<Gfx::Font const> m_font; | ||||
|     float m_opacity; | ||||
|     DeprecatedString m_color_scheme; | ||||
|     VT::CursorShape m_cursor_shape { VT::CursorShape::Block }; | ||||
|     bool m_cursor_is_blinking_set { true }; | ||||
| 
 | ||||
|     RefPtr<Gfx::Font> m_original_font; | ||||
|     RefPtr<Gfx::Font const> m_original_font; | ||||
|     float m_original_opacity; | ||||
|     DeprecatedString m_original_color_scheme; | ||||
|     VT::CursorShape m_original_cursor_shape; | ||||
|  |  | |||
|  | @ -39,7 +39,7 @@ public: | |||
|         return gallery; | ||||
|     } | ||||
| 
 | ||||
|     void set_preview_palette(Gfx::Palette const& palette) | ||||
|     void set_preview_palette(Gfx::Palette& palette) | ||||
|     { | ||||
|         set_palette(palette); | ||||
|         Function<void(GUI::Widget&)> recurse = [&](GUI::Widget& parent_widget) { | ||||
|  |  | |||
|  | @ -26,7 +26,6 @@ public: | |||
|     virtual ~VideoFrameWidget() override = default; | ||||
| 
 | ||||
|     void set_bitmap(Gfx::Bitmap const*); | ||||
|     Gfx::Bitmap* bitmap() { return m_bitmap.ptr(); } | ||||
|     Gfx::Bitmap const* bitmap() const { return m_bitmap.ptr(); } | ||||
| 
 | ||||
|     void set_sizing_mode(VideoSizingMode value) { m_sizing_mode = value; } | ||||
|  | @ -44,7 +43,7 @@ protected: | |||
|     virtual void paint_event(GUI::PaintEvent&) override; | ||||
| 
 | ||||
| private: | ||||
|     RefPtr<Gfx::Bitmap> m_bitmap; | ||||
|     RefPtr<Gfx::Bitmap const> m_bitmap; | ||||
|     VideoSizingMode m_sizing_mode { VideoSizingMode::Fit }; | ||||
|     bool m_auto_resize { false }; | ||||
| }; | ||||
|  |  | |||
|  | @ -306,7 +306,7 @@ GalleryWidget::GalleryWidget() | |||
| 
 | ||||
|     m_cursors_tableview->on_activation = [&](const GUI::ModelIndex& index) { | ||||
|         auto icon_index = index.model()->index(index.row(), MouseCursorModel::Column::Bitmap); | ||||
|         m_cursors_tableview->set_override_cursor(NonnullRefPtr<Gfx::Bitmap>(icon_index.data().as_bitmap())); | ||||
|         m_cursors_tableview->set_override_cursor(NonnullRefPtr<Gfx::Bitmap const>(icon_index.data().as_bitmap())); | ||||
|     }; | ||||
| 
 | ||||
|     auto icons_tab = tab_widget.try_add_tab<GUI::Widget>("Icons").release_value_but_fixme_should_propagate_errors(); | ||||
|  |  | |||
|  | @ -50,7 +50,8 @@ void EditorWrapper::set_mode_displayable() | |||
| { | ||||
|     editor().set_mode(GUI::TextEditor::Editable); | ||||
|     editor().set_background_role(Gfx::ColorRole::Base); | ||||
|     editor().set_palette(GUI::Application::the()->palette()); | ||||
|     auto palette = GUI::Application::the()->palette(); | ||||
|     editor().set_palette(palette); | ||||
| } | ||||
| 
 | ||||
| void EditorWrapper::set_mode_non_displayable() | ||||
|  |  | |||
|  | @ -1837,7 +1837,7 @@ void HackStudioWidget::update_history_actions() | |||
|         m_locations_history_forward_action->set_enabled(true); | ||||
| } | ||||
| 
 | ||||
| RefPtr<Gfx::Font> HackStudioWidget::read_editor_font_from_config() | ||||
| RefPtr<Gfx::Font const> HackStudioWidget::read_editor_font_from_config() | ||||
| { | ||||
|     auto font_family = Config::read_string("HackStudio"sv, "EditorFont"sv, "Family"sv, "Csilla"sv); | ||||
|     auto font_variant = Config::read_string("HackStudio"sv, "EditorFont"sv, "Variant"sv, "Regular"sv); | ||||
|  | @ -1850,7 +1850,7 @@ RefPtr<Gfx::Font> HackStudioWidget::read_editor_font_from_config() | |||
|     return font; | ||||
| } | ||||
| 
 | ||||
| void HackStudioWidget::change_editor_font(RefPtr<Gfx::Font> font) | ||||
| void HackStudioWidget::change_editor_font(RefPtr<Gfx::Font const> font) | ||||
| { | ||||
|     m_editor_font = move(font); | ||||
|     for (auto& editor_wrapper : m_all_editor_wrappers) { | ||||
|  |  | |||
|  | @ -248,9 +248,9 @@ private: | |||
|     RefPtr<GUI::Action> m_toggle_semantic_highlighting_action; | ||||
|     RefPtr<GUI::Action> m_open_project_configuration_action; | ||||
| 
 | ||||
|     RefPtr<Gfx::Font> read_editor_font_from_config(); | ||||
|     void change_editor_font(RefPtr<Gfx::Font>); | ||||
|     RefPtr<Gfx::Font> m_editor_font; | ||||
|     RefPtr<Gfx::Font const> read_editor_font_from_config(); | ||||
|     void change_editor_font(RefPtr<Gfx::Font const>); | ||||
|     RefPtr<Gfx::Font const> m_editor_font; | ||||
|     RefPtr<GUI::Action> m_editor_font_action; | ||||
| 
 | ||||
|     GUI::TextEditor::WrappingMode m_wrapping_mode { GUI::TextEditor::NoWrap }; | ||||
|  |  | |||
|  | @ -32,7 +32,7 @@ private: | |||
| 
 | ||||
|     Profile& m_profile; | ||||
|     Process const& m_process; | ||||
|     RefPtr<Gfx::Bitmap> m_icon; | ||||
|     RefPtr<Gfx::Bitmap const> m_icon; | ||||
|     DeprecatedString m_text; | ||||
|     bool m_selected; | ||||
| }; | ||||
|  |  | |||
|  | @ -421,7 +421,7 @@ Chess::Square ChessWidget::mouse_to_square(GUI::MouseEvent& event) const | |||
|     } | ||||
| } | ||||
| 
 | ||||
| RefPtr<Gfx::Bitmap> ChessWidget::get_piece_graphic(Chess::Piece const& piece) const | ||||
| RefPtr<Gfx::Bitmap const> ChessWidget::get_piece_graphic(Chess::Piece const& piece) const | ||||
| { | ||||
|     return m_pieces.get(piece).value(); | ||||
| } | ||||
|  |  | |||
|  | @ -48,7 +48,7 @@ public: | |||
| 
 | ||||
|     bool drag_enabled() const { return m_drag_enabled; } | ||||
|     void set_drag_enabled(bool e) { m_drag_enabled = e; } | ||||
|     RefPtr<Gfx::Bitmap> get_piece_graphic(Chess::Piece const& piece) const; | ||||
|     RefPtr<Gfx::Bitmap const> get_piece_graphic(Chess::Piece const& piece) const; | ||||
| 
 | ||||
|     bool show_available_moves() const { return m_show_available_moves; } | ||||
|     void set_show_available_moves(bool e) { m_show_available_moves = e; } | ||||
|  | @ -128,7 +128,7 @@ private: | |||
|     Color m_marking_alternate_color { Color::from_argb(0x66ffaa00) }; | ||||
|     Color m_marking_secondary_color { Color::from_argb(0x6655dd55) }; | ||||
|     Chess::Color m_side { Chess::Color::White }; | ||||
|     HashMap<Chess::Piece, RefPtr<Gfx::Bitmap>> m_pieces; | ||||
|     HashMap<Chess::Piece, RefPtr<Gfx::Bitmap const>> m_pieces; | ||||
|     DeprecatedString m_piece_set; | ||||
|     Chess::Square m_moving_square { 50, 50 }; | ||||
|     Gfx::IntPoint m_drag_point; | ||||
|  |  | |||
|  | @ -40,7 +40,7 @@ ColorLines::BitmapArray ColorLines::build_marble_color_bitmaps() | |||
| ColorLines::BitmapArray ColorLines::build_marble_trace_bitmaps() | ||||
| { | ||||
|     // Use "Paw Prints" Unicode Character (U+1F43E)
 | ||||
|     auto trace_bitmap = NonnullRefPtr<Gfx::Bitmap>(*Gfx::Emoji::emoji_for_code_point(0x1F43E)); | ||||
|     auto trace_bitmap = NonnullRefPtr<Gfx::Bitmap const>(*Gfx::Emoji::emoji_for_code_point(0x1F43E)); | ||||
|     BitmapArray result; | ||||
|     result.ensure_capacity(number_of_marble_trace_bitmaps); | ||||
|     result.append(trace_bitmap); | ||||
|  |  | |||
|  | @ -47,7 +47,7 @@ private: | |||
|     void restart_timer(int milliseconds); | ||||
| 
 | ||||
|     using Point = Gfx::IntPoint; | ||||
|     using BitmapArray = Vector<NonnullRefPtr<Gfx::Bitmap>>; | ||||
|     using BitmapArray = Vector<NonnullRefPtr<Gfx::Bitmap const>>; | ||||
| 
 | ||||
|     StringView const m_app_name; | ||||
|     GameState m_game_state { GameState::Idle }; | ||||
|  |  | |||
|  | @ -162,7 +162,7 @@ void Player::remove_cards(NonnullRefPtrVector<Card> const& cards) | |||
| { | ||||
|     for (auto& card : cards) { | ||||
|         hand.remove_first_matching([&card](auto& other_card) { | ||||
|             return other_card == card; | ||||
|             return other_card.ptr() == &card; | ||||
|         }); | ||||
|     } | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling