Use C++11 enum class

This commit is contained in:
Jonas Kvinge
2023-02-18 14:09:27 +01:00
parent e6c5f76872
commit dd72fb4ca5
237 changed files with 2915 additions and 2840 deletions

View File

@@ -76,18 +76,18 @@ void PlaylistSettingsPage::Load() {
ui_->checkbox_playlist_clear->setChecked(s.value("playlist_clear", true).toBool());
ui_->checkbox_auto_sort->setChecked(s.value("auto_sort", false).toBool());
PathType path_type = PathType(s.value("path_type", PathType_Automatic).toInt());
const PathType path_type = static_cast<PathType>(s.value("path_type", static_cast<int>(PathType::Automatic)).toInt());
switch (path_type) {
case PathType_Automatic:
case PathType::Automatic:
ui_->radiobutton_automaticpath->setChecked(true);
break;
case PathType_Absolute:
case PathType::Absolute:
ui_->radiobutton_absolutepath->setChecked(true);
break;
case PathType_Relative:
case PathType::Relative:
ui_->radiobutton_relativepath->setChecked(true);
break;
case PathType_Ask_User:
case PathType::Ask_User:
ui_->radiobutton_askpath->setChecked(true);
}
@@ -111,18 +111,18 @@ void PlaylistSettingsPage::Load() {
void PlaylistSettingsPage::Save() {
PathType path_type = PathType_Automatic;
PathType path_type = PathType::Automatic;
if (ui_->radiobutton_automaticpath->isChecked()) {
path_type = PathType_Automatic;
path_type = PathType::Automatic;
}
else if (ui_->radiobutton_absolutepath->isChecked()) {
path_type = PathType_Absolute;
path_type = PathType::Absolute;
}
else if (ui_->radiobutton_relativepath->isChecked()) {
path_type = PathType_Relative;
path_type = PathType::Relative;
}
else if (ui_->radiobutton_askpath->isChecked()) {
path_type = PathType_Ask_User;
path_type = PathType::Ask_User;
}
QSettings s;