diff --git a/ProfileManager.cpp b/ProfileManager.cpp index d5bd2841..acd388e8 100644 --- a/ProfileManager.cpp +++ b/ProfileManager.cpp @@ -211,9 +211,11 @@ bool ProfileManager::LoadProfile(std::string profile_name) return(ret_val); } -void ProfileManager::DeleteProfile(std::string name) +void ProfileManager::DeleteProfile(std::string profile_name) { + remove(profile_name.c_str()); + UpdateProfileList(); } void ProfileManager::UpdateProfileList() diff --git a/qt/OpenRGBDialog2.cpp b/qt/OpenRGBDialog2.cpp index 996343f6..7b85ab1b 100644 --- a/qt/OpenRGBDialog2.cpp +++ b/qt/OpenRGBDialog2.cpp @@ -6,6 +6,7 @@ #include "OpenRGBProfileSaveDialog.h" #include #include +#include using namespace Ui; @@ -385,3 +386,27 @@ void Ui::OpenRGBDialog2::on_ButtonLoadProfile_clicked() } } } + +void Ui::OpenRGBDialog2::on_ButtonDeleteProfile_clicked() +{ + /*---------------------------------------------------------*\ + | Get the profile filename from the profiles list | + \*---------------------------------------------------------*/ + std::string profile_name = ui->ProfileBox->currentText().toStdString(); + + /*---------------------------------------------------------*\ + | Confirm we want to delete the profile | + \*---------------------------------------------------------*/ + QMessageBox::StandardButton reply; + reply = QMessageBox::question(this, "Delete Profile", "Do you really want to delete this profile?", QMessageBox::Yes|QMessageBox::No); + + /*---------------------------------------------------------*\ + | Load the profile | + \*---------------------------------------------------------*/ + if(reply == QMessageBox::Yes) + { + profile_manager.DeleteProfile(profile_name); + + RefreshProfileList(); + } +} diff --git a/qt/OpenRGBDialog2.h b/qt/OpenRGBDialog2.h index 5ed1ef28..9932df6b 100644 --- a/qt/OpenRGBDialog2.h +++ b/qt/OpenRGBDialog2.h @@ -55,6 +55,7 @@ private slots: void on_ProfileSelected(); void on_ButtonSaveProfile_clicked(); void on_ButtonLoadProfile_clicked(); + void on_ButtonDeleteProfile_clicked(); }; #endif // OPENRGBDIALOG2_H diff --git a/qt/OpenRGBDialog2.ui b/qt/OpenRGBDialog2.ui index f3902db9..5cd4dbc9 100644 --- a/qt/OpenRGBDialog2.ui +++ b/qt/OpenRGBDialog2.ui @@ -15,24 +15,7 @@ - - - - Load Profile - - - - - - - Save Profile - - - - - - - + QTabWidget::Rounded @@ -96,6 +79,30 @@ + + + + + + + Load Profile + + + + + + + Save Profile + + + + + + + Delete Profile + + +