This commit is contained in:
Tygyh 2024-11-14 10:27:25 +01:00 committed by GitHub
commit 39c8f78072
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 58 additions and 57 deletions

View File

@ -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<int>(border_half_width);
base_arrow_x_offset + border_width + static_cast<int>(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.

View File

@ -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);

View File

@ -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()));

View File

@ -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; }

View File

@ -672,7 +672,7 @@ void BreakpointWidget::AddAddressMBP(u32 addr, bool on_read, bool on_write, bool
emit Host::GetInstance()->PPCBreakpointsChanged();
}
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;
@ -680,8 +680,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 =

View File

@ -135,7 +135,7 @@ private:
};
} // namespace
void GekkoSyntaxHighlight::highlightBlock(const QString& text)
void GekkoSyntaxHighlight::highlightBlock(const QString& line)
{
BlockInfo* info = static_cast<BlockInfo*>(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();

View File

@ -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());
}
}

View File

@ -22,9 +22,9 @@ GridProxyModel::GridProxyModel(QObject* parent) : QSortFilterProxyModel(parent)
sort(static_cast<int>(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(

View File

@ -278,9 +278,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()

View File

@ -430,12 +430,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)),
"");
}

View File

@ -21,7 +21,7 @@ class PadMappingDialog : public QDialog
{
Q_OBJECT
public:
explicit PadMappingDialog(QWidget* widget);
explicit PadMappingDialog(QWidget* parent);
int exec() override;

View File

@ -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();

View File

@ -86,7 +86,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();

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -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<std::string> args = Common::CommandLineToUtf8Argv(pCmdLine);
std::vector<std::string> args = Common::CommandLineToUtf8Argv(lpCmdLine);
return RunUpdater(args) ? 0 : 1;
}

View File

@ -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)