Add button to delete profiles and confirmation dialog
This commit is contained in:
parent
45a5f629e5
commit
70783fb28f
4 changed files with 54 additions and 19 deletions
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include "OpenRGBProfileSaveDialog.h"
|
||||
#include <QLabel>
|
||||
#include <QTabBar>
|
||||
#include <QMessageBox>
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ private slots:
|
|||
void on_ProfileSelected();
|
||||
void on_ButtonSaveProfile_clicked();
|
||||
void on_ButtonLoadProfile_clicked();
|
||||
void on_ButtonDeleteProfile_clicked();
|
||||
};
|
||||
|
||||
#endif // OPENRGBDIALOG2_H
|
||||
|
|
|
|||
|
|
@ -15,24 +15,7 @@
|
|||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="ButtonLoadProfile">
|
||||
<property name="text">
|
||||
<string>Load Profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="ButtonSaveProfile">
|
||||
<property name="text">
|
||||
<string>Save Profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QComboBox" name="ProfileBox"/>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<item row="2" column="0" colspan="4">
|
||||
<widget class="QTabWidget" name="MainTabBar">
|
||||
<property name="tabShape">
|
||||
<enum>QTabWidget::Rounded</enum>
|
||||
|
|
@ -96,6 +79,30 @@
|
|||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QComboBox" name="ProfileBox"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="ButtonLoadProfile">
|
||||
<property name="text">
|
||||
<string>Load Profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="ButtonSaveProfile">
|
||||
<property name="text">
|
||||
<string>Save Profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QPushButton" name="ButtonDeleteProfile">
|
||||
<property name="text">
|
||||
<string>Delete Profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue