GUI: add custom config indicator (#3108)

* game_list: add custom config indicator

* icon resize: get rid of duplicate call (great performance boost)

* icon resize: only save on slider release or clicks (performance)

refactoring shenanigans

* game_list: skip filtered out games in Refresh (performance)

* settings_dialog: remove unnecessary show() that caused glitches

* gs_frame: add disableMouse setting

* fix travis warnings
This commit is contained in:
Megamouse 2017-07-28 22:03:48 +02:00 committed by Ivan
parent 9a1a7dd531
commit 4dbc546e7b
17 changed files with 154 additions and 83 deletions

BIN
rpcs3/Icons/cog_black.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
rpcs3/Icons/cog_gray.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

View file

@ -54,7 +54,8 @@
"alwaysStart": "Leave this enabled unless you are a developer.", "alwaysStart": "Leave this enabled unless you are a developer.",
"startGameFullscreen": "Automatically puts the game window in fullscreen.\nDouble click on the game window or press alt+enter to toggle fullscreen and windowed mode.", "startGameFullscreen": "Automatically puts the game window in fullscreen.\nDouble click on the game window or press alt+enter to toggle fullscreen and windowed mode.",
"showFPSInTitle": "It can be useful to disable it with buggy screen recording software that fail to select a window with ever changing title.", "showFPSInTitle": "It can be useful to disable it with buggy screen recording software that fail to select a window with ever changing title.",
"gs_resizeOnBoot": "Automatically resizes the game window on boot.\nThis does not change the internal game resolution." "gs_resizeOnBoot": "Automatically resizes the game window on boot.\nThis does not change the internal game resolution.",
"gs_disableMouse": "Disables the activation of fullscreen mode per doubleclick while the game screen is active.\nCheck this if you want to play with mouse and keyboard (for example with UCR)."
} }
}, },
"gpu": { "gpu": {

View file

@ -43,5 +43,7 @@
<file>Icons/play_blue.png</file> <file>Icons/play_blue.png</file>
<file>Icons/restart_blue.png</file> <file>Icons/restart_blue.png</file>
<file>Icons/stop_blue.png</file> <file>Icons/stop_blue.png</file>
<file>Icons/cog_black.png</file>
<file>Icons/cog_gray.png</file>
</qresource> </qresource>
</RCC> </RCC>

View file

@ -162,13 +162,15 @@ void rpcs3_app::InitializeCallbacks()
h = guiSettings->GetValue(GUI::gs_height).toInt(); h = guiSettings->GetValue(GUI::gs_height).toInt();
} }
bool disableMouse = guiSettings->GetValue(GUI::gs_disableMouse).toBool();
switch (video_renderer type = g_cfg.video.renderer) switch (video_renderer type = g_cfg.video.renderer)
{ {
case video_renderer::null: return std::make_unique<gs_frame>("Null", w, h, RPCS3MainWin->GetAppIcon()); case video_renderer::null: return std::make_unique<gs_frame>("Null", w, h, RPCS3MainWin->GetAppIcon(), disableMouse);
case video_renderer::opengl: return std::make_unique<gl_gs_frame>(w, h, RPCS3MainWin->GetAppIcon()); case video_renderer::opengl: return std::make_unique<gl_gs_frame>(w, h, RPCS3MainWin->GetAppIcon(), disableMouse);
case video_renderer::vulkan: return std::make_unique<gs_frame>("Vulkan", w, h, RPCS3MainWin->GetAppIcon()); case video_renderer::vulkan: return std::make_unique<gs_frame>("Vulkan", w, h, RPCS3MainWin->GetAppIcon(), disableMouse);
#ifdef _MSC_VER #ifdef _MSC_VER
case video_renderer::dx12: return std::make_unique<gs_frame>("DirectX 12", w, h, RPCS3MainWin->GetAppIcon()); case video_renderer::dx12: return std::make_unique<gs_frame>("DirectX 12", w, h, RPCS3MainWin->GetAppIcon(), disableMouse);
#endif #endif
default: fmt::throw_exception("Invalid video renderer: %s" HERE, type); default: fmt::throw_exception("Invalid video renderer: %s" HERE, type);
} }

View file

@ -213,6 +213,13 @@ game_list_frame::game_list_frame(std::shared_ptr<gui_settings> settings, const R
connect(m_xgrid, &QTableWidget::customContextMenuRequested, this, &game_list_frame::ShowContextMenu); connect(m_xgrid, &QTableWidget::customContextMenuRequested, this, &game_list_frame::ShowContextMenu);
connect(m_Slider_Size, &QSlider::valueChanged, this, &game_list_frame::RequestIconSizeActSet); connect(m_Slider_Size, &QSlider::valueChanged, this, &game_list_frame::RequestIconSizeActSet);
connect(m_Slider_Size, &QSlider::sliderReleased, this, [&]{ xgui_settings->SetValue(GUI::gl_iconSize, m_Slider_Size->value()); });
connect(m_Slider_Size, &QSlider::actionTriggered, [&](int action){
if (action != QAbstractSlider::SliderNoAction && action != QAbstractSlider::SliderMove)
{ // we only want to save on mouseclicks or slider release (the other connect handles this)
Q_EMIT RequestSaveSliderPos(true); // actionTriggered happens before the value was changed
}
});
connect(m_modeActs, &QActionGroup::triggered, [=](QAction* act) { connect(m_modeActs, &QActionGroup::triggered, [=](QAction* act) {
Q_EMIT RequestListModeActSet(act == m_modeActList.action); Q_EMIT RequestListModeActSet(act == m_modeActList.action);
@ -317,10 +324,10 @@ void game_list_frame::OnColClicked(int col)
// Filter for Categories // Filter for Categories
void game_list_frame::FilterData() void game_list_frame::FilterData()
{ {
for (int i = 0; i < gameList->rowCount(); ++i) for (auto& game : m_game_data)
{ {
bool match = false; bool match = false;
const QString category = qstr(m_game_data[i].info.category); const QString category = qstr(game.info.category);
for (const auto& filter : m_categoryFilters) for (const auto& filter : m_categoryFilters)
{ {
if (category.contains(filter)) if (category.contains(filter))
@ -329,7 +336,7 @@ void game_list_frame::FilterData()
break; break;
} }
} }
gameList->setRowHidden(i, !match || !SearchMatchesApp(m_game_data[i].info.name, m_game_data[i].info.serial)); game.isVisible = match && SearchMatchesApp(game.info.name, game.info.serial);
} }
} }
@ -432,27 +439,17 @@ void game_list_frame::Refresh(bool fromDrive)
// Load Image // Load Image
QImage img; QImage img;
QPixmap pxmap;
if (!game.icon_path.empty() && img.load(qstr(game.icon_path))) if (game.icon_path.empty() || !img.load(qstr(game.icon_path)))
{ {
QImage scaled = QImage(m_Icon_Size, QImage::Format_ARGB32); LOG_ERROR(GENERAL, "Could not load image from path %s", sstr(QDir(qstr(game.icon_path)).absolutePath()));
scaled.fill(m_Icon_Color);
QPainter painter(&scaled);
painter.drawImage(QPoint(0,0), img.scaled(m_Icon_Size, Qt::KeepAspectRatio, Qt::TransformationMode::SmoothTransformation));
painter.end();
pxmap = QPixmap::fromImage(scaled);
}
else
{
img = QImage(m_Icon_Size, QImage::Format_ARGB32);
QString abspath = QDir(qstr(game.icon_path)).absolutePath();
LOG_ERROR(GENERAL, "Could not load image from path %s", sstr(abspath));
img.fill(QColor(0, 0, 0, 0));
pxmap = QPixmap::fromImage(img);
} }
m_game_data.push_back({ game, img, pxmap, bootable }); bool hasCustomConfig = fs::is_file(fs::get_config_dir() + "data/" + game.serial + "/config.yml");
QPixmap pxmap = PaintedPixmap(img, hasCustomConfig);
m_game_data.push_back({ game, img, pxmap, true, bootable, hasCustomConfig });
} }
auto op = [](const GUI_GameInfo& game1, const GUI_GameInfo& game2) { auto op = [](const GUI_GameInfo& game1, const GUI_GameInfo& game2) {
@ -467,8 +464,8 @@ void game_list_frame::Refresh(bool fromDrive)
if (m_isListLayout) if (m_isListLayout)
{ {
int row = PopulateGameList();
FilterData(); FilterData();
int row = PopulateGameList();
gameList->selectRow(row); gameList->selectRow(row);
SortGameList(); SortGameList();
gameList->scrollTo(gameList->currentIndex(), QAbstractItemView::PositionAtCenter); gameList->scrollTo(gameList->currentIndex(), QAbstractItemView::PositionAtCenter);
@ -628,6 +625,7 @@ void game_list_frame::ShowSpecifiedContextMenu(const QPoint &pos, int row)
connect(boot, &QAction::triggered, [=]() {Boot(row); }); connect(boot, &QAction::triggered, [=]() {Boot(row); });
connect(configure, &QAction::triggered, [=]() { connect(configure, &QAction::triggered, [=]() {
settings_dialog (xgui_settings, m_Render_Creator, 0, this, &currGame).exec(); settings_dialog (xgui_settings, m_Render_Creator, 0, this, &currGame).exec();
Refresh(true);
}); });
connect(removeGame, &QAction::triggered, [=]() connect(removeGame, &QAction::triggered, [=]()
{ {
@ -638,7 +636,7 @@ void game_list_frame::ShowSpecifiedContextMenu(const QPoint &pos, int row)
Refresh(); Refresh();
} }
}); });
connect(removeConfig, &QAction::triggered, [=]() {RemoveCustomConfiguration(row); }); connect(removeConfig, &QAction::triggered, [=]() {RemoveCustomConfiguration(row); Refresh(true); });
connect(openGameFolder, &QAction::triggered, [=]() {open_dir(currGame.path); }); connect(openGameFolder, &QAction::triggered, [=]() {open_dir(currGame.path); });
connect(openConfig, &QAction::triggered, [=]() {open_dir(fs::get_config_dir() + "data/" + currGame.serial); }); connect(openConfig, &QAction::triggered, [=]() {open_dir(fs::get_config_dir() + "data/" + currGame.serial); });
connect(checkCompat, &QAction::triggered, [=]() { connect(checkCompat, &QAction::triggered, [=]() {
@ -667,10 +665,7 @@ void game_list_frame::ShowSpecifiedContextMenu(const QPoint &pos, int row)
} }
// Disable removeconfig if no config exists. // Disable removeconfig if no config exists.
if (fs::is_file(fs::get_config_dir() + "data/" + currGame.serial + "/config.yml") == false) removeConfig->setEnabled(m_game_data[row].hasCustomConfig);
{
removeConfig->setEnabled(false);
}
myMenu.exec(globalPos); myMenu.exec(globalPos);
} }
@ -720,6 +715,30 @@ void game_list_frame::RemoveCustomConfiguration(int row)
} }
} }
QPixmap game_list_frame::PaintedPixmap(const QImage& img, bool paintConfigIcon)
{
QImage scaled = QImage(m_Icon_Size, QImage::Format_ARGB32);
scaled.fill(m_Icon_Color);
QPainter painter(&scaled);
if (!img.isNull())
{
painter.drawImage(QPoint(0, 0), img.scaled(m_Icon_Size, Qt::KeepAspectRatio, Qt::TransformationMode::SmoothTransformation));
}
if (paintConfigIcon && !m_isListLayout)
{
int width = m_Icon_Size.width() * 0.2;
QPoint origin = QPoint(m_Icon_Size.width() - width, 0);
painter.drawImage(origin, QImage(":/Icons/cog_gray.png").scaled(QSize(width, width), Qt::KeepAspectRatio, Qt::TransformationMode::SmoothTransformation));
}
painter.end();
return QPixmap::fromImage(scaled);
}
void game_list_frame::ResizeIcons(const int& sliderPos) void game_list_frame::ResizeIcons(const int& sliderPos)
{ {
m_icon_size_index = sliderPos; m_icon_size_index = sliderPos;
@ -730,21 +749,19 @@ void game_list_frame::ResizeIcons(const int& sliderPos)
m_Slider_Size->setSliderPosition(sliderPos); m_Slider_Size->setSliderPosition(sliderPos);
} }
xgui_settings->SetValue(GUI::gl_iconSize, sliderPos); for (auto& game : m_game_data)
for (size_t i = 0; i < m_game_data.size(); i++)
{ {
QImage scaled = QImage(m_Icon_Size, QImage::Format_ARGB32); game.pxmap = PaintedPixmap(game.icon, game.hasCustomConfig);
scaled.fill(m_Icon_Color);
QPainter painter(&scaled);
painter.drawImage(QPoint(0, 0), m_game_data[i].icon.scaled(m_Icon_Size, Qt::KeepAspectRatio, Qt::TransformationMode::SmoothTransformation));
painter.end();
m_game_data[i].pxmap = QPixmap::fromImage(scaled);
} }
Refresh(); Refresh();
} }
int game_list_frame::GetSliderValue()
{
return m_Slider_Size->value();
}
void game_list_frame::SetListMode(const bool& isList) void game_list_frame::SetListMode(const bool& isList)
{ {
m_oldLayoutIsList = m_isListLayout; m_oldLayoutIsList = m_isListLayout;
@ -756,7 +773,7 @@ void game_list_frame::SetListMode(const bool& isList)
m_modeActList.action->setIcon(m_isListLayout ? m_modeActList.colored : m_modeActList.gray); m_modeActList.action->setIcon(m_isListLayout ? m_modeActList.colored : m_modeActList.gray);
m_modeActGrid.action->setIcon(m_isListLayout ? m_modeActGrid.gray : m_modeActGrid.colored); m_modeActGrid.action->setIcon(m_isListLayout ? m_modeActGrid.gray : m_modeActGrid.colored);
Refresh(); Refresh(true);
m_Central_Widget->setCurrentWidget(m_isListLayout ? gameList : m_xgrid); m_Central_Widget->setCurrentWidget(m_isListLayout ? gameList : m_xgrid);
} }
@ -836,8 +853,7 @@ int game_list_frame::PopulateGameList()
std::string selected_item = CurrentSelectionIconPath(); std::string selected_item = CurrentSelectionIconPath();
gameList->clearContents(); gameList->clearContents();
gameList->setRowCount((int)m_game_data.size());
gameList->setRowCount(m_game_data.size());
auto l_GetItem = [](const std::string& text) auto l_GetItem = [](const std::string& text)
{ {
@ -848,30 +864,43 @@ int game_list_frame::PopulateGameList()
}; };
int row = 0; int row = 0;
for (const GUI_GameInfo& game : m_game_data) for (size_t i = 0; i < m_game_data.size(); i++)
{ {
if (!m_game_data[i].isVisible)
{
continue;
}
// Icon // Icon
QTableWidgetItem* iconItem = new QTableWidgetItem; QTableWidgetItem* iconItem = new QTableWidgetItem;
iconItem->setFlags(iconItem->flags() & ~Qt::ItemIsEditable); iconItem->setFlags(iconItem->flags() & ~Qt::ItemIsEditable);
iconItem->setData(Qt::DecorationRole, game.pxmap); iconItem->setData(Qt::DecorationRole, m_game_data[i].pxmap);
iconItem->setData(Qt::UserRole, row); iconItem->setData(Qt::UserRole, (int)i);
QTableWidgetItem* titleItem = l_GetItem(m_game_data[i].info.name);
if (m_game_data[i].hasCustomConfig)
{
titleItem->setIcon(QIcon(":/Icons/cog_black.png"));
}
gameList->setItem(row, 0, iconItem); gameList->setItem(row, 0, iconItem);
gameList->setItem(row, 1, titleItem);
gameList->setItem(row, 2, l_GetItem(m_game_data[i].info.serial));
gameList->setItem(row, 3, l_GetItem(m_game_data[i].info.fw));
gameList->setItem(row, 4, l_GetItem(m_game_data[i].info.app_ver));
gameList->setItem(row, 5, l_GetItem(m_game_data[i].info.category));
gameList->setItem(row, 6, l_GetItem(m_game_data[i].info.path));
gameList->setItem(row, 7, l_GetItem(GetStringFromU32(m_game_data[i].info.resolution, resolution::mode, true)));
gameList->setItem(row, 8, l_GetItem(GetStringFromU32(m_game_data[i].info.sound_format, sound::format, true)));
gameList->setItem(row, 9, l_GetItem(GetStringFromU32(m_game_data[i].info.parental_lvl, parental::level)));
gameList->setItem(row, 1, l_GetItem(game.info.name)); if (selected_item == m_game_data[i].info.icon_path) result = row;
gameList->setItem(row, 2, l_GetItem(game.info.serial));
gameList->setItem(row, 3, l_GetItem(game.info.fw));
gameList->setItem(row, 4, l_GetItem(game.info.app_ver));
gameList->setItem(row, 5, l_GetItem(game.info.category));
gameList->setItem(row, 6, l_GetItem(game.info.path));
gameList->setItem(row, 7, l_GetItem(GetStringFromU32(game.info.resolution, resolution::mode, true)));
gameList->setItem(row, 8, l_GetItem(GetStringFromU32(game.info.sound_format, sound::format, true)));
gameList->setItem(row, 9, l_GetItem(GetStringFromU32(game.info.parental_lvl, parental::level)));
if (selected_item == game.info.icon_path) result = row;
row++; row++;
} }
gameList->setRowCount(row);
return result; return result;
} }

View file

@ -149,15 +149,17 @@ namespace sound
} }
/* Having the icons associated with the game info simplifies logic internally */ /* Having the icons associated with the game info simplifies logic internally */
typedef struct GUI_GameInfo struct GUI_GameInfo
{ {
GameInfo info; GameInfo info;
QImage icon; QImage icon;
QPixmap pxmap; QPixmap pxmap;
bool isVisible;
bool bootable; bool bootable;
bool hasCustomConfig;
}; };
typedef struct Tool_Bar_Button struct Tool_Bar_Button
{ {
QAction* action; QAction* action;
QIcon colored; QIcon colored;
@ -190,6 +192,8 @@ public:
/** Resize Gamelist Icons to size given by slider position */ /** Resize Gamelist Icons to size given by slider position */
void ResizeIcons(const int& sliderPos); void ResizeIcons(const int& sliderPos);
int GetSliderValue();
public Q_SLOTS: public Q_SLOTS:
void SetListMode(const bool& isList); void SetListMode(const bool& isList);
void SetToolBarVisible(const bool& showToolBar); void SetToolBarVisible(const bool& showToolBar);
@ -211,11 +215,13 @@ Q_SIGNALS:
void RequestIconSizeActSet(const int& idx); void RequestIconSizeActSet(const int& idx);
void RequestListModeActSet(const bool& isList); void RequestListModeActSet(const bool& isList);
void RequestCategoryActSet(const int& id); void RequestCategoryActSet(const int& id);
void RequestSaveSliderPos(const bool& save);
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) override;
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event) override;
private: private:
QPixmap PaintedPixmap(const QImage& img, bool paintConfigIcon = false);
void PopulateGameGrid(uint maxCols, const QSize& image_size, const QColor& image_color); void PopulateGameGrid(uint maxCols, const QSize& image_size, const QColor& image_color);
void FilterData(); void FilterData();
void SortGameList(); void SortGameList();

View file

@ -5,8 +5,8 @@
#include <QOpenGLContext> #include <QOpenGLContext>
#include <QWindow> #include <QWindow>
gl_gs_frame::gl_gs_frame(int w, int h, QIcon appIcon) gl_gs_frame::gl_gs_frame(int w, int h, QIcon appIcon, bool disableMouse)
: gs_frame("OpenGL", w, h, appIcon) : gs_frame("OpenGL", w, h, appIcon, disableMouse)
{ {
setSurfaceType(QSurface::OpenGLSurface); setSurfaceType(QSurface::OpenGLSurface);

View file

@ -9,7 +9,7 @@ private:
QSurfaceFormat m_format; QSurfaceFormat m_format;
public: public:
gl_gs_frame(int w, int h, QIcon appIcon); gl_gs_frame(int w, int h, QIcon appIcon, bool disableMouse);
void* make_context() override; void* make_context() override;
void set_current(draw_context_t context) override; void set_current(draw_context_t context) override;

View file

@ -10,11 +10,9 @@
inline QString qstr(const std::string& _in) { return QString::fromUtf8(_in.data(), _in.size()); } inline QString qstr(const std::string& _in) { return QString::fromUtf8(_in.data(), _in.size()); }
gs_frame::gs_frame(const QString& title, int w, int h, QIcon appIcon) gs_frame::gs_frame(const QString& title, int w, int h, QIcon appIcon, bool disableMouse)
: QWindow() : QWindow(), m_windowTitle(title), m_disable_mouse(disableMouse)
{ {
m_windowTitle = title;
if (!Emu.GetTitle().empty()) if (!Emu.GetTitle().empty())
{ {
m_windowTitle += qstr(" | " + Emu.GetTitle()); m_windowTitle += qstr(" | " + Emu.GetTitle());
@ -201,6 +199,8 @@ void gs_frame::flip(draw_context_t, bool /*skip_frame*/)
void gs_frame::mouseDoubleClickEvent(QMouseEvent* ev) void gs_frame::mouseDoubleClickEvent(QMouseEvent* ev)
{ {
if (m_disable_mouse) return;
if (ev->button() == Qt::LeftButton) if (ev->button() == Qt::LeftButton)
{ {
OnFullScreen(); OnFullScreen();

View file

@ -12,13 +12,14 @@ class gs_frame : public QWindow, public GSFrameBase
u64 m_frames = 0; u64 m_frames = 0;
QString m_windowTitle; QString m_windowTitle;
bool m_show_fps; bool m_show_fps;
bool m_disable_mouse;
public: public:
gs_frame(const QString& title, int w, int h, QIcon appIcon); gs_frame(const QString& title, int w, int h, QIcon appIcon, bool disableMouse);
protected: protected:
virtual void paintEvent(QPaintEvent *event); virtual void paintEvent(QPaintEvent *event);
void keyPressEvent(QKeyEvent *keyEvent); void keyPressEvent(QKeyEvent *keyEvent) override;
void OnFullScreen(); void OnFullScreen();
void close() override; void close() override;

View file

@ -113,9 +113,10 @@ namespace GUI
const GUI_SAVE m_saveNotes = GUI_SAVE(meta, "saveNotes", QVariantMap()); const GUI_SAVE m_saveNotes = GUI_SAVE(meta, "saveNotes", QVariantMap());
const GUI_SAVE m_showDebugTab = GUI_SAVE(meta, "showDebugTab", false); const GUI_SAVE m_showDebugTab = GUI_SAVE(meta, "showDebugTab", false);
const GUI_SAVE gs_resize = GUI_SAVE(gs_frame, "resize", false); const GUI_SAVE gs_disableMouse = GUI_SAVE(gs_frame, "disableMouse", false);
const GUI_SAVE gs_width = GUI_SAVE(gs_frame, "width", 1280); const GUI_SAVE gs_resize = GUI_SAVE(gs_frame, "resize", false);
const GUI_SAVE gs_height = GUI_SAVE(gs_frame, "height", 720); const GUI_SAVE gs_width = GUI_SAVE(gs_frame, "width", 1280);
const GUI_SAVE gs_height = GUI_SAVE(gs_frame, "height", 720);
} }
/** Class for GUI settings.. /** Class for GUI settings..

View file

@ -812,7 +812,7 @@ void main_window::BootRecentAction(const QAction* act)
} }
// path is invalid: remove action from list return // path is invalid: remove action from list return
if (containsPath && nam.isEmpty() || !QFileInfo(pth).isDir() && !QFileInfo(pth).isFile()) if ((containsPath && nam.isEmpty()) || (!QFileInfo(pth).isDir() && !QFileInfo(pth).isFile()))
{ {
if (containsPath) if (containsPath)
{ {
@ -867,7 +867,7 @@ void main_window::BootRecentAction(const QAction* act)
QAction* main_window::CreateRecentAction(const q_string_pair& entry, const uint& sc_idx) QAction* main_window::CreateRecentAction(const q_string_pair& entry, const uint& sc_idx)
{ {
// if path is not valid remove from list // if path is not valid remove from list
if (entry.second.isEmpty() || !QFileInfo(entry.first).isDir() && !QFileInfo(entry.first).isFile()) if (entry.second.isEmpty() || (!QFileInfo(entry.first).isDir() && !QFileInfo(entry.first).isFile()))
{ {
if (m_rg_entries.contains(entry)) if (m_rg_entries.contains(entry))
{ {
@ -1147,11 +1147,20 @@ void main_window::CreateConnects()
}); });
connect(ui->aboutQtAct, &QAction::triggered, qApp, &QApplication::aboutQt); connect(ui->aboutQtAct, &QAction::triggered, qApp, &QApplication::aboutQt);
auto resizeIcons = [=](const int& index){ auto resizeIcons = [=](const int& index){
if (ui->sizeSlider->value() != index) int val = ui->sizeSlider->value();
if (val != index)
{ {
ui->sizeSlider->setSliderPosition(index); ui->sizeSlider->setSliderPosition(index);
} }
gameListFrame->ResizeIcons(index); if (val != gameListFrame->GetSliderValue())
{
if (m_save_slider_pos)
{
m_save_slider_pos = false;
guiSettings->SetValue(GUI::gl_iconSize, index);
}
gameListFrame->ResizeIcons(index);
}
}; };
connect(iconSizeActGroup, &QActionGroup::triggered, [=](QAction* act) connect(iconSizeActGroup, &QActionGroup::triggered, [=](QAction* act)
{ {
@ -1175,6 +1184,7 @@ void main_window::CreateConnects()
resizeIcons(idx); resizeIcons(idx);
}); });
connect(gameListFrame, &game_list_frame::RequestSaveSliderPos, [=](const bool& save){ m_save_slider_pos = true; });
connect(gameListFrame, &game_list_frame::RequestListModeActSet, [=](const bool& isList) connect(gameListFrame, &game_list_frame::RequestListModeActSet, [=](const bool& isList)
{ {
isList ? ui->setlistModeListAct->trigger() : ui->setlistModeGridAct->trigger(); isList ? ui->setlistModeListAct->trigger() : ui->setlistModeGridAct->trigger();
@ -1212,6 +1222,13 @@ void main_window::CreateConnects()
connect(ui->toolbar_grid, &QAction::triggered, [=]() { ui->setlistModeGridAct->trigger(); }); connect(ui->toolbar_grid, &QAction::triggered, [=]() { ui->setlistModeGridAct->trigger(); });
//connect(ui->toolbar_sort, &QAction::triggered, gameListFrame, sort); //connect(ui->toolbar_sort, &QAction::triggered, gameListFrame, sort);
connect(ui->sizeSlider, &QSlider::valueChanged, resizeIcons); connect(ui->sizeSlider, &QSlider::valueChanged, resizeIcons);
connect(ui->sizeSlider, &QSlider::sliderReleased, this, [&] { guiSettings->SetValue(GUI::gl_iconSize, ui->sizeSlider->value()); });
connect(ui->sizeSlider, &QSlider::actionTriggered, [&](int action) {
if (action != QAbstractSlider::SliderNoAction && action != QAbstractSlider::SliderMove)
{ // we only want to save on mouseclicks or slider release (the other connect handles this)
m_save_slider_pos = true; // actionTriggered happens before the value was changed
}
});
connect(ui->searchBar, &QLineEdit::textChanged, gameListFrame, &game_list_frame::SetSearchText); connect(ui->searchBar, &QLineEdit::textChanged, gameListFrame, &game_list_frame::SetSearchText);
} }
@ -1359,7 +1376,7 @@ void main_window::ConfigureGuiFromSettings(bool configureAll)
void main_window::keyPressEvent(QKeyEvent *keyEvent) void main_window::keyPressEvent(QKeyEvent *keyEvent)
{ {
if ((keyEvent->modifiers() & Qt::AltModifier) && keyEvent->key() == Qt::Key_Return || isFullScreen() && keyEvent->key() == Qt::Key_Escape) if (((keyEvent->modifiers() & Qt::AltModifier) && keyEvent->key() == Qt::Key_Return) || (isFullScreen() && keyEvent->key() == Qt::Key_Escape))
{ {
ui->toolbar_fullscreen->trigger(); ui->toolbar_fullscreen->trigger();
} }

View file

@ -29,6 +29,7 @@ class main_window : public QMainWindow
Ui::main_window *ui; Ui::main_window *ui;
bool m_sys_menu_opened; bool m_sys_menu_opened;
bool m_save_slider_pos = false;
Render_Creator m_Render_Creator; Render_Creator m_Render_Creator;
@ -92,8 +93,8 @@ private:
void ConfigureGuiFromSettings(bool configureAll = false); void ConfigureGuiFromSettings(bool configureAll = false);
void EnableMenus(bool enabled); void EnableMenus(bool enabled);
void keyPressEvent(QKeyEvent *keyEvent); void keyPressEvent(QKeyEvent *keyEvent) override;
void mouseDoubleClickEvent(QMouseEvent *event); void mouseDoubleClickEvent(QMouseEvent *event) override;
QAction* CreateRecentAction(const q_string_pair& entry, const uint& sc_idx); QAction* CreateRecentAction(const q_string_pair& entry, const uint& sc_idx);
void BootRecentAction(const QAction* act); void BootRecentAction(const QAction* act);

View file

@ -71,7 +71,7 @@ public:
virtual void Init(const u32 max_connect) override; virtual void Init(const u32 max_connect) override;
explicit pad_settings_dialog(QWidget *parent = 0); explicit pad_settings_dialog(QWidget *parent = 0);
~pad_settings_dialog(); ~pad_settings_dialog();
void keyPressEvent(QKeyEvent *keyEvent); void keyPressEvent(QKeyEvent *keyEvent) override;
void UpdateLabel(); void UpdateLabel();
void UpdateTimerLabel(const u32 id); void UpdateTimerLabel(const u32 id);
void SwitchButtons(const bool IsEnabled); void SwitchButtons(const bool IsEnabled);

View file

@ -677,6 +677,8 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> xSettings, const
ui->gs_resizeOnBoot->setToolTip(json_emu_misc["gs_resizeOnBoot"].toString()); ui->gs_resizeOnBoot->setToolTip(json_emu_misc["gs_resizeOnBoot"].toString());
ui->gs_disableMouse->setToolTip(json_emu_misc["gs_disableMouse"].toString());
ui->cb_show_welcome->setToolTip(json_emu_gui["show_welcome"].toString()); ui->cb_show_welcome->setToolTip(json_emu_gui["show_welcome"].toString());
xemu_settings->EnhanceCheckBox(ui->exitOnStop, emu_settings::ExitRPCS3OnFinish); xemu_settings->EnhanceCheckBox(ui->exitOnStop, emu_settings::ExitRPCS3OnFinish);
@ -779,6 +781,9 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> xSettings, const
addColoredIcon(ui->pb_gl_tool_icon_color, xgui_settings->GetValue(GUI::gl_toolIconColor).value<QColor>(), QIcon(":/Icons/home_blue.png"), GUI::gl_tool_icon_color); addColoredIcon(ui->pb_gl_tool_icon_color, xgui_settings->GetValue(GUI::gl_toolIconColor).value<QColor>(), QIcon(":/Icons/home_blue.png"), GUI::gl_tool_icon_color);
addColoredIcon(ui->pb_tool_icon_color, xgui_settings->GetValue(GUI::mw_toolIconColor).value<QColor>(), QIcon(":/Icons/stop.png"), GUI::mw_tool_icon_color); addColoredIcon(ui->pb_tool_icon_color, xgui_settings->GetValue(GUI::mw_toolIconColor).value<QColor>(), QIcon(":/Icons/stop.png"), GUI::mw_tool_icon_color);
ui->gs_disableMouse->setChecked(xgui_settings->GetValue(GUI::gs_disableMouse).toBool());
connect(ui->gs_disableMouse, &QCheckBox::clicked, [=](bool val) { xgui_settings->SetValue(GUI::gs_disableMouse, val); });
bool enableButtons = xgui_settings->GetValue(GUI::gs_resize).toBool(); bool enableButtons = xgui_settings->GetValue(GUI::gs_resize).toBool();
ui->gs_resizeOnBoot->setChecked(enableButtons); ui->gs_resizeOnBoot->setChecked(enableButtons);
ui->gs_width->setEnabled(enableButtons); ui->gs_width->setEnabled(enableButtons);
@ -960,7 +965,6 @@ void settings_dialog::OnApplyStylesheet()
int settings_dialog::exec() int settings_dialog::exec()
{ {
show();
for (int i = 0; i < ui->tabWidget->count(); i++) for (int i = 0; i < ui->tabWidget->count(); i++)
{ {
ui->tabWidget->setCurrentIndex(i); ui->tabWidget->setCurrentIndex(i);

View file

@ -36,7 +36,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="coreTab"> <widget class="QWidget" name="coreTab">
<attribute name="title"> <attribute name="title">
@ -1102,6 +1102,13 @@
<string>Viewport</string> <string>Viewport</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_50"> <layout class="QVBoxLayout" name="verticalLayout_50">
<item>
<widget class="QCheckBox" name="gs_disableMouse">
<property name="text">
<string>Don't use doubleclick for Fullscreen mode</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="gs_resizeOnBoot"> <widget class="QCheckBox" name="gs_resizeOnBoot">
<property name="text"> <property name="text">