Grid Mode + Tool Bar (#2857)

* Grid layout

* Add Tiny Mode
fix scrolling
fix maxGamesPerRow calculation

* prime empty toolbar

* Add Search Bar, Icon Size and List Mode to ToolBar
Fix some minor glitches

* fix toolbar save and adjust default margin

* fix toolbar regression
minor simplification in Refresh

* Implement search and rename PopulateUI to PopulateGameList

* minor refactoring hehehehehehe

* Fix crash

* refresh speedboost optimizations

* Small refactoring of refresh to have default argument of false.

* add icons to toolbar

* fix scrambed order

* search for serial as well
This commit is contained in:
Megamouse 2017-06-11 16:07:00 +02:00 committed by Ani
parent 9aa632bcc1
commit a3d1f7b7b0
28 changed files with 1023 additions and 425 deletions

BIN
rpcs3/Icons/copy_blue.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
rpcs3/Icons/copy_gray.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
rpcs3/Icons/disc_blue.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
rpcs3/Icons/disc_gray.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
rpcs3/Icons/grid_blue.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
rpcs3/Icons/grid_gray.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
rpcs3/Icons/home_blue.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
rpcs3/Icons/home_gray.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
rpcs3/Icons/info_blue.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
rpcs3/Icons/info_gray.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
rpcs3/Icons/list_blue.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
rpcs3/Icons/list_gray.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
rpcs3/Icons/media_blue.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
rpcs3/Icons/media_gray.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -5,5 +5,21 @@
<file>Icons/restart.png</file> <file>Icons/restart.png</file>
<file>Icons/stop.png</file> <file>Icons/stop.png</file>
<file>rpcs3.ico</file> <file>rpcs3.ico</file>
<file>Icons/copy_blue.png</file>
<file>Icons/disc_blue.png</file>
<file>Icons/grid_blue.png</file>
<file>Icons/harddisk_blue.png</file>
<file>Icons/home_blue.png</file>
<file>Icons/info_blue.png</file>
<file>Icons/list_blue.png</file>
<file>Icons/media_blue.png</file>
<file>Icons/copy_gray.png</file>
<file>Icons/disc_gray.png</file>
<file>Icons/grid_gray.png</file>
<file>Icons/harddisk_gray.png</file>
<file>Icons/home_gray.png</file>
<file>Icons/info_gray.png</file>
<file>Icons/list_gray.png</file>
<file>Icons/media_gray.png</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -392,6 +392,11 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="QTGeneratedFiles\Debug - LLVM\moc_game_list_grid.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Debug - LLVM\moc_graphics_tab.cpp"> <ClCompile Include="QTGeneratedFiles\Debug - LLVM\moc_graphics_tab.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@ -532,6 +537,11 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="QTGeneratedFiles\Debug\moc_game_list_grid.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Debug\moc_graphics_tab.cpp"> <ClCompile Include="QTGeneratedFiles\Debug\moc_graphics_tab.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
@ -682,6 +692,11 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="QTGeneratedFiles\Release - LLVM\moc_game_list_grid.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Release - LLVM\moc_graphics_tab.cpp"> <ClCompile Include="QTGeneratedFiles\Release - LLVM\moc_graphics_tab.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
@ -822,6 +837,11 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="QTGeneratedFiles\Release\moc_game_list_grid.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Release\moc_graphics_tab.cpp"> <ClCompile Include="QTGeneratedFiles\Release\moc_graphics_tab.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@ -917,6 +937,8 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="rpcs3qt\game_list_grid.cpp" />
<ClCompile Include="rpcs3qt\game_list_grid_delegate.cpp" />
<ClCompile Include="rpcs3qt\welcome_dialog.cpp" /> <ClCompile Include="rpcs3qt\welcome_dialog.cpp" />
<ClCompile Include="rpcs3_app.cpp" /> <ClCompile Include="rpcs3_app.cpp" />
<ClCompile Include="rpcs3qt\audio_tab.cpp" /> <ClCompile Include="rpcs3qt\audio_tab.cpp" />
@ -1387,6 +1409,25 @@
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs> <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs> <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">$(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
</CustomBuild> </CustomBuild>
<CustomBuild Include="rpcs3qt\game_list_grid.h">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">Moc%27ing game_list_grid.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DNDEBUG -DQT_WINEXTRAS_LIB -DLLVM_AVAILABLE -D_UNICODE "-I.\..\Vulkan\Vulkan-LoaderAndValidationLayers\include" "-I.\..\3rdparty\minidx12\Include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtQuick" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtQml" "-I$(QTDIR)\include\QtNetwork" "-I$(QTDIR)\include\QtCore" "-I.\release" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)\." "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras" "-I$(NOINHERIT)\."</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Moc%27ing game_list_grid.h...</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 -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_WINEXTRAS_LIB -D_SCL_SECURE_NO_WARNINGS -D_UNICODE "-I.\..\Vulkan\Vulkan-LoaderAndValidationLayers\include" "-I.\.." "-I.\..\3rdparty\minidx12\Include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtQuick" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtQml" "-I$(QTDIR)\include\QtNetwork" "-I$(QTDIR)\include\QtCore" "-I.\debug" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)\." "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras" "-I$(NOINHERIT)\."</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Moc%27ing game_list_grid.h...</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 -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DNDEBUG -DQT_WINEXTRAS_LIB -D_UNICODE "-I.\..\Vulkan\Vulkan-LoaderAndValidationLayers\include" "-I.\..\3rdparty\minidx12\Include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtQuick" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtQml" "-I$(QTDIR)\include\QtNetwork" "-I$(QTDIR)\include\QtCore" "-I.\release" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)\." "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras" "-I$(NOINHERIT)\."</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">Moc%27ing game_list_grid.h...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_WINEXTRAS_LIB -DLLVM_AVAILABLE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE "-I.\..\Vulkan\Vulkan-LoaderAndValidationLayers\include" "-I.\.." "-I.\..\3rdparty\minidx12\Include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtOpenGL" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtQuick" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtQml" "-I$(QTDIR)\include\QtNetwork" "-I$(QTDIR)\include\QtCore" "-I.\debug" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)\." "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras" "-I$(NOINHERIT)\."</Command>
</CustomBuild>
<ClInclude Include="rpcs3qt\game_list_grid_delegate.h" />
<ClInclude Include="rpcs3qt\gl_gs_frame.h" /> <ClInclude Include="rpcs3qt\gl_gs_frame.h" />
<ClInclude Include="rpcs3qt\instruction_editor_dialog.h" /> <ClInclude Include="rpcs3qt\instruction_editor_dialog.h" />
<ClInclude Include="rpcs3qt\memory_viewer_panel.h" /> <ClInclude Include="rpcs3qt\memory_viewer_panel.h" />

View File

@ -513,6 +513,24 @@
<ClCompile Include="QTGeneratedFiles\Debug - LLVM\moc_welcome_dialog.cpp"> <ClCompile Include="QTGeneratedFiles\Debug - LLVM\moc_welcome_dialog.cpp">
<Filter>Generated Files\Debug - LLVM</Filter> <Filter>Generated Files\Debug - LLVM</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="rpcs3qt\game_list_grid.cpp">
<Filter>Gui</Filter>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Release - LLVM\moc_game_list_grid.cpp">
<Filter>Generated Files\Release - LLVM</Filter>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Debug\moc_game_list_grid.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Release\moc_game_list_grid.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Debug - LLVM\moc_game_list_grid.cpp">
<Filter>Generated Files\Debug - LLVM</Filter>
</ClCompile>
<ClCompile Include="rpcs3qt\game_list_grid_delegate.cpp">
<Filter>Gui</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="\Gui\*.h"> <ClInclude Include="\Gui\*.h">
@ -549,6 +567,9 @@
<ClInclude Include="rpcs3qt\register_editor_dialog.h"> <ClInclude Include="rpcs3qt\register_editor_dialog.h">
<Filter>Gui</Filter> <Filter>Gui</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="rpcs3qt\game_list_grid_delegate.h">
<Filter>Gui</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CustomBuild Include="debug\moc_predefs.h.cbt"> <CustomBuild Include="debug\moc_predefs.h.cbt">
@ -644,5 +665,8 @@
<CustomBuild Include="rpcs3qt\welcome_dialog.h"> <CustomBuild Include="rpcs3qt\welcome_dialog.h">
<Filter>Gui</Filter> <Filter>Gui</Filter>
</CustomBuild> </CustomBuild>
<CustomBuild Include="rpcs3qt\game_list_grid.h">
<Filter>Gui</Filter>
</CustomBuild>
</ItemGroup> </ItemGroup>
</Project> </Project>

File diff suppressed because it is too large Load Diff

View File

@ -4,63 +4,19 @@
#include "stdafx.h" #include "stdafx.h"
#include "Emu/GameInfo.h" #include "Emu/GameInfo.h"
#include "game_list_grid.h"
#include "gui_settings.h" #include "gui_settings.h"
#include "emu_settings.h" #include "emu_settings.h"
#include <QDockWidget> #include <QDockWidget>
#include <QList> #include <QList>
#include <QTableWidget> #include <QTableWidget>
#include <QMainWindow>
#include <QToolBar>
#include <QLineEdit>
#include <QStackedWidget>
struct Column #include <memory>
{
u32 pos;
u32 width;
bool shown;
std::vector<std::string> data;
const std::string name;
const u32 def_pos;
const u32 def_width;
Column(const u32 _def_pos, const u32 _def_width, const std::string& _name)
: def_pos(_def_pos)
, def_width(_def_width)
, pos(_def_pos)
, width(_def_width)
, shown(true)
, name(_name)
{
data.clear();
}
};
struct columns_arr
{
std::vector<Column> m_columns;
columns_arr(){};
columns_arr(QSize icon_Size);
Column* GetColumnByPos(u32 pos);
public:
Column* m_col_icon;
Column* m_col_name;
Column* m_col_serial;
Column* m_col_fw;
Column* m_col_app_ver;
Column* m_col_category;
Column* m_col_path;
QSize m_Icon_Size;
QList<QImage*>* m_img_list;
std::vector<int> m_icon_indexes;
void Update(const std::vector<GameInfo>& game_data);
void ShowData(QTableWidget* list);
};
namespace category namespace category
{ {
@ -72,23 +28,28 @@ namespace category
const QString unknown = QObject::tr("Unknown"); const QString unknown = QObject::tr("Unknown");
} }
/* Having the icons associated with the game info simplifies logic internally */
typedef struct GUI_GameInfo
{
GameInfo info;
QImage icon;
QPixmap pxmap;
};
typedef struct Tool_Bar_Button
{
QAction* action;
QIcon colored;
QIcon gray;
};
class game_list_frame : public QDockWidget { class game_list_frame : public QDockWidget {
Q_OBJECT Q_OBJECT
int m_sortColumn;
bool m_sortAscending;
std::vector<std::string> m_games;
std::vector<GameInfo> m_game_data;
gui_settings* m_gui_settings = new gui_settings(this);
QSize m_Icon_Size;
columns_arr m_columns;
QStringList m_categoryFilters;
Render_Creator m_Render_Creator;
public: public:
explicit game_list_frame(std::shared_ptr<gui_settings> settings, Render_Creator r_Creator, QWidget *parent = nullptr); explicit game_list_frame(std::shared_ptr<gui_settings> settings, Render_Creator r_Creator, QWidget *parent = nullptr);
~game_list_frame(); ~game_list_frame();
void Refresh(); void Refresh(const bool fromDrive = false);
void ToggleCategoryFilter(QString category, bool show); void ToggleCategoryFilter(QString category, bool show);
/** Loads from settings. Public so that main frame can easily reset these settings if needed. */ /** Loads from settings. Public so that main frame can easily reset these settings if needed. */
@ -99,31 +60,46 @@ public:
public slots: public slots:
/** Resize Gamelist Icons to size */ /** Resize Gamelist Icons to size */
void ResizeIcons(QSize size); void ResizeIcons(const QSize& size, const int& idx);
void SetListMode(const bool& isList);
void SetToolBarVisible(const bool& showToolBar);
void SetCategoryActIcon(const int& id, const bool& active);
private slots: private slots:
void Boot(int row); void Boot(int row);
void RemoveCustomConfiguration(int row); void RemoveCustomConfiguration(int row);
void OnColClicked(int col); void OnColClicked(int col);
void ShowContextMenu(const QPoint &pos);
void ShowSpecifiedContextMenu(const QPoint &pos, int index); // Different name because the notation for overloaded connects is messy
void doubleClickedSlot(const QModelIndex& index);
signals: signals:
void game_list_frameClosed(); void game_list_frameClosed();
void RequestIconPathSet(const std::string path); void RequestIconPathSet(const std::string path);
void RequestAddRecentGame(const q_string_pair& entry); void RequestAddRecentGame(const q_string_pair& entry);
void RequestIconSizeActSet(const int& idx);
void RequestListModeActSet(const bool& isList);
void RequestCategoryActSet(const int& id);
protected: protected:
/** Override inherited method from Qt to allow signalling when close happened.*/ /** Override inherited method from Qt to allow signalling when close happened.*/
void closeEvent(QCloseEvent* event); void closeEvent(QCloseEvent* event);
void resizeEvent(QResizeEvent *event);
private: private:
QTableWidget *gameList; game_list_grid* MakeGrid(uint maxCols, const QSize& image_size);
void ShowContextMenu(const QPoint &pos);
void doubleClickedSlot(const QModelIndex& index);
void LoadGames();
void LoadPSF();
void ShowData();
void FilterData(); void FilterData();
void PopulateGameList();
bool SearchMatchesApp(const std::string& name, const std::string& serial);
// Which widget we are displaying depends on if we are in grid or list mode.
QMainWindow* m_Game_Dock;
QStackedWidget* m_Central_Widget;
QToolBar* m_Tool_Bar;
QLineEdit* m_Search_Bar;
QSlider* m_Slider_Size;
QTableWidget *gameList;
std::unique_ptr<game_list_grid> m_xgrid;
// Actions regarding showing/hiding columns // Actions regarding showing/hiding columns
QAction* showIconColAct; QAction* showIconColAct;
QAction* showNameColAct; QAction* showNameColAct;
@ -134,7 +110,41 @@ private:
QAction* showPathColAct; QAction* showPathColAct;
QList<QAction*> columnActs; QList<QAction*> columnActs;
// Actions regarding showing/hiding categories
Tool_Bar_Button m_catActHDD;
Tool_Bar_Button m_catActDisc;
Tool_Bar_Button m_catActHome;
Tool_Bar_Button m_catActGameData;
Tool_Bar_Button m_catActAudioVideo;
Tool_Bar_Button m_catActUnknown;
QList<Tool_Bar_Button> m_categoryButtons;
QActionGroup* m_categoryActs;
// Actions regarding switching list modes
Tool_Bar_Button m_modeActList;
Tool_Bar_Button m_modeActGrid;
QActionGroup* m_modeActs;
// TODO: Reorganize this into a sensible order for private variables.
std::shared_ptr<gui_settings> xgui_settings; std::shared_ptr<gui_settings> xgui_settings;
int m_sortColumn;
Qt::SortOrder m_colSortOrder;
bool m_isListLayout = true;
bool m_showToolBar = true;
std::vector<GUI_GameInfo> m_game_data;
QSize m_Icon_Size;
QString m_Icon_Size_Str;
qreal m_Margin_Factor;
qreal m_Text_Factor;
QStringList m_categoryFilters;
Render_Creator m_Render_Creator;
uint m_games_per_row = 0;
}; };
#endif // GAMELISTFRAME_H #endif // GAMELISTFRAME_H

View File

@ -0,0 +1,89 @@
#include "game_list_grid.h"
#include "game_list_grid_delegate.h"
#include <QHeaderView>
game_list_grid::game_list_grid(const QSize& icon_size, const qreal& margin_factor, const qreal& text_factor, const bool& showText)
: QTableWidget(), m_icon_size(icon_size), m_margin_factor(margin_factor), m_text_factor(text_factor), m_text_enabled(showText)
{
QSize item_size;
if (m_text_enabled)
{
item_size = m_icon_size + QSize(m_icon_size.width() * m_margin_factor * 2, m_icon_size.height() * m_margin_factor * (m_text_factor + 1));
}
else
{
item_size = m_icon_size + m_icon_size * m_margin_factor * 2;
}
grid_item_delegate = new game_list_grid_delegate(item_size, m_margin_factor, m_text_factor, this);
setItemDelegate(grid_item_delegate);
setSelectionBehavior(QAbstractItemView::SelectItems);
setSelectionMode(QAbstractItemView::SingleSelection);
setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
setContextMenuPolicy(Qt::CustomContextMenu);
verticalHeader()->setVisible(false);
horizontalHeader()->setVisible(false);
setShowGrid(false);
}
game_list_grid::~game_list_grid()
{
}
void game_list_grid::enableText(const bool& enabled)
{
m_text_enabled = enabled;
}
void game_list_grid::setIconSize(const QSize& size)
{
if (m_text_enabled)
{
grid_item_delegate->setItemSize(size + QSize(size.width() * m_margin_factor * 2, size.height() * m_margin_factor * (m_text_factor + 1)));
}
else
{
grid_item_delegate->setItemSize(size + size * m_margin_factor * 2);
}
}
void game_list_grid::addItem(const QPixmap& img, const QString& name, const int& idx, const int& row, const int& col)
{
// define size of expanded image, which is raw image size + margins
QSize exp_size;
if (m_text_enabled)
{
exp_size = m_icon_size + QSize(m_icon_size.width() * m_margin_factor * 2, m_icon_size.height() * m_margin_factor * (m_text_factor + 1));
}
else
{
exp_size = m_icon_size + m_icon_size * m_margin_factor * 2;
}
// define offset for raw image placement
QPoint offset = QPoint(m_icon_size.width() * m_margin_factor, m_icon_size.height() * m_margin_factor);
// create empty canvas for expanded image
QImage exp_img = QImage(exp_size, QImage::Format_ARGB32);
exp_img.fill(Qt::transparent);
// place raw image inside expanded image
QPainter painter(&exp_img);
painter.drawPixmap(offset, img);
painter.end();
// create item with expanded image, title and position
QTableWidgetItem* item = new QTableWidgetItem();
item->setData(Qt::ItemDataRole::DecorationRole, QPixmap::fromImage(exp_img));
item->setData(Qt::ItemDataRole::UserRole, idx);
item->setData(Qt::ItemDataRole::ToolTipRole, name);
if (m_text_enabled) { item->setData(Qt::ItemDataRole::DisplayRole, name); }
setItem(row, col, item);
}
qreal game_list_grid::getMarginFactor()
{
return m_margin_factor;
}

View File

@ -0,0 +1,36 @@
#ifndef GAME_LIST_GRID_H
#define GAME_LIST_GRID_H
#include "game_list_grid_delegate.h"
#include <QWidget>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QScrollArea>
#include <QString>
#include <QTableWidget>
class game_list_grid : public QTableWidget
{
Q_OBJECT
QSize m_icon_size;
qreal m_margin_factor;
qreal m_text_factor;
bool m_text_enabled = true;
public:
explicit game_list_grid(const QSize& icon_size, const qreal& margin_factor, const qreal& text_factor, const bool& showText);
~game_list_grid();
void enableText(const bool& enabled);
void setIconSize(const QSize& size);
void addItem(const QPixmap& img, const QString& name, const int& idx, const int& row, const int& col);
qreal getMarginFactor();
private:
game_list_grid_delegate* grid_item_delegate;
};
#endif

View File

@ -0,0 +1,54 @@
#include "game_list_grid_delegate.h"
game_list_grid_delegate::game_list_grid_delegate(const QSize& size, const qreal& margin_factor, const qreal& text_factor, QObject *parent)
: QAbstractItemDelegate(parent), m_size(size), m_margin_factor(margin_factor), m_text_factor(text_factor)
{
}
game_list_grid_delegate::~game_list_grid_delegate()
{
}
void game_list_grid_delegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
{
QRect r = option.rect;
painter->eraseRect(r);
//Color: #333
QPen fontPen(QColor::fromRgb(51, 51, 51), 1, Qt::SolidLine);
//Get title and image
QPixmap image = (qvariant_cast<QPixmap>(index.data(Qt::DecorationRole)));
QString title = index.data(Qt::DisplayRole).toString();
// image
if (image.isNull() == false)
{
painter->drawPixmap(r, image);
}
// Add selection overlay
if (option.state & QStyle::State_Selected)
{
QLinearGradient gradientSelected(r.left(), r.top(), r.left(), r.height() + r.top());
gradientSelected.setColorAt(0.0, QColor::fromRgba(qRgba(119, 213, 247, 128)));
gradientSelected.setColorAt(0.9, QColor::fromRgba(qRgba(27, 134, 183, 128)));
gradientSelected.setColorAt(1.0, QColor::fromRgba(qRgba(0, 120, 174, 128)));
painter->fillRect(r, gradientSelected);
}
int h = r.height() / (1 + m_margin_factor + m_margin_factor*m_text_factor);
int height = r.height() - h - h * m_margin_factor;
int top = r.bottom() - height;
// title
painter->setPen(fontPen);
painter->setFont(QFont("Lucida Grande", 8, QFont::DemiBold));
painter->drawText(QRect(r.left(), top, r.width(), height), Qt::TextWordWrap | Qt::AlignCenter, title);
}
QSize game_list_grid_delegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const
{
return m_size;
}

View File

@ -0,0 +1,22 @@
#ifndef GAME_LIST_GRID_DELEGATE
#define GAME_LIST_GRID_DELEGATE
#include <QPainter>
#include <QAbstractItemDelegate>
class game_list_grid_delegate : public QAbstractItemDelegate
{
public:
game_list_grid_delegate(const QSize& imageSize, const qreal& margin_factor, const qreal& margin_ratio, QObject *parent = 0);
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const;
QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const;
void setItemSize(const QSize& size) { m_size = size; };
virtual ~game_list_grid_delegate();
private:
QSize m_size;
qreal m_margin_factor;
qreal m_text_factor;
};
#endif

View File

@ -28,15 +28,19 @@ typedef struct GUI_SAVE
typedef std::map<const QString, const QSize> icon_size; typedef std::map<const QString, const QSize> icon_size;
typedef QPair<QString, QString> q_string_pair; typedef QPair<QString, QString> q_string_pair;
typedef QPair<QString, QSize> q_size_pair;
typedef QList<q_string_pair> q_pair_list; typedef QList<q_string_pair> q_pair_list;
typedef QList<q_size_pair> q_size_list;
namespace GUI namespace GUI
{ {
const QString gl_icon_key_tiny = "tiny";
const QString gl_icon_key_small = "small"; const QString gl_icon_key_small = "small";
const QString gl_icon_key_medium = "medium"; const QString gl_icon_key_medium = "medium";
const QString gl_icon_key_large = "large"; const QString gl_icon_key_large = "large";
const icon_size gl_icon_size = { const q_size_list gl_icon_size = {
{ gl_icon_key_tiny, QSize(40, 22) },
{ gl_icon_key_small, QSize(80, 44) }, { gl_icon_key_small, QSize(80, 44) },
{ gl_icon_key_medium, QSize(160, 88) }, { gl_icon_key_medium, QSize(160, 88) },
{ gl_icon_key_large, QSize(320, 176) } { gl_icon_key_large, QSize(320, 176) }
@ -50,9 +54,9 @@ namespace GUI
const GUI_SAVE rg_freeze = GUI_SAVE(main_window, "recentGamesFrozen", false); const GUI_SAVE rg_freeze = GUI_SAVE(main_window, "recentGamesFrozen", false);
const GUI_SAVE rg_entries = GUI_SAVE(main_window, "recentGamesNames", QVariant::fromValue(q_pair_list())); const GUI_SAVE rg_entries = GUI_SAVE(main_window, "recentGamesNames", QVariant::fromValue(q_pair_list()));
const GUI_SAVE ib_pkg_success = GUI_SAVE( main_window, "infoBoxEnabledInstallPKG", true ); const GUI_SAVE ib_pkg_success = GUI_SAVE( main_window, "infoBoxEnabledInstallPKG", true );
const GUI_SAVE ib_pup_success = GUI_SAVE( main_window, "infoBoxEnabledInstallPUP", true ); const GUI_SAVE ib_pup_success = GUI_SAVE( main_window, "infoBoxEnabledInstallPUP", true );
const GUI_SAVE ib_show_welcome = GUI_SAVE(main_window, "infoBoxEnabledWelcome", true); const GUI_SAVE ib_show_welcome = GUI_SAVE( main_window, "infoBoxEnabledWelcome", true );
const GUI_SAVE fd_install_pkg = GUI_SAVE( main_window, "lastExplorePathPKG", "" ); const GUI_SAVE fd_install_pkg = GUI_SAVE( main_window, "lastExplorePathPKG", "" );
const GUI_SAVE fd_install_pup = GUI_SAVE( main_window, "lastExplorePathPUP", "" ); const GUI_SAVE fd_install_pup = GUI_SAVE( main_window, "lastExplorePathPUP", "" );
@ -75,10 +79,14 @@ namespace GUI
const GUI_SAVE cat_unknown = GUI_SAVE( game_list, "categoryVisibleUnknown", true ); const GUI_SAVE cat_unknown = GUI_SAVE( game_list, "categoryVisibleUnknown", true );
const GUI_SAVE cat_other = GUI_SAVE( game_list, "categoryVisibleOther", true ); const GUI_SAVE cat_other = GUI_SAVE( game_list, "categoryVisibleOther", true );
const GUI_SAVE gl_sortAsc = GUI_SAVE( game_list, "sortAsc", true ); const GUI_SAVE gl_sortAsc = GUI_SAVE( game_list, "sortAsc", true );
const GUI_SAVE gl_sortCol = GUI_SAVE( game_list, "sortCol", 1 ); const GUI_SAVE gl_sortCol = GUI_SAVE( game_list, "sortCol", 1 );
const GUI_SAVE gl_state = GUI_SAVE( game_list, "state", QByteArray() ); const GUI_SAVE gl_state = GUI_SAVE( game_list, "state", QByteArray() );
const GUI_SAVE gl_iconSize = GUI_SAVE( game_list, "iconSize", gl_icon_key_small); const GUI_SAVE gl_iconSize = GUI_SAVE( game_list, "iconSize", gl_icon_key_small );
const GUI_SAVE gl_listMode = GUI_SAVE( game_list, "listMode", true );
const GUI_SAVE gl_textFactor = GUI_SAVE( game_list, "textFactor", (qreal) 2.0 );
const GUI_SAVE gl_marginFactor = GUI_SAVE( game_list, "marginFactor", (qreal) 0.09 );
const GUI_SAVE gl_toolBarVisible = GUI_SAVE( game_list, "toolBarVisible", true );
const GUI_SAVE l_tty = GUI_SAVE( logger, "TTY", true ); const GUI_SAVE l_tty = GUI_SAVE( logger, "TTY", true );
const GUI_SAVE l_level = GUI_SAVE( logger, "level", (uint)(logs::level::success) ); const GUI_SAVE l_level = GUI_SAVE( logger, "level", (uint)(logs::level::success) );

View File

@ -351,7 +351,7 @@ void main_window::InstallPkg()
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes) QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes)
{ {
fs::remove_all(local_path); fs::remove_all(local_path);
gameListFrame->Refresh(); gameListFrame->Refresh(true);
LOG_SUCCESS(LOADER, "PKG: removed incomplete installation in %s", local_path); LOG_SUCCESS(LOADER, "PKG: removed incomplete installation in %s", local_path);
return; return;
} }
@ -377,7 +377,7 @@ void main_window::InstallPkg()
if (progress >= 1.) if (progress >= 1.)
{ {
gameListFrame->Refresh(); gameListFrame->Refresh(true);
LOG_SUCCESS(GENERAL, "Successfully installed %s.", fileName); LOG_SUCCESS(GENERAL, "Successfully installed %s.", fileName);
guiSettings->ShowInfoBox(GUI::ib_pkg_success, tr("Success!"), tr("Successfully installed software from package!"), this); guiSettings->ShowInfoBox(GUI::ib_pkg_success, tr("Success!"), tr("Successfully installed software from package!"), this);
@ -1027,6 +1027,9 @@ void main_window::CreateActions()
showControlsAct = new QAction(tr("Show Controls"), this); showControlsAct = new QAction(tr("Show Controls"), this);
showControlsAct->setCheckable(true); showControlsAct->setCheckable(true);
showGameListToolBarAct = new QAction(tr("Show Tool Bar"), this);
showGameListToolBarAct->setCheckable(true);
refreshGameListAct = new QAction(tr("&Refresh Game List"), this); refreshGameListAct = new QAction(tr("&Refresh Game List"), this);
showCatHDDGameAct = new QAction(category::hdd_Game, this); showCatHDDGameAct = new QAction(category::hdd_Game, this);
@ -1047,6 +1050,18 @@ void main_window::CreateActions()
showCatUnknownAct = new QAction(category::unknown, this); showCatUnknownAct = new QAction(category::unknown, this);
showCatUnknownAct->setCheckable(true); showCatUnknownAct->setCheckable(true);
categoryVisibleActGroup = new QActionGroup(this);
categoryVisibleActGroup->addAction(showCatHDDGameAct);
categoryVisibleActGroup->addAction(showCatDiscGameAct);
categoryVisibleActGroup->addAction(showCatHomeAct);
categoryVisibleActGroup->addAction(showCatAudioVideoAct);
categoryVisibleActGroup->addAction(showCatGameDataAct);
categoryVisibleActGroup->addAction(showCatUnknownAct);
categoryVisibleActGroup->setExclusive(false);
setIconSizeTinyAct = new QAction(tr("Tiny"), this);
setIconSizeTinyAct->setCheckable(true);
setIconSizeSmallAct = new QAction(tr("Small"), this); setIconSizeSmallAct = new QAction(tr("Small"), this);
setIconSizeSmallAct->setCheckable(true); setIconSizeSmallAct->setCheckable(true);
@ -1057,11 +1072,23 @@ void main_window::CreateActions()
setIconSizeLargeAct->setCheckable(true); setIconSizeLargeAct->setCheckable(true);
iconSizeActGroup = new QActionGroup(this); iconSizeActGroup = new QActionGroup(this);
iconSizeActGroup->addAction(setIconSizeTinyAct);
iconSizeActGroup->addAction(setIconSizeSmallAct); iconSizeActGroup->addAction(setIconSizeSmallAct);
iconSizeActGroup->addAction(setIconSizeMediumAct); iconSizeActGroup->addAction(setIconSizeMediumAct);
iconSizeActGroup->addAction(setIconSizeLargeAct); iconSizeActGroup->addAction(setIconSizeLargeAct);
setIconSizeSmallAct->setChecked(true); setIconSizeSmallAct->setChecked(true);
setlistModeListAct = new QAction(tr("List"), this);
setlistModeListAct->setCheckable(true);
setlistModeGridAct = new QAction(tr("Grid"), this);
setlistModeGridAct->setCheckable(true);
listModeActGroup = new QActionGroup(this);
listModeActGroup->addAction(setlistModeListAct);
listModeActGroup->addAction(setlistModeGridAct);
setlistModeListAct->setChecked(true);
aboutAct = new QAction(tr("&About"), this); aboutAct = new QAction(tr("&About"), this);
aboutAct->setStatusTip(tr("Show the application's About box")); aboutAct->setStatusTip(tr("Show the application's About box"));
@ -1166,32 +1193,27 @@ void main_window::CreateConnects()
checked ? controls->show() : controls->hide(); checked ? controls->show() : controls->hide();
guiSettings->SetValue(GUI::mw_controls, checked); guiSettings->SetValue(GUI::mw_controls, checked);
}); });
connect(showGameListToolBarAct, &QAction::triggered, this, [=](bool checked){
gameListFrame->SetToolBarVisible(checked);
});
connect(refreshGameListAct, &QAction::triggered, [=](){ connect(refreshGameListAct, &QAction::triggered, [=](){
gameListFrame->Refresh(); gameListFrame->Refresh(true);
}); });
connect(showCatHDDGameAct, &QAction::triggered, [=](bool checked){ connect(categoryVisibleActGroup, &QActionGroup::triggered, [=](QAction* act)
gameListFrame->ToggleCategoryFilter(category::hdd_Game, checked); {
guiSettings->SetCategoryVisibility(category::hdd_Game, checked); QString cat;
}); const bool& checked = act->isChecked();
connect(showCatDiscGameAct, &QAction::triggered, [=](bool checked){
gameListFrame->ToggleCategoryFilter(category::disc_Game, checked); if (act == showCatHDDGameAct) cat = category::hdd_Game;
guiSettings->SetCategoryVisibility(category::disc_Game, checked); else if (act == showCatDiscGameAct) cat = category::disc_Game;
}); else if (act == showCatHomeAct) cat = category::home;
connect(showCatHomeAct, &QAction::triggered, [=](bool checked){ else if (act == showCatAudioVideoAct) cat = category::audio_Video;
gameListFrame->ToggleCategoryFilter(category::home, checked); else if (act == showCatGameDataAct) cat = category::game_Data;
guiSettings->SetCategoryVisibility(category::home, checked); else if (act == showCatUnknownAct) cat = category::unknown;
});
connect(showCatAudioVideoAct, &QAction::triggered, [=](bool checked){ gameListFrame->SetCategoryActIcon(categoryVisibleActGroup->actions().indexOf(act), checked);
gameListFrame->ToggleCategoryFilter(category::audio_Video, checked); gameListFrame->ToggleCategoryFilter(cat, checked);
guiSettings->SetCategoryVisibility(category::audio_Video, checked); guiSettings->SetCategoryVisibility(cat, checked);
});
connect(showCatGameDataAct, &QAction::triggered, [=](bool checked){
gameListFrame->ToggleCategoryFilter(category::game_Data, checked);
guiSettings->SetCategoryVisibility(category::game_Data, checked);
});
connect(showCatUnknownAct, &QAction::triggered, [=](bool checked) {
gameListFrame->ToggleCategoryFilter(category::unknown, checked);
guiSettings->SetCategoryVisibility(category::unknown, checked);
}); });
connect(aboutAct, &QAction::triggered, this, &main_window::About); connect(aboutAct, &QAction::triggered, this, &main_window::About);
connect(aboutQtAct, &QAction::triggered, qApp, &QApplication::aboutQt); connect(aboutQtAct, &QAction::triggered, qApp, &QApplication::aboutQt);
@ -1207,10 +1229,37 @@ void main_window::CreateConnects()
if (act == setIconSizeLargeAct) key = GUI::gl_icon_key_large; if (act == setIconSizeLargeAct) key = GUI::gl_icon_key_large;
else if (act == setIconSizeMediumAct) key = GUI::gl_icon_key_medium; else if (act == setIconSizeMediumAct) key = GUI::gl_icon_key_medium;
else key = GUI::gl_icon_key_small; else if (act == setIconSizeSmallAct) key = GUI::gl_icon_key_small;
else key = GUI::gl_icon_key_tiny;
guiSettings->SetValue(GUI::gl_iconSize, key); guiSettings->SetValue(GUI::gl_iconSize, key);
gameListFrame->ResizeIcons(GUI::gl_icon_size.at(key));
for (int i = 0; i < GUI::gl_icon_size.count(); i++)
{
if (GUI::gl_icon_size.at(i).first == key)
{
gameListFrame->ResizeIcons(GUI::gl_icon_size.at(i).second, i);
break;
}
}
});
connect (gameListFrame, &game_list_frame::RequestIconSizeActSet, [=](const int& idx)
{
iconSizeActGroup->actions().at(idx)->trigger();
});
connect(gameListFrame, &game_list_frame::RequestListModeActSet, [=](const bool& isList)
{
isList ? setlistModeListAct->trigger() : setlistModeGridAct->trigger();
});
connect(gameListFrame, &game_list_frame::RequestCategoryActSet, [=](const int& id)
{
categoryVisibleActGroup->actions().at(id)->trigger();
});
connect(listModeActGroup, &QActionGroup::triggered, [=](QAction* act)
{
bool isList = act == setlistModeListAct;
gameListFrame->SetListMode(isList);
categoryVisibleActGroup->setEnabled(isList);
}); });
} }
@ -1261,20 +1310,17 @@ void main_window::CreateMenus()
viewMenu->addAction(showControlsAct); viewMenu->addAction(showControlsAct);
viewMenu->addSeparator(); viewMenu->addSeparator();
viewMenu->addAction(showGameListAct); viewMenu->addAction(showGameListAct);
viewMenu->addAction(showGameListToolBarAct);
viewMenu->addAction(refreshGameListAct); viewMenu->addAction(refreshGameListAct);
QMenu *categoryMenu = viewMenu->addMenu(tr("Show Categories")); QMenu *categoryMenu = viewMenu->addMenu(tr("Show Categories"));
categoryMenu->addAction(showCatHDDGameAct); categoryMenu->addActions(categoryVisibleActGroup->actions());
categoryMenu->addAction(showCatDiscGameAct);
categoryMenu->addAction(showCatHomeAct);
categoryMenu->addAction(showCatAudioVideoAct);
categoryMenu->addAction(showCatGameDataAct);
categoryMenu->addAction(showCatUnknownAct);
QMenu *iconSizeMenu = viewMenu->addMenu(tr("Icon Size")); QMenu *iconSizeMenu = viewMenu->addMenu(tr("Icon Size"));
iconSizeMenu->addAction(setIconSizeSmallAct); iconSizeMenu->addActions(iconSizeActGroup->actions());
iconSizeMenu->addAction(setIconSizeMediumAct);
iconSizeMenu->addAction(setIconSizeLargeAct); QMenu *listModeMenu = viewMenu->addMenu(tr("Game List Mode"));
listModeMenu->addActions(listModeActGroup->actions());
QMenu *helpMenu = menuBar()->addMenu(tr("&Help")); QMenu *helpMenu = menuBar()->addMenu(tr("&Help"));
helpMenu->addAction(aboutAct); helpMenu->addAction(aboutAct);
@ -1385,6 +1431,7 @@ void main_window::ConfigureGuiFromSettings(bool configureAll)
showGameListAct->setChecked(guiSettings->GetValue(GUI::mw_gamelist).toBool()); showGameListAct->setChecked(guiSettings->GetValue(GUI::mw_gamelist).toBool());
showDebuggerAct->setChecked(guiSettings->GetValue(GUI::mw_debugger).toBool()); showDebuggerAct->setChecked(guiSettings->GetValue(GUI::mw_debugger).toBool());
showControlsAct->setChecked(guiSettings->GetValue(GUI::mw_controls).toBool()); showControlsAct->setChecked(guiSettings->GetValue(GUI::mw_controls).toBool());
showGameListToolBarAct->setChecked(guiSettings->GetValue(GUI::gl_toolBarVisible).toBool());
guiSettings->GetValue(GUI::mw_controls).toBool() ? controls->show() : controls->hide(); guiSettings->GetValue(GUI::mw_controls).toBool() ? controls->show() : controls->hide();
showCatHDDGameAct->setChecked(guiSettings->GetCategoryVisibility(category::hdd_Game)); showCatHDDGameAct->setChecked(guiSettings->GetCategoryVisibility(category::hdd_Game));
@ -1397,7 +1444,15 @@ void main_window::ConfigureGuiFromSettings(bool configureAll)
QString key = guiSettings->GetValue(GUI::gl_iconSize).toString(); QString key = guiSettings->GetValue(GUI::gl_iconSize).toString();
if (key == GUI::gl_icon_key_large) setIconSizeLargeAct->setChecked(true); if (key == GUI::gl_icon_key_large) setIconSizeLargeAct->setChecked(true);
else if (key == GUI::gl_icon_key_medium) setIconSizeMediumAct->setChecked(true); else if (key == GUI::gl_icon_key_medium) setIconSizeMediumAct->setChecked(true);
else setIconSizeSmallAct->setChecked(true); else if (key == GUI::gl_icon_key_small) setIconSizeSmallAct->setChecked(true);
else setIconSizeTinyAct->setChecked(true);
bool isListMode = guiSettings->GetValue(GUI::gl_listMode).toBool();
if (isListMode) setlistModeListAct->setChecked(true);
else setlistModeGridAct->setChecked(true);
categoryVisibleActGroup->setEnabled(isListMode);
if (configureAll) if (configureAll)
{ {

View File

@ -98,6 +98,8 @@ private:
QList<QAction*> m_recentGameActs; QList<QAction*> m_recentGameActs;
QActionGroup* iconSizeActGroup; QActionGroup* iconSizeActGroup;
QActionGroup* listModeActGroup;
QActionGroup* categoryVisibleActGroup;
QAction *bootElfAct; QAction *bootElfAct;
QAction *bootGameAct; QAction *bootGameAct;
@ -125,15 +127,19 @@ private:
QAction *showGameListAct; QAction *showGameListAct;
QAction *showControlsAct; QAction *showControlsAct;
QAction *refreshGameListAct; QAction *refreshGameListAct;
QAction *showGameListToolBarAct;
QAction* showCatHDDGameAct; QAction* showCatHDDGameAct;
QAction* showCatDiscGameAct; QAction* showCatDiscGameAct;
QAction* showCatHomeAct; QAction* showCatHomeAct;
QAction* showCatAudioVideoAct; QAction* showCatAudioVideoAct;
QAction* showCatGameDataAct; QAction* showCatGameDataAct;
QAction* showCatUnknownAct; QAction* showCatUnknownAct;
QAction* setIconSizeTinyAct;
QAction* setIconSizeSmallAct; QAction* setIconSizeSmallAct;
QAction* setIconSizeMediumAct; QAction* setIconSizeMediumAct;
QAction* setIconSizeLargeAct; QAction* setIconSizeLargeAct;
QAction* setlistModeListAct;
QAction* setlistModeGridAct;
QAction *aboutAct; QAction *aboutAct;
QAction *aboutQtAct; QAction *aboutQtAct;