Skip to content

Commit

Permalink
Browser: Fix clang-tidy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
overriden-sfdd committed Dec 13, 2024
1 parent 1c48187 commit 4b11fc6
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 41 deletions.
4 changes: 2 additions & 2 deletions Userland/Applications/Browser/BookmarksBarWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
* SPDX-License-Identifier: BSD-2-Clause
*/

#include "BookmarksBarWidget.h"
#include "Browser.h"
#include "EditBookmarkDialog.h"
#include <Applications/Browser/BookmarksBarWidget.h>
#include <Applications/Browser/Browser.h>
#include <LibGUI/Action.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Button.h>
Expand Down
4 changes: 2 additions & 2 deletions Userland/Applications/Browser/BrowserTabWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "Browser.h"
#include "BrowserWindow.h"
#include "DownloadWidget.h"
#include <Applications/Browser/URLBox.h>
#include "URLBox.h"
#include <Applications/BrowserSettings/Defaults.h>
#include <LibConfig/Client.h>
#include <LibCore/MimeData.h>
Expand Down Expand Up @@ -763,7 +763,7 @@ void BrowserTabWidget::start_download(const URL::URL& url)
window->show();
}

void BrowserTabWidget::view_source(const URL::URL& url, StringView const& source)
void BrowserTabWidget::view_source(const URL::URL& url, StringView source)
{
auto window = GUI::Window::construct(&this->window());
auto editor = window->set_main_widget<GUI::TextEditor>();
Expand Down
8 changes: 3 additions & 5 deletions Userland/Applications/Browser/DownloadWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "DownloadWidget.h"
#include <AK/LexicalPath.h>
#include <AK/NumberFormat.h>
#include <AK/StringBuilder.h>
#include <Applications/BrowserSettings/Defaults.h>
#include <LibCore/Proxy.h>
#include <LibCore/StandardPaths.h>
Expand All @@ -20,7 +19,6 @@
#include <LibGUI/Label.h>
#include <LibGUI/MessageBox.h>
#include <LibGUI/Progressbar.h>
#include <LibGUI/Window.h>
#include <LibWeb/Loader/ResourceLoader.h>

#include <LibConfig/Client.h>
Expand Down Expand Up @@ -114,7 +112,7 @@ DownloadWidget::DownloadWidget(const URL::URL& url)
m_cancel_button = button_container.add<GUI::Button>("Cancel"_string);
m_cancel_button->set_fixed_size(100, 22);
m_cancel_button->on_click = [this](auto) {
bool success = m_download->stop();
bool const success = m_download->stop();
VERIFY(success);
window()->close();
};
Expand All @@ -129,9 +127,9 @@ DownloadWidget::DownloadWidget(const URL::URL& url)

void DownloadWidget::did_progress(Optional<u64> total_size, u64 downloaded_size)
{
int percent = 0;
int percent { 0 };
if (total_size.has_value()) {
percent = downloaded_size * 100 / total_size.value();
percent = static_cast<int>(downloaded_size * 100 / total_size.value());
window()->set_progress(percent);
m_progressbar->set_value(percent);
}
Expand Down
4 changes: 2 additions & 2 deletions Userland/Applications/Browser/EditBookmarkDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Browser {
Vector<JsonValue> EditBookmarkDialog::edit_bookmark(GUI::Window* parent_window, RefPtr<Gfx::Bitmap> icon, StringView title, StringView url,
PerformEditOn perform_edit_on)
{
auto editor_or_error = EditBookmarkDialog::try_create(parent_window, move(title), move(url));
auto editor_or_error = EditBookmarkDialog::try_create(parent_window, title, url);
if (editor_or_error.is_error()) {
GUI::MessageBox::show(parent_window, "Couldn't load \"edit bookmark\" dialog"sv, "Error while opening \"edit bookmark\" dialog"sv, GUI::MessageBox::Type::Error);
return {};
Expand All @@ -40,7 +40,7 @@ EditBookmarkDialog::try_create(GUI::Window* parent_window, StringView title, Str
{
auto edit_bookmark_widget = TRY(EditBookmarkWidget::try_create());
auto edit_bookmark_dialog = TRY(adopt_nonnull_ref_or_enomem(new (nothrow)
EditBookmarkDialog(parent_window, move(title), move(url), edit_bookmark_widget)));
EditBookmarkDialog(parent_window, title, url, edit_bookmark_widget)));
return edit_bookmark_dialog;
}

Expand Down
34 changes: 17 additions & 17 deletions Userland/Applications/Browser/EditBookmarkDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,34 @@
#pragma once

#include "EditBookmarkWidget.h"
#include <LibGUI/Dialog.h>
#include <LibGUI/TextBox.h>
#include <LibGUI/Window.h>
#include <LibGUI/Dialog.h>

namespace Browser {

enum class PerformEditOn {
NewBookmark,
ExistingBookmark
};
enum class PerformEditOn {
NewBookmark,
ExistingBookmark
};

class EditBookmarkDialog final : public GUI::Dialog {
class EditBookmarkDialog final : public GUI::Dialog {
C_OBJECT_ABSTRACT(EditBookmarkDialog)

public:
static Vector<JsonValue>
edit_bookmark(GUI::Window *parent_window, RefPtr<Gfx::Bitmap> icon, StringView title, StringView url, PerformEditOn perform_edit_on);
static ErrorOr<NonnullRefPtr<EditBookmarkDialog>> try_create(Window* parent_window, StringView title, StringView url);
public:
static Vector<JsonValue>
edit_bookmark(GUI::Window* parent_window, RefPtr<Gfx::Bitmap> icon, StringView title, StringView url, PerformEditOn perform_edit_on);
static ErrorOr<NonnullRefPtr<EditBookmarkDialog>> try_create(Window* parent_window, StringView title, StringView url);

private:
EditBookmarkDialog(GUI::Window* parent_window, StringView title, StringView url, NonnullRefPtr<EditBookmarkWidget> edit_bookmark_widget);
private:
EditBookmarkDialog(GUI::Window* parent_window, StringView title, StringView url, NonnullRefPtr<EditBookmarkWidget> edit_bookmark_widget);

ByteString title() const;
ByteString title() const;

ByteString url() const;
ByteString url() const;

RefPtr<GUI::TextBox> m_title_textbox;
RefPtr<GUI::TextBox> m_url_textbox;
};
RefPtr<GUI::TextBox> m_title_textbox;
RefPtr<GUI::TextBox> m_url_textbox;
};

}
14 changes: 7 additions & 7 deletions Userland/Applications/Browser/EditBookmarkWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

namespace Browser {

class EditBookmarkWidget : public GUI::Widget {
class EditBookmarkWidget : public GUI::Widget {
C_OBJECT_ABSTRACT(EditBookmarkWidget)
public:
static ErrorOr<NonnullRefPtr<EditBookmarkWidget>> try_create();
virtual ~EditBookmarkWidget() override = default;
public:
static ErrorOr<NonnullRefPtr<EditBookmarkWidget>> try_create();
virtual ~EditBookmarkWidget() override = default;

private:
EditBookmarkWidget() = default;
};
private:
EditBookmarkWidget() = default;
};

}
2 changes: 1 addition & 1 deletion Userland/Applications/Browser/IconBag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/

#include <Applications/Browser/IconBag.h>
#include "IconBag.h"

namespace Browser {
ErrorOr<IconBag> IconBag::try_create()
Expand Down
1 change: 0 additions & 1 deletion Userland/Applications/Browser/StorageModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

#include "StorageModel.h"

#include <AK/FuzzyMatch.h>

namespace Browser {
Expand Down
3 changes: 1 addition & 2 deletions Userland/Applications/Browser/URLBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
* SPDX-License-Identifier: BSD-2-Clause
*/

#include <Applications/Browser/URLBox.h>
#include "URLBox.h"
#include <LibGfx/Palette.h>
#include <LibGfx/TextAttributes.h>
#include <LibURL/URL.h>
#include <LibWebView/URL.h>

namespace Browser {
Expand Down
3 changes: 1 addition & 2 deletions Userland/Applications/Browser/WindowActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
*/

#include "WindowActions.h"
#include <Applications/Browser/Browser.h>
#include "Browser.h"
#include <LibGUI/Icon.h>
#include <LibGUI/Window.h>
#include <LibGfx/Bitmap.h>

namespace Browser {

Expand Down

0 comments on commit 4b11fc6

Please sign in to comment.