diff options
Diffstat (limited to 'Userland/Applications')
114 files changed, 370 insertions, 370 deletions
diff --git a/Userland/Applications/3DFileViewer/Mesh.cpp b/Userland/Applications/3DFileViewer/Mesh.cpp index a3cdbb1824..d4fc13c9b5 100644 --- a/Userland/Applications/3DFileViewer/Mesh.cpp +++ b/Userland/Applications/3DFileViewer/Mesh.cpp @@ -34,7 +34,7 @@ Mesh::Mesh(Vector<Vertex> vertices, Vector<TexCoord> tex_coords, Vector<Vertex> void Mesh::draw(float uv_scale) { for (u32 i = 0; i < m_triangle_list.size(); i++) { - const auto& triangle = m_triangle_list[i]; + auto const& triangle = m_triangle_list[i]; const FloatVector3 vertex_a( m_vertex_list.at(triangle.a).x, diff --git a/Userland/Applications/Assistant/FuzzyMatch.cpp b/Userland/Applications/Assistant/FuzzyMatch.cpp index f16c767c90..b931537b0b 100644 --- a/Userland/Applications/Assistant/FuzzyMatch.cpp +++ b/Userland/Applications/Assistant/FuzzyMatch.cpp @@ -10,17 +10,17 @@ namespace Assistant { -static constexpr const int RECURSION_LIMIT = 10; -static constexpr const int MAX_MATCHES = 256; +static constexpr int const RECURSION_LIMIT = 10; +static constexpr int const MAX_MATCHES = 256; // Bonuses and penalties are used to build up a final score for the match. -static constexpr const int SEQUENTIAL_BONUS = 15; // bonus for adjacent matches (needle: 'ca', haystack: 'cat') -static constexpr const int SEPARATOR_BONUS = 30; // bonus if match occurs after a separator ('_' or ' ') -static constexpr const int CAMEL_BONUS = 30; // bonus if match is uppercase and prev is lower (needle: 'myF' haystack: '/path/to/myFile.txt') -static constexpr const int FIRST_LETTER_BONUS = 20; // bonus if the first letter is matched (needle: 'c' haystack: 'cat') -static constexpr const int LEADING_LETTER_PENALTY = -5; // penalty applied for every letter in str before the first match -static constexpr const int MAX_LEADING_LETTER_PENALTY = -15; // maximum penalty for leading letters -static constexpr const int UNMATCHED_LETTER_PENALTY = -1; // penalty for every letter that doesn't matter +static constexpr int const SEQUENTIAL_BONUS = 15; // bonus for adjacent matches (needle: 'ca', haystack: 'cat') +static constexpr int const SEPARATOR_BONUS = 30; // bonus if match occurs after a separator ('_' or ' ') +static constexpr int const CAMEL_BONUS = 30; // bonus if match is uppercase and prev is lower (needle: 'myF' haystack: '/path/to/myFile.txt') +static constexpr int const FIRST_LETTER_BONUS = 20; // bonus if the first letter is matched (needle: 'c' haystack: 'cat') +static constexpr int const LEADING_LETTER_PENALTY = -5; // penalty applied for every letter in str before the first match +static constexpr int const MAX_LEADING_LETTER_PENALTY = -15; // maximum penalty for leading letters +static constexpr int const UNMATCHED_LETTER_PENALTY = -1; // penalty for every letter that doesn't matter static int calculate_score(String const& string, u8* index_points, size_t index_points_size) { diff --git a/Userland/Applications/Assistant/Providers.cpp b/Userland/Applications/Assistant/Providers.cpp index 767432a56a..0a24463638 100644 --- a/Userland/Applications/Assistant/Providers.cpp +++ b/Userland/Applications/Assistant/Providers.cpp @@ -123,7 +123,7 @@ FileProvider::FileProvider() build_filesystem_cache(); } -void FileProvider::query(const String& query, Function<void(NonnullRefPtrVector<Result>)> on_complete) +void FileProvider::query(String const& query, Function<void(NonnullRefPtrVector<Result>)> on_complete) { build_filesystem_cache(); diff --git a/Userland/Applications/Assistant/Providers.h b/Userland/Applications/Assistant/Providers.h index 2469e912bc..b240e18e53 100644 --- a/Userland/Applications/Assistant/Providers.h +++ b/Userland/Applications/Assistant/Providers.h @@ -132,7 +132,7 @@ class Provider : public RefCounted<Provider> { public: virtual ~Provider() = default; - virtual void query(const String&, Function<void(NonnullRefPtrVector<Result>)> on_complete) = 0; + virtual void query(String const&, Function<void(NonnullRefPtrVector<Result>)> on_complete) = 0; }; class AppProvider final : public Provider { diff --git a/Userland/Applications/Browser/BookmarksBarWidget.cpp b/Userland/Applications/Browser/BookmarksBarWidget.cpp index 92a00b70f8..7fb28b5e58 100644 --- a/Userland/Applications/Browser/BookmarksBarWidget.cpp +++ b/Userland/Applications/Browser/BookmarksBarWidget.cpp @@ -100,7 +100,7 @@ BookmarksBarWidget& BookmarksBarWidget::the() return *s_the; } -BookmarksBarWidget::BookmarksBarWidget(const String& bookmarks_file, bool enabled) +BookmarksBarWidget::BookmarksBarWidget(String const& bookmarks_file, bool enabled) { s_the = this; set_layout<GUI::HorizontalBoxLayout>(); @@ -255,7 +255,7 @@ void BookmarksBarWidget::update_content_size() } } -bool BookmarksBarWidget::contains_bookmark(const String& url) +bool BookmarksBarWidget::contains_bookmark(String const& url) { for (int item_index = 0; item_index < model()->row_count(); ++item_index) { @@ -268,7 +268,7 @@ bool BookmarksBarWidget::contains_bookmark(const String& url) return false; } -bool BookmarksBarWidget::remove_bookmark(const String& url) +bool BookmarksBarWidget::remove_bookmark(String const& url) { for (int item_index = 0; item_index < model()->row_count(); ++item_index) { @@ -277,7 +277,7 @@ bool BookmarksBarWidget::remove_bookmark(const String& url) if (item_url == url) { auto& json_model = *static_cast<GUI::JsonArrayModel*>(model()); - const auto item_removed = json_model.remove(item_index); + auto const item_removed = json_model.remove(item_index); if (item_removed) json_model.store(); @@ -288,7 +288,7 @@ bool BookmarksBarWidget::remove_bookmark(const String& url) return false; } -bool BookmarksBarWidget::add_bookmark(const String& url, const String& title) +bool BookmarksBarWidget::add_bookmark(String const& url, String const& title) { Vector<JsonValue> values; values.append(title); @@ -302,7 +302,7 @@ bool BookmarksBarWidget::add_bookmark(const String& url, const String& title) return false; } -bool BookmarksBarWidget::edit_bookmark(const String& url) +bool BookmarksBarWidget::edit_bookmark(String const& url) { for (int item_index = 0; item_index < model()->row_count(); ++item_index) { auto item_title = model()->index(item_index, 0).data().to_string(); diff --git a/Userland/Applications/Browser/BookmarksBarWidget.h b/Userland/Applications/Browser/BookmarksBarWidget.h index dfcef0a7a4..1110c60b30 100644 --- a/Userland/Applications/Browser/BookmarksBarWidget.h +++ b/Userland/Applications/Browser/BookmarksBarWidget.h @@ -26,16 +26,16 @@ public: GUI::Model* model() { return m_model.ptr(); } const GUI::Model* model() const { return m_model.ptr(); } - Function<void(const String& url, unsigned modifiers)> on_bookmark_click; - Function<void(const String&, const String&)> on_bookmark_hover; + Function<void(String const& url, unsigned modifiers)> on_bookmark_click; + Function<void(String const&, String const&)> on_bookmark_hover; - bool contains_bookmark(const String& url); - bool remove_bookmark(const String& url); - bool add_bookmark(const String& url, const String& title); - bool edit_bookmark(const String& url); + bool contains_bookmark(String const& url); + bool remove_bookmark(String const& url); + bool add_bookmark(String const& url, String const& title); + bool edit_bookmark(String const& url); private: - BookmarksBarWidget(const String&, bool enabled); + BookmarksBarWidget(String const&, bool enabled); // ^GUI::ModelClient virtual void model_did_update(unsigned) override; diff --git a/Userland/Applications/Browser/ConsoleWidget.cpp b/Userland/Applications/Browser/ConsoleWidget.cpp index 53e3f1d9fc..33511a38cb 100644 --- a/Userland/Applications/Browser/ConsoleWidget.cpp +++ b/Userland/Applications/Browser/ConsoleWidget.cpp @@ -93,7 +93,7 @@ void ConsoleWidget::notify_about_new_console_message(i32 message_index) request_console_messages(); } -void ConsoleWidget::handle_console_messages(i32 start_index, const Vector<String>& message_types, const Vector<String>& messages) +void ConsoleWidget::handle_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages) { i32 end_index = start_index + message_types.size() - 1; if (end_index <= m_highest_received_message_index) { diff --git a/Userland/Applications/Browser/ConsoleWidget.h b/Userland/Applications/Browser/ConsoleWidget.h index 4683a84e2e..aaa7a5d5c0 100644 --- a/Userland/Applications/Browser/ConsoleWidget.h +++ b/Userland/Applications/Browser/ConsoleWidget.h @@ -26,7 +26,7 @@ public: void print_html(StringView); void reset(); - Function<void(const String&)> on_js_input; + Function<void(String const&)> on_js_input; Function<void(i32)> on_request_messages; private: diff --git a/Userland/Applications/Browser/CookieJar.cpp b/Userland/Applications/Browser/CookieJar.cpp index 119dc9e1ab..d8be5e30e6 100644 --- a/Userland/Applications/Browser/CookieJar.cpp +++ b/Userland/Applications/Browser/CookieJar.cpp @@ -26,7 +26,7 @@ String CookieJar::get_cookie(const URL& url, Web::Cookie::Source source) auto cookie_list = get_matching_cookies(url, domain.value(), source); StringBuilder builder; - for (const auto& cookie : cookie_list) { + for (auto const& cookie : cookie_list) { // If there is an unprocessed cookie in the cookie-list, output the characters %x3B and %x20 ("; ") if (!builder.is_empty()) builder.append("; "); @@ -38,7 +38,7 @@ String CookieJar::get_cookie(const URL& url, Web::Cookie::Source source) return builder.build(); } -void CookieJar::set_cookie(const URL& url, const Web::Cookie::ParsedCookie& parsed_cookie, Web::Cookie::Source source) +void CookieJar::set_cookie(const URL& url, Web::Cookie::ParsedCookie const& parsed_cookie, Web::Cookie::Source source) { auto domain = canonicalize_domain(url); if (!domain.has_value()) @@ -57,7 +57,7 @@ void CookieJar::dump_cookies() const StringBuilder builder; builder.appendff("{} cookies stored\n", m_cookies.size()); - for (const auto& cookie : m_cookies) { + for (auto const& cookie : m_cookies) { builder.appendff("{}{}{} - ", key_color, cookie.key.name, no_color); builder.appendff("{}{}{} - ", key_color, cookie.key.domain, no_color); builder.appendff("{}{}{}\n", key_color, cookie.key.path, no_color); @@ -96,7 +96,7 @@ Optional<String> CookieJar::canonicalize_domain(const URL& url) return url.host().to_lowercase(); } -bool CookieJar::domain_matches(const String& string, const String& domain_string) +bool CookieJar::domain_matches(String const& string, String const& domain_string) { // https://tools.ietf.org/html/rfc6265#section-5.1.3 @@ -120,7 +120,7 @@ bool CookieJar::domain_matches(const String& string, const String& domain_string return true; } -bool CookieJar::path_matches(const String& request_path, const String& cookie_path) +bool CookieJar::path_matches(String const& request_path, String const& cookie_path) { // https://tools.ietf.org/html/rfc6265#section-5.1.4 @@ -165,7 +165,7 @@ String CookieJar::default_path(const URL& url) return uri_path.substring(0, last_separator); } -void CookieJar::store_cookie(const Web::Cookie::ParsedCookie& parsed_cookie, const URL& url, String canonicalized_domain, Web::Cookie::Source source) +void CookieJar::store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, const URL& url, String canonicalized_domain, Web::Cookie::Source source) { // https://tools.ietf.org/html/rfc6265#section-5.3 @@ -251,7 +251,7 @@ void CookieJar::store_cookie(const Web::Cookie::ParsedCookie& parsed_cookie, con m_cookies.set(key, move(cookie)); } -Vector<Web::Cookie::Cookie&> CookieJar::get_matching_cookies(const URL& url, const String& canonicalized_domain, Web::Cookie::Source source) +Vector<Web::Cookie::Cookie&> CookieJar::get_matching_cookies(const URL& url, String const& canonicalized_domain, Web::Cookie::Source source) { // https://tools.ietf.org/html/rfc6265#section-5.4 @@ -305,12 +305,12 @@ void CookieJar::purge_expired_cookies() time_t now = Core::DateTime::now().timestamp(); Vector<CookieStorageKey> keys_to_evict; - for (const auto& cookie : m_cookies) { + for (auto const& cookie : m_cookies) { if (cookie.value.expiry_time.timestamp() < now) keys_to_evict.append(cookie.key); } - for (const auto& key : keys_to_evict) + for (auto const& key : keys_to_evict) m_cookies.remove(key); } diff --git a/Userland/Applications/Browser/CookieJar.h b/Userland/Applications/Browser/CookieJar.h index 1fde67f462..3aedeceef4 100644 --- a/Userland/Applications/Browser/CookieJar.h +++ b/Userland/Applications/Browser/CookieJar.h @@ -17,7 +17,7 @@ namespace Browser { struct CookieStorageKey { - bool operator==(const CookieStorageKey&) const = default; + bool operator==(CookieStorageKey const&) const = default; String name; String domain; @@ -27,18 +27,18 @@ struct CookieStorageKey { class CookieJar { public: String get_cookie(const URL& url, Web::Cookie::Source source); - void set_cookie(const URL& url, const Web::Cookie::ParsedCookie& parsed_cookie, Web::Cookie::Source source); + void set_cookie(const URL& url, Web::Cookie::ParsedCookie const& parsed_cookie, Web::Cookie::Source source); void dump_cookies() const; Vector<Web::Cookie::Cookie> get_all_cookies() const; private: static Optional<String> canonicalize_domain(const URL& url); - static bool domain_matches(const String& string, const String& domain_string); - static bool path_matches(const String& request_path, const String& cookie_path); + static bool domain_matches(String const& string, String const& domain_string); + static bool path_matches(String const& request_path, String const& cookie_path); static String default_path(const URL& url); - void store_cookie(const Web::Cookie::ParsedCookie& parsed_cookie, const URL& url, String canonicalized_domain, Web::Cookie::Source source); - Vector<Web::Cookie::Cookie&> get_matching_cookies(const URL& url, const String& canonicalized_domain, Web::Cookie::Source source); + void store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, const URL& url, String canonicalized_domain, Web::Cookie::Source source); + Vector<Web::Cookie::Cookie&> get_matching_cookies(const URL& url, String const& canonicalized_domain, Web::Cookie::Source source); void purge_expired_cookies(); HashMap<CookieStorageKey, Web::Cookie::Cookie> m_cookies; @@ -50,7 +50,7 @@ namespace AK { template<> struct Traits<Browser::CookieStorageKey> : public GenericTraits<Browser::CookieStorageKey> { - static unsigned hash(const Browser::CookieStorageKey& key) + static unsigned hash(Browser::CookieStorageKey const& key) { unsigned hash = 0; hash = pair_int_hash(hash, string_hash(key.name.characters(), key.name.length())); diff --git a/Userland/Applications/Browser/CookiesModel.cpp b/Userland/Applications/Browser/CookiesModel.cpp index aa2b7abf07..6daecfac33 100644 --- a/Userland/Applications/Browser/CookiesModel.cpp +++ b/Userland/Applications/Browser/CookiesModel.cpp @@ -58,7 +58,7 @@ GUI::Variant CookiesModel::data(GUI::ModelIndex const& index, GUI::ModelRole rol if (role != GUI::ModelRole::Display) return {}; - const auto& cookie = m_cookies[index.row()]; + auto const& cookie = m_cookies[index.row()]; switch (index.column()) { case Column::Domain: diff --git a/Userland/Applications/Browser/History.cpp b/Userland/Applications/Browser/History.cpp index 20dfd3b117..7732c6f5d7 100644 --- a/Userland/Applications/Browser/History.cpp +++ b/Userland/Applications/Browser/History.cpp @@ -18,7 +18,7 @@ void History::dump() const } } -void History::push(const URL& url, const String& title) +void History::push(const URL& url, String const& title) { if (!m_items.is_empty() && m_items[m_current].url == url) return; @@ -55,12 +55,12 @@ void History::clear() m_current = -1; } -void History::update_title(const String& title) +void History::update_title(String const& title) { m_items[m_current].title = title; } -const Vector<StringView> History::get_back_title_history() +Vector<StringView> const History::get_back_title_history() { Vector<StringView> back_title_history; for (int i = m_current - 1; i >= 0; i--) { @@ -69,7 +69,7 @@ const Vector<StringView> History::get_back_title_history() return back_title_history; } -const Vector<StringView> History::get_forward_title_history() +Vector<StringView> const History::get_forward_title_history() { Vector<StringView> forward_title_history; for (int i = m_current + 1; i < static_cast<int>(m_items.size()); i++) { diff --git a/Userland/Applications/Browser/History.h b/Userland/Applications/Browser/History.h index e7891b29a1..05afcd8532 100644 --- a/Userland/Applications/Browser/History.h +++ b/Userland/Applications/Browser/History.h @@ -19,12 +19,12 @@ public: }; void dump() const; - void push(const URL& url, const String& title); - void update_title(const String& title); + void push(const URL& url, String const& title); + void update_title(String const& title); URLTitlePair current() const; - const Vector<StringView> get_back_title_history(); - const Vector<StringView> get_forward_title_history(); + Vector<StringView> const get_back_title_history(); + Vector<StringView> const get_forward_title_history(); void go_back(int steps = 1); void go_forward(int steps = 1); diff --git a/Userland/Applications/Browser/InspectorWidget.cpp b/Userland/Applications/Browser/InspectorWidget.cpp index d923fe17dd..7b04ca5691 100644 --- a/Userland/Applications/Browser/InspectorWidget.cpp +++ b/Userland/Applications/Browser/InspectorWidget.cpp @@ -183,7 +183,7 @@ void InspectorWidget::update_node_box_model(Optional<String> node_box_sizing_jso return; } auto json_value = json_or_error.release_value(); - const auto& json_object = json_value.as_object(); + auto const& json_object = json_value.as_object(); m_node_box_sizing.margin.top = json_object.get("margin_top").to_float(); m_node_box_sizing.margin.right = json_object.get("margin_right").to_float(); diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp index e8445e7343..7fa98ec1fb 100644 --- a/Userland/Applications/Browser/Tab.cpp +++ b/Userland/Applications/Browser/Tab.cpp @@ -66,7 +66,7 @@ void Tab::start_download(const URL& url) window->show(); } -void Tab::view_source(const URL& url, const String& source) +void Tab::view_source(const URL& url, String const& source) { auto window = GUI::Window::construct(&this->window()); auto& editor = window->set_main_widget<GUI::TextEditor>(); @@ -282,7 +282,7 @@ Tab::Tab(BrowserWindow& window) m_image_context_menu->add_separator(); m_image_context_menu->add_action(window.inspect_dom_node_action()); - hooks().on_image_context_menu_request = [this](auto& image_url, auto& screen_position, const Gfx::ShareableBitmap& shareable_bitmap) { + hooks().on_image_context_menu_request = [this](auto& image_url, auto& screen_position, Gfx::ShareableBitmap const& shareable_bitmap) { m_image_context_menu_url = image_url; m_image_context_menu_bitmap = shareable_bitmap; m_image_context_menu->popup(screen_position); @@ -469,7 +469,7 @@ void Tab::bookmark_current_url() update_bookmark_button(url); } -void Tab::update_bookmark_button(const String& url) +void Tab::update_bookmark_button(String const& url) { if (BookmarksBarWidget::the().contains_bookmark(url)) { m_bookmark_button->set_icon(g_icon_bag.bookmark_filled); @@ -503,7 +503,7 @@ void Tab::did_become_active() update_actions(); } -void Tab::context_menu_requested(const Gfx::IntPoint& screen_position) +void Tab::context_menu_requested(Gfx::IntPoint const& screen_position) { m_tab_context_menu->popup(screen_position); } diff --git a/Userland/Applications/Browser/Tab.h b/Userland/Applications/Browser/Tab.h index 7e01c61765..3b060ac586 100644 --- a/Userland/Applications/Browser/Tab.h +++ b/Userland/Applications/Browser/Tab.h @@ -50,19 +50,19 @@ public: void go_forward(int steps = 1); void did_become_active(); - void context_menu_requested(const Gfx::IntPoint& screen_position); + void context_menu_requested(Gfx::IntPoint const& screen_position); void content_filters_changed(); void action_entered(GUI::Action&); void action_left(GUI::Action&); - Function<void(const String&)> on_title_change; + Function<void(String const&)> on_title_change; Function<void(const URL&)> on_tab_open_request; Function<void(Tab&)> on_tab_close_request; Function<void(Tab&)> on_tab_close_other_request; - Function<void(const Gfx::Bitmap&)> on_favicon_change; + Function<void(Gfx::Bitmap const&)> on_favicon_change; Function<String(const URL&, Web::Cookie::Source source)> on_get_cookie; - Function<void(const URL&, const Web::Cookie::ParsedCookie& cookie, Web::Cookie::Source source)> on_set_cookie; + Function<void(const URL&, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source)> on_set_cookie; Function<void()> on_dump_cookies; Function<Vector<Web::Cookie::Cookie>()> on_want_cookies; @@ -75,8 +75,8 @@ public: void show_console_window(); void show_storage_inspector(); - const String& title() const { return m_title; } - const Gfx::Bitmap* icon() const { return m_icon; } + String const& title() const { return m_title; } + Gfx::Bitmap const* icon() const { return m_icon; } GUI::AbstractScrollableWidget& view(); @@ -89,9 +89,9 @@ private: Web::WebViewHooks& hooks(); void update_actions(); void bookmark_current_url(); - void update_bookmark_button(const String& url); + void update_bookmark_button(String const& url); void start_download(const URL& url); - void view_source(const URL& url, const String& source); + void view_source(const URL& url, String const& source); void update_status(Optional<String> text_override = {}, i32 count_waiting = 0); enum class MayAppendTLD { @@ -134,6 +134,6 @@ private: bool m_is_history_navigation { false }; }; -URL url_from_user_input(const String& input); +URL url_from_user_input(String const& input); } diff --git a/Userland/Applications/Browser/main.cpp b/Userland/Applications/Browser/main.cpp index f60edeb295..1842e32f1c 100644 --- a/Userland/Applications/Browser/main.cpp +++ b/Userland/Applications/Browser/main.cpp @@ -59,7 +59,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio recvfd sendfd unix cpath rpath wpath proc exec")); - const char* specified_url = nullptr; + char const* specified_url = nullptr; Core::ArgsParser args_parser; args_parser.add_positional_argument(specified_url, "URL to open", "url", Core::ArgsParser::Required::No); diff --git a/Userland/Applications/Calculator/KeypadValue.cpp b/Userland/Applications/Calculator/KeypadValue.cpp index 63f38212f4..144e447ff6 100644 --- a/Userland/Applications/Calculator/KeypadValue.cpp +++ b/Userland/Applications/Calculator/KeypadValue.cpp @@ -22,7 +22,7 @@ KeypadValue::KeypadValue(i64 value) KeypadValue::KeypadValue(StringView sv) { - String str = sv.to_string(); //TODO: Once we have a StringView equivalent for this C API, we won't need to create a copy for this anymore. + String str = sv.to_string(); // TODO: Once we have a StringView equivalent for this C API, we won't need to create a copy for this anymore. size_t first_index = 0; char* dot_ptr; i64 int_part = strtoll(&str[first_index], &dot_ptr, 10); diff --git a/Userland/Applications/CrashReporter/main.cpp b/Userland/Applications/CrashReporter/main.cpp index ac3766c5c2..61e0842432 100644 --- a/Userland/Applications/CrashReporter/main.cpp +++ b/Userland/Applications/CrashReporter/main.cpp @@ -136,7 +136,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto app = TRY(GUI::Application::try_create(arguments)); - const char* coredump_path = nullptr; + char const* coredump_path = nullptr; bool unlink_on_exit = false; Core::ArgsParser args_parser; diff --git a/Userland/Applications/Debugger/main.cpp b/Userland/Applications/Debugger/main.cpp index d62a39a2df..65e9bdeba3 100644 --- a/Userland/Applications/Debugger/main.cpp +++ b/Userland/Applications/Debugger/main.cpp @@ -37,7 +37,7 @@ static void handle_sigint(int) g_debug_session = nullptr; } -static void handle_print_registers(const PtraceRegisters& regs) +static void handle_print_registers(PtraceRegisters const& regs) { #if ARCH(I386) outln("eax={:p} ebx={:p} ecx={:p} edx={:p}", regs.eax, regs.ebx, regs.ecx, regs.edx); @@ -52,7 +52,7 @@ static void handle_print_registers(const PtraceRegisters& regs) #endif } -static bool handle_disassemble_command(const String& command, FlatPtr first_instruction) +static bool handle_disassemble_command(String const& command, FlatPtr first_instruction) { auto parts = command.split(' '); size_t number_of_instructions_to_disassemble = 5; @@ -90,7 +90,7 @@ static bool handle_disassemble_command(const String& command, FlatPtr first_inst return true; } -static bool handle_backtrace_command(const PtraceRegisters& regs) +static bool handle_backtrace_command(PtraceRegisters const& regs) { #if ARCH(I386) auto ebp_val = regs.ebp; @@ -122,7 +122,7 @@ static bool insert_breakpoint_at_address(FlatPtr address) return g_debug_session->insert_breakpoint(address); } -static bool insert_breakpoint_at_source_position(const String& file, size_t line) +static bool insert_breakpoint_at_source_position(String const& file, size_t line) { auto result = g_debug_session->insert_breakpoint(file, line); if (!result.has_value()) { @@ -133,7 +133,7 @@ static bool insert_breakpoint_at_source_position(const String& file, size_t line return true; } -static bool insert_breakpoint_at_symbol(const String& symbol) +static bool insert_breakpoint_at_symbol(String const& symbol) { auto result = g_debug_session->insert_breakpoint(symbol); if (!result.has_value()) { @@ -144,7 +144,7 @@ static bool insert_breakpoint_at_symbol(const String& symbol) return true; } -static bool handle_breakpoint_command(const String& command) +static bool handle_breakpoint_command(String const& command) { auto parts = command.split(' '); if (parts.size() != 2) @@ -171,7 +171,7 @@ static bool handle_breakpoint_command(const String& command) return insert_breakpoint_at_symbol(argument); } -static bool handle_examine_command(const String& command) +static bool handle_examine_command(String const& command) { auto parts = command.split(' '); if (parts.size() != 2) @@ -214,7 +214,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio proc ptrace exec rpath tty sigaction cpath unix", nullptr)); - const char* command = nullptr; + char const* command = nullptr; Core::ArgsParser args_parser; args_parser.add_positional_argument(command, "The program to be debugged, along with its arguments", diff --git a/Userland/Applications/Help/ManualModel.cpp b/Userland/Applications/Help/ManualModel.cpp index f5a99c702c..7f35f565d5 100644 --- a/Userland/Applications/Help/ManualModel.cpp +++ b/Userland/Applications/Help/ManualModel.cpp @@ -34,10 +34,10 @@ Optional<GUI::ModelIndex> ManualModel::index_from_path(StringView path) const auto parent_index = index(section, 0); for (int row = 0; row < row_count(parent_index); ++row) { auto child_index = index(row, 0, parent_index); - auto* node = static_cast<const ManualNode*>(child_index.internal_data()); + auto* node = static_cast<ManualNode const*>(child_index.internal_data()); if (!node->is_page()) continue; - auto* page = static_cast<const ManualPageNode*>(node); + auto* page = static_cast<ManualPageNode const*>(node); if (page->path() != path) continue; return child_index; @@ -50,10 +50,10 @@ String ManualModel::page_name(const GUI::ModelIndex& index) const { if (!index.is_valid()) return {}; - auto* node = static_cast<const ManualNode*>(index.internal_data()); + auto* node = static_cast<ManualNode const*>(index.internal_data()); if (!node->is_page()) return {}; - auto* page = static_cast<const ManualPageNode*>(node); + auto* page = static_cast<ManualPageNode const*>(node); return page->name(); } @@ -61,10 +61,10 @@ String ManualModel::page_path(const GUI::ModelIndex& index) const { if (!index.is_valid()) return {}; - auto* node = static_cast<const ManualNode*>(index.internal_data()); + auto* node = static_cast<ManualNode const*>(index.internal_data()); if (!node->is_page()) return {}; - auto* page = static_cast<const ManualPageNode*>(node); + auto* page = static_cast<ManualPageNode const*>(node); return page->path(); } @@ -91,11 +91,11 @@ String ManualModel::page_and_section(const GUI::ModelIndex& index) const { if (!index.is_valid()) return {}; - auto* node = static_cast<const ManualNode*>(index.internal_data()); + auto* node = static_cast<ManualNode const*>(index.internal_data()); if (!node->is_page()) return {}; - auto* page = static_cast<const ManualPageNode*>(node); - auto* section = static_cast<const ManualSectionNode*>(page->parent()); + auto* page = static_cast<ManualPageNode const*>(node); + auto* section = static_cast<ManualSectionNode const*>(page->parent()); return String::formatted("{}({})", page->name(), section->section_name()); } @@ -103,7 +103,7 @@ GUI::ModelIndex ManualModel::index(int row, int column, const GUI::ModelIndex& p { if (!parent_index.is_valid()) return create_index(row, column, &s_sections[row]); - auto* parent = static_cast<const ManualNode*>(parent_index.internal_data()); + auto* parent = static_cast<ManualNode const*>(parent_index.internal_data()); auto* child = &parent->children()[row]; return create_index(row, column, child); } @@ -112,7 +112,7 @@ GUI::ModelIndex ManualModel::parent_index(const GUI::ModelIndex& index) const { if (!index.is_valid()) return {}; - auto* child = static_cast<const ManualNode*>(index.internal_data()); + auto* child = static_cast<ManualNode const*>(index.internal_data()); auto* parent = child->parent(); if (parent == nullptr) return {}; @@ -135,7 +135,7 @@ int ManualModel::row_count(const GUI::ModelIndex& index) const { if (!index.is_valid()) return sizeof(s_sections) / sizeof(s_sections[0]); - auto* node = static_cast<const ManualNode*>(index.internal_data()); + auto* node = static_cast<ManualNode const*>(index.internal_data()); return node->children().size(); } @@ -146,7 +146,7 @@ int ManualModel::column_count(const GUI::ModelIndex&) const GUI::Variant ManualModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const { - auto* node = static_cast<const ManualNode*>(index.internal_data()); + auto* node = static_cast<ManualNode const*>(index.internal_data()); switch (role) { case GUI::ModelRole::Search: if (!node->is_page()) @@ -165,7 +165,7 @@ GUI::Variant ManualModel::data(const GUI::ModelIndex& index, GUI::ModelRole role } } -void ManualModel::update_section_node_on_toggle(const GUI::ModelIndex& index, const bool open) +void ManualModel::update_section_node_on_toggle(const GUI::ModelIndex& index, bool const open) { auto* node = static_cast<ManualSectionNode*>(index.internal_data()); node->set_open(open); diff --git a/Userland/Applications/Help/ManualModel.h b/Userland/Applications/Help/ManualModel.h index 262464ee8a..9995836636 100644 --- a/Userland/Applications/Help/ManualModel.h +++ b/Userland/Applications/Help/ManualModel.h @@ -28,7 +28,7 @@ public: String page_and_section(const GUI::ModelIndex&) const; ErrorOr<StringView> page_view(String const& path) const; - void update_section_node_on_toggle(const GUI::ModelIndex&, const bool); + void update_section_node_on_toggle(const GUI::ModelIndex&, bool const); virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; diff --git a/Userland/Applications/Help/ManualNode.h b/Userland/Applications/Help/ManualNode.h index 34971e234d..6fb5957eda 100644 --- a/Userland/Applications/Help/ManualNode.h +++ b/Userland/Applications/Help/ManualNode.h @@ -15,7 +15,7 @@ public: virtual ~ManualNode() = default; virtual NonnullOwnPtrVector<ManualNode>& children() const = 0; - virtual const ManualNode* parent() const = 0; + virtual ManualNode const* parent() const = 0; virtual String name() const = 0; virtual bool is_page() const { return false; } virtual bool is_open() const { return false; } diff --git a/Userland/Applications/Help/ManualPageNode.cpp b/Userland/Applications/Help/ManualPageNode.cpp index dc28cb4c08..e906e34c37 100644 --- a/Userland/Applications/Help/ManualPageNode.cpp +++ b/Userland/Applications/Help/ManualPageNode.cpp @@ -8,7 +8,7 @@ #include "ManualPageNode.h" #include "ManualSectionNode.h" -const ManualNode* ManualPageNode::parent() const +ManualNode const* ManualPageNode::parent() const { return &m_section; } diff --git a/Userland/Applications/Help/ManualPageNode.h b/Userland/Applications/Help/ManualPageNode.h index 0f60dd6569..c01349f2de 100644 --- a/Userland/Applications/Help/ManualPageNode.h +++ b/Userland/Applications/Help/ManualPageNode.h @@ -14,20 +14,20 @@ class ManualPageNode : public ManualNode { public: virtual ~ManualPageNode() override = default; - ManualPageNode(const ManualSectionNode& section, StringView page) + ManualPageNode(ManualSectionNode const& section, StringView page) : m_section(section) , m_page(page) { } virtual NonnullOwnPtrVector<ManualNode>& children() const override; - virtual const ManualNode* parent() const override; + virtual ManualNode const* parent() const override; virtual String name() const override { return m_page; }; virtual bool is_page() const override { return true; } String path() const; private: - const ManualSectionNode& m_section; + ManualSectionNode const& m_section; String m_page; }; diff --git a/Userland/Applications/Help/ManualSectionNode.h b/Userland/Applications/Help/ManualSectionNode.h index 468137066c..173e3475bf 100644 --- a/Userland/Applications/Help/ManualSectionNode.h +++ b/Userland/Applications/Help/ManualSectionNode.h @@ -25,12 +25,12 @@ public: return m_children; } - virtual const ManualNode* parent() const override { return nullptr; } + virtual ManualNode const* parent() const override { return nullptr; } virtual String name() const override { return m_full_name; } virtual bool is_open() const override { return m_open; } void set_open(bool open); - const String& section_name() const { return m_section; } + String const& section_name() const { return m_section; } String path() const; private: diff --git a/Userland/Applications/HexEditor/HexDocument.h b/Userland/Applications/HexEditor/HexDocument.h index bc943a2aa2..5566fade95 100644 --- a/Userland/Applications/HexEditor/HexDocument.h +++ b/Userland/Applications/HexEditor/HexDocument.h @@ -54,7 +54,7 @@ public: explicit HexDocumentFile(NonnullRefPtr<Core::File> file); virtual ~HexDocumentFile() = default; - HexDocumentFile(const HexDocumentFile&) = delete; + HexDocumentFile(HexDocumentFile const&) = delete; void set_file(NonnullRefPtr<Core::File> file); NonnullRefPtr<Core::File> file() const; diff --git a/Userland/Applications/HexEditor/HexEditor.cpp b/Userland/Applications/HexEditor/HexEditor.cpp index fe82bec33a..bb2b2faaee 100644 --- a/Userland/Applications/HexEditor/HexEditor.cpp +++ b/Userland/Applications/HexEditor/HexEditor.cpp @@ -570,11 +570,11 @@ void HexEditor::paint_event(GUI::PaintEvent& event) if (byte_position >= m_document->size()) return; - const bool edited_flag = m_document->get(byte_position).modified; + bool const edited_flag = m_document->get(byte_position).modified; - const bool selection_inbetween_start_end = byte_position >= m_selection_start && byte_position < m_selection_end; - const bool selection_inbetween_end_start = byte_position >= m_selection_end && byte_position < m_selection_start; - const bool highlight_flag = selection_inbetween_start_end || selection_inbetween_end_start; + bool const selection_inbetween_start_end = byte_position >= m_selection_start && byte_position < m_selection_end; + bool const selection_inbetween_end_start = byte_position >= m_selection_end && byte_position < m_selection_start; + bool const highlight_flag = selection_inbetween_start_end || selection_inbetween_end_start; Gfx::IntRect hex_display_rect { frame_thickness() + offset_margin_width() + static_cast<int>(j) * cell_width() + 2 * m_padding, diff --git a/Userland/Applications/HexEditor/SearchResultsModel.h b/Userland/Applications/HexEditor/SearchResultsModel.h index dff620df99..99ba4329f5 100644 --- a/Userland/Applications/HexEditor/SearchResultsModel.h +++ b/Userland/Applications/HexEditor/SearchResultsModel.h @@ -25,7 +25,7 @@ public: Value }; - explicit SearchResultsModel(const Vector<Match>&& matches) + explicit SearchResultsModel(Vector<Match> const&& matches) : m_matches(move(matches)) { } diff --git a/Userland/Applications/ImageViewer/ViewWidget.cpp b/Userland/Applications/ImageViewer/ViewWidget.cpp index 0bde797a59..0a1dfc7c4e 100644 --- a/Userland/Applications/ImageViewer/ViewWidget.cpp +++ b/Userland/Applications/ImageViewer/ViewWidget.cpp @@ -75,7 +75,7 @@ bool ViewWidget::is_previous_available() const return false; } -Vector<String> ViewWidget::load_files_from_directory(const String& path) const +Vector<String> ViewWidget::load_files_from_directory(String const& path) const { Vector<String> files_in_directory; @@ -90,7 +90,7 @@ Vector<String> ViewWidget::load_files_from_directory(const String& path) const return files_in_directory; } -void ViewWidget::set_path(const String& path) +void ViewWidget::set_path(String const& path) { m_path = path; m_files_in_same_dir = load_files_from_directory(path); @@ -151,7 +151,7 @@ void ViewWidget::mouseup_event(GUI::MouseEvent& event) GUI::AbstractZoomPanWidget::mouseup_event(event); } -void ViewWidget::load_from_file(const String& path) +void ViewWidget::load_from_file(String const& path) { auto show_error = [&] { GUI::MessageBox::show(window(), String::formatted("Failed to open {}", path), "Cannot open image", GUI::MessageBox::Type::Error); @@ -186,7 +186,7 @@ void ViewWidget::load_from_file(const String& path) on_image_change(m_bitmap); if (m_decoded_image->is_animated && m_decoded_image->frames.size() > 1) { - const auto& first_frame = m_decoded_image->frames[0]; + auto const& first_frame = m_decoded_image->frames[0]; m_timer->set_interval(first_frame.duration); m_timer->on_timeout = [this] { animate(); }; m_timer->start(); @@ -229,7 +229,7 @@ void ViewWidget::resize_window() window()->resize(new_size); } -void ViewWidget::set_bitmap(const Gfx::Bitmap* bitmap) +void ViewWidget::set_bitmap(Gfx::Bitmap const* bitmap) { if (m_bitmap == bitmap) return; @@ -246,7 +246,7 @@ void ViewWidget::animate() m_current_frame_index = (m_current_frame_index + 1) % m_decoded_image->frames.size(); - const auto& current_frame = m_decoded_image->frames[m_current_frame_index]; + auto const& current_frame = m_decoded_image->frames[m_current_frame_index]; set_bitmap(current_frame.bitmap); if ((int)current_frame.duration != m_timer->interval()) { diff --git a/Userland/Applications/ImageViewer/ViewWidget.h b/Userland/Applications/ImageViewer/ViewWidget.h index b016cd80e7..8aab232c92 100644 --- a/Userland/Applications/ImageViewer/ViewWidget.h +++ b/Userland/Applications/ImageViewer/ViewWidget.h @@ -29,13 +29,13 @@ public: virtual ~ViewWidget() override = default; - const Gfx::Bitmap* bitmap() const { return m_bitmap.ptr(); } - const String& path() const { return m_path; } + Gfx::Bitmap const* bitmap() const { return m_bitmap.ptr(); } + String const& path() const { return m_path; } void set_toolbar_height(int height) { m_toolbar_height = height; } int toolbar_height() { return m_toolbar_height; } bool scaled_for_first_image() { return m_scaled_for_first_image; } void set_scaled_for_first_image(bool val) { m_scaled_for_first_image = val; } - void set_path(const String& path); + void set_path(String const& path); void resize_window(); void set_scaling_mode(Gfx::Painter::ScalingMode); @@ -46,11 +46,11 @@ public: void flip(Gfx::Orientation); void rotate(Gfx::RotationDirection); void navigate(Directions); - void load_from_file(const String&); + void load_from_file(String const&); Function<void()> on_doubleclick; Function<void(const GUI::DropEvent&)> on_drop; - Function<void(const Gfx::Bitmap*)> on_image_change; + Function<void(Gfx::Bitmap const*)> on_image_change; private: ViewWidget(); @@ -60,9 +60,9 @@ private: virtual void mouseup_event(GUI::MouseEvent&) override; virtual void drop_event(GUI::DropEvent&) override; - void set_bitmap(const Gfx::Bitmap* bitmap); + void set_bitmap(Gfx::Bitmap const* bitmap); void animate(); - Vector<String> load_files_from_directory(const String& path) const; + Vector<String> load_files_from_directory(String const& path) const; String m_path; RefPtr<Gfx::Bitmap> m_bitmap; diff --git a/Userland/Applications/ImageViewer/main.cpp b/Userland/Applications/ImageViewer/main.cpp index 10d73fa6eb..6a5bcf99aa 100644 --- a/Userland/Applications/ImageViewer/main.cpp +++ b/Userland/Applications/ImageViewer/main.cpp @@ -45,7 +45,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto app_icon = GUI::Icon::default_icon("filetype-image"); - const char* path = nullptr; + char const* path = nullptr; Core::ArgsParser args_parser; args_parser.add_positional_argument(path, "The image file to be displayed.", "file", Core::ArgsParser::Required::No); args_parser.parse(arguments); @@ -244,7 +244,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) widget->set_scaling_mode(Gfx::Painter::ScalingMode::BilinearBlend); }); - widget->on_image_change = [&](const Gfx::Bitmap* bitmap) { + widget->on_image_change = [&](Gfx::Bitmap const* bitmap) { bool should_enable_image_actions = (bitmap != nullptr); bool should_enable_forward_actions = (widget->is_next_available() && should_enable_image_actions); bool should_enable_backward_actions = (widget->is_previous_available() && should_enable_image_actions); diff --git a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp index 4271223d75..62598ff9c7 100644 --- a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp +++ b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp @@ -127,7 +127,7 @@ u32* KeyboardMapperWidget::map_from_name(const StringView map_name) return map; } -ErrorOr<void> KeyboardMapperWidget::load_map_from_file(const String& filename) +ErrorOr<void> KeyboardMapperWidget::load_map_from_file(String const& filename) { auto character_map = TRY(Keyboard::CharacterMapFile::load_from_file(filename)); diff --git a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.h b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.h index f63c98d389..ca51cd18b2 100644 --- a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.h +++ b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.h @@ -18,7 +18,7 @@ public: virtual ~KeyboardMapperWidget() override = default; void create_frame(); - ErrorOr<void> load_map_from_file(const String&); + ErrorOr<void> load_map_from_file(String const&); ErrorOr<void> load_map_from_system(); ErrorOr<void> save(); ErrorOr<void> save_to_file(StringView); diff --git a/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp b/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp index 7c482eb0de..36c89f7ca7 100644 --- a/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp +++ b/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp @@ -268,7 +268,7 @@ void KeyboardSettingsWidget::set_keymaps(Vector<String> const& keymaps, String c pid_t child_pid; auto keymaps_string = String::join(',', keymaps); - const char* argv[] = { "/bin/keymap", "-s", keymaps_string.characters(), "-m", active_keymap.characters(), nullptr }; + char const* argv[] = { "/bin/keymap", "-s", keymaps_string.characters(), "-m", active_keymap.characters(), nullptr }; if ((errno = posix_spawn(&child_pid, "/bin/keymap", nullptr, nullptr, const_cast<char**>(argv), environ))) { perror("posix_spawn"); exit(1); diff --git a/Userland/Applications/PDFViewer/OutlineModel.cpp b/Userland/Applications/PDFViewer/OutlineModel.cpp index ad4d770416..65f86f7a68 100644 --- a/Userland/Applications/PDFViewer/OutlineModel.cpp +++ b/Userland/Applications/PDFViewer/OutlineModel.cpp @@ -7,12 +7,12 @@ #include "OutlineModel.h" #include <LibGfx/FontDatabase.h> -NonnullRefPtr<OutlineModel> OutlineModel::create(const NonnullRefPtr<PDF::OutlineDict>& outline) +NonnullRefPtr<OutlineModel> OutlineModel::create(NonnullRefPtr<PDF::OutlineDict> const& outline) { return adopt_ref(*new OutlineModel(outline)); } -OutlineModel::OutlineModel(const NonnullRefPtr<PDF::OutlineDict>& outline) +OutlineModel::OutlineModel(NonnullRefPtr<PDF::OutlineDict> const& outline) : m_outline(outline) { m_closed_item_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/book.png").release_value_but_fixme_should_propagate_errors()); diff --git a/Userland/Applications/PDFViewer/OutlineModel.h b/Userland/Applications/PDFViewer/OutlineModel.h index e97fcb3574..50cf406966 100644 --- a/Userland/Applications/PDFViewer/OutlineModel.h +++ b/Userland/Applications/PDFViewer/OutlineModel.h @@ -12,7 +12,7 @@ class OutlineModel final : public GUI::Model { public: - static NonnullRefPtr<OutlineModel> create(const NonnullRefPtr<PDF::OutlineDict>& outline); + static NonnullRefPtr<OutlineModel> create(NonnullRefPtr<PDF::OutlineDict> const& outline); void set_index_open_state(const GUI::ModelIndex& index, bool is_open); @@ -23,7 +23,7 @@ public: virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex&) const override; private: - OutlineModel(const NonnullRefPtr<PDF::OutlineDict>& outline); + OutlineModel(NonnullRefPtr<PDF::OutlineDict> const& outline); GUI::Icon m_closed_item_icon; GUI::Icon m_open_item_icon; diff --git a/Userland/Applications/PDFViewer/PDFViewer.h b/Userland/Applications/PDFViewer/PDFViewer.h index 12f4a17cb2..5f53958087 100644 --- a/Userland/Applications/PDFViewer/PDFViewer.h +++ b/Userland/Applications/PDFViewer/PDFViewer.h @@ -23,7 +23,7 @@ public: ALWAYS_INLINE u32 current_page() const { return m_current_page_index; } ALWAYS_INLINE void set_current_page(u32 current_page) { m_current_page_index = current_page; } - ALWAYS_INLINE const RefPtr<PDF::Document>& document() const { return m_document; } + ALWAYS_INLINE RefPtr<PDF::Document> const& document() const { return m_document; } void set_document(RefPtr<PDF::Document>); Function<void(u32 new_page)> on_page_change; diff --git a/Userland/Applications/PDFViewer/main.cpp b/Userland/Applications/PDFViewer/main.cpp index 31be4ed46d..831c5b78b5 100644 --- a/Userland/Applications/PDFViewer/main.cpp +++ b/Userland/Applications/PDFViewer/main.cpp @@ -17,7 +17,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) { - const char* file_path = nullptr; + char const* file_path = nullptr; Core::ArgsParser args_parser; args_parser.add_positional_argument(file_path, "PDF file to open", "path", Core::ArgsParser::Required::No); args_parser.parse(arguments); diff --git a/Userland/Applications/Piano/KeysWidget.cpp b/Userland/Applications/Piano/KeysWidget.cpp index 5d128b4523..21f7d2a6af 100644 --- a/Userland/Applications/Piano/KeysWidget.cpp +++ b/Userland/Applications/Piano/KeysWidget.cpp @@ -235,7 +235,7 @@ static inline int note_from_white_keys(int white_keys) return note; } -int KeysWidget::note_for_event_position(const Gfx::IntPoint& a_point) const +int KeysWidget::note_for_event_position(Gfx::IntPoint const& a_point) const { if (!frame_inner_rect().contains(a_point)) return -1; diff --git a/Userland/Applications/Piano/KeysWidget.h b/Userland/Applications/Piano/KeysWidget.h index daf6048837..d21aba7fa0 100644 --- a/Userland/Applications/Piano/KeysWidget.h +++ b/Userland/Applications/Piano/KeysWidget.h @@ -32,7 +32,7 @@ private: virtual void mouseup_event(GUI::MouseEvent&) override; virtual void mousemove_event(GUI::MouseEvent&) override; - int note_for_event_position(const Gfx::IntPoint&) const; + int note_for_event_position(Gfx::IntPoint const&) const; TrackManager& m_track_manager; diff --git a/Userland/Applications/Piano/Music.h b/Userland/Applications/Piano/Music.h index 5af0825baa..6759142482 100644 --- a/Userland/Applications/Piano/Music.h +++ b/Userland/Applications/Piano/Music.h @@ -160,7 +160,7 @@ constexpr int beats_per_bar = 4; constexpr int notes_per_beat = 4; constexpr int roll_length = (sample_rate / (beats_per_minute / 60)) * beats_per_bar; -constexpr const char* note_names[] = { +constexpr char const* note_names[] = { "C", "C#", "D", diff --git a/Userland/Applications/Piano/RollWidget.cpp b/Userland/Applications/Piano/RollWidget.cpp index d2457051cb..84ba9ce64f 100644 --- a/Userland/Applications/Piano/RollWidget.cpp +++ b/Userland/Applications/Piano/RollWidget.cpp @@ -152,7 +152,7 @@ void RollWidget::paint_event(GUI::PaintEvent& event) } Gfx::IntRect note_name_rect(3, y, 1, note_height); - const char* note_name = note_names[note % notes_per_octave]; + char const* note_name = note_names[note % notes_per_octave]; painter.draw_text(note_name_rect, note_name, Gfx::TextAlignment::CenterLeft); note_name_rect.translate_by(Gfx::FontDatabase::default_font().width(note_name) + 2, 0); diff --git a/Userland/Applications/Piano/RollWidget.h b/Userland/Applications/Piano/RollWidget.h index 3e4ca04e9f..76f7599bb0 100644 --- a/Userland/Applications/Piano/RollWidget.h +++ b/Userland/Applications/Piano/RollWidget.h @@ -22,8 +22,8 @@ class RollWidget final : public GUI::AbstractScrollableWidget { public: virtual ~RollWidget() override = default; - const KeysWidget* keys_widget() const { return m_keys_widget; } - void set_keys_widget(const KeysWidget* widget) { m_keys_widget = widget; } + KeysWidget const* keys_widget() const { return m_keys_widget; } + void set_keys_widget(KeysWidget const* widget) { m_keys_widget = widget; } private: explicit RollWidget(TrackManager&); @@ -36,7 +36,7 @@ private: bool viewport_changed() const; TrackManager& m_track_manager; - const KeysWidget* m_keys_widget; + KeysWidget const* m_keys_widget; int m_roll_width { 0 }; int m_num_notes { 0 }; diff --git a/Userland/Applications/Piano/Track.cpp b/Userland/Applications/Piano/Track.cpp index 7344a5c0d7..f2cd6494a3 100644 --- a/Userland/Applications/Piano/Track.cpp +++ b/Userland/Applications/Piano/Track.cpp @@ -16,7 +16,7 @@ #include <LibDSP/Music.h> #include <math.h> -Track::Track(const u32& time) +Track::Track(u32 const& time) : m_time(time) , m_temporary_transport(LibDSP::Transport::construct(120, 4)) , m_delay(make_ref_counted<LibDSP::Effects::Delay>(m_temporary_transport)) diff --git a/Userland/Applications/Piano/Track.h b/Userland/Applications/Piano/Track.h index 230b052231..bd785586a1 100644 --- a/Userland/Applications/Piano/Track.h +++ b/Userland/Applications/Piano/Track.h @@ -26,11 +26,11 @@ class Track { AK_MAKE_NONMOVABLE(Track); public: - explicit Track(const u32& time); + explicit Track(u32 const& time); ~Track() = default; - const Vector<Audio::Sample>& recorded_sample() const { return m_recorded_sample; } - const SinglyLinkedList<RollNote>& roll_notes(int note) const { return m_roll_notes[note]; } + Vector<Audio::Sample> const& recorded_sample() const { return m_recorded_sample; } + SinglyLinkedList<RollNote> const& roll_notes(int note) const { return m_roll_notes[note]; } int volume() const { return m_volume; } NonnullRefPtr<LibDSP::Synthesizers::Classic> synth() { return m_synth; } NonnullRefPtr<LibDSP::Effects::Delay> delay() { return m_delay; } @@ -51,7 +51,7 @@ private: int m_volume; - const u32& m_time; + u32 const& m_time; NonnullRefPtr<LibDSP::Transport> m_temporary_transport; NonnullRefPtr<LibDSP::Effects::Delay> m_delay; diff --git a/Userland/Applications/PixelPaint/EditGuideDialog.cpp b/Userland/Applications/PixelPaint/EditGuideDialog.cpp index e509d99d8f..b9c8f79950 100644 --- a/Userland/Applications/PixelPaint/EditGuideDialog.cpp +++ b/Userland/Applications/PixelPaint/EditGuideDialog.cpp @@ -76,7 +76,7 @@ EditGuideDialog::EditGuideDialog(GUI::Window* parent_window, String const& offse }; } -Optional<float> EditGuideDialog::offset_as_pixel(const ImageEditor& editor) +Optional<float> EditGuideDialog::offset_as_pixel(ImageEditor const& editor) { float offset = 0; if (m_offset.ends_with('%')) { diff --git a/Userland/Applications/PixelPaint/FilterModel.cpp b/Userland/Applications/PixelPaint/FilterModel.cpp index 025be5b23b..eb0fd6d57a 100644 --- a/Userland/Applications/PixelPaint/FilterModel.cpp +++ b/Userland/Applications/PixelPaint/FilterModel.cpp @@ -64,7 +64,7 @@ GUI::ModelIndex FilterModel::index(int row, int column, const GUI::ModelIndex& p return {}; return create_index(row, column, &m_filters[row]); } - auto* parent = static_cast<const FilterInfo*>(parent_index.internal_data()); + auto* parent = static_cast<FilterInfo const*>(parent_index.internal_data()); if (static_cast<size_t>(row) >= parent->children.size()) return {}; auto* child = &parent->children[row]; @@ -76,7 +76,7 @@ GUI::ModelIndex FilterModel::parent_index(const GUI::ModelIndex& index) const if (!index.is_valid()) return {}; - auto* child = static_cast<const FilterInfo*>(index.internal_data()); + auto* child = static_cast<FilterInfo const*>(index.internal_data()); auto* parent = child->parent; if (parent == nullptr) return {}; @@ -99,13 +99,13 @@ int FilterModel::row_count(const GUI::ModelIndex& index) const { if (!index.is_valid()) return m_filters.size(); - auto* node = static_cast<const FilterInfo*>(index.internal_data()); + auto* node = static_cast<FilterInfo const*>(index.internal_data()); return node->children.size(); } GUI::Variant FilterModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const { - auto* filter = static_cast<const FilterInfo*>(index.internal_data()); + auto* filter = static_cast<FilterInfo const*>(index.internal_data()); switch (role) { case GUI::ModelRole::Display: return filter->text; diff --git a/Userland/Applications/PixelPaint/FilterPreviewWidget.cpp b/Userland/Applications/PixelPaint/FilterPreviewWidget.cpp index f86fe42769..aff498e971 100644 --- a/Userland/Applications/PixelPaint/FilterPreviewWidget.cpp +++ b/Userland/Applications/PixelPaint/FilterPreviewWidget.cpp @@ -21,7 +21,7 @@ FilterPreviewWidget::~FilterPreviewWidget() { } -void FilterPreviewWidget::set_bitmap(const RefPtr<Gfx::Bitmap>& bitmap) +void FilterPreviewWidget::set_bitmap(RefPtr<Gfx::Bitmap> const& bitmap) { m_bitmap = bitmap; clear_filter(); diff --git a/Userland/Applications/PixelPaint/FilterPreviewWidget.h b/Userland/Applications/PixelPaint/FilterPreviewWidget.h index 451ff90569..4753c693ef 100644 --- a/Userland/Applications/PixelPaint/FilterPreviewWidget.h +++ b/Userland/Applications/PixelPaint/FilterPreviewWidget.h @@ -19,7 +19,7 @@ class FilterPreviewWidget final : public GUI::Frame { public: virtual ~FilterPreviewWidget() override; - void set_bitmap(const RefPtr<Gfx::Bitmap>& bitmap); + void set_bitmap(RefPtr<Gfx::Bitmap> const& bitmap); void set_filter(Filter* filter); void clear_filter(); diff --git a/Userland/Applications/PixelPaint/Image.cpp b/Userland/Applications/PixelPaint/Image.cpp index a14246b08e..f64edc2cad 100644 --- a/Userland/Applications/PixelPaint/Image.cpp +++ b/Userland/Applications/PixelPaint/Image.cpp @@ -126,7 +126,7 @@ void Image::serialize_as_json(JsonObjectSerializer<StringBuilder>& json) const MUST(json.add("height", m_size.height())); { auto json_layers = MUST(json.add_array("layers")); - for (const auto& layer : m_layers) { + for (auto const& layer : m_layers) { Gfx::BMPWriter bmp_writer; auto json_layer = MUST(json_layers.add_object()); MUST(json_layer.add("width", layer.size().width())); @@ -147,7 +147,7 @@ void Image::serialize_as_json(JsonObjectSerializer<StringBuilder>& json) const } } -ErrorOr<void> Image::write_to_file(const String& file_path) const +ErrorOr<void> Image::write_to_file(String const& file_path) const { StringBuilder builder; auto json = MUST(JsonObjectSerializer<>::try_create(builder)); @@ -228,7 +228,7 @@ void Image::add_layer(NonnullRefPtr<Layer> layer) ErrorOr<NonnullRefPtr<Image>> Image::take_snapshot() const { auto snapshot = TRY(try_create_with_size(m_size)); - for (const auto& layer : m_layers) { + for (auto const& layer : m_layers) { auto layer_snapshot = TRY(Layer::try_create_snapshot(*snapshot, layer)); snapshot->add_layer(move(layer_snapshot)); } diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp index 9718bfd3c6..490271105c 100644 --- a/Userland/Applications/PixelPaint/ImageEditor.cpp +++ b/Userland/Applications/PixelPaint/ImageEditor.cpp @@ -162,49 +162,49 @@ void ImageEditor::paint_event(GUI::PaintEvent& event) m_selection.paint(painter); if (m_show_rulers) { - const auto ruler_bg_color = palette().color(Gfx::ColorRole::InactiveSelection); - const auto ruler_fg_color = palette().color(Gfx::ColorRole::Ruler); - const auto ruler_text_color = palette().color(Gfx::ColorRole::InactiveSelectionText); - const auto mouse_indicator_color = Color::White; + auto const ruler_bg_color = palette().color(Gfx::ColorRole::InactiveSelection); + auto const ruler_fg_color = palette().color(Gfx::ColorRole::Ruler); + auto const ruler_text_color = palette().color(Gfx::ColorRole::InactiveSelectionText); + auto const mouse_indicator_color = Color::White; // Ruler background painter.fill_rect({ { 0, 0 }, { m_ruler_thickness, rect().height() } }, ruler_bg_color); painter.fill_rect({ { 0, 0 }, { rect().width(), m_ruler_thickness } }, ruler_bg_color); - const auto ruler_step = calculate_ruler_step_size(); - const auto editor_origin_to_image = frame_to_content_position({ 0, 0 }); - const auto editor_max_to_image = frame_to_content_position({ width(), height() }); + auto const ruler_step = calculate_ruler_step_size(); + auto const editor_origin_to_image = frame_to_content_position({ 0, 0 }); + auto const editor_max_to_image = frame_to_content_position({ width(), height() }); // Horizontal ruler painter.draw_line({ 0, m_ruler_thickness }, { rect().width(), m_ruler_thickness }, ruler_fg_color); - const auto x_start = floor(editor_origin_to_image.x()) - ((int)floor(editor_origin_to_image.x()) % ruler_step) - ruler_step; + auto const x_start = floor(editor_origin_to_image.x()) - ((int)floor(editor_origin_to_image.x()) % ruler_step) - ruler_step; for (int x = x_start; x < editor_max_to_image.x(); x += ruler_step) { - const int num_sub_divisions = min(ruler_step, 10); + int const num_sub_divisions = min(ruler_step, 10); for (int x_sub = 0; x_sub < num_sub_divisions; ++x_sub) { - const int x_pos = x + (int)(ruler_step * x_sub / num_sub_divisions); - const int editor_x_sub = content_to_frame_position({ x_pos, 0 }).x(); - const int line_length = (x_sub % 2 == 0) ? m_ruler_thickness / 3 : m_ruler_thickness / 6; + int const x_pos = x + (int)(ruler_step * x_sub / num_sub_divisions); + int const editor_x_sub = content_to_frame_position({ x_pos, 0 }).x(); + int const line_length = (x_sub % 2 == 0) ? m_ruler_thickness / 3 : m_ruler_thickness / 6; painter.draw_line({ editor_x_sub, m_ruler_thickness - line_length }, { editor_x_sub, m_ruler_thickness }, ruler_fg_color); } - const int editor_x = content_to_frame_position({ x, 0 }).x(); + int const editor_x = content_to_frame_position({ x, 0 }).x(); painter.draw_line({ editor_x, 0 }, { editor_x, m_ruler_thickness }, ruler_fg_color); painter.draw_text({ { editor_x + 2, 0 }, { m_ruler_thickness, m_ruler_thickness - 2 } }, String::formatted("{}", x), painter.font(), Gfx::TextAlignment::CenterLeft, ruler_text_color); } // Vertical ruler painter.draw_line({ m_ruler_thickness, 0 }, { m_ruler_thickness, rect().height() }, ruler_fg_color); - const auto y_start = floor(editor_origin_to_image.y()) - ((int)floor(editor_origin_to_image.y()) % ruler_step) - ruler_step; + auto const y_start = floor(editor_origin_to_image.y()) - ((int)floor(editor_origin_to_image.y()) % ruler_step) - ruler_step; for (int y = y_start; y < editor_max_to_image.y(); y += ruler_step) { - const int num_sub_divisions = min(ruler_step, 10); + int const num_sub_divisions = min(ruler_step, 10); for (int y_sub = 0; y_sub < num_sub_divisions; ++y_sub) { - const int y_pos = y + (int)(ruler_step * y_sub / num_sub_divisions); - const int editor_y_sub = content_to_frame_position({ 0, y_pos }).y(); - const int line_length = (y_sub % 2 == 0) ? m_ruler_thickness / 3 : m_ruler_thickness / 6; + int const y_pos = y + (int)(ruler_step * y_sub / num_sub_divisions); + int const editor_y_sub = content_to_frame_position({ 0, y_pos }).y(); + int const line_length = (y_sub % 2 == 0) ? m_ruler_thickness / 3 : m_ruler_thickness / 6; painter.draw_line({ m_ruler_thickness - line_length, editor_y_sub }, { m_ruler_thickness, editor_y_sub }, ruler_fg_color); } - const int editor_y = content_to_frame_position({ 0, y }).y(); + int const editor_y = content_to_frame_position({ 0, y }).y(); painter.draw_line({ 0, editor_y }, { m_ruler_thickness, editor_y }, ruler_fg_color); painter.draw_text({ { 0, editor_y - m_ruler_thickness }, { m_ruler_thickness, m_ruler_thickness } }, String::formatted("{}", y), painter.font(), Gfx::TextAlignment::BottomRight, ruler_text_color); } @@ -222,8 +222,8 @@ void ImageEditor::paint_event(GUI::PaintEvent& event) int ImageEditor::calculate_ruler_step_size() const { - const auto step_target = 80 / scale(); - const auto max_factor = 5; + auto const step_target = 80 / scale(); + auto const max_factor = 5; for (int factor = 0; factor < max_factor; ++factor) { int ten_to_factor = AK::pow<int>(10, factor); if (step_target <= 1 * ten_to_factor) @@ -619,7 +619,7 @@ Result<void, String> ImageEditor::save_project_to_file(Core::File& file) const auto json = MUST(JsonObjectSerializer<>::try_create(builder)); m_image->serialize_as_json(json); auto json_guides = MUST(json.add_array("guides")); - for (const auto& guide : m_guides) { + for (auto const& guide : m_guides) { auto json_guide = MUST(json_guides.add_object()); MUST(json_guide.add("offset"sv, (double)guide.offset())); if (guide.orientation() == Guide::Orientation::Vertical) diff --git a/Userland/Applications/PixelPaint/MainWidget.cpp b/Userland/Applications/PixelPaint/MainWidget.cpp index abb28a1377..eb00abeebf 100644 --- a/Userland/Applications/PixelPaint/MainWidget.cpp +++ b/Userland/Applications/PixelPaint/MainWidget.cpp @@ -101,7 +101,7 @@ MainWidget::MainWidget() } // Note: Update these together! v -static const Vector<String> s_suggested_zoom_levels { "25%", "50%", "100%", "200%", "300%", "400%", "800%", "1600%", "Fit to width", "Fit to height", "Fit entire image" }; +static Vector<String> const s_suggested_zoom_levels { "25%", "50%", "100%", "200%", "300%", "400%", "800%", "1600%", "Fit to width", "Fit to height", "Fit entire image" }; static constexpr int s_zoom_level_fit_width = 8; static constexpr int s_zoom_level_fit_height = 9; static constexpr int s_zoom_level_fit_image = 10; diff --git a/Userland/Applications/PixelPaint/Tools/BrushTool.cpp b/Userland/Applications/PixelPaint/Tools/BrushTool.cpp index aa809795d1..866be15713 100644 --- a/Userland/Applications/PixelPaint/Tools/BrushTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/BrushTool.cpp @@ -36,7 +36,7 @@ void BrushTool::on_mousedown(Layer* layer, MouseEvent& event) return; } - const int first_draw_opacity = 10; + int const first_draw_opacity = 10; for (int i = 0; i < first_draw_opacity; ++i) draw_point(layer->currently_edited_bitmap(), color_for(layer_event), layer_event.position()); diff --git a/Userland/Applications/PixelPaint/Tools/GuideTool.cpp b/Userland/Applications/PixelPaint/Tools/GuideTool.cpp index 1203fe7285..bbe4efeb70 100644 --- a/Userland/Applications/PixelPaint/Tools/GuideTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/GuideTool.cpp @@ -16,7 +16,7 @@ namespace PixelPaint { -RefPtr<Guide> GuideTool::closest_guide(const Gfx::IntPoint& point) +RefPtr<Guide> GuideTool::closest_guide(Gfx::IntPoint const& point) { auto guides = editor()->guides(); Guide* closest_guide = nullptr; diff --git a/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.cpp b/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.cpp index 9f7de2d0d8..0d2d7daea1 100644 --- a/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.cpp @@ -157,7 +157,7 @@ GUI::Widget* RectangleSelectTool::get_properties_widget() feather_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); feather_label.set_fixed_size(80, 20); - const int feather_slider_max = 100; + int const feather_slider_max = 100; auto& feather_slider = feather_container.add<GUI::ValueSlider>(Orientation::Horizontal, "%"); feather_slider.set_range(0, feather_slider_max); feather_slider.set_value((int)floorf(m_edge_feathering * (float)feather_slider_max)); diff --git a/Userland/Applications/PixelPaint/Tools/SprayTool.cpp b/Userland/Applications/PixelPaint/Tools/SprayTool.cpp index 529798cddf..b1b2521ca7 100644 --- a/Userland/Applications/PixelPaint/Tools/SprayTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/SprayTool.cpp @@ -43,13 +43,13 @@ void SprayTool::paint_it() auto& bitmap = layer->currently_edited_bitmap(); GUI::Painter painter(bitmap); VERIFY(bitmap.bpp() == 32); - const double minimal_radius = 2; - const double base_radius = minimal_radius * m_thickness; + double const minimal_radius = 2; + double const base_radius = minimal_radius * m_thickness; for (int i = 0; i < M_PI * base_radius * base_radius * (m_density / 100.0); i++) { double radius = base_radius * nrand(); double angle = 2 * M_PI * nrand(); - const int xpos = m_last_pos.x() + radius * AK::cos(angle); - const int ypos = m_last_pos.y() - radius * AK::sin(angle); + int const xpos = m_last_pos.x() + radius * AK::cos(angle); + int const ypos = m_last_pos.y() - radius * AK::sin(angle); if (xpos < 0 || xpos >= bitmap.width()) continue; if (ypos < 0 || ypos >= bitmap.height()) diff --git a/Userland/Applications/PixelPaint/main.cpp b/Userland/Applications/PixelPaint/main.cpp index e2cebb31b9..71ba88cf13 100644 --- a/Userland/Applications/PixelPaint/main.cpp +++ b/Userland/Applications/PixelPaint/main.cpp @@ -26,7 +26,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto app = GUI::Application::construct(arguments); Config::pledge_domain("PixelPaint"); - const char* image_file = nullptr; + char const* image_file = nullptr; Core::ArgsParser args_parser; args_parser.add_positional_argument(image_file, "Image file to open", "path", Core::ArgsParser::Required::No); args_parser.parse(arguments); diff --git a/Userland/Applications/Run/RunWindow.cpp b/Userland/Applications/Run/RunWindow.cpp index 6e680936c4..6dcc87dd48 100644 --- a/Userland/Applications/Run/RunWindow.cpp +++ b/Userland/Applications/Run/RunWindow.cpp @@ -107,11 +107,11 @@ void RunWindow::do_run() show(); } -bool RunWindow::run_as_command(const String& run_input) +bool RunWindow::run_as_command(String const& run_input) { pid_t child_pid; - const char* shell_executable = "/bin/Shell"; // TODO query and use the user's preferred shell. - const char* argv[] = { shell_executable, "-c", run_input.characters(), nullptr }; + char const* shell_executable = "/bin/Shell"; // TODO query and use the user's preferred shell. + char const* argv[] = { shell_executable, "-c", run_input.characters(), nullptr }; if ((errno = posix_spawn(&child_pid, shell_executable, nullptr, nullptr, const_cast<char**>(argv), environ))) { perror("posix_spawn"); @@ -136,7 +136,7 @@ bool RunWindow::run_as_command(const String& run_input) return true; } -bool RunWindow::run_via_launch(const String& run_input) +bool RunWindow::run_via_launch(String const& run_input) { auto url = URL::create_with_url_or_path(run_input); diff --git a/Userland/Applications/Run/RunWindow.h b/Userland/Applications/Run/RunWindow.h index c05bccf2ef..ca19e41350 100644 --- a/Userland/Applications/Run/RunWindow.h +++ b/Userland/Applications/Run/RunWindow.h @@ -24,8 +24,8 @@ private: RunWindow(); void do_run(); - bool run_as_command(const String& run_input); - bool run_via_launch(const String& run_input); + bool run_as_command(String const& run_input); + bool run_via_launch(String const& run_input); String history_file_path(); void load_history(); diff --git a/Userland/Applications/SoundPlayer/M3UParser.cpp b/Userland/Applications/SoundPlayer/M3UParser.cpp index 5b32bff491..8454d03781 100644 --- a/Userland/Applications/SoundPlayer/M3UParser.cpp +++ b/Userland/Applications/SoundPlayer/M3UParser.cpp @@ -24,7 +24,7 @@ NonnullOwnPtr<M3UParser> M3UParser::from_file(const String path) return from_memory(String { contents, NoChomp }, use_utf8); } -NonnullOwnPtr<M3UParser> M3UParser::from_memory(const String& m3u_contents, bool utf8) +NonnullOwnPtr<M3UParser> M3UParser::from_memory(String const& m3u_contents, bool utf8) { auto parser = make<M3UParser>(); VERIFY(!m3u_contents.is_null() && !m3u_contents.is_empty() && !m3u_contents.is_whitespace()); @@ -38,7 +38,7 @@ NonnullOwnPtr<Vector<M3UEntry>> M3UParser::parse(bool include_extended_info) auto vec = make<Vector<M3UEntry>>(); if (m_use_utf8) { - //TODO: Implement M3U8 parsing + // TODO: Implement M3U8 parsing TODO(); return vec; } @@ -75,7 +75,7 @@ NonnullOwnPtr<Vector<M3UEntry>> M3UParser::parse(bool include_extended_info) auto display_name = ext_inf.value().substring_view(seconds.length() + 1); VERIFY(!display_name.is_empty() && !display_name.is_null() && !display_name.is_empty()); metadata_for_next_file.track_display_title = display_name; - //TODO: support the alternative, non-standard #EXTINF value of a key=value dictionary + // TODO: support the alternative, non-standard #EXTINF value of a key=value dictionary continue; } if (auto playlist = tag("#PLAYLIST:"); playlist.has_value()) @@ -88,7 +88,7 @@ NonnullOwnPtr<Vector<M3UEntry>> M3UParser::parse(bool include_extended_info) metadata_for_next_file.album_artist = move(ext_art.value()); else if (auto ext_genre = tag("#EXTGENRE:"); ext_genre.has_value()) metadata_for_next_file.album_genre = move(ext_genre.value()); - //TODO: Support M3A files (M3U files with embedded mp3 files) + // TODO: Support M3A files (M3U files with embedded mp3 files) } return vec; diff --git a/Userland/Applications/SoundPlayer/M3UParser.h b/Userland/Applications/SoundPlayer/M3UParser.h index d87b07ed95..31d3a7d71e 100644 --- a/Userland/Applications/SoundPlayer/M3UParser.h +++ b/Userland/Applications/SoundPlayer/M3UParser.h @@ -33,7 +33,7 @@ struct M3UEntry { class M3UParser { public: static NonnullOwnPtr<M3UParser> from_file(String path); - static NonnullOwnPtr<M3UParser> from_memory(const String& m3u_contents, bool utf8); + static NonnullOwnPtr<M3UParser> from_memory(String const& m3u_contents, bool utf8); NonnullOwnPtr<Vector<M3UEntry>> parse(bool include_extended_info); diff --git a/Userland/Applications/SoundPlayer/PlaybackManager.cpp b/Userland/Applications/SoundPlayer/PlaybackManager.cpp index bbaf720a34..fad0b1a7b1 100644 --- a/Userland/Applications/SoundPlayer/PlaybackManager.cpp +++ b/Userland/Applications/SoundPlayer/PlaybackManager.cpp @@ -66,7 +66,7 @@ void PlaybackManager::loop(bool loop) m_loop = loop; } -void PlaybackManager::seek(const int position) +void PlaybackManager::seek(int const position) { if (!m_loader) return; diff --git a/Userland/Applications/SoundPlayer/PlaybackManager.h b/Userland/Applications/SoundPlayer/PlaybackManager.h index 2959855fa9..e4fa03eef6 100644 --- a/Userland/Applications/SoundPlayer/PlaybackManager.h +++ b/Userland/Applications/SoundPlayer/PlaybackManager.h @@ -22,7 +22,7 @@ public: void play(); void stop(); void pause(); - void seek(const int position); + void seek(int const position); void loop(bool); bool toggle_pause(); void set_loader(NonnullRefPtr<Audio::Loader>&&); diff --git a/Userland/Applications/SoundPlayer/Playlist.cpp b/Userland/Applications/SoundPlayer/Playlist.cpp index 96f09f8001..69db139f07 100644 --- a/Userland/Applications/SoundPlayer/Playlist.cpp +++ b/Userland/Applications/SoundPlayer/Playlist.cpp @@ -51,12 +51,12 @@ void Playlist::try_fill_missing_info(Vector<M3UEntry>& entries, StringView path) entry.extended_info->track_display_title = LexicalPath::title(entry.path); if (!entry.extended_info->track_length_in_seconds.has_value()) { - //TODO: Implement embedded metadata extractor for other audio formats + // TODO: Implement embedded metadata extractor for other audio formats if (auto reader = Audio::Loader::create(entry.path); !reader.is_error()) entry.extended_info->track_length_in_seconds = reader.value()->total_samples() / reader.value()->sample_rate(); } - //TODO: Implement a metadata parser for the uncomfortably numerous popular embedded metadata formats + // TODO: Implement a metadata parser for the uncomfortably numerous popular embedded metadata formats } for (auto& entry : to_delete) diff --git a/Userland/Applications/SoundPlayer/PlaylistWidget.cpp b/Userland/Applications/SoundPlayer/PlaylistWidget.cpp index f954c93489..b5881d7bd7 100644 --- a/Userland/Applications/SoundPlayer/PlaylistWidget.cpp +++ b/Userland/Applications/SoundPlayer/PlaylistWidget.cpp @@ -19,7 +19,7 @@ PlaylistWidget::PlaylistWidget() m_table_view->set_selection_mode(GUI::AbstractView::SelectionMode::SingleSelection); m_table_view->set_selection_behavior(GUI::AbstractView::SelectionBehavior::SelectRows); m_table_view->set_highlight_selected_rows(true); - m_table_view->on_doubleclick = [&](const Gfx::Point<int>& point) { + m_table_view->on_doubleclick = [&](Gfx::Point<int> const& point) { auto player = dynamic_cast<Player*>(window()->main_widget()); auto index = m_table_view->index_at_event_position(point); if (!index.is_valid()) @@ -50,7 +50,7 @@ GUI::Variant PlaylistModel::data(const GUI::ModelIndex& index, GUI::ModelRole ro } if (role == GUI::ModelRole::Sort) return data(index, GUI::ModelRole::Display); - if (role == static_cast<GUI::ModelRole>(PlaylistModelCustomRole::FilePath)) //path + if (role == static_cast<GUI::ModelRole>(PlaylistModelCustomRole::FilePath)) // path return m_playlist_items[index.row()].path; return {}; diff --git a/Userland/Applications/SoundPlayer/PlaylistWidget.h b/Userland/Applications/SoundPlayer/PlaylistWidget.h index d4c10360ad..e1260fd20e 100644 --- a/Userland/Applications/SoundPlayer/PlaylistWidget.h +++ b/Userland/Applications/SoundPlayer/PlaylistWidget.h @@ -39,7 +39,7 @@ class PlaylistTableView : public GUI::TableView { public: void doubleclick_event(GUI::MouseEvent& event) override; - Function<void(const Gfx::Point<int>&)> on_doubleclick; + Function<void(Gfx::Point<int> const&)> on_doubleclick; private: PlaylistTableView(); diff --git a/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp b/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp index d9a8160ed7..8261504313 100644 --- a/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp +++ b/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp @@ -35,17 +35,17 @@ static float get_normalized_aspect_ratio(float a, float b) } } -static bool node_is_leaf(const TreeMapNode& node) +static bool node_is_leaf(TreeMapNode const& node) { return node.num_children() == 0; } -bool TreeMapWidget::rect_can_contain_label(const Gfx::IntRect& rect) const +bool TreeMapWidget::rect_can_contain_label(Gfx::IntRect const& rect) const { return rect.height() >= font().presentation_size() && rect.width() > 20; } -void TreeMapWidget::paint_cell_frame(GUI::Painter& painter, const TreeMapNode& node, const Gfx::IntRect& cell_rect, const Gfx::IntRect& inner_rect, int depth, HasLabel has_label) const +void TreeMapWidget::paint_cell_frame(GUI::Painter& painter, TreeMapNode const& node, Gfx::IntRect const& cell_rect, Gfx::IntRect const& inner_rect, int depth, HasLabel has_label) const { if (cell_rect.width() <= 2 || cell_rect.height() <= 2) { painter.fill_rect(cell_rect, Color::Black); @@ -101,7 +101,7 @@ void TreeMapWidget::paint_cell_frame(GUI::Painter& painter, const TreeMapNode& n } template<typename Function> -void TreeMapWidget::lay_out_children(const TreeMapNode& node, const Gfx::IntRect& rect, int depth, Function callback) +void TreeMapWidget::lay_out_children(TreeMapNode const& node, Gfx::IntRect const& rect, int depth, Function callback) { if (node.num_children() == 0) { return; @@ -179,7 +179,7 @@ void TreeMapWidget::lay_out_children(const TreeMapNode& node, const Gfx::IntRect inner_rect = cell_rect; inner_rect.shrink(4, 4); // border and shading if (rect_can_contain_label(inner_rect)) { - const int margin = 5; + int const margin = 5; has_label = HasLabel::Yes; inner_rect.set_y(inner_rect.y() + font().presentation_size() + margin); inner_rect.set_height(inner_rect.height() - (font().presentation_size() + margin * 2)); @@ -214,11 +214,11 @@ void TreeMapWidget::lay_out_children(const TreeMapNode& node, const Gfx::IntRect } } -const TreeMapNode* TreeMapWidget::path_node(size_t n) const +TreeMapNode const* TreeMapWidget::path_node(size_t n) const { if (!m_tree.ptr()) return nullptr; - const TreeMapNode* iter = &m_tree->root(); + TreeMapNode const* iter = &m_tree->root(); size_t path_index = 0; while (iter && path_index < m_path.size() && path_index < n) { size_t child_index = m_path[path_index]; @@ -238,13 +238,13 @@ void TreeMapWidget::paint_event(GUI::PaintEvent& event) m_selected_node_cache = path_node(m_path.size()); - const TreeMapNode* node = path_node(m_viewpoint); + TreeMapNode const* node = path_node(m_viewpoint); if (!node) { painter.fill_rect(frame_inner_rect(), Color::MidGray); } else if (node_is_leaf(*node)) { paint_cell_frame(painter, *node, frame_inner_rect(), Gfx::IntRect(), m_viewpoint - 1, HasLabel::Yes); } else { - lay_out_children(*node, frame_inner_rect(), m_viewpoint, [&](const TreeMapNode& node, int, const Gfx::IntRect& rect, const Gfx::IntRect& inner_rect, int depth, HasLabel has_label, IsRemainder remainder) { + lay_out_children(*node, frame_inner_rect(), m_viewpoint, [&](TreeMapNode const& node, int, Gfx::IntRect const& rect, Gfx::IntRect const& inner_rect, int depth, HasLabel has_label, IsRemainder remainder) { if (remainder == IsRemainder::No) { paint_cell_frame(painter, node, rect, inner_rect, depth, has_label); } else { @@ -258,14 +258,14 @@ void TreeMapWidget::paint_event(GUI::PaintEvent& event) } } -Vector<int> TreeMapWidget::path_to_position(const Gfx::IntPoint& position) +Vector<int> TreeMapWidget::path_to_position(Gfx::IntPoint const& position) { - const TreeMapNode* node = path_node(m_viewpoint); + TreeMapNode const* node = path_node(m_viewpoint); if (!node) { return {}; } Vector<int> path; - lay_out_children(*node, frame_inner_rect(), m_viewpoint, [&](const TreeMapNode&, int index, const Gfx::IntRect& rect, const Gfx::IntRect&, int, HasLabel, IsRemainder is_remainder) { + lay_out_children(*node, frame_inner_rect(), m_viewpoint, [&](TreeMapNode const&, int index, Gfx::IntRect const& rect, Gfx::IntRect const&, int, HasLabel, IsRemainder is_remainder) { if (is_remainder == IsRemainder::No && rect.contains(position)) { path.append(index); } @@ -275,7 +275,7 @@ Vector<int> TreeMapWidget::path_to_position(const Gfx::IntPoint& position) void TreeMapWidget::mousedown_event(GUI::MouseEvent& event) { - const TreeMapNode* node = path_node(m_viewpoint); + TreeMapNode const* node = path_node(m_viewpoint); if (node && !node_is_leaf(*node)) { Vector<int> path = path_to_position(event.position()); if (!path.is_empty()) { @@ -293,7 +293,7 @@ void TreeMapWidget::doubleclick_event(GUI::MouseEvent& event) { if (event.button() != GUI::MouseButton::Primary) return; - const TreeMapNode* node = path_node(m_viewpoint); + TreeMapNode const* node = path_node(m_viewpoint); if (node && !node_is_leaf(*node)) { Vector<int> path = path_to_position(event.position()); m_path.shrink(m_viewpoint); diff --git a/Userland/Applications/SpaceAnalyzer/TreeMapWidget.h b/Userland/Applications/SpaceAnalyzer/TreeMapWidget.h index 9c0ef8382d..14636e7f90 100644 --- a/Userland/Applications/SpaceAnalyzer/TreeMapWidget.h +++ b/Userland/Applications/SpaceAnalyzer/TreeMapWidget.h @@ -15,7 +15,7 @@ struct TreeMapNode { virtual String name() const = 0; virtual i64 area() const = 0; virtual size_t num_children() const = 0; - virtual const TreeMapNode& child_at(size_t i) const = 0; + virtual TreeMapNode const& child_at(size_t i) const = 0; virtual void sort_children_by_area() const = 0; protected: @@ -24,7 +24,7 @@ protected: struct TreeMap : public RefCounted<TreeMap> { virtual ~TreeMap() = default; - virtual const TreeMapNode& root() const = 0; + virtual TreeMapNode const& root() const = 0; }; class TreeMapWidget final : public GUI::Frame { @@ -35,7 +35,7 @@ public: Function<void()> on_path_change; Function<void(GUI::ContextMenuEvent&)> on_context_menu_request; size_t path_size() const; - const TreeMapNode* path_node(size_t n) const; + TreeMapNode const* path_node(size_t n) const; size_t viewpoint() const; void set_viewpoint(size_t); void set_tree(RefPtr<TreeMap> tree); @@ -49,8 +49,8 @@ private: virtual void context_menu_event(GUI::ContextMenuEvent&) override; virtual void keydown_event(GUI::KeyEvent&) override; - bool rect_can_contain_children(const Gfx::IntRect& rect) const; - bool rect_can_contain_label(const Gfx::IntRect& rect) const; + bool rect_can_contain_children(Gfx::IntRect const& rect) const; + bool rect_can_contain_label(Gfx::IntRect const& rect) const; enum class HasLabel { Yes, @@ -62,14 +62,14 @@ private: }; template<typename Function> - void lay_out_children(const TreeMapNode&, const Gfx::IntRect&, int depth, Function); - void paint_cell_frame(GUI::Painter&, const TreeMapNode&, const Gfx::IntRect&, const Gfx::IntRect&, int depth, HasLabel has_label) const; - Vector<int> path_to_position(const Gfx::IntPoint&); + void lay_out_children(TreeMapNode const&, Gfx::IntRect const&, int depth, Function); + void paint_cell_frame(GUI::Painter&, TreeMapNode const&, Gfx::IntRect const&, Gfx::IntRect const&, int depth, HasLabel has_label) const; + Vector<int> path_to_position(Gfx::IntPoint const&); RefPtr<TreeMap> m_tree; Vector<int> m_path; size_t m_viewpoint { 0 }; - const void* m_selected_node_cache; + void const* m_selected_node_cache; }; } diff --git a/Userland/Applications/SpaceAnalyzer/main.cpp b/Userland/Applications/SpaceAnalyzer/main.cpp index b53b67be15..560c7d9e4e 100644 --- a/Userland/Applications/SpaceAnalyzer/main.cpp +++ b/Userland/Applications/SpaceAnalyzer/main.cpp @@ -46,7 +46,7 @@ struct TreeNode : public SpaceAnalyzer::TreeMapNode { } return 0; } - virtual const TreeNode& child_at(size_t i) const override { return m_children->at(i); } + virtual TreeNode const& child_at(size_t i) const override { return m_children->at(i); } virtual void sort_children_by_area() const override { if (m_children) { @@ -65,7 +65,7 @@ struct Tree : public SpaceAnalyzer::TreeMap { : m_root(move(root_name)) {}; virtual ~Tree() {}; TreeNode m_root; - virtual const SpaceAnalyzer::TreeMapNode& root() const override + virtual SpaceAnalyzer::TreeMapNode const& root() const override { return m_root; }; @@ -278,7 +278,7 @@ static void analyze(RefPtr<Tree> tree, SpaceAnalyzer::TreeMapWidget& treemapwidg treemapwidget.set_tree(tree); } -static bool is_removable(const String& absolute_path) +static bool is_removable(String const& absolute_path) { VERIFY(!absolute_path.is_empty()); int access_result = access(LexicalPath::dirname(absolute_path).characters(), W_OK); @@ -287,14 +287,14 @@ static bool is_removable(const String& absolute_path) return access_result == 0; } -static String get_absolute_path_to_selected_node(const SpaceAnalyzer::TreeMapWidget& treemapwidget, bool include_last_node = true) +static String get_absolute_path_to_selected_node(SpaceAnalyzer::TreeMapWidget const& treemapwidget, bool include_last_node = true) { StringBuilder path_builder; for (size_t k = 0; k < treemapwidget.path_size() - (include_last_node ? 0 : 1); k++) { if (k != 0) { path_builder.append('/'); } - const SpaceAnalyzer::TreeMapNode* node = treemapwidget.path_node(k); + SpaceAnalyzer::TreeMapNode const* node = treemapwidget.path_node(k); path_builder.append(node->name()); } return path_builder.build(); diff --git a/Userland/Applications/Spreadsheet/Cell.cpp b/Userland/Applications/Spreadsheet/Cell.cpp index dd111615c1..e9c41fdf61 100644 --- a/Userland/Applications/Spreadsheet/Cell.cpp +++ b/Userland/Applications/Spreadsheet/Cell.cpp @@ -47,7 +47,7 @@ void Cell::set_data(JS::Value new_data) m_evaluated_data = move(new_data); } -void Cell::set_type(const CellType* type) +void Cell::set_type(CellType const* type) { m_type = type; } @@ -67,7 +67,7 @@ void Cell::set_type_metadata(CellTypeMetadata&& metadata) m_type_metadata = move(metadata); } -const CellType& Cell::type() const +CellType const& Cell::type() const { if (m_type) return *m_type; @@ -171,13 +171,13 @@ void Cell::reference_from(Cell* other) if (!other || other == this) return; - if (!m_referencing_cells.find_if([other](const auto& ptr) { return ptr.ptr() == other; }).is_end()) + if (!m_referencing_cells.find_if([other](auto const& ptr) { return ptr.ptr() == other; }).is_end()) return; m_referencing_cells.append(other->make_weak_ptr()); } -void Cell::copy_from(const Cell& other) +void Cell::copy_from(Cell const& other) { m_dirty = true; m_evaluated_externally = other.m_evaluated_externally; diff --git a/Userland/Applications/Spreadsheet/Cell.h b/Userland/Applications/Spreadsheet/Cell.h index f38b0a7092..6159b9ec2d 100644 --- a/Userland/Applications/Spreadsheet/Cell.h +++ b/Userland/Applications/Spreadsheet/Cell.h @@ -58,16 +58,16 @@ struct Cell : public Weakable<Cell> { return m_thrown_value; } - const String& data() const { return m_data; } + String const& data() const { return m_data; } const JS::Value& evaluated_data() const { return m_evaluated_data; } Kind kind() const { return m_kind; } - const Vector<WeakPtr<Cell>>& referencing_cells() const { return m_referencing_cells; } + Vector<WeakPtr<Cell>> const& referencing_cells() const { return m_referencing_cells; } void set_type(StringView name); - void set_type(const CellType*); + void set_type(CellType const*); void set_type_metadata(CellTypeMetadata&&); - const Position& position() const { return m_position; } + Position const& position() const { return m_position; } void set_position(Position position, Badge<Sheet>) { if (position != m_position) { @@ -76,9 +76,9 @@ struct Cell : public Weakable<Cell> { } } - const Format& evaluated_formats() const { return m_evaluated_formats; } + Format const& evaluated_formats() const { return m_evaluated_formats; } Format& evaluated_formats() { return m_evaluated_formats; } - const Vector<ConditionalFormat>& conditional_formats() const { return m_conditional_formats; } + Vector<ConditionalFormat> const& conditional_formats() const { return m_conditional_formats; } void set_conditional_formats(Vector<ConditionalFormat>&& fmts) { m_dirty = true; @@ -88,8 +88,8 @@ struct Cell : public Weakable<Cell> { JS::ThrowCompletionOr<String> typed_display() const; JS::ThrowCompletionOr<JS::Value> typed_js_data() const; - const CellType& type() const; - const CellTypeMetadata& type_metadata() const { return m_type_metadata; } + CellType const& type() const; + CellTypeMetadata const& type_metadata() const { return m_type_metadata; } CellTypeMetadata& type_metadata() { return m_type_metadata; } String source() const; @@ -99,10 +99,10 @@ struct Cell : public Weakable<Cell> { void update(); void update_data(Badge<Sheet>); - const Sheet& sheet() const { return *m_sheet; } + Sheet const& sheet() const { return *m_sheet; } Sheet& sheet() { return *m_sheet; } - void copy_from(const Cell&); + void copy_from(Cell const&); private: bool m_dirty { false }; @@ -113,7 +113,7 @@ private: Kind m_kind { LiteralString }; WeakPtr<Sheet> m_sheet; Vector<WeakPtr<Cell>> m_referencing_cells; - const CellType* m_type { nullptr }; + CellType const* m_type { nullptr }; CellTypeMetadata m_type_metadata; Position m_position; diff --git a/Userland/Applications/Spreadsheet/CellSyntaxHighlighter.cpp b/Userland/Applications/Spreadsheet/CellSyntaxHighlighter.cpp index e9c43180f8..4fdc12b110 100644 --- a/Userland/Applications/Spreadsheet/CellSyntaxHighlighter.cpp +++ b/Userland/Applications/Spreadsheet/CellSyntaxHighlighter.cpp @@ -11,7 +11,7 @@ namespace Spreadsheet { -void CellSyntaxHighlighter::rehighlight(const Palette& palette) +void CellSyntaxHighlighter::rehighlight(Palette const& palette) { auto text = m_client->get_text(); m_client->spans().clear(); diff --git a/Userland/Applications/Spreadsheet/CellSyntaxHighlighter.h b/Userland/Applications/Spreadsheet/CellSyntaxHighlighter.h index 0a19d3f715..265c28efbe 100644 --- a/Userland/Applications/Spreadsheet/CellSyntaxHighlighter.h +++ b/Userland/Applications/Spreadsheet/CellSyntaxHighlighter.h @@ -16,11 +16,11 @@ public: CellSyntaxHighlighter() = default; virtual ~CellSyntaxHighlighter() override = default; - virtual void rehighlight(const Palette&) override; - void set_cell(const Cell* cell) { m_cell = cell; } + virtual void rehighlight(Palette const&) override; + void set_cell(Cell const* cell) { m_cell = cell; } private: - const Cell* m_cell { nullptr }; + Cell const* m_cell { nullptr }; }; } diff --git a/Userland/Applications/Spreadsheet/CellType/Date.cpp b/Userland/Applications/Spreadsheet/CellType/Date.cpp index 3bc12c55af..9810f162d9 100644 --- a/Userland/Applications/Spreadsheet/CellType/Date.cpp +++ b/Userland/Applications/Spreadsheet/CellType/Date.cpp @@ -17,7 +17,7 @@ DateCell::DateCell() { } -JS::ThrowCompletionOr<String> DateCell::display(Cell& cell, const CellTypeMetadata& metadata) const +JS::ThrowCompletionOr<String> DateCell::display(Cell& cell, CellTypeMetadata const& metadata) const { return propagate_failure(cell, [&]() -> JS::ThrowCompletionOr<String> { auto timestamp = TRY(js_value(cell, metadata)); @@ -30,7 +30,7 @@ JS::ThrowCompletionOr<String> DateCell::display(Cell& cell, const CellTypeMetada }); } -JS::ThrowCompletionOr<JS::Value> DateCell::js_value(Cell& cell, const CellTypeMetadata&) const +JS::ThrowCompletionOr<JS::Value> DateCell::js_value(Cell& cell, CellTypeMetadata const&) const { auto js_data = cell.js_data(); auto value = TRY(js_data.to_double(cell.sheet().global_object())); diff --git a/Userland/Applications/Spreadsheet/CellType/Date.h b/Userland/Applications/Spreadsheet/CellType/Date.h index b8df17a8ff..b1aca31f5b 100644 --- a/Userland/Applications/Spreadsheet/CellType/Date.h +++ b/Userland/Applications/Spreadsheet/CellType/Date.h @@ -16,8 +16,8 @@ class DateCell : public CellType { public: DateCell(); virtual ~DateCell() override = default; - virtual JS::ThrowCompletionOr<String> display(Cell&, const CellTypeMetadata&) const override; - virtual JS::ThrowCompletionOr<JS::Value> js_value(Cell&, const CellTypeMetadata&) const override; + virtual JS::ThrowCompletionOr<String> display(Cell&, CellTypeMetadata const&) const override; + virtual JS::ThrowCompletionOr<JS::Value> js_value(Cell&, CellTypeMetadata const&) const override; String metadata_hint(MetadataName) const override; }; diff --git a/Userland/Applications/Spreadsheet/CellType/Format.cpp b/Userland/Applications/Spreadsheet/CellType/Format.cpp index f33d11e320..82e7d31d37 100644 --- a/Userland/Applications/Spreadsheet/CellType/Format.cpp +++ b/Userland/Applications/Spreadsheet/CellType/Format.cpp @@ -21,23 +21,23 @@ struct SingleEntryListNext { template<typename PutChFunc, typename ArgumentListRefT, template<typename T, typename U = ArgumentListRefT> typename NextArgument, typename CharType> struct PrintfImpl : public PrintfImplementation::PrintfImpl<PutChFunc, ArgumentListRefT, NextArgument, CharType> { - ALWAYS_INLINE PrintfImpl(PutChFunc& putch, char*& bufptr, const int& nwritten) + ALWAYS_INLINE PrintfImpl(PutChFunc& putch, char*& bufptr, int const& nwritten) : PrintfImplementation::PrintfImpl<PutChFunc, ArgumentListRefT, NextArgument>(putch, bufptr, nwritten) { } // Disallow pointer formats. - ALWAYS_INLINE int format_n(const PrintfImplementation::ModifierState&, ArgumentListRefT&) const + ALWAYS_INLINE int format_n(PrintfImplementation::ModifierState const&, ArgumentListRefT&) const { return 0; } - ALWAYS_INLINE int format_s(const PrintfImplementation::ModifierState&, ArgumentListRefT&) const + ALWAYS_INLINE int format_s(PrintfImplementation::ModifierState const&, ArgumentListRefT&) const { return 0; } }; -String format_double(const char* format, double value) +String format_double(char const* format, double value) { StringBuilder builder; auto putch = [&](auto, auto ch) { builder.append(ch); }; diff --git a/Userland/Applications/Spreadsheet/CellType/Format.h b/Userland/Applications/Spreadsheet/CellType/Format.h index adbe79f6d1..f9684aacbc 100644 --- a/Userland/Applications/Spreadsheet/CellType/Format.h +++ b/Userland/Applications/Spreadsheet/CellType/Format.h @@ -10,6 +10,6 @@ namespace Spreadsheet { -String format_double(const char* format, double value); +String format_double(char const* format, double value); } diff --git a/Userland/Applications/Spreadsheet/CellType/Identity.cpp b/Userland/Applications/Spreadsheet/CellType/Identity.cpp index b73f026210..b44c7c5802 100644 --- a/Userland/Applications/Spreadsheet/CellType/Identity.cpp +++ b/Userland/Applications/Spreadsheet/CellType/Identity.cpp @@ -15,7 +15,7 @@ IdentityCell::IdentityCell() { } -JS::ThrowCompletionOr<String> IdentityCell::display(Cell& cell, const CellTypeMetadata& metadata) const +JS::ThrowCompletionOr<String> IdentityCell::display(Cell& cell, CellTypeMetadata const& metadata) const { auto data = cell.js_data(); if (!metadata.format.is_empty()) @@ -24,7 +24,7 @@ JS::ThrowCompletionOr<String> IdentityCell::display(Cell& cell, const CellTypeMe return data.to_string(cell.sheet().global_object()); } -JS::ThrowCompletionOr<JS::Value> IdentityCell::js_value(Cell& cell, const CellTypeMetadata&) const +JS::ThrowCompletionOr<JS::Value> IdentityCell::js_value(Cell& cell, CellTypeMetadata const&) const { return cell.js_data(); } diff --git a/Userland/Applications/Spreadsheet/CellType/Identity.h b/Userland/Applications/Spreadsheet/CellType/Identity.h index 8e8cc7c701..2f43f6c820 100644 --- a/Userland/Applications/Spreadsheet/CellType/Identity.h +++ b/Userland/Applications/Spreadsheet/CellType/Identity.h @@ -15,8 +15,8 @@ class IdentityCell : public CellType { public: IdentityCell(); virtual ~IdentityCell() override = default; - virtual JS::ThrowCompletionOr<String> display(Cell&, const CellTypeMetadata&) const override; - virtual JS::ThrowCompletionOr<JS::Value> js_value(Cell&, const CellTypeMetadata&) const override; + virtual JS::ThrowCompletionOr<String> display(Cell&, CellTypeMetadata const&) const override; + virtual JS::ThrowCompletionOr<JS::Value> js_value(Cell&, CellTypeMetadata const&) const override; String metadata_hint(MetadataName) const override; }; diff --git a/Userland/Applications/Spreadsheet/CellType/Numeric.cpp b/Userland/Applications/Spreadsheet/CellType/Numeric.cpp index 72c59d6529..483c55d0b4 100644 --- a/Userland/Applications/Spreadsheet/CellType/Numeric.cpp +++ b/Userland/Applications/Spreadsheet/CellType/Numeric.cpp @@ -17,7 +17,7 @@ NumericCell::NumericCell() { } -JS::ThrowCompletionOr<String> NumericCell::display(Cell& cell, const CellTypeMetadata& metadata) const +JS::ThrowCompletionOr<String> NumericCell::display(Cell& cell, CellTypeMetadata const& metadata) const { return propagate_failure(cell, [&]() -> JS::ThrowCompletionOr<String> { auto value = TRY(js_value(cell, metadata)); @@ -34,7 +34,7 @@ JS::ThrowCompletionOr<String> NumericCell::display(Cell& cell, const CellTypeMet }); } -JS::ThrowCompletionOr<JS::Value> NumericCell::js_value(Cell& cell, const CellTypeMetadata&) const +JS::ThrowCompletionOr<JS::Value> NumericCell::js_value(Cell& cell, CellTypeMetadata const&) const { return propagate_failure(cell, [&]() { return cell.js_data().to_number(cell.sheet().global_object()); diff --git a/Userland/Applications/Spreadsheet/CellType/Numeric.h b/Userland/Applications/Spreadsheet/CellType/Numeric.h index d0f3b8491b..2bf94e15cc 100644 --- a/Userland/Applications/Spreadsheet/CellType/Numeric.h +++ b/Userland/Applications/Spreadsheet/CellType/Numeric.h @@ -26,8 +26,8 @@ class NumericCell : public CellType { public: NumericCell(); virtual ~NumericCell() override = default; - virtual JS::ThrowCompletionOr<String> display(Cell&, const CellTypeMetadata&) const override; - virtual JS::ThrowCompletionOr<JS::Value> js_value(Cell&, const CellTypeMetadata&) const override; + virtual JS::ThrowCompletionOr<String> display(Cell&, CellTypeMetadata const&) const override; + virtual JS::ThrowCompletionOr<JS::Value> js_value(Cell&, CellTypeMetadata const&) const override; String metadata_hint(MetadataName) const override; }; diff --git a/Userland/Applications/Spreadsheet/CellType/String.cpp b/Userland/Applications/Spreadsheet/CellType/String.cpp index 310bda6e83..c0707be469 100644 --- a/Userland/Applications/Spreadsheet/CellType/String.cpp +++ b/Userland/Applications/Spreadsheet/CellType/String.cpp @@ -15,7 +15,7 @@ StringCell::StringCell() { } -JS::ThrowCompletionOr<String> StringCell::display(Cell& cell, const CellTypeMetadata& metadata) const +JS::ThrowCompletionOr<String> StringCell::display(Cell& cell, CellTypeMetadata const& metadata) const { auto string = TRY(cell.js_data().to_string(cell.sheet().global_object())); if (metadata.length >= 0) @@ -24,7 +24,7 @@ JS::ThrowCompletionOr<String> StringCell::display(Cell& cell, const CellTypeMeta return string; } -JS::ThrowCompletionOr<JS::Value> StringCell::js_value(Cell& cell, const CellTypeMetadata& metadata) const +JS::ThrowCompletionOr<JS::Value> StringCell::js_value(Cell& cell, CellTypeMetadata const& metadata) const { auto string = TRY(display(cell, metadata)); return JS::js_string(cell.sheet().interpreter().heap(), string); diff --git a/Userland/Applications/Spreadsheet/CellType/String.h b/Userland/Applications/Spreadsheet/CellType/String.h index aecf1a23a6..ed6333af7a 100644 --- a/Userland/Applications/Spreadsheet/CellType/String.h +++ b/Userland/Applications/Spreadsheet/CellType/String.h @@ -15,8 +15,8 @@ class StringCell : public CellType { public: StringCell(); virtual ~StringCell() override = default; - virtual JS::ThrowCompletionOr<String> display(Cell&, const CellTypeMetadata&) const override; - virtual JS::ThrowCompletionOr<JS::Value> js_value(Cell&, const CellTypeMetadata&) const override; + virtual JS::ThrowCompletionOr<String> display(Cell&, CellTypeMetadata const&) const override; + virtual JS::ThrowCompletionOr<JS::Value> js_value(Cell&, CellTypeMetadata const&) const override; String metadata_hint(MetadataName) const override; }; diff --git a/Userland/Applications/Spreadsheet/CellType/Type.cpp b/Userland/Applications/Spreadsheet/CellType/Type.cpp index 5690d8b64b..e75665fbbc 100644 --- a/Userland/Applications/Spreadsheet/CellType/Type.cpp +++ b/Userland/Applications/Spreadsheet/CellType/Type.cpp @@ -20,7 +20,7 @@ static Spreadsheet::DateCell s_date_cell; namespace Spreadsheet { -const CellType* CellType::get_by_name(StringView name) +CellType const* CellType::get_by_name(StringView name) { return s_cell_types.get(name).value_or(nullptr); } diff --git a/Userland/Applications/Spreadsheet/CellType/Type.h b/Userland/Applications/Spreadsheet/CellType/Type.h index 10d27027d8..2418c900f3 100644 --- a/Userland/Applications/Spreadsheet/CellType/Type.h +++ b/Userland/Applications/Spreadsheet/CellType/Type.h @@ -32,15 +32,15 @@ enum class MetadataName { class CellType { public: - static const CellType* get_by_name(StringView); + static CellType const* get_by_name(StringView); static Vector<StringView> names(); - virtual JS::ThrowCompletionOr<String> display(Cell&, const CellTypeMetadata&) const = 0; - virtual JS::ThrowCompletionOr<JS::Value> js_value(Cell&, const CellTypeMetadata&) const = 0; + virtual JS::ThrowCompletionOr<String> display(Cell&, CellTypeMetadata const&) const = 0; + virtual JS::ThrowCompletionOr<JS::Value> js_value(Cell&, CellTypeMetadata const&) const = 0; virtual String metadata_hint(MetadataName) const { return {}; } virtual ~CellType() = default; - const String& name() const { return m_name; } + String const& name() const { return m_name; } protected: CellType(StringView name); diff --git a/Userland/Applications/Spreadsheet/CellTypeDialog.cpp b/Userland/Applications/Spreadsheet/CellTypeDialog.cpp index 5775900eaf..045966650c 100644 --- a/Userland/Applications/Spreadsheet/CellTypeDialog.cpp +++ b/Userland/Applications/Spreadsheet/CellTypeDialog.cpp @@ -29,7 +29,7 @@ REGISTER_WIDGET(Spreadsheet, ConditionsView); namespace Spreadsheet { -CellTypeDialog::CellTypeDialog(const Vector<Position>& positions, Sheet& sheet, GUI::Window* parent) +CellTypeDialog::CellTypeDialog(Vector<Position> const& positions, Sheet& sheet, GUI::Window* parent) : GUI::Dialog(parent) { VERIFY(!positions.is_empty()); @@ -62,8 +62,8 @@ CellTypeDialog::CellTypeDialog(const Vector<Position>& positions, Sheet& sheet, ok_button.on_click = [&](auto) { done(ExecOK); }; } -const Vector<String> g_horizontal_alignments { "Left", "Center", "Right" }; -const Vector<String> g_vertical_alignments { "Top", "Center", "Bottom" }; +Vector<String> const g_horizontal_alignments { "Left", "Center", "Right" }; +Vector<String> const g_vertical_alignments { "Top", "Center", "Bottom" }; Vector<String> g_types; constexpr static CellTypeDialog::VerticalAlignment vertical_alignment_from(Gfx::TextAlignment alignment) @@ -110,7 +110,7 @@ constexpr static CellTypeDialog::HorizontalAlignment horizontal_alignment_from(G return CellTypeDialog::HorizontalAlignment::Right; } -void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, const Vector<Position>& positions, Sheet& sheet) +void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector<Position> const& positions, Sheet& sheet) { g_types.clear(); for (auto& type_name : CellType::names()) diff --git a/Userland/Applications/Spreadsheet/CellTypeDialog.h b/Userland/Applications/Spreadsheet/CellTypeDialog.h index d9f7955eb6..f260ddf818 100644 --- a/Userland/Applications/Spreadsheet/CellTypeDialog.h +++ b/Userland/Applications/Spreadsheet/CellTypeDialog.h @@ -18,7 +18,7 @@ class CellTypeDialog : public GUI::Dialog { public: CellTypeMetadata metadata() const; - const CellType* type() const { return m_type; } + CellType const* type() const { return m_type; } Vector<ConditionalFormat> conditional_formats() { return m_conditional_formats; } enum class HorizontalAlignment : int { @@ -33,10 +33,10 @@ public: }; private: - CellTypeDialog(const Vector<Position>&, Sheet&, GUI::Window* parent = nullptr); - void setup_tabs(GUI::TabWidget&, const Vector<Position>&, Sheet&); + CellTypeDialog(Vector<Position> const&, Sheet&, GUI::Window* parent = nullptr); + void setup_tabs(GUI::TabWidget&, Vector<Position> const&, Sheet&); - const CellType* m_type { nullptr }; + CellType const* m_type { nullptr }; int m_length { -1 }; String m_format; diff --git a/Userland/Applications/Spreadsheet/ExportDialog.cpp b/Userland/Applications/Spreadsheet/ExportDialog.cpp index d16c1b55dc..31dc703b98 100644 --- a/Userland/Applications/Spreadsheet/ExportDialog.cpp +++ b/Userland/Applications/Spreadsheet/ExportDialog.cpp @@ -26,11 +26,11 @@ #include <unistd.h> // This is defined in ImportDialog.cpp, we can't include it twice, since the generated symbol is exported. -extern const char select_format_page_gml[]; +extern char const select_format_page_gml[]; namespace Spreadsheet { -CSVExportDialogPage::CSVExportDialogPage(const Sheet& sheet) +CSVExportDialogPage::CSVExportDialogPage(Sheet const& sheet) : m_data(sheet.to_xsv()) { m_headers.extend(m_data.take_first()); @@ -213,7 +213,7 @@ void CSVExportDialogPage::update_preview() m_data_preview_text_editor->update(); } -Result<void, String> CSVExportDialogPage::move_into(const String& target) +Result<void, String> CSVExportDialogPage::move_into(String const& target) { auto& source = m_temp_output_file_path; diff --git a/Userland/Applications/Spreadsheet/ExportDialog.h b/Userland/Applications/Spreadsheet/ExportDialog.h index 59439a29a1..3618ac0793 100644 --- a/Userland/Applications/Spreadsheet/ExportDialog.h +++ b/Userland/Applications/Spreadsheet/ExportDialog.h @@ -20,11 +20,11 @@ class Workbook; struct CSVExportDialogPage { using XSV = Writer::XSV<Vector<Vector<String>>, Vector<String>>; - explicit CSVExportDialogPage(const Sheet&); + explicit CSVExportDialogPage(Sheet const&); NonnullRefPtr<GUI::WizardPage> page() { return *m_page; } Optional<XSV>& writer() { return m_previously_made_writer; } - Result<void, String> move_into(const String& target); + Result<void, String> move_into(String const& target); protected: void update_preview(); diff --git a/Userland/Applications/Spreadsheet/HelpWindow.cpp b/Userland/Applications/Spreadsheet/HelpWindow.cpp index 1b24930cc4..f498527712 100644 --- a/Userland/Applications/Spreadsheet/HelpWindow.cpp +++ b/Userland/Applications/Spreadsheet/HelpWindow.cpp @@ -39,7 +39,7 @@ public: String key(const GUI::ModelIndex& index) const { return m_keys[index.row()]; } - void set_from(const JsonObject& object) + void set_from(JsonObject const& object) { m_keys.clear(); object.for_each_member([this](auto& name, auto&) { diff --git a/Userland/Applications/Spreadsheet/JSIntegration.cpp b/Userland/Applications/Spreadsheet/JSIntegration.cpp index 18314b36a2..a3a047bf27 100644 --- a/Userland/Applications/Spreadsheet/JSIntegration.cpp +++ b/Userland/Applications/Spreadsheet/JSIntegration.cpp @@ -186,7 +186,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::get_real_cell_contents) if (!position.has_value()) return vm.throw_completion<JS::TypeError>(global_object, "Invalid cell name"); - const auto* cell = sheet_object->m_sheet.at(position.value()); + auto const* cell = sheet_object->m_sheet.at(position.value()); if (!cell) return JS::js_undefined(); diff --git a/Userland/Applications/Spreadsheet/Position.h b/Userland/Applications/Spreadsheet/Position.h index 301add499e..a1f43ccd1c 100644 --- a/Userland/Applications/Spreadsheet/Position.h +++ b/Userland/Applications/Spreadsheet/Position.h @@ -32,18 +32,18 @@ struct Position { return m_hash; } - bool operator==(const Position& other) const + bool operator==(Position const& other) const { return row == other.row && column == other.column; } - bool operator!=(const Position& other) const + bool operator!=(Position const& other) const { return !(other == *this); } - String to_cell_identifier(const Sheet& sheet) const; - URL to_url(const Sheet& sheet) const; + String to_cell_identifier(Sheet const& sheet) const; + URL to_url(Sheet const& sheet) const; size_t column { 0 }; size_t row { 0 }; diff --git a/Userland/Applications/Spreadsheet/Readers/XSV.cpp b/Userland/Applications/Spreadsheet/Readers/XSV.cpp index 9039ee0f99..4170743195 100644 --- a/Userland/Applications/Spreadsheet/Readers/XSV.cpp +++ b/Userland/Applications/Spreadsheet/Readers/XSV.cpp @@ -274,7 +274,7 @@ XSV::Field XSV::read_one_unquoted_field() StringView XSV::Row::operator[](StringView name) const { VERIFY(!m_xsv.m_names.is_empty()); - auto it = m_xsv.m_names.find_if([&](const auto& entry) { return name == entry; }); + auto it = m_xsv.m_names.find_if([&](auto const& entry) { return name == entry; }); VERIFY(!it.is_end()); return (*this)[it.index()]; diff --git a/Userland/Applications/Spreadsheet/Readers/XSV.h b/Userland/Applications/Spreadsheet/Readers/XSV.h index 63e7e3d9ef..9962dedf60 100644 --- a/Userland/Applications/Spreadsheet/Readers/XSV.h +++ b/Userland/Applications/Spreadsheet/Readers/XSV.h @@ -146,11 +146,11 @@ public: } bool is_end() const { return m_index == m_xsv.m_rows.size(); } - bool operator==(const RowIterator& other) const + bool operator==(RowIterator const& other) const { return m_index == other.m_index && &m_xsv == &other.m_xsv; } - bool operator==(const RowIterator<!const_>& other) const + bool operator==(RowIterator<!const_> const& other) const { return m_index == other.m_index && &m_xsv == &other.m_xsv; } diff --git a/Userland/Applications/Spreadsheet/Spreadsheet.cpp b/Userland/Applications/Spreadsheet/Spreadsheet.cpp index 14efb02f59..c8cee6ef0e 100644 --- a/Userland/Applications/Spreadsheet/Spreadsheet.cpp +++ b/Userland/Applications/Spreadsheet/Spreadsheet.cpp @@ -182,7 +182,7 @@ Cell* Sheet::at(StringView name) return nullptr; } -Cell* Sheet::at(const Position& position) +Cell* Sheet::at(Position const& position) { auto it = m_cells.find(position); @@ -271,7 +271,7 @@ Optional<Position> Sheet::position_from_url(const URL& url) const return parse_cell_name(url.fragment()); } -Position Sheet::offset_relative_to(const Position& base, const Position& offset, const Position& offset_base) const +Position Sheet::offset_relative_to(Position const& base, Position const& offset, Position const& offset_base) const { if (offset.column >= m_columns.size()) { dbgln("Column '{}' does not exist!", offset.column); @@ -361,7 +361,7 @@ void Sheet::copy_cells(Vector<Position> from, Vector<Position> to, Optional<Posi } } -RefPtr<Sheet> Sheet::from_json(const JsonObject& object, Workbook& workbook) +RefPtr<Sheet> Sheet::from_json(JsonObject const& object, Workbook& workbook) { auto sheet = adopt_ref(*new Sheet(workbook)); auto rows = object.get("rows").to_u32(default_row_count); @@ -391,7 +391,7 @@ RefPtr<Sheet> Sheet::from_json(const JsonObject& object, Workbook& workbook) auto json = sheet->interpreter().global_object().get_without_side_effects("JSON"); auto& parse_function = json.as_object().get_without_side_effects("parse").as_function(); - auto read_format = [](auto& format, const auto& obj) { + auto read_format = [](auto& format, auto const& obj) { if (auto value = obj.get("foreground_color"); value.is_string()) format.foreground_color = Color::from_string(value.as_string()); if (auto value = obj.get("background_color"); value.is_string()) @@ -519,7 +519,7 @@ JsonObject Sheet::to_json() const JsonObject object; object.set("name", m_name); - auto save_format = [](const auto& format, auto& obj) { + auto save_format = [](auto const& format, auto& obj) { if (format.foreground_color.has_value()) obj.set("foreground_color", format.foreground_color.value().to_string()); if (format.background_color.has_value()) @@ -629,7 +629,7 @@ Vector<Vector<String>> Sheet::to_xsv() const return data; } -RefPtr<Sheet> Sheet::from_xsv(const Reader::XSV& xsv, Workbook& workbook) +RefPtr<Sheet> Sheet::from_xsv(Reader::XSV const& xsv, Workbook& workbook) { auto cols = xsv.headers(); auto rows = xsv.size(); @@ -736,12 +736,12 @@ String Sheet::generate_inline_documentation_for(StringView function, size_t argu return builder.build(); } -String Position::to_cell_identifier(const Sheet& sheet) const +String Position::to_cell_identifier(Sheet const& sheet) const { return String::formatted("{}{}", sheet.column(column), row); } -URL Position::to_url(const Sheet& sheet) const +URL Position::to_url(Sheet const& sheet) const { URL url; url.set_protocol("spreadsheet"); diff --git a/Userland/Applications/Spreadsheet/Spreadsheet.h b/Userland/Applications/Spreadsheet/Spreadsheet.h index a3bf270df2..6aa5b0e3db 100644 --- a/Userland/Applications/Spreadsheet/Spreadsheet.h +++ b/Userland/Applications/Spreadsheet/Spreadsheet.h @@ -36,37 +36,37 @@ public: Optional<String> column_arithmetic(StringView column_name, int offset); Cell* from_url(const URL&); - const Cell* from_url(const URL& url) const { return const_cast<Sheet*>(this)->from_url(url); } + Cell const* from_url(const URL& url) const { return const_cast<Sheet*>(this)->from_url(url); } Optional<Position> position_from_url(const URL& url) const; /// Resolve 'offset' to an absolute position assuming 'base' is at 'offset_base'. /// Effectively, "Walk the distance between 'offset' and 'offset_base' away from 'base'". - Position offset_relative_to(const Position& base, const Position& offset, const Position& offset_base) const; + Position offset_relative_to(Position const& base, Position const& offset, Position const& offset_base) const; JsonObject to_json() const; - static RefPtr<Sheet> from_json(const JsonObject&, Workbook&); + static RefPtr<Sheet> from_json(JsonObject const&, Workbook&); Vector<Vector<String>> to_xsv() const; - static RefPtr<Sheet> from_xsv(const Reader::XSV&, Workbook&); + static RefPtr<Sheet> from_xsv(Reader::XSV const&, Workbook&); - const String& name() const { return m_name; } + String const& name() const { return m_name; } void set_name(StringView name) { m_name = name; } JsonObject gather_documentation() const; - const HashTable<Position>& selected_cells() const { return m_selected_cells; } + HashTable<Position> const& selected_cells() const { return m_selected_cells; } HashTable<Position>& selected_cells() { return m_selected_cells; } - const HashMap<Position, NonnullOwnPtr<Cell>>& cells() const { return m_cells; } + HashMap<Position, NonnullOwnPtr<Cell>> const& cells() const { return m_cells; } HashMap<Position, NonnullOwnPtr<Cell>>& cells() { return m_cells; } - Cell* at(const Position& position); - const Cell* at(const Position& position) const { return const_cast<Sheet*>(this)->at(position); } + Cell* at(Position const& position); + Cell const* at(Position const& position) const { return const_cast<Sheet*>(this)->at(position); } - const Cell* at(StringView name) const { return const_cast<Sheet*>(this)->at(name); } + Cell const* at(StringView name) const { return const_cast<Sheet*>(this)->at(name); } Cell* at(StringView); - const Cell& ensure(const Position& position) const { return const_cast<Sheet*>(this)->ensure(position); } - Cell& ensure(const Position& position) + Cell const& ensure(Position const& position) const { return const_cast<Sheet*>(this)->ensure(position); } + Cell& ensure(Position const& position) { if (auto cell = at(position)) return *cell; @@ -80,8 +80,8 @@ public: size_t row_count() const { return m_rows; } size_t column_count() const { return m_columns.size(); } - const Vector<String>& columns() const { return m_columns; } - const String& column(size_t index) + Vector<String> const& columns() const { return m_columns; } + String const& column(size_t index) { for (size_t i = column_count(); i < index; ++i) add_column(); @@ -89,7 +89,7 @@ public: VERIFY(column_count() > index); return m_columns[index]; } - const String& column(size_t index) const + String const& column(size_t index) const { VERIFY(column_count() > index); return m_columns[index]; @@ -114,7 +114,7 @@ public: Cell*& current_evaluated_cell() { return m_current_cell_being_evaluated; } bool has_been_visited(Cell* cell) const { return m_visited_cells_in_update.contains(cell); } - const Workbook& workbook() const { return m_workbook; } + Workbook const& workbook() const { return m_workbook; } enum class CopyOperation { Copy, @@ -160,7 +160,7 @@ namespace AK { template<> struct Traits<Spreadsheet::Position> : public GenericTraits<Spreadsheet::Position> { static constexpr bool is_trivial() { return false; } - static unsigned hash(const Spreadsheet::Position& p) + static unsigned hash(Spreadsheet::Position const& p) { return p.hash(); } diff --git a/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp b/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp index e7980430f0..b190788b7a 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp @@ -19,7 +19,7 @@ GUI::Variant SheetModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) return {}; if (role == GUI::ModelRole::Display) { - const auto* cell = m_sheet->at({ (size_t)index.column(), (size_t)index.row() }); + auto const* cell = m_sheet->at({ (size_t)index.column(), (size_t)index.row() }); if (!cell) return String::empty(); @@ -63,7 +63,7 @@ GUI::Variant SheetModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) return Position { (size_t)index.column(), (size_t)index.row() }.to_url(m_sheet).to_string(); if (role == GUI::ModelRole::TextAlignment) { - const auto* cell = m_sheet->at({ (size_t)index.column(), (size_t)index.row() }); + auto const* cell = m_sheet->at({ (size_t)index.column(), (size_t)index.row() }); if (!cell) return {}; @@ -71,7 +71,7 @@ GUI::Variant SheetModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) } if (role == GUI::ModelRole::ForegroundColor) { - const auto* cell = m_sheet->at({ (size_t)index.column(), (size_t)index.row() }); + auto const* cell = m_sheet->at({ (size_t)index.column(), (size_t)index.row() }); if (!cell) return {}; @@ -90,7 +90,7 @@ GUI::Variant SheetModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) } if (role == GUI::ModelRole::BackgroundColor) { - const auto* cell = m_sheet->at({ (size_t)index.column(), (size_t)index.row() }); + auto const* cell = m_sheet->at({ (size_t)index.column(), (size_t)index.row() }); if (!cell) return {}; diff --git a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp index ce8b46665f..0f2ce5765e 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp @@ -32,7 +32,7 @@ void SpreadsheetView::EditingDelegate::set_value(GUI::Variant const& value, GUI: return StringModelEditingDelegate::set_value(value, selection_behavior); m_has_set_initial_value = true; - const auto option = m_sheet.at({ (size_t)index().column(), (size_t)index().row() }); + auto const option = m_sheet.at({ (size_t)index().column(), (size_t)index().row() }); if (option) return StringModelEditingDelegate::set_value(option->source(), selection_behavior); @@ -461,7 +461,7 @@ void SpreadsheetView::move_cursor(GUI::AbstractView::CursorMovement direction) m_table_view->move_cursor(direction, GUI::AbstractView::SelectionUpdate::Set); } -void SpreadsheetView::TableCellPainter::paint(GUI::Painter& painter, const Gfx::IntRect& rect, const Gfx::Palette& palette, const GUI::ModelIndex& index) +void SpreadsheetView::TableCellPainter::paint(GUI::Painter& painter, Gfx::IntRect const& rect, Gfx::Palette const& palette, const GUI::ModelIndex& index) { // Draw a border. // Undo the horizontal padding done by the table view... diff --git a/Userland/Applications/Spreadsheet/SpreadsheetView.h b/Userland/Applications/Spreadsheet/SpreadsheetView.h index aacc0c84cb..2723ed32a7 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetView.h +++ b/Userland/Applications/Spreadsheet/SpreadsheetView.h @@ -121,7 +121,7 @@ private: class EditingDelegate final : public GUI::StringModelEditingDelegate { public: - EditingDelegate(const Sheet& sheet) + EditingDelegate(Sheet const& sheet) : m_sheet(sheet) { } @@ -148,7 +148,7 @@ private: private: bool m_has_set_initial_value { false }; - const Sheet& m_sheet; + Sheet const& m_sheet; }; class TableCellPainter final : public GUI::TableCellPaintingDelegate { @@ -157,7 +157,7 @@ private: : m_table_view(view) { } - void paint(GUI::Painter&, const Gfx::IntRect&, const Gfx::Palette&, const GUI::ModelIndex&) override; + void paint(GUI::Painter&, Gfx::IntRect const&, Gfx::Palette const&, const GUI::ModelIndex&) override; private: const GUI::TableView& m_table_view; diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.h b/Userland/Applications/Spreadsheet/SpreadsheetWidget.h index b21b103178..ef1c5dcfa0 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.h +++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.h @@ -26,13 +26,13 @@ public: void add_sheet(); void add_sheet(NonnullRefPtr<Sheet>&&); - const String& current_filename() const { return m_workbook->current_filename(); } + String const& current_filename() const { return m_workbook->current_filename(); } SpreadsheetView* current_view() { return static_cast<SpreadsheetView*>(m_tab_widget->active_widget()); } Sheet* current_worksheet_if_available() { return current_view() ? current_view()->sheet_if_available() : nullptr; } void update_window_title(); Workbook& workbook() { return *m_workbook; } - const Workbook& workbook() const { return *m_workbook; } + Workbook const& workbook() const { return *m_workbook; } const GUI::ModelIndex* current_selection_cursor() { diff --git a/Userland/Applications/Spreadsheet/Workbook.cpp b/Userland/Applications/Spreadsheet/Workbook.cpp index 6756b9eafb..73d4e0fe87 100644 --- a/Userland/Applications/Spreadsheet/Workbook.cpp +++ b/Userland/Applications/Spreadsheet/Workbook.cpp @@ -43,7 +43,7 @@ Workbook::Workbook(NonnullRefPtrVector<Sheet>&& sheets, GUI::Window& parent_wind m_vm->enable_default_host_import_module_dynamically_hook(); } -bool Workbook::set_filename(const String& filename) +bool Workbook::set_filename(String const& filename) { if (m_current_filename == filename) return false; diff --git a/Userland/Applications/Spreadsheet/Workbook.h b/Userland/Applications/Spreadsheet/Workbook.h index 5c570b21e0..5a035e11ec 100644 --- a/Userland/Applications/Spreadsheet/Workbook.h +++ b/Userland/Applications/Spreadsheet/Workbook.h @@ -21,14 +21,14 @@ public: Result<bool, String> load(StringView filename); Result<bool, String> open_file(Core::File&); - const String& current_filename() const { return m_current_filename; } - bool set_filename(const String& filename); + String const& current_filename() const { return m_current_filename; } + bool set_filename(String const& filename); bool dirty() { return m_dirty; } void set_dirty(bool dirty) { m_dirty = dirty; } bool has_sheets() const { return !m_sheets.is_empty(); } - const NonnullRefPtrVector<Sheet>& sheets() const { return m_sheets; } + NonnullRefPtrVector<Sheet> const& sheets() const { return m_sheets; } NonnullRefPtrVector<Sheet> sheets() { return m_sheets; } Sheet& add_sheet(StringView name) diff --git a/Userland/Applications/Spreadsheet/Writers/CSV.h b/Userland/Applications/Spreadsheet/Writers/CSV.h index d7650e760a..92c3adfe06 100644 --- a/Userland/Applications/Spreadsheet/Writers/CSV.h +++ b/Userland/Applications/Spreadsheet/Writers/CSV.h @@ -15,7 +15,7 @@ namespace Writer { template<typename ContainerType> class CSV : public XSV<ContainerType> { public: - CSV(OutputStream& output, const ContainerType& data, const Vector<StringView>& headers = {}, WriterBehavior behaviors = default_behaviors()) + CSV(OutputStream& output, ContainerType const& data, Vector<StringView> const& headers = {}, WriterBehavior behaviors = default_behaviors()) : XSV<ContainerType>(output, data, { ",", "\"", WriterTraits::Repeat }, headers, behaviors) { } diff --git a/Userland/Applications/Spreadsheet/Writers/XSV.h b/Userland/Applications/Spreadsheet/Writers/XSV.h index 6e1bd8548f..006bc53ce3 100644 --- a/Userland/Applications/Spreadsheet/Writers/XSV.h +++ b/Userland/Applications/Spreadsheet/Writers/XSV.h @@ -62,7 +62,7 @@ constexpr WriterBehavior default_behaviors() template<typename ContainerType, typename HeaderType = Vector<StringView>> class XSV { public: - XSV(OutputStream& output, const ContainerType& data, const WriterTraits& traits, const HeaderType& headers = {}, WriterBehavior behaviors = default_behaviors()) + XSV(OutputStream& output, ContainerType const& data, WriterTraits const& traits, HeaderType const& headers = {}, WriterBehavior behaviors = default_behaviors()) : m_data(data) , m_traits(traits) , m_behaviors(behaviors) @@ -188,10 +188,10 @@ private: set_error(WriteError::InternalError); } - const ContainerType& m_data; - const WriterTraits& m_traits; + ContainerType const& m_data; + WriterTraits const& m_traits; WriterBehavior m_behaviors; - const HeaderType& m_names; + HeaderType const& m_names; WriteError m_error { WriteError::None }; OutputStream& m_output; }; diff --git a/Userland/Applications/Spreadsheet/main.cpp b/Userland/Applications/Spreadsheet/main.cpp index 088bdbfba8..210c7da977 100644 --- a/Userland/Applications/Spreadsheet/main.cpp +++ b/Userland/Applications/Spreadsheet/main.cpp @@ -30,7 +30,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto app = GUI::Application::construct(arguments); - const char* filename = nullptr; + char const* filename = nullptr; Core::ArgsParser args_parser; args_parser.add_positional_argument(filename, "File to read from", "file", Core::ArgsParser::Required::No); diff --git a/Userland/Applications/SystemMonitor/GraphWidget.cpp b/Userland/Applications/SystemMonitor/GraphWidget.cpp index 238fbb3372..d32c21a83d 100644 --- a/Userland/Applications/SystemMonitor/GraphWidget.cpp +++ b/Userland/Applications/SystemMonitor/GraphWidget.cpp @@ -21,7 +21,7 @@ void GraphWidget::add_value(Vector<u64, 1>&& value) void GraphWidget::paint_event(GUI::PaintEvent& event) { - const auto& system_palette = GUI::Application::the()->palette(); + auto const& system_palette = GUI::Application::the()->palette(); GUI::Frame::paint_event(event); GUI::Painter painter(*this); @@ -35,18 +35,18 @@ void GraphWidget::paint_event(GUI::PaintEvent& event) if (!m_values.is_empty()) { // Draw one set of values at a time for (size_t k = 0; k < m_value_format.size(); k++) { - const auto& format = m_value_format[k]; + auto const& format = m_value_format[k]; if (format.graph_color_role == ColorRole::Base) { continue; } - const auto& line_color = system_palette.color(format.graph_color_role); - const auto& background_color = line_color.with_alpha(0x7f); + auto const& line_color = system_palette.color(format.graph_color_role); + auto const& background_color = line_color.with_alpha(0x7f); m_calculated_points.clear_with_capacity(); for (size_t i = 0; i < m_values.size(); i++) { int x = inner_rect.right() - (i * 2) + 1; if (x < 0) break; - const auto& current_values = m_values.at(m_values.size() - i - 1); + auto const& current_values = m_values.at(m_values.size() - i - 1); if (current_values.size() <= k) { // Don't have a data point m_calculated_points.append({ -1, -1 }); @@ -67,8 +67,8 @@ void GraphWidget::paint_event(GUI::PaintEvent& event) Gfx::Path path; size_t points_in_path = 0; bool started_path = false; - const Gfx::IntPoint* current_point = nullptr; - const Gfx::IntPoint* first_point = nullptr; + Gfx::IntPoint const* current_point = nullptr; + Gfx::IntPoint const* first_point = nullptr; auto check_fill_area = [&]() { if (!started_path) return; @@ -109,9 +109,9 @@ void GraphWidget::paint_event(GUI::PaintEvent& event) } if (format.graph_color_role != ColorRole::Base) { // Draw the line for the data points we have - const Gfx::IntPoint* previous_point = nullptr; + Gfx::IntPoint const* previous_point = nullptr; for (size_t i = 0; i < m_calculated_points.size(); i++) { - const auto& current_point = m_calculated_points[i]; + auto const& current_point = m_calculated_points[i]; if (current_point.x() < 0) { previous_point = nullptr; continue; @@ -125,11 +125,11 @@ void GraphWidget::paint_event(GUI::PaintEvent& event) } if (!m_values.is_empty() && !m_value_format.is_empty()) { - const auto& current_values = m_values.last(); + auto const& current_values = m_values.last(); int y = 0; for (size_t i = 0; i < min(m_value_format.size(), current_values.size()); i++) { - const auto& format = m_value_format[i]; - const auto& graph_color = system_palette.color(format.graph_color_role); + auto const& format = m_value_format[i]; + auto const& graph_color = system_palette.color(format.graph_color_role); if (!format.text_formatter) continue; auto constrain_rect = inner_rect.shrunken(8, 8); diff --git a/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp b/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp index 398eead9a2..80df7ac14a 100644 --- a/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp +++ b/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp @@ -36,7 +36,7 @@ MemoryStatsWidget::MemoryStatsWidget(GraphWidget& graph) layout()->set_margins({ 8, 0, 0 }); layout()->set_spacing(3); - auto build_widgets_for_label = [this](const String& description) -> RefPtr<GUI::Label> { + auto build_widgets_for_label = [this](String const& description) -> RefPtr<GUI::Label> { auto& container = add<GUI::Widget>(); container.set_layout<GUI::HorizontalBoxLayout>(); container.set_fixed_size(275, 12); diff --git a/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp b/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp index 3295892092..5216c90a4a 100644 --- a/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp +++ b/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp @@ -18,7 +18,7 @@ class PagemapPaintingDelegate final : public GUI::TableCellPaintingDelegate { public: virtual ~PagemapPaintingDelegate() override = default; - virtual void paint(GUI::Painter& painter, const Gfx::IntRect& a_rect, const Gfx::Palette&, const GUI::ModelIndex& index) override + virtual void paint(GUI::Painter& painter, Gfx::IntRect const& a_rect, Gfx::Palette const&, const GUI::ModelIndex& index) override { auto rect = a_rect.shrunken(2, 2); auto pagemap = index.data(GUI::ModelRole::Custom).to_string(); @@ -93,7 +93,7 @@ ProcessMemoryMapWidget::ProcessMemoryMapWidget() [](auto&) { return GUI::Variant(0); }, - [](const JsonObject& object) { + [](JsonObject const& object) { auto pagemap = object.get("pagemap").as_string_or({}); return pagemap; }); diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp index e9f8c90a54..e3f96643b1 100644 --- a/Userland/Applications/SystemMonitor/main.cpp +++ b/Userland/Applications/SystemMonitor/main.cpp @@ -64,7 +64,7 @@ class UnavailableProcessWidget final : public GUI::Frame { public: virtual ~UnavailableProcessWidget() override = default; - const String& text() const { return m_text; } + String const& text() const { return m_text; } void set_text(String text) { m_text = move(text); } private: @@ -390,7 +390,7 @@ class ProgressbarPaintingDelegate final : public GUI::TableCellPaintingDelegate public: virtual ~ProgressbarPaintingDelegate() override = default; - virtual void paint(GUI::Painter& painter, const Gfx::IntRect& a_rect, const Palette& palette, const GUI::ModelIndex& index) override + virtual void paint(GUI::Painter& painter, Gfx::IntRect const& a_rect, Palette const& palette, const GUI::ModelIndex& index) override { auto rect = a_rect.shrunken(2, 2); auto percentage = index.data(GUI::ModelRole::Custom).to_i32(); @@ -707,7 +707,7 @@ NonnullRefPtr<GUI::Widget> build_performance_tab() cpu_graphs.append(cpu_graph); } } - ProcessModel::the().on_cpu_info_change = [cpu_graphs](const NonnullOwnPtrVector<ProcessModel::CpuInfo>& cpus) mutable { + ProcessModel::the().on_cpu_info_change = [cpu_graphs](NonnullOwnPtrVector<ProcessModel::CpuInfo> const& cpus) mutable { float sum_cpu = 0; for (size_t i = 0; i < cpus.size(); ++i) { cpu_graphs[i].add_value({ static_cast<size_t>(cpus[i].total_cpu_percent), static_cast<size_t>(cpus[i].total_cpu_percent_kernel) }); diff --git a/Userland/Applications/Terminal/main.cpp b/Userland/Applications/Terminal/main.cpp index 0d206343e3..75993d391f 100644 --- a/Userland/Applications/Terminal/main.cpp +++ b/Userland/Applications/Terminal/main.cpp @@ -141,7 +141,7 @@ static void run_command(String command, bool keep_open) } endpwent(); - const char* args[5] = { shell.characters(), nullptr, nullptr, nullptr, nullptr }; + char const* args[5] = { shell.characters(), nullptr, nullptr, nullptr, nullptr }; if (!command.is_empty()) { int arg_index = 1; if (keep_open) @@ -149,7 +149,7 @@ static void run_command(String command, bool keep_open) args[arg_index++] = "-c"; args[arg_index++] = command.characters(); } - const char* envs[] = { "TERM=xterm", "PAGER=more", "PATH=/usr/local/bin:/usr/bin:/bin", nullptr }; + char const* envs[] = { "TERM=xterm", "PAGER=more", "PATH=/usr/local/bin:/usr/bin:/bin", nullptr }; int rc = execve(shell.characters(), const_cast<char**>(args), const_cast<char**>(envs)); if (rc < 0) { perror("execve"); @@ -247,7 +247,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) Config::pledge_domain("Terminal"); - const char* command_to_execute = nullptr; + char const* command_to_execute = nullptr; bool keep_open = false; Core::ArgsParser args_parser; diff --git a/Userland/Applications/ThemeEditor/PreviewWidget.cpp b/Userland/Applications/ThemeEditor/PreviewWidget.cpp index 0c23c73ae1..a25cb4add0 100644 --- a/Userland/Applications/ThemeEditor/PreviewWidget.cpp +++ b/Userland/Applications/ThemeEditor/PreviewWidget.cpp @@ -30,7 +30,7 @@ class MiniWidgetGallery final : public GUI::Widget { C_OBJECT(MiniWidgetGallery); public: - void set_preview_palette(const Gfx::Palette& palette) + void set_preview_palette(Gfx::Palette const& palette) { set_palette(palette); Function<void(GUI::Widget&)> recurse = [&](GUI::Widget& parent_widget) { @@ -79,7 +79,7 @@ private: RefPtr<GUI::Statusbar> m_statusbar; }; -PreviewWidget::PreviewWidget(const Gfx::Palette& preview_palette) +PreviewWidget::PreviewWidget(Gfx::Palette const& preview_palette) : m_preview_palette(preview_palette) { m_active_window_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png").release_value_but_fixme_should_propagate_errors(); @@ -131,7 +131,7 @@ void PreviewWidget::load_theme_bitmaps() load_bitmap(m_preview_palette.tooltip_shadow_path(), m_last_tooltip_shadow_path, m_tooltip_shadow); } -void PreviewWidget::set_preview_palette(const Gfx::Palette& palette) +void PreviewWidget::set_preview_palette(Gfx::Palette const& palette) { m_preview_palette = palette; m_gallery->set_preview_palette(palette); @@ -172,7 +172,7 @@ void PreviewWidget::paint_event(GUI::PaintEvent& event) RefPtr<Gfx::Bitmap> bitmap; }; - auto paint_window = [&](auto& title, const Gfx::IntRect& rect, auto state, const Gfx::Bitmap& icon) { + auto paint_window = [&](auto& title, Gfx::IntRect const& rect, auto state, Gfx::Bitmap const& icon) { int window_button_width = m_preview_palette.window_title_button_width(); int window_button_height = m_preview_palette.window_title_button_height(); auto titlebar_text_rect = Gfx::WindowTheme::current().titlebar_text_rect(Gfx::WindowTheme::WindowType::Normal, rect, m_preview_palette); diff --git a/Userland/Applications/ThemeEditor/PreviewWidget.h b/Userland/Applications/ThemeEditor/PreviewWidget.h index f096c8cd89..746c5a464a 100644 --- a/Userland/Applications/ThemeEditor/PreviewWidget.h +++ b/Userland/Applications/ThemeEditor/PreviewWidget.h @@ -24,8 +24,8 @@ class PreviewWidget final : public GUI::Frame { public: virtual ~PreviewWidget() override = default; - const Gfx::Palette& preview_palette() const { return m_preview_palette; } - void set_preview_palette(const Gfx::Palette&); + Gfx::Palette const& preview_palette() const { return m_preview_palette; } + void set_preview_palette(Gfx::Palette const&); void set_theme_from_file(Core::File&); void set_color_filter(OwnPtr<Gfx::ColorBlindnessFilter>); @@ -33,7 +33,7 @@ public: Function<void(String const&)> on_theme_load_from_file; private: - explicit PreviewWidget(const Gfx::Palette&); + explicit PreviewWidget(Gfx::Palette const&); void load_theme_bitmaps(); diff --git a/Userland/Applications/ThemeEditor/main.cpp b/Userland/Applications/ThemeEditor/main.cpp index fa58efbc2f..ba5006ccde 100644 --- a/Userland/Applications/ThemeEditor/main.cpp +++ b/Userland/Applications/ThemeEditor/main.cpp @@ -35,7 +35,7 @@ class ColorRoleModel final : public GUI::ItemListModel<Gfx::ColorRole> { public: - explicit ColorRoleModel(const Vector<Gfx::ColorRole>& data) + explicit ColorRoleModel(Vector<Gfx::ColorRole> const& data) : ItemListModel<Gfx::ColorRole>(data) { } |