From a161c9e74a839174e5b9937960c73dec6d0be909 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Thu, 9 Mar 2023 22:18:14 +0200 Subject: [PATCH] start reworking on adding the new gamelist part1 --- shadPS4/gui/game_list_frame.cpp | 36 +++++++++++++++++++++++++++++++++ shadPS4/gui/game_list_frame.h | 7 ++++++- shadPS4/gui/shadps4gui.cpp | 11 ++++++---- shadPS4/gui/shadps4gui.h | 1 + shadPS4/shadPS4.vcxproj | 5 ++++- shadPS4/shadPS4.vcxproj.filters | 9 ++++++--- 6 files changed, 60 insertions(+), 9 deletions(-) diff --git a/shadPS4/gui/game_list_frame.cpp b/shadPS4/gui/game_list_frame.cpp index f01313e8..2cb10e98 100644 --- a/shadPS4/gui/game_list_frame.cpp +++ b/shadPS4/gui/game_list_frame.cpp @@ -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(); diff --git a/shadPS4/gui/game_list_frame.h b/shadPS4/gui/game_list_frame.h index 0443ed9f..48dd7c08 100644 --- a/shadPS4/gui/game_list_frame.h +++ b/shadPS4/gui/game_list_frame.h @@ -4,10 +4,15 @@ #include "shadps4gui.h" #include +#include +#include -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; diff --git a/shadPS4/gui/shadps4gui.cpp b/shadPS4/gui/shadps4gui.cpp index 3b2b4214..c10d2eb1 100644 --- a/shadPS4/gui/shadps4gui.cpp +++ b/shadPS4/gui/shadps4gui.cpp @@ -12,11 +12,14 @@ shadps4gui::shadps4gui(std::shared_ptr 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() diff --git a/shadPS4/gui/shadps4gui.h b/shadPS4/gui/shadps4gui.h index 9f65ae78..ed559002 100644 --- a/shadPS4/gui/shadps4gui.h +++ b/shadPS4/gui/shadps4gui.h @@ -4,6 +4,7 @@ #include "ui_shadps4gui.h" #include "GameListViewer.h" #include "gui_settings.h" +#include "game_list_frame.h" class shadps4gui : public QMainWindow { diff --git a/shadPS4/shadPS4.vcxproj b/shadPS4/shadPS4.vcxproj index 817400ef..802acab7 100644 --- a/shadPS4/shadPS4.vcxproj +++ b/shadPS4/shadPS4.vcxproj @@ -42,12 +42,15 @@ - + + + + {F005E4D9-1FBE-40B3-9FBD-35CEC59081CD} QtVS_v304 diff --git a/shadPS4/shadPS4.vcxproj.filters b/shadPS4/shadPS4.vcxproj.filters index 8280e965..7e510f3c 100644 --- a/shadPS4/shadPS4.vcxproj.filters +++ b/shadPS4/shadPS4.vcxproj.filters @@ -90,6 +90,9 @@ gui + + gui + @@ -122,8 +125,8 @@ gui - - gui - + + + \ No newline at end of file