mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-11-20 16:32:29 +00:00
feat(profiles): add "open profiles folder" button + add dropdown button for profile actions
Co-Authored-By: iTrooz <hey@itrooz.fr> Co-Authored-By: Max Chateau <maxban.chateau@gmail.com> Co-Authored-By: Damien R. <rodriguezdamien1677@gmail.com>
This commit is contained in:
parent
9c28f19e56
commit
a99cb008db
@ -6,6 +6,7 @@
|
|||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
#include <QDesktopServices>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
@ -14,6 +15,7 @@
|
|||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
|
#include <QUrl>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#include "Core/HotkeyManager.h"
|
#include "Core/HotkeyManager.h"
|
||||||
@ -143,7 +145,17 @@ void MappingWindow::CreateProfilesLayout()
|
|||||||
m_profiles_combo = new QComboBox();
|
m_profiles_combo = new QComboBox();
|
||||||
m_profiles_load = new NonDefaultQPushButton(tr("Load"));
|
m_profiles_load = new NonDefaultQPushButton(tr("Load"));
|
||||||
m_profiles_save = new NonDefaultQPushButton(tr("Save"));
|
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();
|
auto* button_layout = new QHBoxLayout();
|
||||||
|
|
||||||
@ -154,7 +166,7 @@ void MappingWindow::CreateProfilesLayout()
|
|||||||
m_profiles_layout->addWidget(m_profiles_combo);
|
m_profiles_layout->addWidget(m_profiles_combo);
|
||||||
button_layout->addWidget(m_profiles_load);
|
button_layout->addWidget(m_profiles_load);
|
||||||
button_layout->addWidget(m_profiles_save);
|
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_layout->addLayout(button_layout);
|
||||||
|
|
||||||
m_profiles_box->setLayout(m_profiles_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_reset_default, &QPushButton::clicked, this, &MappingWindow::OnDefaultFieldsPressed);
|
||||||
connect(m_profiles_save, &QPushButton::clicked, this, &MappingWindow::OnSaveProfilePressed);
|
connect(m_profiles_save, &QPushButton::clicked, this, &MappingWindow::OnSaveProfilePressed);
|
||||||
connect(m_profiles_load, &QPushButton::clicked, this, &MappingWindow::OnLoadProfilePressed);
|
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::currentIndexChanged, this, &MappingWindow::OnSelectProfile);
|
||||||
connect(m_profiles_combo, &QComboBox::editTextChanged, this,
|
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)
|
void MappingWindow::OnSelectDevice(int)
|
||||||
{
|
{
|
||||||
// Original string is stored in the "user-data".
|
// Original string is stored in the "user-data".
|
||||||
|
|||||||
@ -85,6 +85,7 @@ private:
|
|||||||
void OnDeleteProfilePressed();
|
void OnDeleteProfilePressed();
|
||||||
void OnLoadProfilePressed();
|
void OnLoadProfilePressed();
|
||||||
void OnSaveProfilePressed();
|
void OnSaveProfilePressed();
|
||||||
|
void OnOpenProfileFolder();
|
||||||
void UpdateProfileIndex();
|
void UpdateProfileIndex();
|
||||||
void UpdateProfileButtonState();
|
void UpdateProfileButtonState();
|
||||||
void PopulateProfileSelection();
|
void PopulateProfileSelection();
|
||||||
@ -115,7 +116,9 @@ private:
|
|||||||
QComboBox* m_profiles_combo;
|
QComboBox* m_profiles_combo;
|
||||||
QPushButton* m_profiles_load;
|
QPushButton* m_profiles_load;
|
||||||
QPushButton* m_profiles_save;
|
QPushButton* m_profiles_save;
|
||||||
QPushButton* m_profiles_delete;
|
QToolButton* m_profile_other_actions;
|
||||||
|
QAction* m_profiles_delete;
|
||||||
|
QAction* m_profiles_open_folder;
|
||||||
|
|
||||||
// Reset
|
// Reset
|
||||||
QGroupBox* m_reset_box;
|
QGroupBox* m_reset_box;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user