Merge pull request #14068 from iTrooz/open_folder

feat(profiles): add "open profiles folder" button + add dropdown button for profile actions
This commit is contained in:
Admiral H. Curtiss 2025-11-09 14:29:18 +01:00 committed by GitHub
commit 29e2b0ff01
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 4 deletions

View File

@ -6,6 +6,7 @@
#include <QAction>
#include <QCheckBox>
#include <QComboBox>
#include <QDesktopServices>
#include <QDialogButtonBox>
#include <QGroupBox>
#include <QHBoxLayout>
@ -14,6 +15,7 @@
#include <QTabWidget>
#include <QTimer>
#include <QToolButton>
#include <QUrl>
#include <QVBoxLayout>
#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".

View File

@ -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;