Skip to content

Commit

Permalink
Added option to include extra directories for scenery library scanning.
Browse files Browse the repository at this point in the history
Reworked scenery library page in options to use table instead of list.
#959
  • Loading branch information
albar965 committed Apr 27, 2023
1 parent 4608d4c commit 02ac6d7
Show file tree
Hide file tree
Showing 8 changed files with 461 additions and 252 deletions.
1 change: 1 addition & 0 deletions src/common/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ const QLatin1String OPTIONS_DIALOG_DB_DIR_DLG("OptionsDialog/DatabaseDirDialog")
const QLatin1String OPTIONS_DIALOG_DB_PROGRESS_DLG("OptionsDialog/DatabaseProgressDialog");
const QLatin1String OPTIONS_DIALOG_DB_FILE_DLG("OptionsDialog/DatabaseFilesDialog");
const QLatin1String OPTIONS_DIALOG_DB_EXCLUDE("OptionsDialog/DatabaseExclude");
const QLatin1String OPTIONS_DIALOG_DB_INCLUDE("OptionsDialog/DatabaseInclude");
const QLatin1String OPTIONS_DIALOG_DB_ADDON_EXCLUDE("OptionsDialog/DatabaseAddonExclude");
const QLatin1String OPTIONS_DIALOG_FLIGHTPLAN_COLOR("OptionsDialog/FlightplanColor");
const QLatin1String OPTIONS_DIALOG_FLIGHTPLAN_OUTLINE_COLOR("OptionsDialog/FlightplanOutlineColor");
Expand Down
10 changes: 7 additions & 3 deletions src/db/databaseloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,18 @@ void DatabaseLoader::loadScenery()
// Add exclude paths from option dialog ===================
const OptionData& optionData = OptionData::instance();

// Add add-on excludes for files and directories ================================================
for(const QString& path : optionData.getDatabaseAddonExclude())
navDatabaseOpts->addAddonExcludeGui(path);
// Add include directories ================================================
for(const QString& path : optionData.getDatabaseInclude())
navDatabaseOpts->addIncludeGui(path);

// Add excludes for files and directories ================================================
for(const QString& path : optionData.getDatabaseExclude())
navDatabaseOpts->addExcludeGui(path);

// Add add-on excludes for files and directories ================================================
for(const QString& path : optionData.getDatabaseAddonExclude())
navDatabaseOpts->addAddonExcludeGui(path);

// Select simulator db to load
navDatabaseOpts->setSimulatorType(selectedFsType);

Expand Down
7 changes: 6 additions & 1 deletion src/db/databasemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1702,6 +1702,10 @@ void DatabaseManager::updateDialogInfo(atools::fs::FsPaths::SimulatorType value)

const OptionData& options = OptionData::instance();
QStringList optionsHeader;
if(!options.getDatabaseInclude().isEmpty())
optionsHeader.append(tr("%1 %2 included for loading").
arg(options.getDatabaseInclude().size()).
arg(options.getDatabaseInclude().size() > 1 ? tr("extra directories are") : tr("extra directory is")));
if(!options.getDatabaseExclude().isEmpty())
optionsHeader.append(tr("%1 %2 excluded from loading").
arg(options.getDatabaseExclude().size()).
Expand All @@ -1714,7 +1718,8 @@ void DatabaseManager::updateDialogInfo(atools::fs::FsPaths::SimulatorType value)
if(!optionsHeader.isEmpty())
{
optionsHeader = QStringList(atools::strJoin(tr("<b>Note:</b> "), optionsHeader, tr(", "), tr(" and "), tr(".")));
optionsHeader.append(tr("Excluded directories can be changed in options on page \"Scenery Library Database\".").arg(tableText));
optionsHeader.append(tr("Included and excluded directories can be changed in options on page \"Scenery Library Database\".").
arg(tableText));
}

databaseDialog->setHeader(metaText +
Expand Down
21 changes: 15 additions & 6 deletions src/options/optiondata.h
Original file line number Diff line number Diff line change
Expand Up @@ -708,10 +708,10 @@ class OptionData
return weatherIvaoUrl;
}

/* List of directories that excludes paths from being recognized as add-ons. Only for scenery database loading. */
const QStringList& getDatabaseAddonExclude() const
/* Folders that are included in scanning */
const QStringList& getDatabaseInclude() const
{
return databaseAddonExclude;
return databaseInclude;
}

/* List of directories and files that are excluded from scenery database loading */
Expand All @@ -720,6 +720,12 @@ class OptionData
return databaseExclude;
}

/* List of directories that excludes paths from being recognized as add-ons. Only for scenery database loading. */
const QStringList& getDatabaseAddonExclude() const
{
return databaseAddonExclude;
}

opts::MapScrollDetail getMapScrollDetail() const
{
return mapScrollDetail;
Expand Down Expand Up @@ -1325,12 +1331,15 @@ class OptionData
// Initialized by widget
QString flightplanPattern;

// ui->listWidgetOptionsDatabaseAddon
QStringList databaseAddonExclude;
// ui->tableWidgetOptionsDatabaseInclude
QStringList databaseInclude;

// ui->listWidgetOptionsDatabaseExclude
// ui->tableWidgetOptionsDatabaseExclude
QStringList databaseExclude;

// ui->tableWidgetOptionsDatabaseAddon
QStringList databaseAddonExclude;

opts::MapScrollDetail mapScrollDetail = opts::DETAIL_NORMAL;
opts::MapNavigation mapNavigation = opts::MAP_NAV_CLICK_DRAG_MOVE;

Expand Down
Loading

0 comments on commit 02ac6d7

Please sign in to comment.