mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-24 19:52:37 +01:00
Qt: Replace some instances of QMap, QPair and QList
This commit is contained in:
parent
e8f730e61f
commit
c3729d06d0
@ -1491,7 +1491,7 @@ namespace vm
|
||||
{
|
||||
if (auto rsxthr = g_fxo->try_get<rsx::thread>())
|
||||
{
|
||||
for (const auto [event_data1, event_data2] : event_data)
|
||||
for (const auto& [event_data1, event_data2] : event_data)
|
||||
{
|
||||
rsxthr->on_notify_post_memory_unmapped(event_data1, event_data2);
|
||||
}
|
||||
@ -1991,7 +1991,7 @@ namespace vm
|
||||
{
|
||||
if (auto rsxthr = g_fxo->try_get<rsx::thread>())
|
||||
{
|
||||
for (const auto [event_data1, event_data2] : unmap_data)
|
||||
for (const auto& [event_data1, event_data2] : unmap_data)
|
||||
{
|
||||
rsxthr->on_notify_post_memory_unmapped(event_data1, event_data2);
|
||||
}
|
||||
|
@ -538,7 +538,7 @@ bool ds4_pad_handler::GetCalibrationData(DS4Device* ds4Dev) const
|
||||
|
||||
// Make sure data 'looks' valid, dongle will report invalid calibration data with no controller connected
|
||||
|
||||
for (size_t i = 0; i < ds4Dev->calib_data.size(); i++)
|
||||
for (usz i = 0; i < ds4Dev->calib_data.size(); i++)
|
||||
{
|
||||
CalibData& data = ds4Dev->calib_data[i];
|
||||
|
||||
|
@ -489,7 +489,7 @@ bool dualsense_pad_handler::get_calibration_data(DualSenseDevice* dev) const
|
||||
|
||||
// Make sure data 'looks' valid, dongle will report invalid calibration data with no controller connected
|
||||
|
||||
for (size_t i = 0; i < dev->calib_data.size(); i++)
|
||||
for (usz i = 0; i < dev->calib_data.size(); i++)
|
||||
{
|
||||
CalibData& data = dev->calib_data[i];
|
||||
|
||||
|
@ -54,20 +54,20 @@
|
||||
flow_layout::flow_layout(QWidget* parent, int margin, bool dynamic_spacing, int hSpacing, int vSpacing)
|
||||
: QLayout(parent)
|
||||
, m_dynamic_spacing(dynamic_spacing)
|
||||
, m_hSpaceInitial(hSpacing)
|
||||
, m_vSpaceInitial(vSpacing)
|
||||
, m_hSpace(hSpacing)
|
||||
, m_vSpace(vSpacing)
|
||||
, m_h_space_initial(hSpacing)
|
||||
, m_v_space_initial(vSpacing)
|
||||
, m_h_space(hSpacing)
|
||||
, m_v_space(vSpacing)
|
||||
{
|
||||
setContentsMargins(margin, margin, margin, margin);
|
||||
}
|
||||
|
||||
flow_layout::flow_layout(int margin, bool dynamic_spacing, int hSpacing, int vSpacing)
|
||||
: m_dynamic_spacing(dynamic_spacing)
|
||||
, m_hSpaceInitial(hSpacing)
|
||||
, m_vSpaceInitial(vSpacing)
|
||||
, m_hSpace(hSpacing)
|
||||
, m_vSpace(vSpacing)
|
||||
, m_h_space_initial(hSpacing)
|
||||
, m_v_space_initial(vSpacing)
|
||||
, m_h_space(hSpacing)
|
||||
, m_v_space(vSpacing)
|
||||
{
|
||||
setContentsMargins(margin, margin, margin, margin);
|
||||
}
|
||||
@ -84,21 +84,21 @@ void flow_layout::clear()
|
||||
delete item->widget();
|
||||
delete item;
|
||||
}
|
||||
itemList.clear();
|
||||
m_item_list.clear();
|
||||
m_positions.clear();
|
||||
}
|
||||
|
||||
void flow_layout::addItem(QLayoutItem* item)
|
||||
{
|
||||
m_positions.append(position{ .row = -1, .col = -1 });
|
||||
itemList.append(item);
|
||||
m_item_list.append(item);
|
||||
}
|
||||
|
||||
int flow_layout::horizontalSpacing() const
|
||||
{
|
||||
if (m_hSpace >= 0)
|
||||
if (m_h_space >= 0)
|
||||
{
|
||||
return m_hSpace;
|
||||
return m_h_space;
|
||||
}
|
||||
|
||||
return smartSpacing(QStyle::PM_LayoutHorizontalSpacing);
|
||||
@ -106,9 +106,9 @@ int flow_layout::horizontalSpacing() const
|
||||
|
||||
int flow_layout::verticalSpacing() const
|
||||
{
|
||||
if (m_vSpace >= 0)
|
||||
if (m_v_space >= 0)
|
||||
{
|
||||
return m_vSpace;
|
||||
return m_v_space;
|
||||
}
|
||||
|
||||
return smartSpacing(QStyle::PM_LayoutVerticalSpacing);
|
||||
@ -116,20 +116,20 @@ int flow_layout::verticalSpacing() const
|
||||
|
||||
int flow_layout::count() const
|
||||
{
|
||||
return itemList.size();
|
||||
return m_item_list.size();
|
||||
}
|
||||
|
||||
QLayoutItem* flow_layout::itemAt(int index) const
|
||||
{
|
||||
return itemList.value(index);
|
||||
return m_item_list.value(index);
|
||||
}
|
||||
|
||||
QLayoutItem* flow_layout::takeAt(int index)
|
||||
{
|
||||
if (index >= 0 && index < itemList.size())
|
||||
if (index >= 0 && index < m_item_list.size())
|
||||
{
|
||||
m_positions.takeAt(index);
|
||||
return itemList.takeAt(index);
|
||||
return m_item_list.takeAt(index);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
@ -164,7 +164,7 @@ QSize flow_layout::sizeHint() const
|
||||
QSize flow_layout::minimumSize() const
|
||||
{
|
||||
QSize size;
|
||||
for (const QLayoutItem* item : itemList)
|
||||
for (const QLayoutItem* item : m_item_list)
|
||||
{
|
||||
if (item)
|
||||
{
|
||||
@ -196,9 +196,9 @@ int flow_layout::doLayout(const QRect& rect, bool testOnly) const
|
||||
int width = 0;
|
||||
int index = 0;
|
||||
|
||||
for (; index < itemList.size(); index++)
|
||||
for (; index < m_item_list.size(); index++)
|
||||
{
|
||||
if (QLayoutItem* item = itemList.at(index))
|
||||
if (QLayoutItem* item = m_item_list.at(index))
|
||||
{
|
||||
const int new_width = width + item->sizeHint().width() + (width > 0 ? min_spacing : 0);
|
||||
|
||||
@ -213,22 +213,22 @@ int flow_layout::doLayout(const QRect& rect, bool testOnly) const
|
||||
}
|
||||
|
||||
// Try to evenly distribute the items across the width
|
||||
m_hSpace = (index == 0) ? -1 : ((available_width - width) / index);
|
||||
m_h_space = (index == 0) ? -1 : ((available_width - width) / index);
|
||||
|
||||
if (fits_into_width)
|
||||
{
|
||||
// Make sure there aren't huge gaps between the items
|
||||
m_hSpace = smartSpacing(QStyle::PM_LayoutHorizontalSpacing);
|
||||
m_h_space = smartSpacing(QStyle::PM_LayoutHorizontalSpacing);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_hSpace = m_hSpaceInitial;
|
||||
m_h_space = m_h_space_initial;
|
||||
}
|
||||
|
||||
for (int i = 0, row = 0, col = 0; i < itemList.size(); i++)
|
||||
for (int i = 0, row = 0, col = 0; i < m_item_list.size(); i++)
|
||||
{
|
||||
QLayoutItem* item = itemList.at(i);
|
||||
QLayoutItem* item = m_item_list.at(i);
|
||||
if (!item)
|
||||
continue;
|
||||
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
~flow_layout();
|
||||
|
||||
void clear();
|
||||
const QList<QLayoutItem*>& item_list() const { return itemList; }
|
||||
const QList<QLayoutItem*>& item_list() const { return m_item_list; }
|
||||
const QList<position>& positions() const { return m_positions; }
|
||||
int rows() const { return m_rows; }
|
||||
int cols() const { return m_cols; }
|
||||
@ -90,12 +90,12 @@ private:
|
||||
int doLayout(const QRect& rect, bool testOnly) const;
|
||||
int smartSpacing(QStyle::PixelMetric pm) const;
|
||||
|
||||
QList<QLayoutItem*> itemList;
|
||||
QList<QLayoutItem*> m_item_list;
|
||||
bool m_dynamic_spacing{};
|
||||
int m_hSpaceInitial{-1};
|
||||
int m_vSpaceInitial{-1};
|
||||
mutable int m_hSpace{-1};
|
||||
mutable int m_vSpace{-1};
|
||||
int m_h_space_initial{-1};
|
||||
int m_v_space_initial{-1};
|
||||
mutable int m_h_space{-1};
|
||||
mutable int m_v_space{-1};
|
||||
|
||||
mutable QList<position> m_positions;
|
||||
mutable int m_rows{};
|
||||
|
@ -34,7 +34,7 @@ void flow_widget::add_widget(flow_widget_item* widget)
|
||||
{
|
||||
if (widget)
|
||||
{
|
||||
m_widgets << widget;
|
||||
m_widgets.push_back(widget);
|
||||
m_flow_layout->addWidget(widget);
|
||||
|
||||
connect(widget, &flow_widget_item::navigate, this, &flow_widget::on_navigate);
|
||||
@ -48,14 +48,9 @@ void flow_widget::clear()
|
||||
m_flow_layout->clear();
|
||||
}
|
||||
|
||||
QList<flow_widget_item*>& flow_widget::items()
|
||||
{
|
||||
return m_widgets;
|
||||
}
|
||||
|
||||
flow_widget_item* flow_widget::selected_item() const
|
||||
{
|
||||
if (m_selected_index >= 0 && m_selected_index < m_widgets.size())
|
||||
if (m_selected_index >= 0 && static_cast<usz>(m_selected_index) < m_widgets.size())
|
||||
{
|
||||
return ::at32(m_widgets, m_selected_index);
|
||||
}
|
||||
@ -63,11 +58,6 @@ flow_widget_item* flow_widget::selected_item() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QScrollArea* flow_widget::scroll_area() const
|
||||
{
|
||||
return m_scroll_area;
|
||||
}
|
||||
|
||||
void flow_widget::paintEvent(QPaintEvent* /*event*/)
|
||||
{
|
||||
// Needed for stylesheets to apply to QWidgets
|
||||
@ -77,7 +67,7 @@ void flow_widget::paintEvent(QPaintEvent* /*event*/)
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &option, &painter, this);
|
||||
}
|
||||
|
||||
int flow_widget::find_item(const flow_layout::position& pos)
|
||||
s64 flow_widget::find_item(const flow_layout::position& pos)
|
||||
{
|
||||
if (pos.row < 0 || pos.col < 0)
|
||||
{
|
||||
@ -86,7 +76,7 @@ int flow_widget::find_item(const flow_layout::position& pos)
|
||||
|
||||
const auto& positions = m_flow_layout->positions();
|
||||
|
||||
for (int i = 0; i < positions.size(); i++)
|
||||
for (s64 i = 0; i < positions.size(); i++)
|
||||
{
|
||||
if (const auto& other = ::at32(positions, i); other.row == pos.row && other.col == pos.col)
|
||||
{
|
||||
@ -97,7 +87,7 @@ int flow_widget::find_item(const flow_layout::position& pos)
|
||||
return -1;
|
||||
}
|
||||
|
||||
flow_layout::position flow_widget::find_item(flow_widget_item* item)
|
||||
flow_layout::position flow_widget::find_item(flow_widget_item* item)
|
||||
{
|
||||
if (item)
|
||||
{
|
||||
@ -105,7 +95,7 @@ int flow_widget::find_item(const flow_layout::position& pos)
|
||||
const auto& positions = m_flow_layout->positions();
|
||||
ensure(item_list.size() == positions.size());
|
||||
|
||||
for (int i = 0; i < item_list.size(); i++)
|
||||
for (s64 i = 0; i < item_list.size(); i++)
|
||||
{
|
||||
if (const auto& layout_item = ::at32(item_list, i); layout_item && layout_item->widget() == item)
|
||||
{
|
||||
@ -196,9 +186,9 @@ flow_layout::position flow_widget::find_next_item(flow_layout::position current_
|
||||
void flow_widget::select_item(flow_widget_item* item)
|
||||
{
|
||||
const flow_layout::position selected_pos = find_item(item);
|
||||
const int selected_index = find_item(selected_pos);
|
||||
const s64 selected_index = find_item(selected_pos);
|
||||
|
||||
if (selected_index < 0 || selected_index >= items().size())
|
||||
if (selected_index < 0 || static_cast<usz>(selected_index) >= items().size())
|
||||
{
|
||||
m_selected_index = -1;
|
||||
return;
|
||||
@ -207,12 +197,12 @@ void flow_widget::select_item(flow_widget_item* item)
|
||||
m_selected_index = selected_index;
|
||||
Q_EMIT ItemSelectionChanged(m_selected_index);
|
||||
|
||||
for (int i = 0; i < items().size(); i++)
|
||||
for (usz i = 0; i < items().size(); i++)
|
||||
{
|
||||
if (flow_widget_item* item = items().at(i))
|
||||
{
|
||||
// We need to polish the widgets in order to re-apply any stylesheet changes for the selected property.
|
||||
item->selected = i == m_selected_index;
|
||||
item->selected = m_selected_index >= 0 && i == static_cast<usz>(m_selected_index);
|
||||
item->polish_style();
|
||||
}
|
||||
}
|
||||
@ -229,8 +219,8 @@ void flow_widget::on_item_focus()
|
||||
void flow_widget::on_navigate(flow_navigation value)
|
||||
{
|
||||
const flow_layout::position selected_pos = find_next_item(find_item(static_cast<flow_widget_item*>(QObject::sender())), value);
|
||||
const int selected_index = find_item(selected_pos);
|
||||
if (selected_index < 0 || selected_index >= items().size())
|
||||
const s64 selected_index = find_item(selected_pos);
|
||||
if (selected_index < 0 || static_cast<usz>(selected_index) >= items().size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "util/types.hpp"
|
||||
#include "flow_widget_item.h"
|
||||
#include "flow_layout.h"
|
||||
|
||||
@ -18,9 +19,9 @@ public:
|
||||
void add_widget(flow_widget_item* widget);
|
||||
void clear();
|
||||
|
||||
QList<flow_widget_item*>& items();
|
||||
std::vector<flow_widget_item*>& items() { return m_widgets; }
|
||||
flow_widget_item* selected_item() const;
|
||||
QScrollArea* scroll_area() const;
|
||||
QScrollArea* scroll_area() const { return m_scroll_area; }
|
||||
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
|
||||
@ -36,12 +37,12 @@ protected:
|
||||
void mouseDoubleClickEvent(QMouseEvent* event) override;
|
||||
|
||||
private:
|
||||
int find_item(const flow_layout::position& pos);
|
||||
s64 find_item(const flow_layout::position& pos);
|
||||
flow_layout::position find_item(flow_widget_item* item);
|
||||
flow_layout::position find_next_item(flow_layout::position current_pos, flow_navigation value);
|
||||
|
||||
flow_layout* m_flow_layout{};
|
||||
QScrollArea* m_scroll_area{};
|
||||
QList<flow_widget_item*> m_widgets{};
|
||||
int m_selected_index = -1;
|
||||
std::vector<flow_widget_item*> m_widgets;
|
||||
s64 m_selected_index = -1;
|
||||
};
|
||||
|
@ -14,7 +14,7 @@ game_list_base::game_list_base()
|
||||
{
|
||||
}
|
||||
|
||||
void game_list_base::repaint_icons(QList<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio)
|
||||
void game_list_base::repaint_icons(std::vector<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio)
|
||||
{
|
||||
m_icon_size = icon_size;
|
||||
m_icon_color = icon_color;
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
void set_icon_color(QColor color) { m_icon_color = std::move(color); }
|
||||
void set_draw_compat_status_to_grid(bool enabled) { m_draw_compat_status_to_grid = enabled; }
|
||||
|
||||
virtual void repaint_icons(QList<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio);
|
||||
virtual void repaint_icons(std::vector<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio);
|
||||
|
||||
// Returns the visible version string in the game list
|
||||
static std::string GetGameVersion(const game_info& game);
|
||||
|
@ -258,7 +258,7 @@ void game_list_frame::OnColClicked(int col)
|
||||
m_gui_settings->SetValue(gui::gl_sortAsc, m_col_sort_order == Qt::AscendingOrder, false);
|
||||
m_gui_settings->SetValue(gui::gl_sortCol, col, true);
|
||||
|
||||
m_game_list->sort(m_game_data.count(), m_sort_column, m_col_sort_order);
|
||||
m_game_list->sort(m_game_data.size(), m_sort_column, m_col_sort_order);
|
||||
}
|
||||
|
||||
// Get visibility of entries
|
||||
@ -546,7 +546,7 @@ void game_list_frame::Refresh(const bool from_drive, const std::vector<std::stri
|
||||
m_game_grid->clear_list();
|
||||
const int scroll_position = m_game_list->verticalScrollBar()->value();
|
||||
m_game_list->populate(matching_apps, m_notes, m_titles, selected_item, m_play_hover_movies);
|
||||
m_game_list->sort(m_game_data.count(), m_sort_column, m_col_sort_order);
|
||||
m_game_list->sort(m_game_data.size(), m_sort_column, m_col_sort_order);
|
||||
RepaintIcons();
|
||||
|
||||
if (scroll_after)
|
||||
@ -2277,11 +2277,11 @@ void game_list_frame::RemoveHDD1Cache(const std::string& base_dir, const std::st
|
||||
game_list_log.fatal("Only %d/%d HDD1 cache directories could be removed in %s (%s)", dirs_removed, dirs_total, base_dir, title_id);
|
||||
}
|
||||
|
||||
void game_list_frame::BatchCreateCPUCaches(const QList<game_info>& game_data)
|
||||
void game_list_frame::BatchCreateCPUCaches(const std::vector<game_info>& game_data)
|
||||
{
|
||||
const std::string vsh_path = g_cfg_vfs.get_dev_flash() + "vsh/module/";
|
||||
const bool vsh_exists = game_data.isEmpty() && fs::is_file(vsh_path + "vsh.self");
|
||||
const u32 total = !game_data.isEmpty() ? game_data.size() : (m_game_data.size() + (vsh_exists ? 1 : 0));
|
||||
const bool vsh_exists = game_data.empty() && fs::is_file(vsh_path + "vsh.self");
|
||||
const usz total = !game_data.empty() ? game_data.size() : (m_game_data.size() + (vsh_exists ? 1 : 0));
|
||||
|
||||
if (total == 0)
|
||||
{
|
||||
@ -2296,7 +2296,7 @@ void game_list_frame::BatchCreateCPUCaches(const QList<game_info>& game_data)
|
||||
|
||||
const QString main_label = tr("Creating all LLVM caches");
|
||||
|
||||
progress_dialog* pdlg = new progress_dialog(tr("LLVM Cache Batch Creation"), main_label, tr("Cancel"), 0, total, false, this);
|
||||
progress_dialog* pdlg = new progress_dialog(tr("LLVM Cache Batch Creation"), main_label, tr("Cancel"), 0, ::narrow<s32>(total), false, this);
|
||||
pdlg->setWindowFlags(Qt::Window | Qt::WindowMinimizeButtonHint);
|
||||
pdlg->setAutoClose(false);
|
||||
pdlg->setAutoReset(false);
|
||||
@ -2329,7 +2329,7 @@ void game_list_frame::BatchCreateCPUCaches(const QList<game_info>& game_data)
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& game : (game_data.isEmpty() ? m_game_data : game_data))
|
||||
for (const auto& game : (game_data.empty() ? m_game_data : game_data))
|
||||
{
|
||||
if (pdlg->wasCanceled() || g_system_progress_canceled)
|
||||
{
|
||||
@ -2995,7 +2995,7 @@ void game_list_frame::SetPlayHoverGifs(bool play)
|
||||
}
|
||||
}
|
||||
|
||||
const QList<game_info>& game_list_frame::GetGameInfo() const
|
||||
const std::vector<game_info>& game_list_frame::GetGameInfo() const
|
||||
{
|
||||
return m_game_data;
|
||||
}
|
||||
|
@ -58,14 +58,14 @@ public:
|
||||
|
||||
game_compatibility* GetGameCompatibility() const { return m_game_compat; }
|
||||
|
||||
const QList<game_info>& GetGameInfo() const;
|
||||
const std::vector<game_info>& GetGameInfo() const;
|
||||
|
||||
void CreateShortcuts(const game_info& gameinfo, const std::set<gui::utils::shortcut_location>& locations);
|
||||
|
||||
bool IsEntryVisible(const game_info& game, bool search_fallback = false) const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void BatchCreateCPUCaches(const QList<game_info>& game_data = QList<game_info>{});
|
||||
void BatchCreateCPUCaches(const std::vector<game_info>& game_data = {});
|
||||
void BatchRemovePPUCaches();
|
||||
void BatchRemoveSPUCaches();
|
||||
void BatchRemoveCustomConfigurations();
|
||||
@ -181,7 +181,7 @@ private:
|
||||
std::shared_ptr<gui_settings> m_gui_settings;
|
||||
std::shared_ptr<emu_settings> m_emu_settings;
|
||||
std::shared_ptr<persistent_settings> m_persistent_settings;
|
||||
QList<game_info> m_game_data;
|
||||
std::vector<game_info> m_game_data;
|
||||
struct path_entry
|
||||
{
|
||||
std::string path;
|
||||
|
@ -137,7 +137,7 @@ void game_list_grid::populate(
|
||||
select_item(selected_item);
|
||||
}
|
||||
|
||||
void game_list_grid::repaint_icons(QList<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio)
|
||||
void game_list_grid::repaint_icons(std::vector<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio)
|
||||
{
|
||||
m_icon_size = icon_size;
|
||||
m_icon_color = icon_color;
|
||||
@ -178,9 +178,9 @@ void game_list_grid::repaint_icons(QList<game_info>& game_data, const QColor& ic
|
||||
|
||||
void game_list_grid::FocusAndSelectFirstEntryIfNoneIs()
|
||||
{
|
||||
if (items().empty() == false)
|
||||
if (!items().empty())
|
||||
{
|
||||
items().first()->setFocus();
|
||||
items().front()->setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
const std::string& selected_item_id,
|
||||
bool play_hover_movies) override;
|
||||
|
||||
void repaint_icons(QList<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio) override;
|
||||
void repaint_icons(std::vector<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio) override;
|
||||
|
||||
bool eventFilter(QObject* watched, QEvent* event) override;
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
|
@ -113,11 +113,11 @@ void game_list_table::adjust_icon_column()
|
||||
resizeColumnToContents(static_cast<int>(gui::game_list_columns::count) - 1);
|
||||
}
|
||||
|
||||
void game_list_table::sort(int game_count, int sort_column, Qt::SortOrder col_sort_order)
|
||||
void game_list_table::sort(usz game_count, int sort_column, Qt::SortOrder col_sort_order)
|
||||
{
|
||||
// Back-up old header sizes to handle unwanted column resize in case of zero search results
|
||||
const int old_row_count = rowCount();
|
||||
const int old_game_count = game_count;
|
||||
const usz old_game_count = game_count;
|
||||
|
||||
std::vector<int> column_widths(columnCount());
|
||||
for (int i = 0; i < columnCount(); i++)
|
||||
@ -395,7 +395,7 @@ void game_list_table::populate(
|
||||
selectRow(selected_row);
|
||||
}
|
||||
|
||||
void game_list_table::repaint_icons(QList<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio)
|
||||
void game_list_table::repaint_icons(std::vector<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio)
|
||||
{
|
||||
game_list_base::repaint_icons(game_data, icon_color, icon_size, device_pixel_ratio);
|
||||
adjust_icon_column();
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
|
||||
void adjust_icon_column();
|
||||
|
||||
void sort(int game_count, int sort_column, Qt::SortOrder col_sort_order);
|
||||
void sort(usz game_count, int sort_column, Qt::SortOrder col_sort_order);
|
||||
|
||||
void set_custom_config_icon(const game_info& game);
|
||||
|
||||
@ -31,7 +31,7 @@ public:
|
||||
const std::string& selected_item_id,
|
||||
bool play_hover_movies) override;
|
||||
|
||||
void repaint_icons(QList<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio) override;
|
||||
void repaint_icons(std::vector<game_info>& game_data, const QColor& icon_color, const QSize& icon_size, qreal device_pixel_ratio) override;
|
||||
|
||||
Q_SIGNALS:
|
||||
void size_on_disk_ready(const game_info& game);
|
||||
|
@ -974,23 +974,23 @@ void gui_application::OnChangeStyleSheetRequest()
|
||||
{
|
||||
QString stylesheet_path;
|
||||
QString stylesheet_dir;
|
||||
QList<QDir> locs;
|
||||
locs << m_gui_settings->GetSettingsDir();
|
||||
std::vector<QDir> locs;
|
||||
locs.push_back(m_gui_settings->GetSettingsDir());
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#ifdef __APPLE__
|
||||
locs << QCoreApplication::applicationDirPath() + "/../Resources/GuiConfigs/";
|
||||
locs.push_back(QCoreApplication::applicationDirPath() + "/../Resources/GuiConfigs/");
|
||||
#else
|
||||
#ifdef DATADIR
|
||||
const QString data_dir = (DATADIR);
|
||||
locs << data_dir + "/GuiConfigs/";
|
||||
locs.push_back(data_dir + "/GuiConfigs/");
|
||||
#endif
|
||||
locs << QCoreApplication::applicationDirPath() + "/../share/rpcs3/GuiConfigs/";
|
||||
locs.push_back(QCoreApplication::applicationDirPath() + "/../share/rpcs3/GuiConfigs/");
|
||||
#endif
|
||||
locs << QCoreApplication::applicationDirPath() + "/GuiConfigs/";
|
||||
locs.push_back(QCoreApplication::applicationDirPath() + "/GuiConfigs/");
|
||||
#endif
|
||||
|
||||
for (auto&& loc : locs)
|
||||
for (QDir& loc : locs)
|
||||
{
|
||||
QFileInfo file_info(loc.absoluteFilePath(stylesheet_name + QStringLiteral(".qss")));
|
||||
if (file_info.exists())
|
||||
|
@ -479,21 +479,21 @@ void log_frame::LoadSettings()
|
||||
void log_frame::RepaintTextColors()
|
||||
{
|
||||
// Backup old colors
|
||||
QList<QColor> old_colors = m_color;
|
||||
std::vector<QColor> old_colors = m_color;
|
||||
QColor old_stack_color = m_color_stack;
|
||||
|
||||
const QColor color = gui::utils::get_foreground_color();
|
||||
|
||||
// Get text color. Do this once to prevent possible slowdown
|
||||
m_color.clear();
|
||||
m_color.append(gui::utils::get_label_color("log_level_always", Qt::darkCyan, Qt::cyan));
|
||||
m_color.append(gui::utils::get_label_color("log_level_fatal", Qt::darkMagenta, Qt::magenta));
|
||||
m_color.append(gui::utils::get_label_color("log_level_error", Qt::red, Qt::red));
|
||||
m_color.append(gui::utils::get_label_color("log_level_todo", Qt::darkYellow, Qt::darkYellow));
|
||||
m_color.append(gui::utils::get_label_color("log_level_success", Qt::darkGreen, Qt::green));
|
||||
m_color.append(gui::utils::get_label_color("log_level_warning", Qt::darkYellow, Qt::darkYellow));
|
||||
m_color.append(gui::utils::get_label_color("log_level_notice", color, color));
|
||||
m_color.append(gui::utils::get_label_color("log_level_trace", color, color));
|
||||
m_color.push_back(gui::utils::get_label_color("log_level_always", Qt::darkCyan, Qt::cyan));
|
||||
m_color.push_back(gui::utils::get_label_color("log_level_fatal", Qt::darkMagenta, Qt::magenta));
|
||||
m_color.push_back(gui::utils::get_label_color("log_level_error", Qt::red, Qt::red));
|
||||
m_color.push_back(gui::utils::get_label_color("log_level_todo", Qt::darkYellow, Qt::darkYellow));
|
||||
m_color.push_back(gui::utils::get_label_color("log_level_success", Qt::darkGreen, Qt::green));
|
||||
m_color.push_back(gui::utils::get_label_color("log_level_warning", Qt::darkYellow, Qt::darkYellow));
|
||||
m_color.push_back(gui::utils::get_label_color("log_level_notice", color, color));
|
||||
m_color.push_back(gui::utils::get_label_color("log_level_trace", color, color));
|
||||
|
||||
m_color_stack = gui::utils::get_label_color("log_stack", color, color);
|
||||
|
||||
|
@ -49,7 +49,7 @@ private:
|
||||
|
||||
QTimer* m_timer = nullptr;
|
||||
|
||||
QList<QColor> m_color;
|
||||
std::vector<QColor> m_color;
|
||||
QColor m_color_stack;
|
||||
QPlainTextEdit* m_log = nullptr;
|
||||
std::string m_old_log_text;
|
||||
|
@ -2399,7 +2399,7 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri
|
||||
locations.insert(gui::utils::shortcut_location::applications);
|
||||
}
|
||||
|
||||
QList<game_info> game_data;
|
||||
std::vector<game_info> game_data;
|
||||
|
||||
for (const auto& [boot_path, title_id] : paths)
|
||||
{
|
||||
@ -2422,7 +2422,7 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri
|
||||
}
|
||||
}
|
||||
|
||||
if (!game_data.isEmpty())
|
||||
if (!game_data.empty())
|
||||
{
|
||||
m_game_list_frame->BatchCreateCPUCaches(game_data);
|
||||
}
|
||||
|
@ -323,24 +323,29 @@ void patch_manager_dialog::populate_tree()
|
||||
const QString q_description = QString::fromStdString(description);
|
||||
QString visible_description = q_description;
|
||||
|
||||
const QList<QPair<int, QVariant>> match_criteria = QList<QPair<int, QVariant>>()
|
||||
<< QPair<int, QVariant>(description_role, q_description)
|
||||
<< QPair<int, QVariant>(persistance_role, true);
|
||||
const std::vector<std::pair<int, QVariant>> match_criteria =
|
||||
{
|
||||
std::pair<int, QVariant>(description_role, q_description),
|
||||
std::pair<int, QVariant>(persistance_role, true)
|
||||
};
|
||||
|
||||
// Add counter to leafs if the name already exists due to different hashes of the same game (PPU, SPU, PRX, OVL)
|
||||
if (const auto matches = gui::utils::find_children_by_data(serial_level_item, match_criteria, false); matches.count() > 0)
|
||||
std::vector<QTreeWidgetItem*> matches;
|
||||
gui::utils::find_children_by_data(serial_level_item, matches, match_criteria, false);
|
||||
|
||||
if (!matches.empty())
|
||||
{
|
||||
if (auto only_match = matches.count() == 1 ? matches[0] : nullptr)
|
||||
if (auto only_match = matches.size() == 1 ? matches[0] : nullptr)
|
||||
{
|
||||
only_match->setText(0, q_description + QStringLiteral(" (01)"));
|
||||
}
|
||||
const int counter = matches.count() + 1;
|
||||
const usz counter = matches.size() + 1;
|
||||
visible_description += QStringLiteral(" (");
|
||||
if (counter < 10) visible_description += '0';
|
||||
visible_description += QString::number(counter) + ')';
|
||||
}
|
||||
|
||||
QMap<QString, QVariant> q_config_values;
|
||||
QVariantMap q_config_values;
|
||||
|
||||
for (const auto& [key, default_config_value] : patch.default_config_values)
|
||||
{
|
||||
@ -375,8 +380,10 @@ void patch_manager_dialog::populate_tree()
|
||||
}
|
||||
}
|
||||
|
||||
const QList<QPair<int, QVariant>> match_criteria = QList<QPair<int, QVariant>>()
|
||||
<< QPair<int, QVariant>(persistance_role, true);
|
||||
const std::vector<std::pair<int, QVariant>> match_criteria =
|
||||
{
|
||||
std::pair<int, QVariant>(persistance_role, true)
|
||||
};
|
||||
|
||||
for (int i = ui->patch_tree->topLevelItemCount() - 1; i >= 0; i--)
|
||||
{
|
||||
@ -578,7 +585,7 @@ void patch_manager_dialog::update_patch_info(const patch_manager_dialog::gui_pat
|
||||
ui->configurable_double_spin_box->setVisible(false);
|
||||
|
||||
// Fetch the config values of this item
|
||||
const QVariant& variant = info.config_values.value(key);
|
||||
const QVariant& variant = ::at32(info.config_values, key);
|
||||
ensure(variant.canConvert<patch_engine::patch_config_value>());
|
||||
|
||||
const patch_engine::patch_config_value config_value = variant.value<patch_engine::patch_config_value>();
|
||||
@ -662,7 +669,7 @@ void patch_manager_dialog::handle_item_selected(QTreeWidgetItem* current, QTreeW
|
||||
info.notes = QString::fromStdString(found_info.notes);
|
||||
info.description = QString::fromStdString(found_info.description);
|
||||
info.patch_version = QString::fromStdString(found_info.patch_version);
|
||||
info.config_values = current->data(0, config_values_role).toMap();
|
||||
info.config_values = current->data(0, config_values_role).toMap().toStdMap();
|
||||
info.config_value_key = current->data(0, config_key_role).toString();
|
||||
|
||||
if (current != previous)
|
||||
@ -670,11 +677,9 @@ void patch_manager_dialog::handle_item_selected(QTreeWidgetItem* current, QTreeW
|
||||
// Update the config value combo box with the new config keys
|
||||
ui->configurable_selector->blockSignals(true);
|
||||
ui->configurable_selector->clear();
|
||||
for (const QString& key : info.config_values.keys())
|
||||
for (const auto& [key, variant] : info.config_values)
|
||||
{
|
||||
const QVariant& variant = info.config_values.value(key);
|
||||
ensure(variant.canConvert<patch_engine::patch_config_value>());
|
||||
const patch_engine::patch_config_value config_value = variant.value<patch_engine::patch_config_value>();
|
||||
ui->configurable_selector->addItem(key, key);
|
||||
}
|
||||
if (ui->configurable_selector->count() > 0)
|
||||
|
@ -31,7 +31,7 @@ class patch_manager_dialog : public QDialog
|
||||
QString description;
|
||||
QString patch_version;
|
||||
QString config_value_key;
|
||||
QMap<QString, QVariant> config_values;
|
||||
std::map<QString, QVariant> config_values;
|
||||
};
|
||||
|
||||
const QString tr_all_titles = tr("All titles - Warning: These patches apply to all games!");
|
||||
|
@ -501,10 +501,8 @@ namespace gui
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QList<QTreeWidgetItem*> find_children_by_data(QTreeWidgetItem* parent, const QList<QPair<int /*role*/, QVariant /*data*/>>& criteria, bool recursive)
|
||||
void find_children_by_data(QTreeWidgetItem* parent, std::vector<QTreeWidgetItem*>& children, const std::vector<std::pair<int /*role*/, QVariant /*data*/>>& criteria, bool recursive)
|
||||
{
|
||||
QList<QTreeWidgetItem*> list;
|
||||
|
||||
if (parent)
|
||||
{
|
||||
for (int i = 0; i < parent->childCount(); i++)
|
||||
@ -524,18 +522,16 @@ namespace gui
|
||||
|
||||
if (match)
|
||||
{
|
||||
list << item;
|
||||
children.push_back(item);
|
||||
}
|
||||
|
||||
if (recursive)
|
||||
{
|
||||
list << find_children_by_data(item, criteria, recursive);
|
||||
find_children_by_data(item, children, criteria, recursive);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
QTreeWidgetItem* add_child(QTreeWidgetItem *parent, const QString& text, int column)
|
||||
@ -561,7 +557,7 @@ namespace gui
|
||||
}
|
||||
}
|
||||
|
||||
void remove_children(QTreeWidgetItem* parent, const QList<QPair<int /*role*/, QVariant /*data*/>>& criteria, bool recursive)
|
||||
void remove_children(QTreeWidgetItem* parent, const std::vector<std::pair<int /*role*/, QVariant /*data*/>>& criteria, bool recursive)
|
||||
{
|
||||
if (parent)
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ namespace gui
|
||||
QTreeWidgetItem* find_child(QTreeWidgetItem* parent, const QString& text);
|
||||
|
||||
// Finds all children of a QTreeWidgetItem that match the given criteria
|
||||
QList<QTreeWidgetItem*> find_children_by_data(QTreeWidgetItem* parent, const QList<QPair<int /*role*/, QVariant /*data*/>>& criteria, bool recursive);
|
||||
void find_children_by_data(QTreeWidgetItem* parent, std::vector<QTreeWidgetItem*>& children, const std::vector<std::pair<int /*role*/, QVariant /*data*/>>& criteria, bool recursive);
|
||||
|
||||
// Constructs and adds a child to a QTreeWidgetItem
|
||||
QTreeWidgetItem* add_child(QTreeWidgetItem* parent, const QString& text, int column = 0);
|
||||
@ -140,7 +140,7 @@ namespace gui
|
||||
void remove_children(QTreeWidgetItem* parent);
|
||||
|
||||
// Removes all children of a QTreeWidgetItem that don't match the given criteria
|
||||
void remove_children(QTreeWidgetItem* parent, const QList<QPair<int /*role*/, QVariant /*data*/>>& criteria, bool recursive);
|
||||
void remove_children(QTreeWidgetItem* parent, const std::vector<std::pair<int /*role*/, QVariant /*data*/>>& criteria, bool recursive);
|
||||
|
||||
// Sort a QTreeWidget (currently only column 0)
|
||||
void sort_tree(QTreeWidget* tree, Qt::SortOrder sort_order, bool recursive);
|
||||
|
@ -2644,7 +2644,7 @@ int settings_dialog::exec()
|
||||
void settings_dialog::SubscribeDescription(QLabel* description)
|
||||
{
|
||||
description->setFixedHeight(description->sizeHint().height());
|
||||
m_description_labels.append(QPair<QLabel*, QString>(description, description->text()));
|
||||
m_description_labels.push_back(std::pair<QLabel*, QString>(description, description->text()));
|
||||
}
|
||||
|
||||
void settings_dialog::SubscribeTooltip(QObject* object, const QString& tooltip)
|
||||
@ -2677,11 +2677,9 @@ bool settings_dialog::eventFilter(QObject* object, QEvent* event)
|
||||
{
|
||||
const int i = ui->tab_widget_settings->currentIndex();
|
||||
|
||||
if (i < m_description_labels.size())
|
||||
if (i >= 0 && static_cast<usz>(i) < m_description_labels.size())
|
||||
{
|
||||
QLabel* label = m_description_labels[i].first;
|
||||
|
||||
if (label)
|
||||
if (QLabel* label = m_description_labels[i].first)
|
||||
{
|
||||
if (event->type() == QEvent::Enter)
|
||||
{
|
||||
@ -2689,8 +2687,7 @@ bool settings_dialog::eventFilter(QObject* object, QEvent* event)
|
||||
}
|
||||
else if (event->type() == QEvent::Leave)
|
||||
{
|
||||
const QString description = m_description_labels[i].second;
|
||||
label->setText(description);
|
||||
label->setText(m_description_labels[i].second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ private:
|
||||
QString m_discord_state;
|
||||
|
||||
// Descriptions
|
||||
QList<QPair<QLabel*, QString>> m_description_labels;
|
||||
std::vector<std::pair<QLabel*, QString>> m_description_labels;
|
||||
QHash<QObject*, QString> m_descriptions;
|
||||
void SubscribeDescription(QLabel* description);
|
||||
void SubscribeTooltip(QObject* object, const QString& tooltip);
|
||||
|
@ -569,11 +569,8 @@ void trophy_manager_dialog::ResizeGameIcons()
|
||||
placeholder.fill(Qt::transparent);
|
||||
|
||||
qRegisterMetaType<QVector<int>>("QVector<int>");
|
||||
QList<int> indices;
|
||||
for (int i = 0; i < m_game_table->rowCount(); ++i)
|
||||
{
|
||||
indices.append(i);
|
||||
|
||||
if (QTableWidgetItem* icon_item = m_game_table->item(i, static_cast<int>(gui::trophy_game_list_columns::icon)))
|
||||
{
|
||||
icon_item->setData(Qt::DecorationRole, placeholder);
|
||||
|
Loading…
Reference in New Issue
Block a user