mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-12-27 18:16:23 +00:00
initial work on new game_list
This commit is contained in:
parent
e2181f1ed9
commit
e95f542e34
45
shadPS4/gui/game_list_frame.cpp
Normal file
45
shadPS4/gui/game_list_frame.cpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
#include "game_list_frame.h"
|
||||
|
||||
|
||||
|
||||
void game_list_frame::FixNarrowColumns() const
|
||||
{
|
||||
qApp->processEvents();
|
||||
|
||||
// handle columns (other than the icon column) that have zero width after showing them (stuck between others)
|
||||
for (int col = 1; col < m_columnActs.count(); ++col)
|
||||
{
|
||||
if (m_game_list->isColumnHidden(col))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m_game_list->columnWidth(col) <= m_game_list->horizontalHeader()->minimumSectionSize())
|
||||
{
|
||||
m_game_list->setColumnWidth(col, m_game_list->horizontalHeader()->minimumSectionSize());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void game_list_frame::ResizeColumnsToContents(int spacing) const
|
||||
{
|
||||
if (!m_game_list)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_game_list->verticalHeader()->resizeSections(QHeaderView::ResizeMode::ResizeToContents);
|
||||
m_game_list->horizontalHeader()->resizeSections(QHeaderView::ResizeMode::ResizeToContents);
|
||||
|
||||
// Make non-icon columns slighty bigger for better visuals
|
||||
for (int i = 1; i < m_game_list->columnCount(); i++)
|
||||
{
|
||||
if (m_game_list->isColumnHidden(i))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const int size = m_game_list->horizontalHeader()->sectionSize(i) + spacing;
|
||||
m_game_list->horizontalHeader()->resizeSection(i, size);
|
||||
}
|
||||
}
|
23
shadPS4/gui/game_list_frame.h
Normal file
23
shadPS4/gui/game_list_frame.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#include "game_list_table.h"
|
||||
#include "shadps4gui.h"
|
||||
|
||||
#include <QHeaderView>
|
||||
|
||||
class game_list_frame
|
||||
{
|
||||
public :
|
||||
/** Fix columns with width smaller than the minimal section size */
|
||||
void FixNarrowColumns() const;
|
||||
|
||||
/** Resizes the columns to their contents and adds a small spacing */
|
||||
void ResizeColumnsToContents(int spacing = 20) const;
|
||||
|
||||
private:
|
||||
// Game List
|
||||
game_list_table* m_game_list = nullptr;
|
||||
QList<QAction*> m_columnActs;
|
||||
|
||||
};
|
||||
|
|
@ -17,6 +17,7 @@
|
|||
<ClCompile Include="emulator\Loader.cpp" />
|
||||
<ClCompile Include="gui\custom_table_widget_item.cpp" />
|
||||
<ClCompile Include="gui\GameListViewer.cpp" />
|
||||
<ClCompile Include="gui\game_list_frame.cpp" />
|
||||
<ClCompile Include="gui\game_list_grid.cpp" />
|
||||
<ClCompile Include="gui\game_list_grid_delegate.cpp" />
|
||||
<ClCompile Include="gui\game_list_table.cpp" />
|
||||
|
@ -41,6 +42,7 @@
|
|||
<ClInclude Include="emulator\Loader.h" />
|
||||
<ClInclude Include="gui\custom_table_widget_item.h" />
|
||||
<QtMoc Include="gui\game_list_grid.h" />
|
||||
<ClInclude Include="gui\game_list_frame.h" />
|
||||
<ClInclude Include="gui\game_list_grid_delegate.h" />
|
||||
<ClInclude Include="gui\game_list_table.h" />
|
||||
<ClInclude Include="gui\gui_settings.h" />
|
||||
|
|
|
@ -71,6 +71,9 @@
|
|||
<ClCompile Include="gui\game_list_grid.cpp">
|
||||
<Filter>gui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="gui\game_list_frame.cpp">
|
||||
<Filter>gui</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtUic Include="gui\shadps4gui.ui">
|
||||
|
@ -119,5 +122,8 @@
|
|||
<ClInclude Include="gui\game_list_grid_delegate.h">
|
||||
<Filter>gui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="gui\game_list_frame.h">
|
||||
<Filter>gui</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Reference in a new issue