start reworking on adding the new gamelist part1

This commit is contained in:
georgemoralis 2023-03-09 22:18:14 +02:00
parent 8f51bd2fa0
commit a161c9e74a
6 changed files with 60 additions and 9 deletions

View file

@ -1,7 +1,43 @@
#include "game_list_frame.h"
#include "gui_settings.h"
game_list_frame::game_list_frame(QWidget* parent)
: QWidget(parent)
{
m_game_list = new game_list_table();
m_game_list->setShowGrid(false);
m_game_list->setEditTriggers(QAbstractItemView::NoEditTriggers);
m_game_list->setSelectionBehavior(QAbstractItemView::SelectRows);
m_game_list->setSelectionMode(QAbstractItemView::SingleSelection);
m_game_list->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
m_game_list->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
m_game_list->verticalScrollBar()->installEventFilter(this);
m_game_list->verticalScrollBar()->setSingleStep(20);
m_game_list->horizontalScrollBar()->setSingleStep(20);
m_game_list->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);
m_game_list->verticalHeader()->setVisible(false);
m_game_list->horizontalHeader()->setContextMenuPolicy(Qt::CustomContextMenu);
m_game_list->horizontalHeader()->setHighlightSections(false);
m_game_list->horizontalHeader()->setSortIndicatorShown(true);
m_game_list->horizontalHeader()->setStretchLastSection(true);
m_game_list->horizontalHeader()->setDefaultSectionSize(150);
m_game_list->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
m_game_list->setContextMenuPolicy(Qt::CustomContextMenu);
m_game_list->setAlternatingRowColors(true);
m_game_list->installEventFilter(this);
m_game_list->setColumnCount(gui::column_count);
//temp code
QVBoxLayout* layout = new QVBoxLayout;
layout->setContentsMargins(0, 0, 0, 0);
QSpacerItem* item = new QSpacerItem(100, 1, QSizePolicy::Expanding, QSizePolicy::Fixed);
layout->addWidget(m_game_list);
setLayout(layout);
//endof temp code
}
game_list_frame::~game_list_frame(){
}
void game_list_frame::FixNarrowColumns() const
{
qApp->processEvents();

View file

@ -4,10 +4,15 @@
#include "shadps4gui.h"
#include <QHeaderView>
#include <QScrollbar>
#include <QWidget>
class game_list_frame
class game_list_frame : public QWidget
{
Q_OBJECT
public :
explicit game_list_frame(QWidget* parent = nullptr);
~game_list_frame();
/** Fix columns with width smaller than the minimal section size */
void FixNarrowColumns() const;

View file

@ -12,11 +12,14 @@ shadps4gui::shadps4gui(std::shared_ptr<gui_settings> gui_settings, QWidget* pare
, m_gui_settings(std::move(gui_settings))
{
ui.setupUi(this);
game_list = new GameListViewer();
game_list->SetGamePath(QDir::currentPath() + "/game/");
ui.horizontalLayout->addWidget(game_list);
//game_list = new GameListViewer();
//game_list->SetGamePath(QDir::currentPath() + "/game/");
//ui.horizontalLayout->addWidget(game_list);
//show();
//game_list->PopulateAsync();
game_list_frame* game_list2 = new game_list_frame();
ui.horizontalLayout->addWidget(game_list2);
show();
game_list->PopulateAsync();
}
shadps4gui::~shadps4gui()

View file

@ -4,6 +4,7 @@
#include "ui_shadps4gui.h"
#include "GameListViewer.h"
#include "gui_settings.h"
#include "game_list_frame.h"
class shadps4gui : public QMainWindow
{

View file

@ -42,12 +42,15 @@
<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" />
<QtMoc 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" />
<ClInclude Include="Types.h" />
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{F005E4D9-1FBE-40B3-9FBD-35CEC59081CD}</ProjectGuid>
<Keyword>QtVS_v304</Keyword>

View file

@ -90,6 +90,9 @@
<QtMoc Include="gui\game_list_grid.h">
<Filter>gui</Filter>
</QtMoc>
<QtMoc Include="gui\game_list_frame.h">
<Filter>gui</Filter>
</QtMoc>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Types.h">
@ -122,8 +125,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>
<ItemGroup>
<None Include="cpp.hint" />
</ItemGroup>
</Project>