general: Make most settings a BasicSetting

Creates a new BasicSettings class in common/settings, and forces setting
a default and label for each setting that uses it in common/settings.
Moves defaults and labels from both frontends into common settings.
Creates a helper function in each frontend to facillitate reading the
settings now with the new default and label properties.

Settings::Setting is also now a subclass of Settings::BasicSetting. Also
adds documentation for both Setting and BasicSetting.
This commit is contained in:
lat9nq 2021-06-28 15:58:16 -04:00
parent 2a3db91559
commit 794c444285
32 changed files with 813 additions and 666 deletions

View file

@ -166,7 +166,7 @@ void ConfigureProfileManager::PopulateUserList() {
void ConfigureProfileManager::UpdateCurrentUser() {
ui->pm_add->setEnabled(profile_manager->GetUserCount() < Service::Account::MAX_USERS);
const auto& current_user = profile_manager->GetUser(Settings::values.current_user);
const auto& current_user = profile_manager->GetUser(Settings::values.current_user.GetValue());
ASSERT(current_user);
const auto username = GetAccountUsername(*profile_manager, *current_user);
@ -245,15 +245,18 @@ void ConfigureProfileManager::DeleteUser() {
this, tr("Confirm Delete"),
tr("You are about to delete user with name \"%1\". Are you sure?").arg(username));
if (confirm == QMessageBox::No)
if (confirm == QMessageBox::No) {
return;
}
if (Settings::values.current_user == tree_view->currentIndex().row())
if (Settings::values.current_user.GetValue() == tree_view->currentIndex().row()) {
Settings::values.current_user = 0;
}
UpdateCurrentUser();
if (!profile_manager->RemoveUser(*uuid))
if (!profile_manager->RemoveUser(*uuid)) {
return;
}
item_model->removeRows(tree_view->currentIndex().row(), 1);
tree_view->clearSelection();