From 9866024666d3312d165ca86f8387b9ccebaa2fa4 Mon Sep 17 00:00:00 2001 From: Georg Zotti Date: Fri, 15 Sep 2023 00:45:43 +0200 Subject: [PATCH] Make directory for observing lists configurable (Fix #3165) --- guide/app_config_ini.tex | 1 + src/gui/ObsListDialog.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/guide/app_config_ini.tex b/guide/app_config_ini.tex index 3b9b79dee6e51..1ac6eb1a3067e 100644 --- a/guide/app_config_ini.tex +++ b/guide/app_config_ini.tex @@ -609,6 +609,7 @@ \subsection{\big[main\big]} screenshot\_custom\_width & int & custom width of screenshots. Max.\ available size is hardware dependent!\\ screenshot\_custom\_height & int & custom height of screenshots. Max.\ available size is hardware dependent!\\ screenshot\_dpi & int & DPI setting for screenshots. \\\midrule +observinglists\_dir & string & Default path for saving and loading observing lists. Defaults to the user's home dir.\\ version & string & Version of Stellarium. This parameter may be used to detect necessary changes in config.ini file, do not edit.\\%\midrule use\_separate\_output\_file & bool & Set to \emph{true} if you want to create a new file for script output for each start of Stellarium\\%\midrule restore\_defaults & bool & If \emph{true}, Stellarium will restore default settings at startup. diff --git a/src/gui/ObsListDialog.cpp b/src/gui/ObsListDialog.cpp index c1e983506ffdb..3bb5185c1d0a2 100644 --- a/src/gui/ObsListDialog.cpp +++ b/src/gui/ObsListDialog.cpp @@ -904,9 +904,10 @@ void ObsListDialog::editListButtonPressed() void ObsListDialog::exportListButtonPressed() { static const QString filter = "Stellarium Single Observing List (*.sol);;Stellarium Observing List (*.ol)"; + const QString destinationDir=StelApp::getInstance().getSettings()->value("main/observinglists_dir", QDir::homePath()).toString(); QString selectedFilter = "Stellarium Single Observing List (*.sol)"; QString exportListJsonPath = QFileDialog::getSaveFileName(nullptr, q_("Export observing list as..."), - QDir::homePath() + "/" + JSON_FILE_BASENAME + "_" + currentListName + ".sol", filter, &selectedFilter); + destinationDir + "/" + JSON_FILE_BASENAME + "_" + currentListName + ".sol", filter, &selectedFilter); QFile jsonFile(exportListJsonPath); if (!jsonFile.open(QIODevice::ReadWrite | QIODevice::Text)) @@ -950,8 +951,9 @@ void ObsListDialog::exportListButtonPressed() void ObsListDialog::importListButtonPressed() { static const QString filter = "Stellarium Single Observing List (*.sol);;Stellarium Observing List (*.ol);;Stellarium Legacy JSON Observing List or Bookmarks (*.json)"; + const QString destinationDir=StelApp::getInstance().getSettings()->value("main/observinglists_dir", QDir::homePath()).toString(); QString fileToImportJsonPath = QFileDialog::getOpenFileName(nullptr, q_("Import observing list"), - QDir::homePath(), + destinationDir, filter); QVariantMap map; QFile jsonFile(fileToImportJsonPath);