Merge pull request #14500 from Sintendo/span2

Replace `const std::vector&` arguments with `std::span`
This commit is contained in:
Jordan Woyak
2026-04-11 14:55:41 -05:00
committed by GitHub
79 changed files with 164 additions and 146 deletions
@@ -45,7 +45,7 @@ void ConfigChoiceU32::OnConfigChanged()
setCurrentIndex(ReadValue(m_setting));
}
ConfigStringChoice::ConfigStringChoice(const std::vector<std::string>& options,
ConfigStringChoice::ConfigStringChoice(std::span<const std::string> options,
const Config::Info<std::string>& setting,
Config::Layer* layer)
: ConfigControl(setting.GetLocation(), layer), m_setting(setting), m_text_is_data(true)
@@ -57,7 +57,7 @@ ConfigStringChoice::ConfigStringChoice(const std::vector<std::string>& options,
connect(this, &QComboBox::currentIndexChanged, this, &ConfigStringChoice::Update);
}
ConfigStringChoice::ConfigStringChoice(const std::vector<std::pair<QString, QString>>& options,
ConfigStringChoice::ConfigStringChoice(std::span<const std::pair<QString, QString>> options,
const Config::Info<std::string>& setting,
Config::Layer* layer)
: ConfigControl(setting.GetLocation(), layer), m_setting(setting), m_text_is_data(false)
@@ -85,9 +85,9 @@ class ConfigStringChoice final : public ConfigControl<ToolTipComboBox>
{
Q_OBJECT
public:
ConfigStringChoice(const std::vector<std::string>& options,
const Config::Info<std::string>& setting, Config::Layer* layer = nullptr);
ConfigStringChoice(const std::vector<std::pair<QString, QString>>& options,
ConfigStringChoice(std::span<const std::string> options, const Config::Info<std::string>& setting,
Config::Layer* layer = nullptr);
ConfigStringChoice(std::span<const std::pair<QString, QString>> options,
const Config::Info<std::string>& setting, Config::Layer* layer = nullptr);
void Load();
@@ -6,8 +6,8 @@
#include <future>
#include <memory>
#include <optional>
#include <span>
#include <tuple>
#include <vector>
#include <QByteArray>
#include <QHBoxLayout>
@@ -129,7 +129,7 @@ void VerifyWidget::ConnectWidgets()
#endif
}
static void SetHash(QLineEdit* line_edit, const std::vector<u8>& hash)
static void SetHash(QLineEdit* line_edit, std::span<const u8> hash)
{
const QByteArray byte_array = QByteArray::fromRawData(reinterpret_cast<const char*>(hash.data()),
static_cast<int>(hash.size()));
@@ -4,7 +4,6 @@
#pragma once
#include <memory>
#include <string>
#include <utility>
#include <QCheckBox>
@@ -98,7 +98,7 @@ void WiimoteControllersWidget::StartBluetoothAdapterRefresh()
}
void WiimoteControllersWidget::OnBluetoothAdapterRefreshComplete(
const std::vector<USBUtils::DeviceInfo>& devices)
std::span<const USBUtils::DeviceInfo> devices)
{
const int configured_vid = Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_VID);
const int configured_pid = Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_PID);
@@ -4,6 +4,7 @@
#pragma once
#include <array>
#include <span>
#include <QWidget>
@@ -40,7 +41,7 @@ private:
void OnBluetoothPassthroughDeviceChanged(int index);
void OnBluetoothPassthroughSyncPressed();
void OnBluetoothPassthroughResetPressed();
void OnBluetoothAdapterRefreshComplete(const std::vector<USBUtils::DeviceInfo>& devices);
void OnBluetoothAdapterRefreshComplete(std::span<const USBUtils::DeviceInfo> devices);
void OnWiimoteRefreshPressed();
void OnWiimoteConfigure(size_t index);
void StartBluetoothAdapterRefresh();
+1 -1
View File
@@ -38,7 +38,7 @@ void GBAHost::GameChanged()
});
}
void GBAHost::FrameEnded(const std::vector<u32>& video_buffer)
void GBAHost::FrameEnded(std::span<const u32> video_buffer)
{
QueueOnObject(m_widget_controller, [widget_controller = m_widget_controller, video_buffer] {
widget_controller->FrameEnded(video_buffer);
+2 -2
View File
@@ -5,7 +5,7 @@
#ifdef HAS_LIBMGBA
#include <vector>
#include <span>
#include "Core/Host.h"
@@ -22,7 +22,7 @@ public:
explicit GBAHost(std::weak_ptr<HW::GBA::Core> core);
~GBAHost() override;
void GameChanged() override;
void FrameEnded(const std::vector<u32>& video_buffer) override;
void FrameEnded(std::span<const u32> video_buffer) override;
private:
GBAWidgetController* m_widget_controller{};
@@ -65,7 +65,7 @@ void ChunkedProgressDialog::ConnectWidgets()
}
void ChunkedProgressDialog::show(const QString& title, const u64 data_size,
const std::vector<int>& players)
std::span<const int> players)
{
m_progress_box->setTitle(title);
m_data_size = data_size;
@@ -4,7 +4,7 @@
#pragma once
#include <map>
#include <vector>
#include <span>
#include <QDialog>
@@ -23,7 +23,7 @@ class ChunkedProgressDialog : public QDialog
public:
explicit ChunkedProgressDialog(QWidget* parent);
void show(const QString& title, u64 data_size, const std::vector<int>& players);
void show(const QString& title, u64 data_size, std::span<const int> players);
void SetProgress(int pid, u64 progress);
void reject() override;
@@ -1248,7 +1248,7 @@ void NetPlayDialog::AbortGameDigest()
}
void NetPlayDialog::ShowChunkedProgressDialog(const std::string& title, const u64 data_size,
const std::vector<int>& players)
std::span<const int> players)
{
QueueOnObject(this, [this, title, data_size, players] {
if (m_chunked_progress_dialog->isVisible())
@@ -93,7 +93,7 @@ public:
void AbortGameDigest() override;
void ShowChunkedProgressDialog(const std::string& title, u64 data_size,
const std::vector<int>& players) override;
std::span<const int> players) override;
void HideChunkedProgressDialog() override;
void SetChunkedProgress(int pid, u64 progress) override;