Merge pull request #11434 from momocaoo/graphics-mod-folder-button

DolphinQt: Add button to open graphics mod folder on settings
This commit is contained in:
Pierre Bourdon 2023-01-31 14:35:21 +01:00 committed by GitHub
commit 2a2ee5d543
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View File

@ -4,15 +4,18 @@
#include "DolphinQt/Config/GraphicsModListWidget.h" #include "DolphinQt/Config/GraphicsModListWidget.h"
#include <QCheckBox> #include <QCheckBox>
#include <QDesktopServices>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QLabel> #include <QLabel>
#include <QListWidget> #include <QListWidget>
#include <QPushButton> #include <QPushButton>
#include <QUrl>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QWidget> #include <QWidget>
#include <set> #include <set>
#include "Common/FileUtil.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "DolphinQt/Config/GraphicsModWarningWidget.h" #include "DolphinQt/Config/GraphicsModWarningWidget.h"
@ -59,9 +62,10 @@ void GraphicsModListWidget::CreateWidgets()
m_mod_list->setSelectionRectVisible(true); m_mod_list->setSelectionRectVisible(true);
m_mod_list->setDragDropMode(QAbstractItemView::InternalMove); m_mod_list->setDragDropMode(QAbstractItemView::InternalMove);
m_open_directory_button = new QPushButton(tr("Open Directory..."));
m_refresh = new QPushButton(tr("&Refresh List")); m_refresh = new QPushButton(tr("&Refresh List"));
QHBoxLayout* hlayout = new QHBoxLayout; QHBoxLayout* hlayout = new QHBoxLayout;
hlayout->addStretch(); hlayout->addWidget(m_open_directory_button);
hlayout->addWidget(m_refresh); hlayout->addWidget(m_refresh);
left_v_layout->addWidget(m_mod_list); left_v_layout->addWidget(m_mod_list);
@ -99,6 +103,9 @@ void GraphicsModListWidget::ConnectWidgets()
connect(m_mod_list->model(), &QAbstractItemModel::rowsMoved, this, connect(m_mod_list->model(), &QAbstractItemModel::rowsMoved, this,
&GraphicsModListWidget::SaveModList); &GraphicsModListWidget::SaveModList);
connect(m_open_directory_button, &QPushButton::clicked, this,
&GraphicsModListWidget::OpenGraphicsModDir);
connect(m_refresh, &QPushButton::clicked, this, &GraphicsModListWidget::RefreshModList); connect(m_refresh, &QPushButton::clicked, this, &GraphicsModListWidget::RefreshModList);
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
@ -274,3 +281,9 @@ void GraphicsModListWidget::CalculateGameRunning(Core::State state)
m_loaded_game_is_running = m_loaded_game_is_running =
state == Core::State::Running ? m_game_id == SConfig::GetInstance().GetGameID() : false; state == Core::State::Running ? m_game_id == SConfig::GetInstance().GetGameID() : false;
} }
void GraphicsModListWidget::OpenGraphicsModDir()
{
QDesktopServices::openUrl(
QUrl::fromLocalFile(QString::fromStdString(File::GetUserPath(D_GRAPHICSMOD_IDX))));
}

View File

@ -58,6 +58,8 @@ private:
void ClearLayoutRecursively(QLayout* layout); void ClearLayoutRecursively(QLayout* layout);
void OpenGraphicsModDir();
void CalculateGameRunning(Core::State state); void CalculateGameRunning(Core::State state);
bool m_loaded_game_is_running = false; bool m_loaded_game_is_running = false;
bool m_needs_save = false; bool m_needs_save = false;
@ -67,6 +69,7 @@ private:
QLabel* m_selected_mod_name; QLabel* m_selected_mod_name;
QVBoxLayout* m_mod_meta_layout; QVBoxLayout* m_mod_meta_layout;
QPushButton* m_open_directory_button;
QPushButton* m_refresh; QPushButton* m_refresh;
GraphicsModWarningWidget* m_warning; GraphicsModWarningWidget* m_warning;