diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp b/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp index e134902115..23ce80a489 100644 --- a/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -14,6 +15,7 @@ #include #include #include +#include #include #include "Core/HotkeyManager.h" @@ -143,7 +145,17 @@ void MappingWindow::CreateProfilesLayout() m_profiles_combo = new QComboBox(); m_profiles_load = new NonDefaultQPushButton(tr("Load")); m_profiles_save = new NonDefaultQPushButton(tr("Save")); - m_profiles_delete = new NonDefaultQPushButton(tr("Delete")); + + // Other actions + m_profile_other_actions = new QToolButton(); + m_profile_other_actions->setPopupMode(QToolButton::InstantPopup); + m_profile_other_actions->setArrowType(Qt::DownArrow); + m_profile_other_actions->setStyleSheet( + QStringLiteral("QToolButton::menu-indicator { image: none; }")); // remove other arrow + m_profiles_delete = new QAction(tr("Delete"), this); + m_profiles_open_folder = new QAction(tr("Open Folder"), this); + m_profile_other_actions->addAction(m_profiles_delete); + m_profile_other_actions->addAction(m_profiles_open_folder); auto* button_layout = new QHBoxLayout(); @@ -154,7 +166,7 @@ void MappingWindow::CreateProfilesLayout() m_profiles_layout->addWidget(m_profiles_combo); button_layout->addWidget(m_profiles_load); button_layout->addWidget(m_profiles_save); - button_layout->addWidget(m_profiles_delete); + button_layout->addWidget(m_profile_other_actions); m_profiles_layout->addLayout(button_layout); m_profiles_box->setLayout(m_profiles_layout); @@ -205,7 +217,8 @@ void MappingWindow::ConnectWidgets() connect(m_reset_default, &QPushButton::clicked, this, &MappingWindow::OnDefaultFieldsPressed); connect(m_profiles_save, &QPushButton::clicked, this, &MappingWindow::OnSaveProfilePressed); connect(m_profiles_load, &QPushButton::clicked, this, &MappingWindow::OnLoadProfilePressed); - connect(m_profiles_delete, &QPushButton::clicked, this, &MappingWindow::OnDeleteProfilePressed); + connect(m_profiles_delete, &QAction::triggered, this, &MappingWindow::OnDeleteProfilePressed); + connect(m_profiles_open_folder, &QAction::triggered, this, &MappingWindow::OnOpenProfileFolder); connect(m_profiles_combo, &QComboBox::currentIndexChanged, this, &MappingWindow::OnSelectProfile); connect(m_profiles_combo, &QComboBox::editTextChanged, this, @@ -350,6 +363,14 @@ void MappingWindow::OnSaveProfilePressed() } } +void MappingWindow::OnOpenProfileFolder() +{ + std::string path = m_config->GetUserProfileDirectoryPath(); + File::CreateDirs(path); + QUrl url = QUrl::fromLocalFile(QString::fromStdString(path)); + QDesktopServices::openUrl(url); +} + void MappingWindow::OnSelectDevice(int) { // Original string is stored in the "user-data". diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingWindow.h b/Source/Core/DolphinQt/Config/Mapping/MappingWindow.h index f07aac7fd4..222d3e3a58 100644 --- a/Source/Core/DolphinQt/Config/Mapping/MappingWindow.h +++ b/Source/Core/DolphinQt/Config/Mapping/MappingWindow.h @@ -85,6 +85,7 @@ private: void OnDeleteProfilePressed(); void OnLoadProfilePressed(); void OnSaveProfilePressed(); + void OnOpenProfileFolder(); void UpdateProfileIndex(); void UpdateProfileButtonState(); void PopulateProfileSelection(); @@ -115,7 +116,9 @@ private: QComboBox* m_profiles_combo; QPushButton* m_profiles_load; QPushButton* m_profiles_save; - QPushButton* m_profiles_delete; + QToolButton* m_profile_other_actions; + QAction* m_profiles_delete; + QAction* m_profiles_open_folder; // Reset QGroupBox* m_reset_box;