Skip to content

Commit

Permalink
Fixed selection the title of observing lists when he is saved or impo…
Browse files Browse the repository at this point in the history
…rted (fix #3623)
  • Loading branch information
alex-w committed Feb 3, 2024
1 parent 714ed63 commit 435131b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions src/gui/ObsListDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ void ObsListDialog::addModelRow(const QString &olud, const QString &designation,
* Load the lists names from jsonMap,
* Populate the list names into combo box and extract defaultOlud
*/
void ObsListDialog::loadListNames()
void ObsListDialog::loadListNames(const QString& listID)
{
listNames.clear();
QVariantMap::iterator i;
Expand All @@ -385,6 +385,14 @@ void ObsListDialog::loadListNames()
}
}
ui->obsListComboBox->model()->sort(0);
if (!listID.isEmpty())
{
// select observing list by OLUD
int idx = ui->obsListComboBox->findData(listID, Qt::UserRole);
if (idx<0)
idx = 0;
ui->obsListComboBox->setCurrentIndex(idx);
}

// If defaultOlud list not found, set first list as default.
if (!observingLists.contains(defaultOlud))
Expand Down Expand Up @@ -1114,7 +1122,7 @@ void ObsListDialog::importListButtonPressed()
tainted=false;

// Now we have stored to file, but the program is not aware of the new lists!
loadListNames(); // also populate Combobox and make sure at least some defaultOlud exists.
loadListNames(selectedOlud); // also populate Combobox and make sure at least some defaultOlud exists.
Q_ASSERT(selectedOlud.length()>0);

loadSelectedList();
Expand Down Expand Up @@ -1342,7 +1350,7 @@ void ObsListDialog::saveButtonPressed()

tainted=false;
switchEditMode(false, false); // Set GUI to normal mode
loadListNames(); // reload Combobox
loadListNames(selectedOlud); // reload Combobox
loadSelectedList();
}

Expand Down
2 changes: 1 addition & 1 deletion src/gui/ObsListDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class ObsListDialog : public StelDialog
//! Load the lists names from jsonMap,
//! Populate the list names into combo box and extract defaultOlud
//! Note that list names may not be unique, but the OLUDs must be.
void loadListNames();
void loadListNames(const QString &listID = "");

//! Load the selected observing list (selectedOlud) from the jsonMap.
void loadSelectedList();
Expand Down

0 comments on commit 435131b

Please sign in to comment.