Removing .orp extension from profile names

This commit is contained in:
Jack 2021-02-19 03:29:39 +00:00 committed by Adam Honse
parent f0fbe17456
commit f844108022
2 changed files with 11 additions and 10 deletions

View file

@ -32,10 +32,15 @@ bool ProfileManager::SaveProfile(std::string profile_name)
\*---------------------------------------------------------*/
if(profile_name != "")
{
/*---------------------------------------------------------*\
| Extension .orp - OpenRgb Profile |
\*---------------------------------------------------------*/
std::string filename = profile_name + ".orp";
/*---------------------------------------------------------*\
| Open an output file in binary mode |
\*---------------------------------------------------------*/
std::ofstream controller_file(configuration_directory + profile_name, std::ios::out | std::ios::binary);
std::ofstream controller_file(configuration_directory + filename, std::ios::out | std::ios::binary);
/*---------------------------------------------------------*\
| Write header |
@ -334,7 +339,7 @@ bool ProfileManager::LoadProfileWithOptions
void ProfileManager::DeleteProfile(std::string profile_name)
{
remove((configuration_directory + profile_name).c_str());
remove((configuration_directory + profile_name + ".orp").c_str());
UpdateProfileList();
}
@ -373,6 +378,7 @@ void ProfileManager::UpdateProfileList()
/*---------------------------------------------------------*\
| Add this profile to the list |
\*---------------------------------------------------------*/
filename.erase(filename.length() - 4);
profile_list.push_back(filename);
}
}

View file

@ -141,7 +141,7 @@ bool OpenRGBDialog2::IsDarkTheme()
return true;
}
#endif
return false;
}
@ -770,7 +770,7 @@ void OpenRGBDialog2::UpdateDevicesList()
{
found = true;
QWidget* tab_widget = ui->InformationTabBar->widget(tab_idx);
ui->InformationTabBar->removeTab(tab_idx);
delete tab_widget;
@ -965,15 +965,10 @@ void Ui::OpenRGBDialog2::on_ButtonSaveProfile_clicked()
\*---------------------------------------------------------*/
std::string profile_name = dialog.show();
/*---------------------------------------------------------*\
| Extension .orp - OpenRgb Profile |
\*---------------------------------------------------------*/
std::string filename = profile_name + ".orp";
/*---------------------------------------------------------*\
| Save the profile |
\*---------------------------------------------------------*/
if(profile_manager->SaveProfile(filename))
if(profile_manager->SaveProfile(profile_name))
{
UpdateProfileList();
}