New PathsDialog, for managing locations.
This commit is contained in:
parent
aa20e0acd8
commit
4f15e1a840
6 changed files with 119 additions and 471 deletions
|
@ -73,7 +73,8 @@ if (HAVE_QT)
|
|||
qt5_wrap_ui(uic_sources Launcher.ui
|
||||
EditRatingsFilterDialog.ui
|
||||
SetupRootDialog.ui
|
||||
AddCatalogDialog.ui)
|
||||
AddCatalogDialog.ui
|
||||
PathsDialog.ui)
|
||||
qt5_add_resources(qrc_sources resources.qrc)
|
||||
|
||||
include_directories(${PROJECT_BINARY_DIR}/src/GUI)
|
||||
|
@ -94,6 +95,8 @@ if (HAVE_QT)
|
|||
CatalogListModel.hxx
|
||||
AddCatalogDialog.cxx
|
||||
AddCatalogDialog.hxx
|
||||
PathsDialog.cxx
|
||||
PathsDialog.hxx
|
||||
${uic_sources}
|
||||
${qrc_sources})
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@
|
|||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
|
@ -544,7 +544,7 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Additional options</string>
|
||||
|
@ -569,7 +569,7 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="7" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
@ -582,275 +582,11 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_4">
|
||||
<attribute name="title">
|
||||
<string>Add-ons</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="1,0">
|
||||
<item>
|
||||
<widget class="QLabel" name="customAircraftDirLabel">
|
||||
<property name="text">
|
||||
<string>Custom aircraft directory:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="openAircraftDirButton">
|
||||
<property name="text">
|
||||
<string>Open in Finder</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Additional scenery locations</string>
|
||||
<item row="6" column="0">
|
||||
<widget class="QPushButton" name="pathsButton">
|
||||
<property name="text">
|
||||
<string>Configure add-on aircraft and scenery</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>567</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QToolButton" name="removeSceneryPath">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QToolButton" name="addSceneryPath">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>+</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QListWidget" name="sceneryPathsList"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>Aircraft hangar locations</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<property name="leftMargin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>567</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QToolButton" name="removeCatalog">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QToolButton" name="addCatalog">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>+</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QListView" name="catalogsList"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Additional aircraft locations</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<property name="leftMargin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QListWidget" name="aircraftPathsList"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>567</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QToolButton" name="removeAircraftPath">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QToolButton" name="addAircraftPath">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>+</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
48
src/GUI/PathsDialog.hxx
Normal file
48
src/GUI/PathsDialog.hxx
Normal file
|
@ -0,0 +1,48 @@
|
|||
#ifndef PATHSDIALOG_HXX
|
||||
#define PATHSDIALOG_HXX
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include <simgear/package/Root.hxx>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class PathsDialog;
|
||||
}
|
||||
|
||||
class CatalogListModel;
|
||||
|
||||
class PathsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PathsDialog(QWidget *parent, simgear::pkg::RootRef root);
|
||||
~PathsDialog();
|
||||
|
||||
protected:
|
||||
virtual void accept();
|
||||
|
||||
private slots:
|
||||
void onAddSceneryPath();
|
||||
void onRemoveSceneryPath();
|
||||
|
||||
void onAddAircraftPath();
|
||||
void onRemoveAircraftPath();
|
||||
|
||||
void onAddCatalog();
|
||||
void onRemoveCatalog();
|
||||
|
||||
void onChangeDownloadDir();
|
||||
void onClearDownloadDir();
|
||||
private:
|
||||
void updateUi();
|
||||
|
||||
Ui::PathsDialog* m_ui;
|
||||
CatalogListModel* m_catalogsModel;
|
||||
simgear::pkg::RootRef m_packageRoot;
|
||||
QString m_downloadDir;
|
||||
|
||||
};
|
||||
|
||||
#endif // PATHSDIALOG_HXX
|
|
@ -15,29 +15,15 @@
|
|||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QLabel" name="downloadLocation">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="changeDownloadDir">
|
||||
<property name="text">
|
||||
<string>Change...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="clearDownloadDir">
|
||||
<property name="text">
|
||||
<string>Use default location</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="downloadLocation">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
@ -50,18 +36,32 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="changeDownloadDir">
|
||||
<property name="text">
|
||||
<string>Aircraft hangars and automatic scenery downloads may cause this location to contain large numbers of files. Changing this location will cause files to be downloaded again.</string>
|
||||
<string>Change...</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearDownloadDir">
|
||||
<property name="text">
|
||||
<string>Use default location</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Aircraft hangars and automatic scenery downloads may cause this location to contain large numbers of files. Changing this location will cause files to be downloaded again.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
|
|
|
@ -53,8 +53,7 @@
|
|||
#include "EditRatingsFilterDialog.hxx"
|
||||
#include "AircraftItemDelegate.hxx"
|
||||
#include "AircraftModel.hxx"
|
||||
#include "CatalogListModel.hxx"
|
||||
#include "AddCatalogDialog.hxx"
|
||||
#include "PathsDialog.hxx"
|
||||
|
||||
#include <Main/globals.hxx>
|
||||
#include <Navaids/NavDataCache.hxx>
|
||||
|
@ -426,9 +425,6 @@ QtLauncher::QtLauncher() :
|
|||
connect(m_airportsModel, &AirportSearchModel::searchComplete,
|
||||
this, &QtLauncher::onAirportSearchComplete);
|
||||
|
||||
// default value, restoreSettings() will override
|
||||
m_downloadDir = QString();
|
||||
|
||||
// create and configure the proxy model
|
||||
m_aircraftProxy = new AircraftProxyModel(this);
|
||||
connect(m_ui->ratingsFilterCheck, &QAbstractButton::toggled,
|
||||
|
@ -495,16 +491,6 @@ QtLauncher::QtLauncher() :
|
|||
this, &QtLauncher::onToggleTerrasync);
|
||||
updateSettingsSummary();
|
||||
|
||||
connect(m_ui->addSceneryPath, &QToolButton::clicked,
|
||||
this, &QtLauncher::onAddSceneryPath);
|
||||
connect(m_ui->removeSceneryPath, &QToolButton::clicked,
|
||||
this, &QtLauncher::onRemoveSceneryPath);
|
||||
|
||||
connect(m_ui->addAircraftPath, &QToolButton::clicked,
|
||||
this, &QtLauncher::onAddAircraftPath);
|
||||
connect(m_ui->removeAircraftPath, &QToolButton::clicked,
|
||||
this, &QtLauncher::onRemoveAircraftPath);
|
||||
|
||||
fgInitPackageRoot();
|
||||
simgear::pkg::RootRef r(globals->packageRoot());
|
||||
|
||||
|
@ -533,14 +519,8 @@ QtLauncher::QtLauncher() :
|
|||
connect(delegate, &AircraftItemDelegate::variantChanged,
|
||||
this, &QtLauncher::onAircraftSelected);
|
||||
|
||||
|
||||
m_catalogsModel = new CatalogListModel(this, r);
|
||||
m_ui->catalogsList->setModel(m_catalogsModel);
|
||||
|
||||
connect(m_ui->addCatalog, &QToolButton::clicked,
|
||||
this, &QtLauncher::onAddCatalog);
|
||||
connect(m_ui->removeCatalog, &QToolButton::clicked,
|
||||
this, &QtLauncher::onRemoveCatalog);
|
||||
connect(m_ui->pathsButton, &QPushButton::clicked,
|
||||
this, &QtLauncher::onEditPaths);
|
||||
|
||||
QSettings settings;
|
||||
m_aircraftModel->setPaths(settings.value("aircraft-paths").toStringList());
|
||||
|
@ -623,11 +603,6 @@ void QtLauncher::restoreSettings()
|
|||
// select the default C172p
|
||||
}
|
||||
|
||||
QVariant downloadDir = settings.value("download-dir");
|
||||
if (downloadDir.isValid()) {
|
||||
m_downloadDir = downloadDir.toString();
|
||||
}
|
||||
|
||||
updateSelectedAircraft();
|
||||
|
||||
// ICAO identifiers
|
||||
|
@ -647,12 +622,6 @@ void QtLauncher::restoreSettings()
|
|||
m_aircraftProxy->setRatingFilterEnabled(m_ui->ratingsFilterCheck->isChecked());
|
||||
m_aircraftProxy->setRatings(m_ratingFilters);
|
||||
|
||||
QStringList sceneryPaths = settings.value("scenery-paths").toStringList();
|
||||
m_ui->sceneryPathsList->addItems(sceneryPaths);
|
||||
|
||||
QStringList aircraftPaths = settings.value("aircraft-paths").toStringList();
|
||||
m_ui->aircraftPathsList->addItems(aircraftPaths);
|
||||
|
||||
m_ui->commandLineArgs->setPlainText(settings.value("additional-args").toString());
|
||||
}
|
||||
|
||||
|
@ -670,27 +639,7 @@ void QtLauncher::saveSettings()
|
|||
settings.setValue("recent-airports", m_recentAirports);
|
||||
settings.setValue("timeofday", m_ui->timeOfDayCombo->currentIndex());
|
||||
settings.setValue("season", m_ui->seasonCombo->currentIndex());
|
||||
|
||||
QStringList paths;
|
||||
for (int i=0; i<m_ui->sceneryPathsList->count(); ++i) {
|
||||
paths.append(m_ui->sceneryPathsList->item(i)->text());
|
||||
}
|
||||
|
||||
settings.setValue("scenery-paths", paths);
|
||||
paths.clear();
|
||||
|
||||
for (int i=0; i<m_ui->aircraftPathsList->count(); ++i) {
|
||||
paths.append(m_ui->aircraftPathsList->item(i)->text());
|
||||
}
|
||||
|
||||
settings.setValue("aircraft-paths", paths);
|
||||
settings.setValue("additional-args", m_ui->commandLineArgs->toPlainText());
|
||||
|
||||
if (m_downloadDir.isEmpty()) {
|
||||
settings.remove("download-dir");
|
||||
} else {
|
||||
settings.setValue("download-dir", m_downloadDir);
|
||||
}
|
||||
}
|
||||
|
||||
void QtLauncher::setEnableDisableOptionFromCheckbox(QCheckBox* cbox, QString name) const
|
||||
|
@ -774,8 +723,10 @@ void QtLauncher::onRun()
|
|||
opt->addOption("season", dayval.toStdString());
|
||||
}
|
||||
|
||||
if (!m_downloadDir.isEmpty()) {
|
||||
QDir d(m_downloadDir);
|
||||
QSettings settings;
|
||||
QString downloadDir = settings.value("download-dir").toString();
|
||||
if (!downloadDir.isEmpty()) {
|
||||
QDir d(downloadDir);
|
||||
if (!d.exists()) {
|
||||
int result = QMessageBox::question(this, tr("Create download folder?"),
|
||||
tr("The selected location for downloads does not exist. Create it?"),
|
||||
|
@ -785,7 +736,7 @@ void QtLauncher::onRun()
|
|||
}
|
||||
|
||||
if (result == QMessageBox::Yes) {
|
||||
d.mkpath(m_downloadDir);
|
||||
d.mkpath(downloadDir);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -794,14 +745,12 @@ void QtLauncher::onRun()
|
|||
}
|
||||
|
||||
// scenery paths
|
||||
for (int i=0; i<m_ui->sceneryPathsList->count(); ++i) {
|
||||
QString path = m_ui->sceneryPathsList->item(i)->text();
|
||||
Q_FOREACH(QString path, settings.value("scenery-paths").toStringList()) {
|
||||
opt->addOption("fg-scenery", path.toStdString());
|
||||
}
|
||||
|
||||
// aircraft paths
|
||||
for (int i=0; i<m_ui->aircraftPathsList->count(); ++i) {
|
||||
QString path = m_ui->aircraftPathsList->item(i)->text();
|
||||
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());
|
||||
}
|
||||
|
@ -905,13 +854,19 @@ void QtLauncher::onAirportChanged()
|
|||
void QtLauncher::onToggleTerrasync(bool enabled)
|
||||
{
|
||||
if (enabled) {
|
||||
QFileInfo info(m_downloadDir);
|
||||
QSettings settings;
|
||||
QString downloadDir = settings.value("download-dir").toString();
|
||||
if (downloadDir.isEmpty()) {
|
||||
downloadDir = QString::fromStdString(flightgear::defaultDownloadDir());
|
||||
}
|
||||
|
||||
QFileInfo info(downloadDir);
|
||||
if (!info.exists()) {
|
||||
QMessageBox msg;
|
||||
msg.setWindowTitle(tr("Create download folder?"));
|
||||
msg.setText(tr("The current download folder '%1' does not exist, create it now? "
|
||||
msg.setText(tr("The download folder '%1' does not exist, create it now? "
|
||||
"Click 'change location' to choose another folder "
|
||||
"to store downloaded files").arg(m_downloadDir));
|
||||
"to store downloaded files").arg(downloadDir));
|
||||
msg.addButton(QMessageBox::Yes);
|
||||
msg.addButton(QMessageBox::Cancel);
|
||||
msg.addButton(tr("Change location"), QMessageBox::ActionRole);
|
||||
|
@ -923,16 +878,14 @@ void QtLauncher::onToggleTerrasync(bool enabled)
|
|||
}
|
||||
|
||||
if (result == QMessageBox::ActionRole) {
|
||||
qDebug() << "Change location!";
|
||||
// open the prefrences dialog?
|
||||
onEditPaths();
|
||||
return;
|
||||
}
|
||||
|
||||
QDir d(m_downloadDir);
|
||||
d.mkpath(m_downloadDir);
|
||||
QDir d(downloadDir);
|
||||
d.mkpath(downloadDir);
|
||||
}
|
||||
|
||||
}
|
||||
} // of is enabled
|
||||
}
|
||||
|
||||
void QtLauncher::updateAirportDescription()
|
||||
|
@ -1080,28 +1033,6 @@ void QtLauncher::setAirport(FGAirportRef ref)
|
|||
updateAirportDescription();
|
||||
}
|
||||
|
||||
#if 0
|
||||
void QtLauncher::onOpenCustomAircraftDir()
|
||||
{
|
||||
QFileInfo info(m_customAircraftDir);
|
||||
if (!info.exists()) {
|
||||
int result = QMessageBox::question(this, "Create folder?",
|
||||
"The custom aircraft folder does not exist, create it now?",
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
QMessageBox::Yes);
|
||||
if (result == QMessageBox::No) {
|
||||
return;
|
||||
}
|
||||
|
||||
QDir d(m_customAircraftDir);
|
||||
d.mkpath(m_customAircraftDir);
|
||||
}
|
||||
|
||||
QUrl u = QUrl::fromLocalFile(m_customAircraftDir);
|
||||
QDesktopServices::openUrl(u);
|
||||
}
|
||||
#endif
|
||||
|
||||
void QtLauncher::onEditRatingsFilter()
|
||||
{
|
||||
EditRatingsFilterDialog dialog(this);
|
||||
|
@ -1155,61 +1086,6 @@ void QtLauncher::updateSettingsSummary()
|
|||
m_ui->settingsDescription->setText(s);
|
||||
}
|
||||
|
||||
void QtLauncher::onAddSceneryPath()
|
||||
{
|
||||
QString path = QFileDialog::getExistingDirectory(this, tr("Choose scenery folder"));
|
||||
if (!path.isEmpty()) {
|
||||
m_ui->sceneryPathsList->addItem(path);
|
||||
saveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
void QtLauncher::onRemoveSceneryPath()
|
||||
{
|
||||
if (m_ui->sceneryPathsList->currentItem()) {
|
||||
delete m_ui->sceneryPathsList->currentItem();
|
||||
saveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
void QtLauncher::onAddAircraftPath()
|
||||
{
|
||||
QString path = QFileDialog::getExistingDirectory(this, tr("Choose aircraft folder"));
|
||||
if (!path.isEmpty()) {
|
||||
m_ui->aircraftPathsList->addItem(path);
|
||||
saveSettings();
|
||||
|
||||
// re-scan the aircraft list
|
||||
QSettings settings;
|
||||
m_aircraftModel->setPaths(settings.value("aircraft-paths").toStringList());
|
||||
m_aircraftModel->scanDirs();
|
||||
}
|
||||
}
|
||||
|
||||
void QtLauncher::onRemoveAircraftPath()
|
||||
{
|
||||
if (m_ui->aircraftPathsList->currentItem()) {
|
||||
delete m_ui->aircraftPathsList->currentItem();
|
||||
saveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
void QtLauncher::onChangeDownloadDir()
|
||||
{
|
||||
QString path = QFileDialog::getExistingDirectory(this, tr("Choose downloads folder"));
|
||||
if (!path.isEmpty()) {
|
||||
m_downloadDir = path;
|
||||
saveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
void QtLauncher::onClearDownloadDir()
|
||||
{
|
||||
// does this need an 'are you sure'?
|
||||
m_downloadDir.clear();
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
void QtLauncher::onRembrandtToggled(bool b)
|
||||
{
|
||||
// Rembrandt and multi-sample are exclusive
|
||||
|
@ -1221,19 +1097,17 @@ void QtLauncher::onSubsytemIdleTimeout()
|
|||
globals->get_subsystem_mgr()->update(0.0);
|
||||
}
|
||||
|
||||
void QtLauncher::onAddCatalog()
|
||||
void QtLauncher::onEditPaths()
|
||||
{
|
||||
AddCatalogDialog* dlg = new AddCatalogDialog(this, globals->packageRoot());
|
||||
dlg->exec();
|
||||
if (dlg->result() == QDialog::Accepted) {
|
||||
m_catalogsModel->refresh();
|
||||
PathsDialog dlg(this, globals->packageRoot());
|
||||
dlg.exec();
|
||||
if (dlg.result() == QDialog::Accepted) {
|
||||
// re-scan the aircraft list
|
||||
QSettings settings;
|
||||
m_aircraftModel->setPaths(settings.value("aircraft-paths").toStringList());
|
||||
m_aircraftModel->scanDirs();
|
||||
}
|
||||
}
|
||||
|
||||
void QtLauncher::onRemoveCatalog()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#include "QtLauncher.moc"
|
||||
|
||||
|
|
|
@ -73,22 +73,12 @@ private slots:
|
|||
|
||||
void onAirportSearchComplete();
|
||||
|
||||
void onAddSceneryPath();
|
||||
void onRemoveSceneryPath();
|
||||
|
||||
void onAddAircraftPath();
|
||||
void onRemoveAircraftPath();
|
||||
|
||||
void onAddCatalog();
|
||||
void onRemoveCatalog();
|
||||
|
||||
void onRembrandtToggled(bool b);
|
||||
void onToggleTerrasync(bool enabled);
|
||||
|
||||
void onSubsytemIdleTimeout();
|
||||
|
||||
void onChangeDownloadDir();
|
||||
void onClearDownloadDir();
|
||||
void onEditPaths();
|
||||
private:
|
||||
void setAirport(FGAirportRef ref);
|
||||
void updateSelectedAircraft();
|
||||
|
@ -105,14 +95,11 @@ private:
|
|||
AirportSearchModel* m_airportsModel;
|
||||
AircraftProxyModel* m_aircraftProxy;
|
||||
AircraftItemModel* m_aircraftModel;
|
||||
CatalogListModel* m_catalogsModel;
|
||||
|
||||
FGAirportRef m_selectedAirport;
|
||||
|
||||
QString m_selectedAircraft;
|
||||
QStringList m_recentAircraft,
|
||||
m_recentAirports;
|
||||
QString m_downloadDir;
|
||||
QTimer* m_subsystemIdleTimer;
|
||||
|
||||
int m_ratingFilters[4];
|
||||
|
|
Loading…
Reference in a new issue