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
|
qt5_wrap_ui(uic_sources Launcher.ui
|
||||||
EditRatingsFilterDialog.ui
|
EditRatingsFilterDialog.ui
|
||||||
SetupRootDialog.ui
|
SetupRootDialog.ui
|
||||||
AddCatalogDialog.ui)
|
AddCatalogDialog.ui
|
||||||
|
PathsDialog.ui)
|
||||||
qt5_add_resources(qrc_sources resources.qrc)
|
qt5_add_resources(qrc_sources resources.qrc)
|
||||||
|
|
||||||
include_directories(${PROJECT_BINARY_DIR}/src/GUI)
|
include_directories(${PROJECT_BINARY_DIR}/src/GUI)
|
||||||
|
@ -94,6 +95,8 @@ if (HAVE_QT)
|
||||||
CatalogListModel.hxx
|
CatalogListModel.hxx
|
||||||
AddCatalogDialog.cxx
|
AddCatalogDialog.cxx
|
||||||
AddCatalogDialog.hxx
|
AddCatalogDialog.hxx
|
||||||
|
PathsDialog.cxx
|
||||||
|
PathsDialog.hxx
|
||||||
${uic_sources}
|
${uic_sources}
|
||||||
${qrc_sources})
|
${qrc_sources})
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
@ -544,7 +544,7 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0" colspan="2">
|
<item row="8" column="0" colspan="2">
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Additional options</string>
|
<string>Additional options</string>
|
||||||
|
@ -569,7 +569,7 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
<item row="7" column="0">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
|
@ -582,275 +582,11 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item row="6" column="0">
|
||||||
</widget>
|
<widget class="QPushButton" name="pathsButton">
|
||||||
<widget class="QWidget" name="tab_4">
|
<property name="text">
|
||||||
<attribute name="title">
|
<string>Configure add-on aircraft and scenery</string>
|
||||||
<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>
|
|
||||||
</property>
|
</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>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</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>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<widget class="QLabel" name="downloadLocation">
|
||||||
<item row="0" column="0" colspan="3">
|
<property name="text">
|
||||||
<widget class="QLabel" name="downloadLocation">
|
<string>TextLabel</string>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>TextLabel</string>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
</widget>
|
<item>
|
||||||
</item>
|
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0">
|
||||||
<item row="1" column="0">
|
<item>
|
||||||
<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">
|
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
|
@ -50,18 +36,32 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" colspan="3">
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QPushButton" name="changeDownloadDir">
|
||||||
<property name="text">
|
<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>
|
||||||
<property name="wordWrap">
|
</widget>
|
||||||
<bool>true</bool>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="clearDownloadDir">
|
||||||
|
<property name="text">
|
||||||
|
<string>Use default location</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</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>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
|
|
@ -53,8 +53,7 @@
|
||||||
#include "EditRatingsFilterDialog.hxx"
|
#include "EditRatingsFilterDialog.hxx"
|
||||||
#include "AircraftItemDelegate.hxx"
|
#include "AircraftItemDelegate.hxx"
|
||||||
#include "AircraftModel.hxx"
|
#include "AircraftModel.hxx"
|
||||||
#include "CatalogListModel.hxx"
|
#include "PathsDialog.hxx"
|
||||||
#include "AddCatalogDialog.hxx"
|
|
||||||
|
|
||||||
#include <Main/globals.hxx>
|
#include <Main/globals.hxx>
|
||||||
#include <Navaids/NavDataCache.hxx>
|
#include <Navaids/NavDataCache.hxx>
|
||||||
|
@ -426,9 +425,6 @@ QtLauncher::QtLauncher() :
|
||||||
connect(m_airportsModel, &AirportSearchModel::searchComplete,
|
connect(m_airportsModel, &AirportSearchModel::searchComplete,
|
||||||
this, &QtLauncher::onAirportSearchComplete);
|
this, &QtLauncher::onAirportSearchComplete);
|
||||||
|
|
||||||
// default value, restoreSettings() will override
|
|
||||||
m_downloadDir = QString();
|
|
||||||
|
|
||||||
// create and configure the proxy model
|
// create and configure the proxy model
|
||||||
m_aircraftProxy = new AircraftProxyModel(this);
|
m_aircraftProxy = new AircraftProxyModel(this);
|
||||||
connect(m_ui->ratingsFilterCheck, &QAbstractButton::toggled,
|
connect(m_ui->ratingsFilterCheck, &QAbstractButton::toggled,
|
||||||
|
@ -495,16 +491,6 @@ QtLauncher::QtLauncher() :
|
||||||
this, &QtLauncher::onToggleTerrasync);
|
this, &QtLauncher::onToggleTerrasync);
|
||||||
updateSettingsSummary();
|
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();
|
fgInitPackageRoot();
|
||||||
simgear::pkg::RootRef r(globals->packageRoot());
|
simgear::pkg::RootRef r(globals->packageRoot());
|
||||||
|
|
||||||
|
@ -533,14 +519,8 @@ QtLauncher::QtLauncher() :
|
||||||
connect(delegate, &AircraftItemDelegate::variantChanged,
|
connect(delegate, &AircraftItemDelegate::variantChanged,
|
||||||
this, &QtLauncher::onAircraftSelected);
|
this, &QtLauncher::onAircraftSelected);
|
||||||
|
|
||||||
|
connect(m_ui->pathsButton, &QPushButton::clicked,
|
||||||
m_catalogsModel = new CatalogListModel(this, r);
|
this, &QtLauncher::onEditPaths);
|
||||||
m_ui->catalogsList->setModel(m_catalogsModel);
|
|
||||||
|
|
||||||
connect(m_ui->addCatalog, &QToolButton::clicked,
|
|
||||||
this, &QtLauncher::onAddCatalog);
|
|
||||||
connect(m_ui->removeCatalog, &QToolButton::clicked,
|
|
||||||
this, &QtLauncher::onRemoveCatalog);
|
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
m_aircraftModel->setPaths(settings.value("aircraft-paths").toStringList());
|
m_aircraftModel->setPaths(settings.value("aircraft-paths").toStringList());
|
||||||
|
@ -623,11 +603,6 @@ void QtLauncher::restoreSettings()
|
||||||
// select the default C172p
|
// select the default C172p
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant downloadDir = settings.value("download-dir");
|
|
||||||
if (downloadDir.isValid()) {
|
|
||||||
m_downloadDir = downloadDir.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
updateSelectedAircraft();
|
updateSelectedAircraft();
|
||||||
|
|
||||||
// ICAO identifiers
|
// ICAO identifiers
|
||||||
|
@ -647,12 +622,6 @@ void QtLauncher::restoreSettings()
|
||||||
m_aircraftProxy->setRatingFilterEnabled(m_ui->ratingsFilterCheck->isChecked());
|
m_aircraftProxy->setRatingFilterEnabled(m_ui->ratingsFilterCheck->isChecked());
|
||||||
m_aircraftProxy->setRatings(m_ratingFilters);
|
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());
|
m_ui->commandLineArgs->setPlainText(settings.value("additional-args").toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -670,27 +639,7 @@ void QtLauncher::saveSettings()
|
||||||
settings.setValue("recent-airports", m_recentAirports);
|
settings.setValue("recent-airports", m_recentAirports);
|
||||||
settings.setValue("timeofday", m_ui->timeOfDayCombo->currentIndex());
|
settings.setValue("timeofday", m_ui->timeOfDayCombo->currentIndex());
|
||||||
settings.setValue("season", m_ui->seasonCombo->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());
|
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
|
void QtLauncher::setEnableDisableOptionFromCheckbox(QCheckBox* cbox, QString name) const
|
||||||
|
@ -774,8 +723,10 @@ void QtLauncher::onRun()
|
||||||
opt->addOption("season", dayval.toStdString());
|
opt->addOption("season", dayval.toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_downloadDir.isEmpty()) {
|
QSettings settings;
|
||||||
QDir d(m_downloadDir);
|
QString downloadDir = settings.value("download-dir").toString();
|
||||||
|
if (!downloadDir.isEmpty()) {
|
||||||
|
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. Create it?"),
|
||||||
|
@ -785,7 +736,7 @@ void QtLauncher::onRun()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == QMessageBox::Yes) {
|
if (result == QMessageBox::Yes) {
|
||||||
d.mkpath(m_downloadDir);
|
d.mkpath(downloadDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -794,14 +745,12 @@ void QtLauncher::onRun()
|
||||||
}
|
}
|
||||||
|
|
||||||
// scenery paths
|
// scenery paths
|
||||||
for (int i=0; i<m_ui->sceneryPathsList->count(); ++i) {
|
Q_FOREACH(QString path, settings.value("scenery-paths").toStringList()) {
|
||||||
QString path = m_ui->sceneryPathsList->item(i)->text();
|
|
||||||
opt->addOption("fg-scenery", path.toStdString());
|
opt->addOption("fg-scenery", path.toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// aircraft paths
|
// aircraft paths
|
||||||
for (int i=0; i<m_ui->aircraftPathsList->count(); ++i) {
|
Q_FOREACH(QString path, settings.value("aircraft-paths").toStringList()) {
|
||||||
QString path = m_ui->aircraftPathsList->item(i)->text();
|
|
||||||
// can't use fg-aircraft for this, as it is processed before the launcher is run
|
// can't use fg-aircraft for this, as it is processed before the launcher is run
|
||||||
globals->append_aircraft_path(path.toStdString());
|
globals->append_aircraft_path(path.toStdString());
|
||||||
}
|
}
|
||||||
|
@ -905,13 +854,19 @@ void QtLauncher::onAirportChanged()
|
||||||
void QtLauncher::onToggleTerrasync(bool enabled)
|
void QtLauncher::onToggleTerrasync(bool enabled)
|
||||||
{
|
{
|
||||||
if (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()) {
|
if (!info.exists()) {
|
||||||
QMessageBox msg;
|
QMessageBox msg;
|
||||||
msg.setWindowTitle(tr("Create download folder?"));
|
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 "
|
"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::Yes);
|
||||||
msg.addButton(QMessageBox::Cancel);
|
msg.addButton(QMessageBox::Cancel);
|
||||||
msg.addButton(tr("Change location"), QMessageBox::ActionRole);
|
msg.addButton(tr("Change location"), QMessageBox::ActionRole);
|
||||||
|
@ -923,16 +878,14 @@ void QtLauncher::onToggleTerrasync(bool enabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == QMessageBox::ActionRole) {
|
if (result == QMessageBox::ActionRole) {
|
||||||
qDebug() << "Change location!";
|
onEditPaths();
|
||||||
// open the prefrences dialog?
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDir d(m_downloadDir);
|
QDir d(downloadDir);
|
||||||
d.mkpath(m_downloadDir);
|
d.mkpath(downloadDir);
|
||||||
}
|
}
|
||||||
|
} // of is enabled
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtLauncher::updateAirportDescription()
|
void QtLauncher::updateAirportDescription()
|
||||||
|
@ -1080,28 +1033,6 @@ void QtLauncher::setAirport(FGAirportRef ref)
|
||||||
updateAirportDescription();
|
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()
|
void QtLauncher::onEditRatingsFilter()
|
||||||
{
|
{
|
||||||
EditRatingsFilterDialog dialog(this);
|
EditRatingsFilterDialog dialog(this);
|
||||||
|
@ -1155,61 +1086,6 @@ void QtLauncher::updateSettingsSummary()
|
||||||
m_ui->settingsDescription->setText(s);
|
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)
|
void QtLauncher::onRembrandtToggled(bool b)
|
||||||
{
|
{
|
||||||
// Rembrandt and multi-sample are exclusive
|
// Rembrandt and multi-sample are exclusive
|
||||||
|
@ -1221,19 +1097,17 @@ void QtLauncher::onSubsytemIdleTimeout()
|
||||||
globals->get_subsystem_mgr()->update(0.0);
|
globals->get_subsystem_mgr()->update(0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtLauncher::onAddCatalog()
|
void QtLauncher::onEditPaths()
|
||||||
{
|
{
|
||||||
AddCatalogDialog* dlg = new AddCatalogDialog(this, globals->packageRoot());
|
PathsDialog dlg(this, globals->packageRoot());
|
||||||
dlg->exec();
|
dlg.exec();
|
||||||
if (dlg->result() == QDialog::Accepted) {
|
if (dlg.result() == QDialog::Accepted) {
|
||||||
m_catalogsModel->refresh();
|
// re-scan the aircraft list
|
||||||
|
QSettings settings;
|
||||||
|
m_aircraftModel->setPaths(settings.value("aircraft-paths").toStringList());
|
||||||
|
m_aircraftModel->scanDirs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtLauncher::onRemoveCatalog()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "QtLauncher.moc"
|
#include "QtLauncher.moc"
|
||||||
|
|
||||||
|
|
|
@ -73,22 +73,12 @@ private slots:
|
||||||
|
|
||||||
void onAirportSearchComplete();
|
void onAirportSearchComplete();
|
||||||
|
|
||||||
void onAddSceneryPath();
|
|
||||||
void onRemoveSceneryPath();
|
|
||||||
|
|
||||||
void onAddAircraftPath();
|
|
||||||
void onRemoveAircraftPath();
|
|
||||||
|
|
||||||
void onAddCatalog();
|
|
||||||
void onRemoveCatalog();
|
|
||||||
|
|
||||||
void onRembrandtToggled(bool b);
|
void onRembrandtToggled(bool b);
|
||||||
void onToggleTerrasync(bool enabled);
|
void onToggleTerrasync(bool enabled);
|
||||||
|
|
||||||
void onSubsytemIdleTimeout();
|
void onSubsytemIdleTimeout();
|
||||||
|
|
||||||
void onChangeDownloadDir();
|
void onEditPaths();
|
||||||
void onClearDownloadDir();
|
|
||||||
private:
|
private:
|
||||||
void setAirport(FGAirportRef ref);
|
void setAirport(FGAirportRef ref);
|
||||||
void updateSelectedAircraft();
|
void updateSelectedAircraft();
|
||||||
|
@ -105,14 +95,11 @@ private:
|
||||||
AirportSearchModel* m_airportsModel;
|
AirportSearchModel* m_airportsModel;
|
||||||
AircraftProxyModel* m_aircraftProxy;
|
AircraftProxyModel* m_aircraftProxy;
|
||||||
AircraftItemModel* m_aircraftModel;
|
AircraftItemModel* m_aircraftModel;
|
||||||
CatalogListModel* m_catalogsModel;
|
|
||||||
|
|
||||||
FGAirportRef m_selectedAirport;
|
FGAirportRef m_selectedAirport;
|
||||||
|
|
||||||
QString m_selectedAircraft;
|
QString m_selectedAircraft;
|
||||||
QStringList m_recentAircraft,
|
QStringList m_recentAircraft,
|
||||||
m_recentAirports;
|
m_recentAirports;
|
||||||
QString m_downloadDir;
|
|
||||||
QTimer* m_subsystemIdleTimer;
|
QTimer* m_subsystemIdleTimer;
|
||||||
|
|
||||||
int m_ratingFilters[4];
|
int m_ratingFilters[4];
|
||||||
|
|
Loading…
Reference in a new issue