From 0ca1f820599557c637721cf7ff1181c1a2c95250 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Thu, 5 Oct 2017 04:22:02 +0200 Subject: [PATCH] [Qt] fix experimental build warning layout and smoothen gamelist scrolling (#3532) * Qt: fix layout of "experimental build warning" for dpi scaling and remove compiler warning in welcome_dialog.ui * Qt: smoothen gamelist/-grid scrolling by setting singlestep value and fix missing scroll and deselect on gamegrid * Qt: show all bootable categories in gamegrid --- rpcs3/rpcs3qt/game_list.h | 2 +- rpcs3/rpcs3qt/game_list_frame.cpp | 10 +++++----- rpcs3/rpcs3qt/game_list_frame.h | 10 ++++++++++ rpcs3/rpcs3qt/game_list_grid.cpp | 3 +++ rpcs3/rpcs3qt/main_window.cpp | 13 ++++++++++++- rpcs3/rpcs3qt/welcome_dialog.ui | 1 - 6 files changed, 31 insertions(+), 8 deletions(-) diff --git a/rpcs3/rpcs3qt/game_list.h b/rpcs3/rpcs3qt/game_list.h index a2632f7fc4..bb8e902185 100644 --- a/rpcs3/rpcs3qt/game_list.h +++ b/rpcs3/rpcs3qt/game_list.h @@ -12,7 +12,7 @@ class game_list : public QTableWidget private: void mousePressEvent(QMouseEvent *event) { - if (!indexAt(event->pos()).isValid()) + if (!indexAt(event->pos()).isValid() || itemAt(event->pos())->data(Qt::UserRole) < 0) { clearSelection(); } diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index 6f2ddcb9e8..e2af1e3d08 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -153,6 +153,9 @@ game_list_frame::game_list_frame(std::shared_ptr settings, const R m_gameList->setSelectionBehavior(QAbstractItemView::SelectRows); m_gameList->setSelectionMode(QAbstractItemView::SingleSelection); m_gameList->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); + m_gameList->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); + m_gameList->verticalScrollBar()->setSingleStep(20); + m_gameList->horizontalScrollBar()->setSingleStep(20); m_gameList->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed); m_gameList->verticalHeader()->setMinimumSectionSize(m_Icon_Size.height()); m_gameList->verticalHeader()->setMaximumSectionSize(m_Icon_Size.height()); @@ -951,7 +954,7 @@ void game_list_frame::resizeEvent(QResizeEvent *event) { if (!m_isListLayout) { - Refresh(); + Refresh(false, m_xgrid->selectedItems().count()); } QDockWidget::resizeEvent(event); } @@ -1079,10 +1082,7 @@ void game_list_frame::PopulateGameGrid(uint maxCols, const QSize& image_size, co { continue; } - - QString category = qstr(m_game_data[i].info.category); - - if (category == category::hdd_Game || category == category::disc_Game) + if (category::CategoryInMap(m_game_data[i].info.category, category::cat_boot)) { QString title = GUI::get_Single_Line(qstr(m_game_data[i].info.name)); diff --git a/rpcs3/rpcs3qt/game_list_frame.h b/rpcs3/rpcs3qt/game_list_frame.h index 8a1a9ea9e7..7ac394311d 100644 --- a/rpcs3/rpcs3qt/game_list_frame.h +++ b/rpcs3/rpcs3qt/game_list_frame.h @@ -100,6 +100,16 @@ namespace category // (see PARAM.SFO in psdevwiki.com) TODO: Disc Categories const QStringList media = { app_Photo, app_Video, bc_Video, app_Music, app_TV, web_TV }; const QStringList data = { ps3_Data, ps2_Data, ps3_Save, psp_Save }; const QStringList others = { network, store_FE, trophy, other }; + + inline bool CategoryInMap(const std::string& cat, const q_from_char& map) + { + auto map_contains_category = [cat](std::pair p) + { + return p.second == qstr(cat); + }; + + return std::find_if(map.begin(), map.end(), map_contains_category) != map.end(); + } } namespace parental diff --git a/rpcs3/rpcs3qt/game_list_grid.cpp b/rpcs3/rpcs3qt/game_list_grid.cpp index 1a8f99acbe..147b17e0d5 100644 --- a/rpcs3/rpcs3qt/game_list_grid.cpp +++ b/rpcs3/rpcs3qt/game_list_grid.cpp @@ -4,6 +4,7 @@ #include #include +#include game_list_grid::game_list_grid(const QSize& icon_size, const QColor& icon_color, const qreal& margin_factor, const qreal& text_factor, const bool& showText) : game_list(), m_icon_size(icon_size), m_icon_color(icon_color), m_margin_factor(margin_factor), m_text_factor(text_factor), m_text_enabled(showText) @@ -28,6 +29,8 @@ game_list_grid::game_list_grid(const QSize& icon_size, const QColor& icon_color, setSelectionMode(QAbstractItemView::SingleSelection); setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); + verticalScrollBar()->setSingleStep(20); + horizontalScrollBar()->setSingleStep(20); setContextMenuPolicy(Qt::CustomContextMenu); verticalHeader()->setVisible(false); horizontalHeader()->setVisible(false); diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index a0b00cc849..34d2331a6b 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -132,9 +132,20 @@ void main_window::Init() msg.setWindowIcon(m_appIcon); msg.setIcon(QMessageBox::Critical); msg.setTextFormat(Qt::RichText); - msg.setText("Please understand that this build is not an official RPCS3 release.
This build contains changes that may break games, or even damage your data.
It's recommended to download and use the official build from RPCS3 website.

Build origin: " STRINGIZE(BRANCH) "
Do you wish to use this build anyway?"); msg.setStandardButtons(QMessageBox::Yes | QMessageBox::No); msg.setDefaultButton(QMessageBox::No); + msg.setText(QString( + R"( +

+ Please understand that this build is not an official RPCS3 release.
+ This build contains changes that may break games, or even damage your data.
+ We recommend to download and use the official build from the RPCS3 website.

+ Build origin: %1
+ Do you wish to use this build anyway? +

+ )" + ).arg(STRINGIZE(BRANCH))); + msg.layout()->setSizeConstraint(QLayout::SetFixedSize); if (msg.exec() == QMessageBox::No) { diff --git a/rpcs3/rpcs3qt/welcome_dialog.ui b/rpcs3/rpcs3qt/welcome_dialog.ui index 675d8f914b..f994c7ef51 100644 --- a/rpcs3/rpcs3qt/welcome_dialog.ui +++ b/rpcs3/rpcs3qt/welcome_dialog.ui @@ -152,7 +152,6 @@ -