1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 02:57:44 +00:00

Everywhere: Run clang-format

This commit is contained in:
Idan Horowitz 2022-04-01 20:58:27 +03:00 committed by Linus Groh
parent 0376c127f6
commit 086969277e
1665 changed files with 8479 additions and 8479 deletions

View file

@ -169,11 +169,11 @@ void ClockWidget::paint_event(GUI::PaintEvent& event)
// Render string center-left aligned, but attempt to center the string based on a constant
// "ideal" time string (i.e., the same one used to size this widget in the initializer).
// This prevents the rest of the string from shifting around while seconds tick.
const Gfx::Font& font = Gfx::FontDatabase::default_font();
const int frame_width = frame_thickness();
const int ideal_width = m_time_width;
const int widget_width = max_width();
const int translation_x = (widget_width - ideal_width) / 2 - frame_width;
Gfx::Font const& font = Gfx::FontDatabase::default_font();
int const frame_width = frame_thickness();
int const ideal_width = m_time_width;
int const widget_width = max_width();
int const translation_x = (widget_width - ideal_width) / 2 - frame_width;
painter.draw_text(frame_inner_rect().translated(translation_x, frame_width), time_text, font, Gfx::TextAlignment::CenterLeft, palette().window_text());
}

View file

@ -23,7 +23,7 @@ struct Option {
bool default_action;
};
static const Vector<Option> options = {
static Vector<Option> const options = {
{ "Power off computer", { "/bin/shutdown", "--now", nullptr }, true, true },
{ "Reboot", { "/bin/reboot", nullptr }, true, false },
{ "Log out", { "/bin/logout", nullptr }, true, false },

View file

@ -14,7 +14,7 @@
#include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h>
TaskbarButton::TaskbarButton(const WindowIdentifier& identifier)
TaskbarButton::TaskbarButton(WindowIdentifier const& identifier)
: m_identifier(identifier)
{
}
@ -49,7 +49,7 @@ void TaskbarButton::resize_event(GUI::ResizeEvent& event)
return GUI::Button::resize_event(event);
}
static void paint_custom_progressbar(GUI::Painter& painter, const Gfx::IntRect& rect, const Gfx::IntRect& text_rect, const Palette& palette, int min, int max, int value, StringView text, const Gfx::Font& font, Gfx::TextAlignment text_alignment)
static void paint_custom_progressbar(GUI::Painter& painter, Gfx::IntRect const& rect, Gfx::IntRect const& text_rect, Palette const& palette, int min, int max, int value, StringView text, Gfx::Font const& font, Gfx::TextAlignment text_alignment)
{
float range_size = max - min;
float progress = (value - min) / range_size;

View file

@ -18,7 +18,7 @@ public:
void clear_taskbar_rect();
private:
explicit TaskbarButton(const WindowIdentifier&);
explicit TaskbarButton(WindowIdentifier const&);
virtual void context_menu_event(GUI::ContextMenuEvent&) override;
virtual void resize_event(GUI::ResizeEvent&) override;

View file

@ -104,9 +104,9 @@ void TaskbarWindow::show_desktop_button_clicked(unsigned)
GUI::ConnectionToWindowMangerServer::the().async_toggle_show_desktop();
}
void TaskbarWindow::on_screen_rects_change(const Vector<Gfx::IntRect, 4>& rects, size_t main_screen_index)
void TaskbarWindow::on_screen_rects_change(Vector<Gfx::IntRect, 4> const& rects, size_t main_screen_index)
{
const auto& rect = rects[main_screen_index];
auto const& rect = rects[main_screen_index];
Gfx::IntRect new_rect { rect.x(), rect.bottom() - taskbar_height() + 1, rect.width(), taskbar_height() };
set_rect(new_rect);
update_applet_area();
@ -123,7 +123,7 @@ void TaskbarWindow::update_applet_area()
GUI::ConnectionToWindowMangerServer::the().async_set_applet_area_position(new_rect.location());
}
NonnullRefPtr<GUI::Button> TaskbarWindow::create_button(const WindowIdentifier& identifier)
NonnullRefPtr<GUI::Button> TaskbarWindow::create_button(WindowIdentifier const& identifier)
{
auto& button = m_task_button_container->add<TaskbarButton>(identifier);
button.set_min_size(20, 21);
@ -133,7 +133,7 @@ NonnullRefPtr<GUI::Button> TaskbarWindow::create_button(const WindowIdentifier&
return button;
}
void TaskbarWindow::add_window_button(::Window& window, const WindowIdentifier& identifier)
void TaskbarWindow::add_window_button(::Window& window, WindowIdentifier const& identifier)
{
if (window.button())
return;
@ -200,7 +200,7 @@ void TaskbarWindow::event(Core::Event& event)
// we adjust it so that the nearest button ends up being clicked anyways.
auto& mouse_event = static_cast<GUI::MouseEvent&>(event);
const int ADJUSTMENT = 4;
int const ADJUSTMENT = 4;
auto adjusted_x = AK::clamp(mouse_event.x(), ADJUSTMENT, width() - ADJUSTMENT);
auto adjusted_y = AK::min(mouse_event.y(), height() - ADJUSTMENT);
Gfx::IntPoint adjusted_point = { adjusted_x, adjusted_y };

View file

@ -27,9 +27,9 @@ private:
explicit TaskbarWindow(NonnullRefPtr<GUI::Menu> start_menu);
static void show_desktop_button_clicked(unsigned);
void set_quick_launch_button_data(GUI::Button&, String const&, NonnullRefPtr<Desktop::AppFile>);
void on_screen_rects_change(const Vector<Gfx::IntRect, 4>&, size_t);
NonnullRefPtr<GUI::Button> create_button(const WindowIdentifier&);
void add_window_button(::Window&, const WindowIdentifier&);
void on_screen_rects_change(Vector<Gfx::IntRect, 4> const&, size_t);
NonnullRefPtr<GUI::Button> create_button(WindowIdentifier const&);
void add_window_button(::Window&, WindowIdentifier const&);
void remove_window_button(::Window&, bool);
void update_window_button(::Window&, bool);
::Window* find_window_owner(::Window&) const;

View file

@ -20,7 +20,7 @@ public:
int client_id() const { return m_client_id; }
int window_id() const { return m_window_id; }
bool operator==(const WindowIdentifier& other) const
bool operator==(WindowIdentifier const& other) const
{
return m_client_id == other.m_client_id && m_window_id == other.m_window_id;
}
@ -38,6 +38,6 @@ private:
namespace AK {
template<>
struct Traits<WindowIdentifier> : public GenericTraits<WindowIdentifier> {
static unsigned hash(const WindowIdentifier& w) { return pair_int_hash(w.client_id(), w.window_id()); }
static unsigned hash(WindowIdentifier const& w) { return pair_int_hash(w.client_id(), w.window_id()); }
};
}

View file

@ -12,7 +12,7 @@ WindowList& WindowList::the()
return s_the;
}
Window* WindowList::find_parent(const Window& window)
Window* WindowList::find_parent(Window const& window)
{
if (!window.parent_identifier().is_valid())
return nullptr;
@ -24,7 +24,7 @@ Window* WindowList::find_parent(const Window& window)
return nullptr;
}
Window* WindowList::window(const WindowIdentifier& identifier)
Window* WindowList::window(WindowIdentifier const& identifier)
{
auto it = m_windows.find(identifier);
if (it != m_windows.end())
@ -32,7 +32,7 @@ Window* WindowList::window(const WindowIdentifier& identifier)
return nullptr;
}
Window& WindowList::ensure_window(const WindowIdentifier& identifier)
Window& WindowList::ensure_window(WindowIdentifier const& identifier)
{
auto it = m_windows.find(identifier);
if (it != m_windows.end())
@ -43,7 +43,7 @@ Window& WindowList::ensure_window(const WindowIdentifier& identifier)
return window_ref;
}
void WindowList::remove_window(const WindowIdentifier& identifier)
void WindowList::remove_window(WindowIdentifier const& identifier)
{
m_windows.remove(identifier);
}

View file

@ -14,7 +14,7 @@
class Window {
public:
explicit Window(const WindowIdentifier& identifier)
explicit Window(WindowIdentifier const& identifier)
: m_identifier(identifier)
{
}
@ -25,16 +25,16 @@ public:
m_button->remove_from_parent();
}
const WindowIdentifier& identifier() const { return m_identifier; }
WindowIdentifier const& identifier() const { return m_identifier; }
void set_parent_identifier(const WindowIdentifier& parent_identifier) { m_parent_identifier = parent_identifier; }
const WindowIdentifier& parent_identifier() const { return m_parent_identifier; }
void set_parent_identifier(WindowIdentifier const& parent_identifier) { m_parent_identifier = parent_identifier; }
WindowIdentifier const& parent_identifier() const { return m_parent_identifier; }
String title() const { return m_title; }
void set_title(const String& title) { m_title = title; }
void set_title(String const& title) { m_title = title; }
Gfx::IntRect rect() const { return m_rect; }
void set_rect(const Gfx::IntRect& rect) { m_rect = rect; }
void set_rect(Gfx::IntRect const& rect) { m_rect = rect; }
GUI::Button* button() { return m_button; }
void set_button(GUI::Button* button) { m_button = button; }
@ -67,7 +67,7 @@ public:
Optional<int> progress() const { return m_progress; }
const Gfx::Bitmap* icon() const { return m_icon.ptr(); }
Gfx::Bitmap const* icon() const { return m_icon.ptr(); }
private:
WindowIdentifier m_identifier;
@ -95,10 +95,10 @@ public:
callback(*it.value);
}
Window* find_parent(const Window&);
Window* window(const WindowIdentifier&);
Window& ensure_window(const WindowIdentifier&);
void remove_window(const WindowIdentifier&);
Window* find_parent(Window const&);
Window* window(WindowIdentifier const&);
Window& ensure_window(WindowIdentifier const&);
void remove_window(WindowIdentifier const&);
private:
HashMap<WindowIdentifier, NonnullOwnPtr<Window>> m_windows;

View file

@ -156,14 +156,14 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu()
app_category_menus.set(category, category_menu);
};
for (const auto& category : sorted_app_categories) {
for (auto const& category : sorted_app_categories) {
if (category != "Settings"sv)
create_category_menu(category);
}
// Then we create and insert all the app menu items into the right place.
int app_identifier = 0;
for (const auto& app : g_apps) {
for (auto const& app : g_apps) {
if (app.category == "Settings"sv) {
++app_identifier;
continue;