From e2c2337a61b3e1a005f23f61989994fcb65e2c1a Mon Sep 17 00:00:00 2001 From: "Dr. Dystopia" Date: Tue, 13 Aug 2024 20:59:38 +0200 Subject: [PATCH 1/2] Make parameter names for declarations and implementations consistent - WinUpdater --- Source/Core/WinUpdater/Main.cpp | 8 ++++---- Source/Core/WinUpdater/WinUI.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/Core/WinUpdater/Main.cpp b/Source/Core/WinUpdater/Main.cpp index bcf814c78d..907693bab4 100644 --- a/Source/Core/WinUpdater/Main.cpp +++ b/Source/Core/WinUpdater/Main.cpp @@ -17,9 +17,9 @@ // Refer to docs/autoupdate_overview.md for a detailed overview of the autoupdate process -int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow) +int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR lpCmdLine, int nShowCmd) { - if (lstrlenW(pCmdLine) == 0) + if (lstrlenW(lpCmdLine) == 0) { MessageBoxW(nullptr, L"This updater is not meant to be launched directly. Configure Auto-Update in " @@ -58,11 +58,11 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine } // Relaunch the updater as administrator - ShellExecuteW(nullptr, L"runas", path->c_str(), pCmdLine, nullptr, SW_SHOW); + ShellExecuteW(nullptr, L"runas", path->c_str(), lpCmdLine, nullptr, SW_SHOW); return 0; } - std::vector args = Common::CommandLineToUtf8Argv(pCmdLine); + std::vector args = Common::CommandLineToUtf8Argv(lpCmdLine); return RunUpdater(args) ? 0 : 1; } diff --git a/Source/Core/WinUpdater/WinUI.cpp b/Source/Core/WinUpdater/WinUI.cpp index 696ac55b0a..8387400e80 100644 --- a/Source/Core/WinUpdater/WinUI.cpp +++ b/Source/Core/WinUpdater/WinUI.cpp @@ -285,9 +285,9 @@ void LaunchApplication(std::string path) } } -void Sleep(int sleep) +void Sleep(int seconds) { - ::Sleep(sleep * 1000); + ::Sleep(seconds * 1000); } void WaitForPID(u32 pid) From cfc206d315b142805e26b732dacfe472280795ff Mon Sep 17 00:00:00 2001 From: "Dr. Dystopia" Date: Sun, 18 Aug 2024 23:07:23 +0200 Subject: [PATCH 2/2] Make parameter names for declarations and implementations consistent - DolphinQt --- .../Config/ToolTipControls/BalloonTip.cpp | 22 ++++++------- .../Core/DolphinQt/Debugger/AssemblerWidget.h | 2 +- .../DolphinQt/Debugger/AssemblyEditor.cpp | 4 +-- .../Core/DolphinQt/Debugger/AssemblyEditor.h | 2 +- .../DolphinQt/Debugger/BreakpointWidget.cpp | 6 ++-- .../Debugger/GekkoSyntaxHighlight.cpp | 8 ++--- .../Core/DolphinQt/GameList/GameTracker.cpp | 32 +++++++++---------- .../DolphinQt/GameList/GridProxyModel.cpp | 4 +-- Source/Core/DolphinQt/Host.cpp | 4 +-- .../Core/DolphinQt/NetPlay/NetPlayDialog.cpp | 7 ++-- .../Core/DolphinQt/NetPlay/PadMappingDialog.h | 2 +- Source/Core/DolphinQt/ResourcePackManager.cpp | 2 +- Source/Core/DolphinQt/Settings.h | 2 +- .../Settings/BroadbandAdapterSettingsDialog.h | 2 +- .../SkylanderPortal/SkylanderPortalWindow.h | 2 +- Source/Core/DolphinQt/TAS/StickWidget.h | 2 +- 16 files changed, 52 insertions(+), 51 deletions(-) diff --git a/Source/Core/DolphinQt/Config/ToolTipControls/BalloonTip.cpp b/Source/Core/DolphinQt/Config/ToolTipControls/BalloonTip.cpp index 52033a9445..b344982516 100644 --- a/Source/Core/DolphinQt/Config/ToolTipControls/BalloonTip.cpp +++ b/Source/Core/DolphinQt/Config/ToolTipControls/BalloonTip.cpp @@ -120,9 +120,9 @@ void BalloonTip::paintEvent(QPaintEvent*) } void BalloonTip::UpdateBoundsAndRedraw(const QPoint& target_arrow_tip_position, - const ShowArrow show_arrow, const int border_full_width) + const ShowArrow show_arrow, const int border_width) { - const float border_half_width = border_full_width / 2.0; + const float border_half_width = border_width / 2.0; // This should be odd so that the arrow tip is a single pixel wide. const int arrow_full_width = 35; @@ -138,7 +138,7 @@ void BalloonTip::UpdateBoundsAndRedraw(const QPoint& target_arrow_tip_position, // larger border sizes. const int rounded_corner_margin = border_half_width / 4; const int horizontal_margin = - border_full_width + rounded_corner_margin + balloon_interior_padding; + border_width + rounded_corner_margin + balloon_interior_padding; const int vertical_margin = horizontal_margin + arrow_height; // Create enough space around the layout containing the title and message to draw the balloon and @@ -149,8 +149,8 @@ void BalloonTip::UpdateBoundsAndRedraw(const QPoint& target_arrow_tip_position, QSize size_hint = sizeHint(); // These positions represent the middle of each edge of the BalloonTip's rounded rectangle - const float rect_width = size_hint.width() - border_full_width; - const float rect_height = size_hint.height() - border_full_width - 2 * arrow_height; + const float rect_width = size_hint.width() - border_width; + const float rect_height = size_hint.height() - border_width - 2 * arrow_height; const float rect_top = border_half_width + arrow_height; const float rect_bottom = rect_top + rect_height; const float rect_left = border_half_width; @@ -160,14 +160,14 @@ void BalloonTip::UpdateBoundsAndRedraw(const QPoint& target_arrow_tip_position, // corner". Unlike the rectangle's edges this corresponds to the outside of the rounded curve // instead of its middle, so we add the full width to the inner radius instead of the half width const float corner_base_inner_radius = 7.0; - const float corner_outer_radius = corner_base_inner_radius + border_full_width; + const float corner_outer_radius = corner_base_inner_radius + border_width; // This value is arbitrary but works well. const int base_arrow_x_offset = 34; // Adjust the offset inward to compensate for the border and rounded corner widths. This ensures // the arrow is on the flat part of the top/bottom border. const int adjusted_arrow_x_offset = - base_arrow_x_offset + border_full_width + static_cast(border_half_width); + base_arrow_x_offset + border_width + static_cast(border_half_width); // If the border is wide enough (or the BalloonTip small enough) the offset might end up past the // midpoint; if that happens just use the midpoint instead const int centered_arrow_x_offset = (size_hint.width() - arrow_full_width) / 2; @@ -206,7 +206,7 @@ void BalloonTip::UpdateBoundsAndRedraw(const QPoint& target_arrow_tip_position, m_pixmap = QPixmap(size_hint); - QPen border_pen(m_border_color, border_full_width); + QPen border_pen(m_border_color, border_width); border_pen.setCapStyle(Qt::FlatCap); QPainter balloon_painter(&m_pixmap); @@ -217,7 +217,7 @@ void BalloonTip::UpdateBoundsAndRedraw(const QPoint& target_arrow_tip_position, QBitmap mask_bitmap(size_hint); mask_bitmap.fill(Qt::color0); - QPen mask_pen(Qt::color1, border_full_width); + QPen mask_pen(Qt::color1, border_width); mask_pen.setCapStyle(Qt::FlatCap); QPainter mask_painter(&mask_bitmap); @@ -236,7 +236,7 @@ void BalloonTip::UpdateBoundsAndRedraw(const QPoint& target_arrow_tip_position, const float arrow_tip_vertical_offset = arrow_at_bottom ? arrow_height : -arrow_height; const float arrow_tip_interior_y = arrow_base_y + arrow_tip_vertical_offset; const float arrow_tip_exterior_y = - arrow_tip_interior_y + (arrow_at_bottom ? border_full_width : -border_full_width); + arrow_tip_interior_y + (arrow_at_bottom ? border_width : -border_width); const float arrow_base_left_edge_x = arrow_at_left ? arrow_nearest_edge_x_offset : size_hint.width() - arrow_nearest_edge_x_offset - arrow_full_width; @@ -259,7 +259,7 @@ void BalloonTip::UpdateBoundsAndRedraw(const QPoint& target_arrow_tip_position, QPainterPath arrow_border_path; QPainterPath arrow_interior_fill_path; - const float y_end_offset = arrow_at_bottom ? border_full_width : -border_full_width; + const float y_end_offset = arrow_at_bottom ? border_width : -border_width; // Draw the arrow border and interior lines from the outside inward. Each loop iteration draws // one pair of border lines and one pair of interior lines. diff --git a/Source/Core/DolphinQt/Debugger/AssemblerWidget.h b/Source/Core/DolphinQt/Debugger/AssemblerWidget.h index d130d01701..70a5427d45 100644 --- a/Source/Core/DolphinQt/Debugger/AssemblerWidget.h +++ b/Source/Core/DolphinQt/Debugger/AssemblerWidget.h @@ -72,7 +72,7 @@ private: int AllocateTabNum(); void FreeTabNum(int num); void UpdateTabText(AsmEditor* editor); - void DisambiguateTabTitles(AsmEditor* editor); + void DisambiguateTabTitles(AsmEditor* new_tab); void UpdateIcons(); void ZoomAllEditors(int amount); diff --git a/Source/Core/DolphinQt/Debugger/AssemblyEditor.cpp b/Source/Core/DolphinQt/Debugger/AssemblyEditor.cpp index 113c59fa07..d92cc6767c 100644 --- a/Source/Core/DolphinQt/Debugger/AssemblyEditor.cpp +++ b/Source/Core/DolphinQt/Debugger/AssemblyEditor.cpp @@ -203,9 +203,9 @@ int AsmEditor::CharWidth() const return fontMetrics().horizontalAdvance(QLatin1Char(' ')); } -void AsmEditor::resizeEvent(QResizeEvent* e) +void AsmEditor::resizeEvent(QResizeEvent* event) { - QPlainTextEdit::resizeEvent(e); + QPlainTextEdit::resizeEvent(event); const QRect cr = contentsRect(); m_line_number_area->setGeometry(QRect(cr.left(), cr.top(), LineNumberAreaWidth(), cr.height())); diff --git a/Source/Core/DolphinQt/Debugger/AssemblyEditor.h b/Source/Core/DolphinQt/Debugger/AssemblyEditor.h index c850817b82..db825e2475 100644 --- a/Source/Core/DolphinQt/Debugger/AssemblyEditor.h +++ b/Source/Core/DolphinQt/Debugger/AssemblyEditor.h @@ -18,7 +18,7 @@ class AsmEditor : public QPlainTextEdit Q_OBJECT; public: - AsmEditor(const QString& file_path, int editor_num, bool dark_scheme, QWidget* parent = nullptr); + AsmEditor(const QString& path, int editor_num, bool dark_scheme, QWidget* parent = nullptr); void LineNumberAreaPaintEvent(QPaintEvent* event); int LineNumberAreaWidth(); const QString& Path() const { return m_path; } diff --git a/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp b/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp index 92b49a3b0e..121b1ced65 100644 --- a/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp @@ -677,7 +677,7 @@ void BreakpointWidget::AddAddressMBP(u32 addr, bool on_read, bool on_write, bool Update(); } -void BreakpointWidget::AddRangedMBP(u32 from, u32 to, bool on_read, bool on_write, bool do_log, +void BreakpointWidget::AddRangedMBP(u32 from, u32 to, bool do_read, bool do_write, bool do_log, bool do_break, const QString& condition) { TMemCheck check; @@ -685,8 +685,8 @@ void BreakpointWidget::AddRangedMBP(u32 from, u32 to, bool on_read, bool on_writ check.start_address = from; check.end_address = to; check.is_ranged = true; - check.is_break_on_read = on_read; - check.is_break_on_write = on_write; + check.is_break_on_read = do_read; + check.is_break_on_write = do_write; check.log_on_hit = do_log; check.break_on_hit = do_break; check.condition = diff --git a/Source/Core/DolphinQt/Debugger/GekkoSyntaxHighlight.cpp b/Source/Core/DolphinQt/Debugger/GekkoSyntaxHighlight.cpp index 0523944f63..62a83aa925 100644 --- a/Source/Core/DolphinQt/Debugger/GekkoSyntaxHighlight.cpp +++ b/Source/Core/DolphinQt/Debugger/GekkoSyntaxHighlight.cpp @@ -135,7 +135,7 @@ private: }; } // namespace -void GekkoSyntaxHighlight::highlightBlock(const QString& text) +void GekkoSyntaxHighlight::highlightBlock(const QString& line) { BlockInfo* info = static_cast(currentBlockUserData()); if (info == nullptr) @@ -144,16 +144,16 @@ void GekkoSyntaxHighlight::highlightBlock(const QString& text) setCurrentBlockUserData(info); } - qsizetype comment_idx = text.indexOf(QLatin1Char('#')); + qsizetype comment_idx = line.indexOf(QLatin1Char('#')); if (comment_idx != -1) { - HighlightSubstr(comment_idx, text.length() - comment_idx, HighlightFormat::Comment); + HighlightSubstr(comment_idx, line.length() - comment_idx, HighlightFormat::Comment); } if (m_mode == 0) { HighlightParsePlugin plugin; - ParseWithPlugin(&plugin, text.toStdString()); + ParseWithPlugin(&plugin, line.toStdString()); info->block_format = plugin.MoveFormatting(); info->parens = plugin.MoveParens(); diff --git a/Source/Core/DolphinQt/GameList/GameTracker.cpp b/Source/Core/DolphinQt/GameList/GameTracker.cpp index 9428729997..350cd6b474 100644 --- a/Source/Core/DolphinQt/GameList/GameTracker.cpp +++ b/Source/Core/DolphinQt/GameList/GameTracker.cpp @@ -165,22 +165,22 @@ void GameTracker::StartInternal() QueueOnObject(this, [] { Settings::Instance().NotifyRefreshGameListComplete(); }); } -bool GameTracker::AddPath(const QString& dir) +bool GameTracker::AddPath(const QString& path) { if (Settings::Instance().IsAutoRefreshEnabled()) - QueueOnObject(this, [this, dir] { return addPath(dir); }); + QueueOnObject(this, [this, path] { return addPath(path); }); - m_tracked_paths.push_back(dir); + m_tracked_paths.push_back(path); return true; } -bool GameTracker::RemovePath(const QString& dir) +bool GameTracker::RemovePath(const QString& path) { if (Settings::Instance().IsAutoRefreshEnabled()) - QueueOnObject(this, [this, dir] { return removePath(dir); }); + QueueOnObject(this, [this, path] { return removePath(path); }); - const auto index = m_tracked_paths.indexOf(dir); + const auto index = m_tracked_paths.indexOf(path); if (index == -1) return false; @@ -228,9 +228,9 @@ void GameTracker::UpdateDirectory(const QString& dir) m_load_thread.EmplaceItem(Command{CommandType::UpdateDirectory, dir}); } -void GameTracker::UpdateFile(const QString& dir) +void GameTracker::UpdateFile(const QString& path) { - m_load_thread.EmplaceItem(Command{CommandType::UpdateFile, dir}); + m_load_thread.EmplaceItem(Command{CommandType::UpdateFile, path}); } void GameTracker::AddDirectoryInternal(const QString& dir) @@ -308,20 +308,20 @@ void GameTracker::UpdateDirectoryInternal(const QString& dir) } } -void GameTracker::UpdateFileInternal(const QString& file) +void GameTracker::UpdateFileInternal(const QString& path) { - if (QFileInfo(file).exists()) + if (QFileInfo(path).exists()) { if (m_started) - GameRemoved(file.toStdString()); - AddPath(file); - LoadGame(file); + GameRemoved(path.toStdString()); + AddPath(path); + LoadGame(path); } - else if (RemovePath(file)) + else if (RemovePath(path)) { - m_tracked_files.remove(file); + m_tracked_files.remove(path); if (m_started) - emit GameRemoved(file.toStdString()); + emit GameRemoved(path.toStdString()); } } diff --git a/Source/Core/DolphinQt/GameList/GridProxyModel.cpp b/Source/Core/DolphinQt/GameList/GridProxyModel.cpp index a35340f3b7..2f6a0e91d8 100644 --- a/Source/Core/DolphinQt/GameList/GridProxyModel.cpp +++ b/Source/Core/DolphinQt/GameList/GridProxyModel.cpp @@ -22,9 +22,9 @@ GridProxyModel::GridProxyModel(QObject* parent) : QSortFilterProxyModel(parent) sort(static_cast(GameListModel::Column::Title)); } -QVariant GridProxyModel::data(const QModelIndex& i, int role) const +QVariant GridProxyModel::data(const QModelIndex& index, int role) const { - QModelIndex source_index = mapToSource(i); + QModelIndex source_index = mapToSource(index); if (role == Qt::DisplayRole) { return sourceModel()->data( diff --git a/Source/Core/DolphinQt/Host.cpp b/Source/Core/DolphinQt/Host.cpp index 80a4247a2b..5cdaea3153 100644 --- a/Source/Core/DolphinQt/Host.cpp +++ b/Source/Core/DolphinQt/Host.cpp @@ -268,9 +268,9 @@ void Host_UpdateMainFrame() { } -void Host_RequestRenderWindowSize(int w, int h) +void Host_RequestRenderWindowSize(int width, int height) { - emit Host::GetInstance()->RequestRenderSize(w, h); + emit Host::GetInstance()->RequestRenderSize(width, height); } bool Host_UIBlocksControllerState() diff --git a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp index c02946d48f..f29096db44 100644 --- a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp +++ b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp @@ -428,12 +428,13 @@ void NetPlayDialog::ConnectWidgets() connect(m_hide_remote_gbas_action, &QAction::toggled, this, &NetPlayDialog::SaveSettings); } -void NetPlayDialog::SendMessage(const std::string& msg) +void NetPlayDialog::SendMessage(const std::string& message) { - Settings::Instance().GetNetPlayClient()->SendChatMessage(msg); + Settings::Instance().GetNetPlayClient()->SendChatMessage(message); DisplayMessage( - QStringLiteral("%1: %2").arg(QString::fromStdString(m_nickname), QString::fromStdString(msg)), + QStringLiteral("%1: %2").arg(QString::fromStdString(m_nickname), + QString::fromStdString(message)), ""); } diff --git a/Source/Core/DolphinQt/NetPlay/PadMappingDialog.h b/Source/Core/DolphinQt/NetPlay/PadMappingDialog.h index cd7a61c2bf..d9981c51b3 100644 --- a/Source/Core/DolphinQt/NetPlay/PadMappingDialog.h +++ b/Source/Core/DolphinQt/NetPlay/PadMappingDialog.h @@ -21,7 +21,7 @@ class PadMappingDialog : public QDialog { Q_OBJECT public: - explicit PadMappingDialog(QWidget* widget); + explicit PadMappingDialog(QWidget* parent); int exec() override; diff --git a/Source/Core/DolphinQt/ResourcePackManager.cpp b/Source/Core/DolphinQt/ResourcePackManager.cpp index eac48cd6c5..03b6d74077 100644 --- a/Source/Core/DolphinQt/ResourcePackManager.cpp +++ b/Source/Core/DolphinQt/ResourcePackManager.cpp @@ -17,7 +17,7 @@ #include "DolphinQt/QtUtils/SetWindowDecorations.h" #include "UICommon/ResourcePack/Manager.h" -ResourcePackManager::ResourcePackManager(QWidget* widget) : QDialog(widget) +ResourcePackManager::ResourcePackManager(QWidget* parent) : QDialog(parent) { CreateWidgets(); ConnectWidgets(); diff --git a/Source/Core/DolphinQt/Settings.h b/Source/Core/DolphinQt/Settings.h index f59e7c143b..bf1c32312f 100644 --- a/Source/Core/DolphinQt/Settings.h +++ b/Source/Core/DolphinQt/Settings.h @@ -88,7 +88,7 @@ public: void SetLogConfigVisible(bool visible); void SetToolBarVisible(bool visible); bool IsToolBarVisible() const; - void SetWidgetsLocked(bool visible); + void SetWidgetsLocked(bool locked); bool AreWidgetsLocked() const; void RefreshWidgetVisibility(); diff --git a/Source/Core/DolphinQt/Settings/BroadbandAdapterSettingsDialog.h b/Source/Core/DolphinQt/Settings/BroadbandAdapterSettingsDialog.h index 08a8793a08..f5738cce33 100644 --- a/Source/Core/DolphinQt/Settings/BroadbandAdapterSettingsDialog.h +++ b/Source/Core/DolphinQt/Settings/BroadbandAdapterSettingsDialog.h @@ -20,7 +20,7 @@ public: ModemTapServer }; - explicit BroadbandAdapterSettingsDialog(QWidget* target, Type bba_type); + explicit BroadbandAdapterSettingsDialog(QWidget* parent, Type bba_type); private: QLineEdit* m_address_input; diff --git a/Source/Core/DolphinQt/SkylanderPortal/SkylanderPortalWindow.h b/Source/Core/DolphinQt/SkylanderPortal/SkylanderPortalWindow.h index 49f562104e..ca18ba640d 100644 --- a/Source/Core/DolphinQt/SkylanderPortal/SkylanderPortalWindow.h +++ b/Source/Core/DolphinQt/SkylanderPortal/SkylanderPortalWindow.h @@ -55,7 +55,7 @@ private: void CreateMainWindow(); QVBoxLayout* CreateSlotLayout(); QVBoxLayout* CreateFinderLayout(); - void closeEvent(QCloseEvent* bar) override; + void closeEvent(QCloseEvent* event) override; bool eventFilter(QObject* object, QEvent* event) final override; // UI diff --git a/Source/Core/DolphinQt/TAS/StickWidget.h b/Source/Core/DolphinQt/TAS/StickWidget.h index 46fd399b92..1f5cbe22ee 100644 --- a/Source/Core/DolphinQt/TAS/StickWidget.h +++ b/Source/Core/DolphinQt/TAS/StickWidget.h @@ -11,7 +11,7 @@ class StickWidget : public QWidget { Q_OBJECT public: - explicit StickWidget(QWidget* parent, u16 width, u16 height); + explicit StickWidget(QWidget* parent, u16 max_x, u16 max_y); signals: void ChangedX(u16 x);