Skip to content

Commit b59a6a7

Browse files
committed
Ensured file paths are constant
1 parent 145faae commit b59a6a7

2 files changed

Lines changed: 5 additions & 13 deletions

File tree

src/gui/ObsListDialog.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ ObsListDialog::ObsListDialog(QObject *parent) :
5353
landscapeMgr(GETSTELMODULE(LandscapeMgr)),
5454
labelMgr(GETSTELMODULE(LabelMgr)),
5555
itemModel(new QStandardItemModel(0, ColumnCount)),
56+
observingListJsonPath(StelFileMgr::findFile("data", static_cast<StelFileMgr::Flags>(StelFileMgr::Directory | StelFileMgr::Writable)) + "/" + QString(JSON_FILE_NAME)),
57+
bookmarksJsonPath( StelFileMgr::findFile("data", static_cast<StelFileMgr::Flags>(StelFileMgr::Directory | StelFileMgr::Writable)) + "/" + QString(JSON_BOOKMARKS_FILE_NAME)),
5658
tainted(false),
5759
isEditMode(false),
5860
isCreationMode(false)
@@ -62,16 +64,6 @@ ObsListDialog::ObsListDialog(QObject *parent) :
6264
//Initialize the list of observing lists
6365
setObservingListHeaderNames();
6466

65-
observingListJsonPath =
66-
StelFileMgr::findFile("data",
67-
static_cast<StelFileMgr::Flags>(StelFileMgr::Directory | StelFileMgr::Writable)) +
68-
"/" +
69-
QString(JSON_FILE_NAME);
70-
bookmarksJsonPath =
71-
StelFileMgr::findFile("data",
72-
static_cast<StelFileMgr::Flags>(StelFileMgr::Directory | StelFileMgr::Writable)) +
73-
"/" +
74-
QString(JSON_BOOKMARKS_FILE_NAME);
7567
QSettings* conf = StelApp::getInstance().getSettings();
7668
flagUseJD = conf->value("bookmarks/useJD", false).toBool();
7769
flagUseLandscape = conf->value("bookmarks/useLandscape", false).toBool();

src/gui/ObsListDialog.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ class ObsListDialog : public StelDialog
150150
class LabelMgr *labelMgr;
151151

152152
QStandardItemModel *itemModel; //!< Data for the table display.
153-
QString observingListJsonPath; //!< Path to observingList.json file, set once in constructor. CURRENTLY reset in loading methods which is nonsense!
154-
QString bookmarksJsonPath; //!< Path to bookmarks.json, set once in constructor. INSTEAD: use file name as loading argument!
153+
const QString observingListJsonPath; //!< Path to observingList.json file, set once in constructor.
154+
const QString bookmarksJsonPath; //!< Path to bookmarks.json, set once in constructor.
155155

156156
//! This QVariantMap represents the contents of the observingList.json file. Read ONCE at start. Contains 4 key/value pairs:
157157
//! - defaultListOlud: The OLUD of the currently configured default list. If empty or invalid, the first list is used as default.
@@ -165,7 +165,7 @@ class ObsListDialog : public StelDialog
165165
QString defaultOlud; //!< OLUD (UUID) of default list
166166
QString selectedOlud; //!< OLUD has to be set before calling loadSelectedObservingList. Could be called currentListOlud
167167

168-
//! filled when loading a selected observing list. This is needed for the interaction with the table in GUI
168+
//! filled when loading a selected observing list. This is needed for the interaction with the table/itemModel in GUI
169169
QHash<QString, observingListItem> currentItemCollection;
170170

171171
QList<int> highlightLabelIDs; //!< int label IDs for addressing labels by the HighlightMgr

0 commit comments

Comments
 (0)