Skip to content

Commit

Permalink
Merge pull request #11434 from momocaoo/graphics-mod-folder-button
Browse files Browse the repository at this point in the history
DolphinQt: Add button to open graphics mod folder on settings
  • Loading branch information
delroth committed Jan 31, 2023
2 parents e98ab07 + 05ed25d commit 2a2ee5d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Source/Core/DolphinQt/Config/GraphicsModListWidget.cpp
Expand Up @@ -4,15 +4,18 @@
#include "DolphinQt/Config/GraphicsModListWidget.h"

#include <QCheckBox>
#include <QDesktopServices>
#include <QHBoxLayout>
#include <QLabel>
#include <QListWidget>
#include <QPushButton>
#include <QUrl>
#include <QVBoxLayout>
#include <QWidget>

#include <set>

#include "Common/FileUtil.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "DolphinQt/Config/GraphicsModWarningWidget.h"
Expand Down Expand Up @@ -59,9 +62,10 @@ void GraphicsModListWidget::CreateWidgets()
m_mod_list->setSelectionRectVisible(true);
m_mod_list->setDragDropMode(QAbstractItemView::InternalMove);

m_open_directory_button = new QPushButton(tr("Open Directory..."));
m_refresh = new QPushButton(tr("&Refresh List"));
QHBoxLayout* hlayout = new QHBoxLayout;
hlayout->addStretch();
hlayout->addWidget(m_open_directory_button);
hlayout->addWidget(m_refresh);

left_v_layout->addWidget(m_mod_list);
Expand Down Expand Up @@ -99,6 +103,9 @@ void GraphicsModListWidget::ConnectWidgets()
connect(m_mod_list->model(), &QAbstractItemModel::rowsMoved, this,
&GraphicsModListWidget::SaveModList);

connect(m_open_directory_button, &QPushButton::clicked, this,
&GraphicsModListWidget::OpenGraphicsModDir);

connect(m_refresh, &QPushButton::clicked, this, &GraphicsModListWidget::RefreshModList);

connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
Expand Down Expand Up @@ -274,3 +281,9 @@ void GraphicsModListWidget::CalculateGameRunning(Core::State state)
m_loaded_game_is_running =
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))));
}
3 changes: 3 additions & 0 deletions Source/Core/DolphinQt/Config/GraphicsModListWidget.h
Expand Up @@ -58,6 +58,8 @@ class GraphicsModListWidget : public QWidget

void ClearLayoutRecursively(QLayout* layout);

void OpenGraphicsModDir();

void CalculateGameRunning(Core::State state);
bool m_loaded_game_is_running = false;
bool m_needs_save = false;
Expand All @@ -67,6 +69,7 @@ class GraphicsModListWidget : public QWidget
QLabel* m_selected_mod_name;
QVBoxLayout* m_mod_meta_layout;

QPushButton* m_open_directory_button;
QPushButton* m_refresh;
GraphicsModWarningWidget* m_warning;

Expand Down

0 comments on commit 2a2ee5d

Please sign in to comment.