Launcher: fix bugs around paths setting.
We now show paths in ‘view command line’ and set them through the standard mechanism. Re-ordering the paths also notifies the rest of the system correctly.
This commit is contained in:
parent
dd0b9adbfc
commit
5f8f2886dc
3 changed files with 33 additions and 19 deletions
|
@ -493,6 +493,18 @@ void LauncherMainWindow::collectAircraftArgs()
|
||||||
qWarning() << "unsupported aircraft launch URL" << m_selectedAircraft;
|
qWarning() << "unsupported aircraft launch URL" << m_selectedAircraft;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// scenery paths
|
||||||
|
QSettings settings;
|
||||||
|
Q_FOREACH(QString path, settings.value("scenery-paths").toStringList()) {
|
||||||
|
m_config->setArg("fg-scenery", path);
|
||||||
|
}
|
||||||
|
|
||||||
|
// aircraft paths
|
||||||
|
Q_FOREACH(QString path, settings.value("aircraft-paths").toStringList()) {
|
||||||
|
m_config->setArg("fg-aircraft", path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherMainWindow::onRun()
|
void LauncherMainWindow::onRun()
|
||||||
|
@ -511,16 +523,16 @@ void LauncherMainWindow::onRun()
|
||||||
m_recentAircraft.pop_back();
|
m_recentAircraft.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
// m_ui->location->setLocationProperties();
|
// aircraft paths
|
||||||
|
QSettings settings;
|
||||||
updateLocationHistory();
|
updateLocationHistory();
|
||||||
|
|
||||||
QSettings settings;
|
QString downloadDir = settings.value("downloadSettings/downloadDir").toString();
|
||||||
QString downloadDir = settings.value("download-dir").toString();
|
|
||||||
if (!downloadDir.isEmpty()) {
|
if (!downloadDir.isEmpty()) {
|
||||||
QDir d(downloadDir);
|
QDir d(downloadDir);
|
||||||
if (!d.exists()) {
|
if (!d.exists()) {
|
||||||
int result = QMessageBox::question(this, tr("Create download folder?"),
|
int result = QMessageBox::question(this, tr("Create download folder?"),
|
||||||
tr("The selected location for downloads does not exist. Create it?"),
|
tr("The selected location for downloads does not exist. (%1) Create it?").arg(downloadDir),
|
||||||
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
|
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
|
||||||
if (result == QMessageBox::Cancel) {
|
if (result == QMessageBox::Cancel) {
|
||||||
return;
|
return;
|
||||||
|
@ -532,17 +544,6 @@ void LauncherMainWindow::onRun()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// scenery paths
|
|
||||||
Q_FOREACH(QString path, settings.value("scenery-paths").toStringList()) {
|
|
||||||
opt->addOption("fg-scenery", path.toStdString());
|
|
||||||
}
|
|
||||||
|
|
||||||
// aircraft paths
|
|
||||||
Q_FOREACH(QString path, settings.value("aircraft-paths").toStringList()) {
|
|
||||||
// can't use fg-aircraft for this, as it is processed before the launcher is run
|
|
||||||
globals->append_aircraft_path(path.toStdString());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (settings.contains("restore-defaults-on-run")) {
|
if (settings.contains("restore-defaults-on-run")) {
|
||||||
settings.remove("restore-defaults-on-run");
|
settings.remove("restore-defaults-on-run");
|
||||||
opt->addOption("restore-defaults", "");
|
opt->addOption("restore-defaults", "");
|
||||||
|
|
|
@ -68,9 +68,15 @@ AddOnsPage::AddOnsPage(QWidget *parent, simgear::pkg::RootRef root) :
|
||||||
QStringList sceneryPaths = settings.value("scenery-paths").toStringList();
|
QStringList sceneryPaths = settings.value("scenery-paths").toStringList();
|
||||||
m_ui->sceneryPathsList->addItems(sceneryPaths);
|
m_ui->sceneryPathsList->addItems(sceneryPaths);
|
||||||
|
|
||||||
|
connect(m_ui->sceneryPathsList->model(), &QAbstractItemModel::rowsMoved,
|
||||||
|
this, &AddOnsPage::saveSceneryPaths);
|
||||||
|
|
||||||
QStringList aircraftPaths = settings.value("aircraft-paths").toStringList();
|
QStringList aircraftPaths = settings.value("aircraft-paths").toStringList();
|
||||||
m_ui->aircraftPathsList->addItems(aircraftPaths);
|
m_ui->aircraftPathsList->addItems(aircraftPaths);
|
||||||
|
|
||||||
|
connect(m_ui->aircraftPathsList->model(), &QAbstractItemModel::rowsMoved,
|
||||||
|
this, &AddOnsPage::saveAircraftPaths);
|
||||||
|
|
||||||
updateUi();
|
updateUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +166,6 @@ void AddOnsPage::onAddAircraftPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
saveAircraftPaths();
|
saveAircraftPaths();
|
||||||
emit aircraftPathsChanged();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +174,6 @@ void AddOnsPage::onRemoveAircraftPath()
|
||||||
if (m_ui->aircraftPathsList->currentItem()) {
|
if (m_ui->aircraftPathsList->currentItem()) {
|
||||||
delete m_ui->aircraftPathsList->currentItem();
|
delete m_ui->aircraftPathsList->currentItem();
|
||||||
saveAircraftPaths();
|
saveAircraftPaths();
|
||||||
emit aircraftPathsChanged();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,6 +187,7 @@ void AddOnsPage::saveAircraftPaths()
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.setValue("aircraft-paths", paths);
|
settings.setValue("aircraft-paths", paths);
|
||||||
|
emit aircraftPathsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddOnsPage::saveSceneryPaths()
|
void AddOnsPage::saveSceneryPaths()
|
||||||
|
@ -293,3 +298,8 @@ void AddOnsPage::updateUi()
|
||||||
FGHTTPClient* http = globals->get_subsystem<FGHTTPClient>();
|
FGHTTPClient* http = globals->get_subsystem<FGHTTPClient>();
|
||||||
m_ui->addDefaultCatalogButton->setEnabled(!http->isDefaultCatalogInstalled());
|
m_ui->addDefaultCatalogButton->setEnabled(!http->isDefaultCatalogInstalled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddOnsPage::onDraggedAircraftList()
|
||||||
|
{
|
||||||
|
qWarning() << "did drag aircraft list";
|
||||||
|
}
|
||||||
|
|
|
@ -38,11 +38,14 @@ private slots:
|
||||||
void onAddDefaultCatalog();
|
void onAddDefaultCatalog();
|
||||||
|
|
||||||
void onInstallScenery();
|
void onInstallScenery();
|
||||||
private:
|
|
||||||
void updateUi();
|
void onDraggedAircraftList();
|
||||||
|
|
||||||
void saveAircraftPaths();
|
void saveAircraftPaths();
|
||||||
void saveSceneryPaths();
|
void saveSceneryPaths();
|
||||||
|
private:
|
||||||
|
void updateUi();
|
||||||
|
|
||||||
bool haveSceneryPath(QString path) const;
|
bool haveSceneryPath(QString path) const;
|
||||||
|
|
||||||
Ui::AddOnsPage* m_ui;
|
Ui::AddOnsPage* m_ui;
|
||||||
|
|
Loading…
Reference in a new issue