mirror of
https://github.com/ARMSX2/ARMSX3.git
synced 2026-08-24 16:58:52 -07:00
Refactor game_list_frame
This commit is contained in:
+35
-1
@@ -289,6 +289,12 @@
|
||||
<ClCompile Include="QTGeneratedFiles\Debug\moc_flow_widget_item.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QTGeneratedFiles\Debug\moc_game_list_actions.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QTGeneratedFiles\Debug\moc_game_list_context_menu.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QTGeneratedFiles\Debug\moc_game_compatibility.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
@@ -586,6 +592,12 @@
|
||||
<ClCompile Include="QTGeneratedFiles\Release\moc_flow_widget_item.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QTGeneratedFiles\Release\moc_game_list_actions.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QTGeneratedFiles\Release\moc_game_list_context_menu.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QTGeneratedFiles\Release\moc_game_compatibility.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
@@ -833,7 +845,9 @@
|
||||
<ClCompile Include="rpcs3qt\flow_widget.cpp" />
|
||||
<ClCompile Include="rpcs3qt\flow_widget_item.cpp" />
|
||||
<ClCompile Include="rpcs3qt\game_list.cpp" />
|
||||
<ClCompile Include="rpcs3qt\game_list_actions.cpp" />
|
||||
<ClCompile Include="rpcs3qt\game_list_base.cpp" />
|
||||
<ClCompile Include="rpcs3qt\game_list_context_menu.cpp" />
|
||||
<ClCompile Include="rpcs3qt\game_list_delegate.cpp" />
|
||||
<ClCompile Include="rpcs3qt\game_list_grid_item.cpp" />
|
||||
<ClCompile Include="rpcs3qt\game_list_table.cpp" />
|
||||
@@ -1458,6 +1472,26 @@
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DWIN32_LEAN_AND_MEAN -DHAVE_VULKAN -DMINIUPNP_STATICLIB -DHAVE_SDL3 -DWITH_DISCORD_RPC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -DQT_CONCURRENT_LIB -DQT_MULTIMEDIA_LIB -DQT_MULTIMEDIAWIDGETS_LIB -DQT_SVG_LIB -D%(PreprocessorDefinitions) "-I.\..\3rdparty\SoundTouch\soundtouch\include" "-I.\..\3rdparty\cubeb\extra" "-I.\..\3rdparty\cubeb\cubeb\include" "-I.\..\3rdparty\flatbuffers\include" "-I.\..\3rdparty\wolfssl\wolfssl" "-I.\..\3rdparty\curl\curl\include" "-I.\..\3rdparty\libusb\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I.\..\3rdparty\libsdl-org\SDL\include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtCore" "-I.\release" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtMultimedia" "-I$(QTDIR)\include\QtMultimediaWidgets" "-I$(QTDIR)\include\QtSvg"</Command>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="rpcs3qt\game_list_actions.h">
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Moc%27ing %(Identity)...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DWIN32_LEAN_AND_MEAN -DHAVE_VULKAN -DMINIUPNP_STATICLIB -DHAVE_SDL3 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_CONCURRENT_LIB -DQT_MULTIMEDIA_LIB -DQT_MULTIMEDIAWIDGETS_LIB -DQT_SVG_LIB -D%(PreprocessorDefinitions) "-I.\..\3rdparty\SoundTouch\soundtouch\include" "-I.\..\3rdparty\cubeb\extra" "-I.\..\3rdparty\cubeb\cubeb\include" "-I.\..\3rdparty\flatbuffers\include" "-I.\..\3rdparty\wolfssl\wolfssl" "-I.\..\3rdparty\curl\curl\include" "-I.\..\3rdparty\libusb\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtCore" "-I.\debug" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtMultimedia" "-I$(QTDIR)\include\QtMultimediaWidgets" "-I$(QTDIR)\include\QtSvg"</Command>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Moc%27ing %(Identity)...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DWIN32_LEAN_AND_MEAN -DHAVE_VULKAN -DMINIUPNP_STATICLIB -DHAVE_SDL3 -DWITH_DISCORD_RPC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -DQT_CONCURRENT_LIB -DQT_MULTIMEDIA_LIB -DQT_MULTIMEDIAWIDGETS_LIB -DQT_SVG_LIB -D%(PreprocessorDefinitions) "-I.\..\3rdparty\SoundTouch\soundtouch\include" "-I.\..\3rdparty\cubeb\extra" "-I.\..\3rdparty\cubeb\cubeb\include" "-I.\..\3rdparty\flatbuffers\include" "-I.\..\3rdparty\wolfssl\wolfssl" "-I.\..\3rdparty\curl\curl\include" "-I.\..\3rdparty\libusb\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I.\..\3rdparty\libsdl-org\SDL\include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtCore" "-I.\release" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtMultimedia" "-I$(QTDIR)\include\QtMultimediaWidgets" "-I$(QTDIR)\include\QtSvg"</Command>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="rpcs3qt\game_list_context_menu.h">
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Moc%27ing %(Identity)...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DWIN32_LEAN_AND_MEAN -DHAVE_VULKAN -DMINIUPNP_STATICLIB -DHAVE_SDL3 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_CONCURRENT_LIB -DQT_MULTIMEDIA_LIB -DQT_MULTIMEDIAWIDGETS_LIB -DQT_SVG_LIB -D%(PreprocessorDefinitions) "-I.\..\3rdparty\SoundTouch\soundtouch\include" "-I.\..\3rdparty\cubeb\extra" "-I.\..\3rdparty\cubeb\cubeb\include" "-I.\..\3rdparty\flatbuffers\include" "-I.\..\3rdparty\wolfssl\wolfssl" "-I.\..\3rdparty\curl\curl\include" "-I.\..\3rdparty\libusb\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtCore" "-I.\debug" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtMultimedia" "-I$(QTDIR)\include\QtMultimediaWidgets" "-I$(QTDIR)\include\QtSvg"</Command>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Moc%27ing %(Identity)...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DWIN32_LEAN_AND_MEAN -DHAVE_VULKAN -DMINIUPNP_STATICLIB -DHAVE_SDL3 -DWITH_DISCORD_RPC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -DQT_CONCURRENT_LIB -DQT_MULTIMEDIA_LIB -DQT_MULTIMEDIAWIDGETS_LIB -DQT_SVG_LIB -D%(PreprocessorDefinitions) "-I.\..\3rdparty\SoundTouch\soundtouch\include" "-I.\..\3rdparty\cubeb\extra" "-I.\..\3rdparty\cubeb\cubeb\include" "-I.\..\3rdparty\flatbuffers\include" "-I.\..\3rdparty\wolfssl\wolfssl" "-I.\..\3rdparty\curl\curl\include" "-I.\..\3rdparty\libusb\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I.\..\3rdparty\libsdl-org\SDL\include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtCore" "-I.\release" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtConcurrent" "-I$(QTDIR)\include\QtMultimedia" "-I$(QTDIR)\include\QtMultimediaWidgets" "-I$(QTDIR)\include\QtSvg"</Command>
|
||||
</CustomBuild>
|
||||
<ClInclude Include="rpcs3qt\game_list_delegate.h" />
|
||||
<CustomBuild Include="rpcs3qt\game_list_table.h">
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
|
||||
@@ -2236,4 +2270,4 @@
|
||||
<UserProperties MocDir=".\QTGeneratedFiles\$(ConfigurationName)" Qt5Version_x0020_x64="$(DefaultQtVersion)" RccDir=".\QTGeneratedFiles" UicDir=".\QTGeneratedFiles" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -1254,6 +1254,24 @@
|
||||
<ClCompile Include="Input\sdl_camera_video_sink.cpp">
|
||||
<Filter>Io\camera</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="rpcs3qt\game_list_context_menu.cpp">
|
||||
<Filter>Gui\game list</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="rpcs3qt\game_list_actions.cpp">
|
||||
<Filter>Gui\game list</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QTGeneratedFiles\Debug\moc_game_list_context_menu.cpp">
|
||||
<Filter>Generated Files\Debug</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QTGeneratedFiles\Debug\moc_game_list_actions.cpp">
|
||||
<Filter>Generated Files\Debug</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QTGeneratedFiles\Release\moc_game_list_actions.cpp">
|
||||
<Filter>Generated Files\Release</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="QTGeneratedFiles\Release\moc_game_list_context_menu.cpp">
|
||||
<Filter>Generated Files\Release</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Input\ds4_pad_handler.h">
|
||||
@@ -1837,6 +1855,12 @@
|
||||
<CustomBuild Include="rpcs3qt\debugger_add_bp_window.h">
|
||||
<Filter>Gui\debugger</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="rpcs3qt\game_list_context_menu.h">
|
||||
<Filter>Gui\game list</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="rpcs3qt\game_list_actions.h">
|
||||
<Filter>Gui\game list</Filter>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="rpcs3.ico" />
|
||||
|
||||
@@ -31,7 +31,9 @@ add_library(rpcs3_ui STATIC
|
||||
flow_widget_item.cpp
|
||||
game_compatibility.cpp
|
||||
game_list.cpp
|
||||
game_list_actions.cpp
|
||||
game_list_base.cpp
|
||||
game_list_context_menu.cpp
|
||||
game_list_delegate.cpp
|
||||
game_list_frame.cpp
|
||||
game_list_grid.cpp
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,113 @@
|
||||
#pragma once
|
||||
|
||||
#include "gui_game_info.h"
|
||||
#include "shortcut_utils.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class progress_dialog;
|
||||
class game_list_frame;
|
||||
class gui_settings;
|
||||
|
||||
class game_list_actions : QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
game_list_actions(game_list_frame* frame, std::shared_ptr<gui_settings> gui_settings);
|
||||
virtual ~game_list_actions();
|
||||
|
||||
enum content_type
|
||||
{
|
||||
NO_CONTENT = 0,
|
||||
DISC = (1 << 0),
|
||||
DATA = (1 << 1),
|
||||
LOCKS = (1 << 2),
|
||||
CACHES = (1 << 3),
|
||||
CUSTOM_CONFIG = (1 << 4),
|
||||
ICONS = (1 << 5),
|
||||
SHORTCUTS = (1 << 6),
|
||||
SAVESTATES = (1 << 7),
|
||||
CAPTURES = (1 << 8),
|
||||
RECORDINGS = (1 << 9),
|
||||
SCREENSHOTS = (1 << 10)
|
||||
};
|
||||
|
||||
struct content_info
|
||||
{
|
||||
u16 content_types = NO_CONTENT; // Always set by SetContentList()
|
||||
bool clear_on_finish = true; // Always overridden by BatchRemoveContentLists()
|
||||
|
||||
bool is_single_selection = false;
|
||||
u16 in_games_dir_count = 0;
|
||||
QString info;
|
||||
std::map<std::string, std::set<std::string>> name_list;
|
||||
std::map<std::string, std::set<std::string>> path_list;
|
||||
std::set<std::string> disc_list;
|
||||
std::set<std::string> removed_disc_list; // Filled in by RemoveContentList()
|
||||
};
|
||||
|
||||
static bool IsGameRunning(const std::string& serial);
|
||||
|
||||
void CreateShortcuts(const std::vector<game_info>& games, const std::set<gui::utils::shortcut_location>& locations);
|
||||
|
||||
void ShowRemoveGameDialog(const std::vector<game_info>& games);
|
||||
void ShowGameInfoDialog(const std::vector<game_info>& games);
|
||||
|
||||
void BatchCreateCPUCaches(const std::vector<game_info>& games = {}, bool is_fast_compilation = false, bool is_interactive = false);
|
||||
void BatchRemoveCustomConfigurations(const std::vector<game_info>& games = {}, bool is_interactive = false);
|
||||
void BatchRemoveCustomPadConfigurations(const std::vector<game_info>& games = {}, bool is_interactive = false);
|
||||
void BatchRemoveShaderCaches(const std::vector<game_info>& games = {}, bool is_interactive = false);
|
||||
void BatchRemovePPUCaches(const std::vector<game_info>& games = {}, bool is_interactive = false);
|
||||
void BatchRemoveSPUCaches(const std::vector<game_info>& games = {}, bool is_interactive = false);
|
||||
void BatchRemoveHDD1Caches(const std::vector<game_info>& games = {}, bool is_interactive = false);
|
||||
void BatchRemoveAllCaches(const std::vector<game_info>& games = {}, bool is_interactive = false);
|
||||
|
||||
// NOTES:
|
||||
// - SetContentList() MUST always be called to set the content's info to be removed by:
|
||||
// - RemoveContentList()
|
||||
// - BatchRemoveContentLists()
|
||||
//
|
||||
void SetContentList(u16 content_types, const content_info& content_info);
|
||||
void BatchRemoveContentLists(const std::vector<game_info>& games = {}, bool is_interactive = false);
|
||||
|
||||
void ClearContentList(bool refresh = false);
|
||||
content_info GetContentInfo(const std::vector<game_info>& games);
|
||||
|
||||
bool ValidateRemoval(const std::string& serial, const std::string& path, const std::string& desc, bool is_interactive = false);
|
||||
bool ValidateBatchRemoval(const std::string& desc, bool is_interactive = false);
|
||||
|
||||
static bool CreateCPUCaches(const std::string& path, const std::string& serial = {}, bool is_fast_compilation = false);
|
||||
static bool CreateCPUCaches(const game_info& game, bool is_fast_compilation = false);
|
||||
bool RemoveCustomConfiguration(const std::string& serial, const game_info& game = nullptr, bool is_interactive = false);
|
||||
bool RemoveCustomPadConfiguration(const std::string& serial, const game_info& game = nullptr, bool is_interactive = false);
|
||||
bool RemoveShaderCache(const std::string& serial, bool is_interactive = false);
|
||||
bool RemovePPUCache(const std::string& serial, bool is_interactive = false);
|
||||
bool RemoveSPUCache(const std::string& serial, bool is_interactive = false);
|
||||
bool RemoveHDD1Cache(const std::string& serial, bool is_interactive = false);
|
||||
bool RemoveAllCaches(const std::string& serial, bool is_interactive = false);
|
||||
bool RemoveContentList(const std::string& serial, bool is_interactive = false);
|
||||
|
||||
static bool RemoveContentPath(const std::string& path, const std::string& desc);
|
||||
static u32 RemoveContentPathList(const std::set<std::string>& path_list, const std::string& desc);
|
||||
static bool RemoveContentBySerial(const std::string& base_dir, const std::string& serial, const std::string& desc);
|
||||
|
||||
private:
|
||||
game_list_frame* m_game_list_frame = nullptr;
|
||||
std::shared_ptr<gui_settings> m_gui_settings;
|
||||
|
||||
// NOTE:
|
||||
// m_content_info is used by:
|
||||
// - SetContentList()
|
||||
// - ClearContentList()
|
||||
// - GetContentInfo()
|
||||
// - RemoveContentList()
|
||||
// - BatchRemoveContentLists()
|
||||
//
|
||||
content_info m_content_info;
|
||||
|
||||
void BatchActionBySerials(progress_dialog* pdlg, const std::set<std::string>& serials,
|
||||
QString progressLabel, std::function<bool(const std::string&)> action,
|
||||
std::function<void(u32, u32)> cancel_log, std::function<void()> action_on_finish, bool refresh_on_finish,
|
||||
bool can_be_concurrent = false, std::function<bool()> should_wait_cb = {});
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include "gui_game_info.h"
|
||||
|
||||
#include "QMenu"
|
||||
|
||||
class game_list_actions;
|
||||
class game_list_frame;
|
||||
class gui_settings;
|
||||
class emu_settings;
|
||||
class persistent_settings;
|
||||
|
||||
class game_list_context_menu : QMenu
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
game_list_context_menu(game_list_frame* frame);
|
||||
virtual ~game_list_context_menu();
|
||||
|
||||
void show_menu(const std::vector<game_info>& games, const QPoint& global_pos);
|
||||
|
||||
private:
|
||||
void show_single_selection_context_menu(const game_info& gameinfo, const QPoint& global_pos);
|
||||
void show_multi_selection_context_menu(const std::vector<game_info>& games, const QPoint& global_pos);
|
||||
|
||||
game_list_frame* m_game_list_frame = nullptr;
|
||||
std::shared_ptr<game_list_actions> m_game_list_actions;
|
||||
std::shared_ptr<gui_settings> m_gui_settings;
|
||||
std::shared_ptr<emu_settings> m_emu_settings;
|
||||
std::shared_ptr<persistent_settings> m_persistent_settings;
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
+30
-114
@@ -1,20 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "game_list.h"
|
||||
#include "game_list_actions.h"
|
||||
#include "custom_dock_widget.h"
|
||||
#include "shortcut_utils.h"
|
||||
#include "Utilities/lockless.h"
|
||||
#include "Utilities/mutex.h"
|
||||
#include "util/auto_typemap.hpp"
|
||||
#include "Emu/config_mode.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QToolBar>
|
||||
#include <QStackedWidget>
|
||||
#include <QSet>
|
||||
#include <QTableWidgetItem>
|
||||
#include <QFutureWatcher>
|
||||
#include <QTimer>
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
@@ -56,61 +54,34 @@ public:
|
||||
void SetShowHidden(bool show);
|
||||
|
||||
game_compatibility* GetGameCompatibility() const { return m_game_compat; }
|
||||
|
||||
const std::vector<game_info>& GetGameInfo() const;
|
||||
|
||||
void CreateShortcuts(const std::vector<game_info>& games, const std::set<gui::utils::shortcut_location>& locations);
|
||||
const std::vector<game_info>& GetGameInfo() const { return m_game_data; }
|
||||
std::shared_ptr<game_list_actions> actions() const { return m_game_list_actions; }
|
||||
std::shared_ptr<gui_settings> get_gui_settings() const { return m_gui_settings; }
|
||||
std::shared_ptr<emu_settings> get_emu_settings() const { return m_emu_settings; }
|
||||
std::shared_ptr<persistent_settings> get_persistent_settings() const { return m_persistent_settings; }
|
||||
std::map<QString, QString>& notes() { return m_notes; }
|
||||
std::map<QString, QString>& titles() { return m_titles; }
|
||||
QSet<QString>& hidden_list() { return m_hidden_list; }
|
||||
|
||||
bool IsEntryVisible(const game_info& game, bool search_fallback = false) const;
|
||||
|
||||
enum content_type
|
||||
{
|
||||
NO_CONTENT = 0,
|
||||
DISC = (1 << 0),
|
||||
DATA = (1 << 1),
|
||||
LOCKS = (1 << 2),
|
||||
CACHES = (1 << 3),
|
||||
CUSTOM_CONFIG = (1 << 4),
|
||||
ICONS = (1 << 5),
|
||||
SHORTCUTS = (1 << 6),
|
||||
SAVESTATES = (1 << 7),
|
||||
CAPTURES = (1 << 8),
|
||||
RECORDINGS = (1 << 9),
|
||||
SCREENSHOTS = (1 << 10)
|
||||
};
|
||||
void ShowCustomConfigIcon(const game_info& game);
|
||||
|
||||
struct content_info
|
||||
// Enqueue slot for refreshed signal
|
||||
// Allowing for an individual container for each distinct use case (currently disabled and contains only one such entry)
|
||||
template <typename KeySlot = void, typename Func>
|
||||
void AddRefreshedSlot(Func&& func)
|
||||
{
|
||||
u16 content_types = NO_CONTENT; // Always set by SetContentList()
|
||||
bool clear_on_finish = true; // Always overridden by BatchRemoveContentLists()
|
||||
// NOTE: Remove assert when the need for individual containers arises
|
||||
static_assert(std::is_void_v<KeySlot>);
|
||||
|
||||
bool is_single_selection = false;
|
||||
u16 in_games_dir_count = 0;
|
||||
QString info;
|
||||
std::map<std::string, std::set<std::string>> name_list;
|
||||
std::map<std::string, std::set<std::string>> path_list;
|
||||
std::set<std::string> disc_list;
|
||||
std::set<std::string> removed_disc_list; // Filled in by RemoveContentList()
|
||||
};
|
||||
connect(this, &game_list_frame::Refreshed, this, [this, func = std::move(func)]() mutable
|
||||
{
|
||||
func(m_refresh_funcs_manage_type->get<GameIdsTable<KeySlot>>().m_done_paths);
|
||||
}, Qt::SingleShotConnection);
|
||||
}
|
||||
|
||||
public Q_SLOTS:
|
||||
void BatchCreateCPUCaches(const std::vector<game_info>& games = {}, bool is_fast_compilation = false, bool is_interactive = false);
|
||||
void BatchRemoveCustomConfigurations(const std::vector<game_info>& games = {}, bool is_interactive = false);
|
||||
void BatchRemoveCustomPadConfigurations(const std::vector<game_info>& games = {}, bool is_interactive = false);
|
||||
void BatchRemoveShaderCaches(const std::vector<game_info>& games = {}, bool is_interactive = false);
|
||||
void BatchRemovePPUCaches(const std::vector<game_info>& games = {}, bool is_interactive = false);
|
||||
void BatchRemoveSPUCaches(const std::vector<game_info>& games = {}, bool is_interactive = false);
|
||||
void BatchRemoveHDD1Caches(const std::vector<game_info>& games = {}, bool is_interactive = false);
|
||||
void BatchRemoveAllCaches(const std::vector<game_info>& games = {}, bool is_interactive = false);
|
||||
|
||||
// NOTES:
|
||||
// - SetContentList() MUST always be called to set the content's info to be removed by:
|
||||
// - RemoveContentList()
|
||||
// - BatchRemoveContentLists()
|
||||
//
|
||||
void SetContentList(u16 content_types, const content_info& content_info);
|
||||
void BatchRemoveContentLists(const std::vector<game_info>& games = {}, bool is_interactive = false);
|
||||
|
||||
void SetListMode(bool is_list);
|
||||
void SetSearchText(const QString& text);
|
||||
void SetShowCompatibilityInGrid(bool show);
|
||||
@@ -128,6 +99,7 @@ private Q_SLOTS:
|
||||
void doubleClickedSlot(QTableWidgetItem* item);
|
||||
void doubleClickedSlot(const game_info& game);
|
||||
void ItemSelectionChangedSlot();
|
||||
|
||||
Q_SIGNALS:
|
||||
void GameListFrameClosed();
|
||||
void NotifyGameSelection(const game_info& game);
|
||||
@@ -138,7 +110,12 @@ Q_SIGNALS:
|
||||
void Refreshed();
|
||||
void RequestSaveStateManager(const game_info& game);
|
||||
|
||||
public:
|
||||
protected:
|
||||
/** Override inherited method from Qt to allow signalling when close happened.*/
|
||||
void closeEvent(QCloseEvent* event) override;
|
||||
bool eventFilter(QObject *object, QEvent *event) override;
|
||||
|
||||
private:
|
||||
template <typename KeyType>
|
||||
struct GameIdsTable
|
||||
{
|
||||
@@ -146,76 +123,13 @@ public:
|
||||
std::set<std::string> m_done_paths;
|
||||
};
|
||||
|
||||
// Enqueue slot for refreshed signal
|
||||
// Allowing for an individual container for each distinct use case (currently disabled and contains only one such entry)
|
||||
template <typename KeySlot = void, typename Func>
|
||||
void AddRefreshedSlot(Func&& func)
|
||||
{
|
||||
// NOTE: Remove assert when the need for individual containers arises
|
||||
static_assert(std::is_void_v<KeySlot>);
|
||||
|
||||
connect(this, &game_list_frame::Refreshed, this, [this, func = std::move(func)]() mutable
|
||||
{
|
||||
func(m_refresh_funcs_manage_type->get<GameIdsTable<KeySlot>>().m_done_paths);
|
||||
}, Qt::SingleShotConnection);
|
||||
}
|
||||
|
||||
protected:
|
||||
/** Override inherited method from Qt to allow signalling when close happened.*/
|
||||
void closeEvent(QCloseEvent* event) override;
|
||||
bool eventFilter(QObject *object, QEvent *event) override;
|
||||
private:
|
||||
void push_path(const std::string& path, std::vector<std::string>& legit_paths);
|
||||
|
||||
QString get_header_text(int col) const;
|
||||
QString get_action_text(int col) const;
|
||||
|
||||
void ShowCustomConfigIcon(const game_info& game);
|
||||
bool SearchMatchesApp(const QString& name, const QString& serial, bool fallback = false) const;
|
||||
|
||||
void ShowSingleSelectionContextMenu(const game_info& gameinfo, QPoint& global_pos);
|
||||
void ShowMultiSelectionContextMenu(const std::vector<game_info>& games, QPoint& global_pos);
|
||||
|
||||
// NOTE:
|
||||
// m_content_info is used by:
|
||||
// - SetContentList()
|
||||
// - ClearContentList()
|
||||
// - GetContentInfo()
|
||||
// - RemoveContentList()
|
||||
// - BatchRemoveContentLists()
|
||||
//
|
||||
content_info m_content_info;
|
||||
|
||||
void ClearContentList(bool refresh = false);
|
||||
content_info GetContentInfo(const std::vector<game_info>& games);
|
||||
|
||||
void ShowRemoveGameDialog(const std::vector<game_info>& games);
|
||||
void ShowGameInfoDialog(const std::vector<game_info>& games);
|
||||
|
||||
static bool IsGameRunning(const std::string& serial);
|
||||
bool ValidateRemoval(const std::string& serial, const std::string& path, const std::string& desc, bool is_interactive = false);
|
||||
bool ValidateBatchRemoval(const std::string& desc, bool is_interactive = false);
|
||||
|
||||
static bool CreateCPUCaches(const std::string& path, const std::string& serial = {}, bool is_fast_compilation = false);
|
||||
static bool CreateCPUCaches(const game_info& game, bool is_fast_compilation = false);
|
||||
bool RemoveCustomConfiguration(const std::string& serial, const game_info& game = nullptr, bool is_interactive = false);
|
||||
bool RemoveCustomPadConfiguration(const std::string& serial, const game_info& game = nullptr, bool is_interactive = false);
|
||||
bool RemoveShaderCache(const std::string& serial, bool is_interactive = false);
|
||||
bool RemovePPUCache(const std::string& serial, bool is_interactive = false);
|
||||
bool RemoveSPUCache(const std::string& serial, bool is_interactive = false);
|
||||
bool RemoveHDD1Cache(const std::string& serial, bool is_interactive = false);
|
||||
bool RemoveAllCaches(const std::string& serial, bool is_interactive = false);
|
||||
bool RemoveContentList(const std::string& serial, bool is_interactive = false);
|
||||
|
||||
static bool RemoveContentPath(const std::string& path, const std::string& desc);
|
||||
static u32 RemoveContentPathList(const std::set<std::string>& path_list, const std::string& desc);
|
||||
static bool RemoveContentBySerial(const std::string& base_dir, const std::string& serial, const std::string& desc);
|
||||
|
||||
void BatchActionBySerials(progress_dialog* pdlg, const std::set<std::string>& serials,
|
||||
QString progressLabel, std::function<bool(const std::string&)> action,
|
||||
std::function<void(u32, u32)> cancel_log, std::function<void()> action_on_finish, bool refresh_on_finish,
|
||||
bool can_be_concurrent = false, std::function<bool()> should_wait_cb = {});
|
||||
|
||||
std::string CurrentSelectionPath();
|
||||
|
||||
game_info GetGameInfoByMode(const QTableWidgetItem* item) const;
|
||||
@@ -224,6 +138,8 @@ private:
|
||||
void WaitAndAbortRepaintThreads();
|
||||
void WaitAndAbortSizeCalcThreads();
|
||||
|
||||
std::shared_ptr<game_list_actions> m_game_list_actions;
|
||||
|
||||
// Which widget we are displaying depends on if we are in grid or list mode.
|
||||
QMainWindow* m_game_dock = nullptr;
|
||||
QStackedWidget* m_central_widget = nullptr;
|
||||
|
||||
@@ -3,10 +3,8 @@
|
||||
#include "game_list_grid_item.h"
|
||||
#include "gui_settings.h"
|
||||
#include "qt_utils.h"
|
||||
#include "Utilities/File.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QStringBuilder>
|
||||
|
||||
game_list_grid::game_list_grid()
|
||||
: flow_widget(nullptr), game_list_base()
|
||||
|
||||
@@ -2401,7 +2401,7 @@ void main_window::CreateShortCuts(const std::map<std::string, QString>& paths, b
|
||||
|
||||
if (!game_data_shortcuts.empty() && !locations.empty())
|
||||
{
|
||||
m_game_list_frame->CreateShortcuts(game_data_shortcuts, locations);
|
||||
m_game_list_frame->actions()->CreateShortcuts(game_data_shortcuts, locations);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2428,7 +2428,7 @@ void main_window::PrecompileCachesFromInstalledPackages(const std::map<std::stri
|
||||
|
||||
if (!game_data.empty())
|
||||
{
|
||||
m_game_list_frame->BatchCreateCPUCaches(game_data, true);
|
||||
m_game_list_frame->actions()->BatchCreateCPUCaches(game_data, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2724,40 +2724,40 @@ void main_window::CreateConnects()
|
||||
|
||||
connect(ui->batchCreateCPUCachesAct, &QAction::triggered, this, [this]()
|
||||
{
|
||||
m_game_list_frame->BatchCreateCPUCaches({}, false, true);
|
||||
m_game_list_frame->actions()->BatchCreateCPUCaches({}, false, true);
|
||||
});
|
||||
connect(ui->batchRemoveCustomConfigurationsAct, &QAction::triggered, this, [this]()
|
||||
{
|
||||
m_game_list_frame->BatchRemoveCustomConfigurations({}, true);
|
||||
m_game_list_frame->actions()->BatchRemoveCustomConfigurations({}, true);
|
||||
});
|
||||
connect(ui->batchRemoveCustomPadConfigurationsAct, &QAction::triggered, this, [this]()
|
||||
{
|
||||
m_game_list_frame->BatchRemoveCustomPadConfigurations({}, true);
|
||||
m_game_list_frame->actions()->BatchRemoveCustomPadConfigurations({}, true);
|
||||
});
|
||||
connect(ui->batchRemoveShaderCachesAct, &QAction::triggered, this, [this]()
|
||||
{
|
||||
m_game_list_frame->BatchRemoveShaderCaches({}, true);
|
||||
m_game_list_frame->actions()->BatchRemoveShaderCaches({}, true);
|
||||
});
|
||||
connect(ui->batchRemovePPUCachesAct, &QAction::triggered, this, [this]()
|
||||
{
|
||||
m_game_list_frame->BatchRemovePPUCaches({}, true);
|
||||
m_game_list_frame->actions()->BatchRemovePPUCaches({}, true);
|
||||
});
|
||||
connect(ui->batchRemoveSPUCachesAct, &QAction::triggered, this, [this]()
|
||||
{
|
||||
m_game_list_frame->BatchRemoveSPUCaches({}, true);
|
||||
m_game_list_frame->actions()->BatchRemoveSPUCaches({}, true);
|
||||
});
|
||||
connect(ui->removeHDD1CachesAct, &QAction::triggered, this, [this]()
|
||||
{
|
||||
m_game_list_frame->BatchRemoveHDD1Caches({}, true);
|
||||
m_game_list_frame->actions()->BatchRemoveHDD1Caches({}, true);
|
||||
});
|
||||
connect(ui->removeAllCachesAct, &QAction::triggered, this, [this]()
|
||||
{
|
||||
m_game_list_frame->BatchRemoveAllCaches({}, true);
|
||||
m_game_list_frame->actions()->BatchRemoveAllCaches({}, true);
|
||||
});
|
||||
connect(ui->removeSavestatesAct, &QAction::triggered, this, [this]()
|
||||
{
|
||||
m_game_list_frame->SetContentList(game_list_frame::content_type::SAVESTATES, {});
|
||||
m_game_list_frame->BatchRemoveContentLists({}, true);
|
||||
m_game_list_frame->actions()->SetContentList(game_list_actions::content_type::SAVESTATES, {});
|
||||
m_game_list_frame->actions()->BatchRemoveContentLists({}, true);
|
||||
});
|
||||
connect(ui->cleanUpGameListAct, &QAction::triggered, this, &main_window::CleanUpGameList);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user