Allow re-ordering of paths in the launcher.
- suggested by Gilberto, allow the user to set the order of the scenery and aircraft paths by dragging.
This commit is contained in:
parent
a1b88d77ab
commit
e5c6d14cef
2 changed files with 69 additions and 37 deletions
|
@ -22,6 +22,15 @@ PathsDialog::PathsDialog(QWidget *parent, simgear::pkg::RootRef root) :
|
|||
m_catalogsModel = new CatalogListModel(this, m_packageRoot);
|
||||
m_ui->catalogsList->setModel(m_catalogsModel);
|
||||
|
||||
// enable drag-drop to re-order the paths
|
||||
m_ui->sceneryPathsList->setDragEnabled(true);
|
||||
m_ui->sceneryPathsList->setDragDropMode(QAbstractItemView::InternalMove);
|
||||
m_ui->sceneryPathsList->setDropIndicatorShown(true);
|
||||
|
||||
m_ui->aircraftPathsList->setDragEnabled(true);
|
||||
m_ui->aircraftPathsList->setDragDropMode(QAbstractItemView::InternalMove);
|
||||
m_ui->aircraftPathsList->setDropIndicatorShown(true);
|
||||
|
||||
connect(m_ui->addCatalog, &QToolButton::clicked,
|
||||
this, &PathsDialog::onAddCatalog);
|
||||
connect(m_ui->addDefaultCatalogButton, &QPushButton::clicked,
|
||||
|
@ -98,6 +107,11 @@ void PathsDialog::onAddSceneryPath()
|
|||
if (!path.isEmpty()) {
|
||||
m_ui->sceneryPathsList->addItem(path);
|
||||
}
|
||||
|
||||
// work around a Qt OS-X bug - this dialog is ending ordered
|
||||
// behind the main settings dialog (consequence of modal-dialog
|
||||
// showing a modla dialog showing a modial dialog)
|
||||
window()->raise();
|
||||
}
|
||||
|
||||
void PathsDialog::onRemoveSceneryPath()
|
||||
|
@ -113,6 +127,10 @@ void PathsDialog::onAddAircraftPath()
|
|||
if (!path.isEmpty()) {
|
||||
m_ui->aircraftPathsList->addItem(path);
|
||||
}
|
||||
// work around a Qt OS-X bug - this dialog is ending ordered
|
||||
// behind the main settings dialog (consequence of modal-dialog
|
||||
// showing a modla dialog showing a modial dialog)
|
||||
window()->raise();
|
||||
}
|
||||
|
||||
void PathsDialog::onRemoveAircraftPath()
|
||||
|
|
|
@ -83,20 +83,7 @@
|
|||
<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="1">
|
||||
<item row="1" column="2">
|
||||
<widget class="QToolButton" name="addSceneryPath">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
|
@ -115,10 +102,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QListWidget" name="sceneryPathsList"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<item row="1" column="3">
|
||||
<widget class="QToolButton" name="removeSceneryPath">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
|
@ -137,6 +121,29 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<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="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Drag to re-order</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="4">
|
||||
<widget class="QListWidget" name="sceneryPathsList"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -246,10 +253,7 @@
|
|||
<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">
|
||||
<item row="1" column="1">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
@ -263,6 +267,25 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<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>
|
||||
<item row="1" column="3">
|
||||
<widget class="QToolButton" name="removeAircraftPath">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
|
@ -281,25 +304,16 @@
|
|||
</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>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>+</string>
|
||||
<string>Drag to re-order</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="4">
|
||||
<widget class="QListWidget" name="aircraftPathsList"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
Loading…
Add table
Reference in a new issue