]> git.mxchange.org Git - flightgear.git/commitdiff
Allow re-ordering of paths in the launcher.
authorJames Turner <zakalawe@mac.com>
Sat, 9 Jan 2016 23:17:58 +0000 (17:17 -0600)
committerJames Turner <zakalawe@mac.com>
Sat, 9 Jan 2016 23:17:58 +0000 (17:17 -0600)
- suggested by Gilberto, allow the user to set the order of the
  scenery and aircraft paths by dragging.

src/GUI/PathsDialog.cxx
src/GUI/PathsDialog.ui

index 726932deaf77f487550a4528cda85db267195dc8..3770733c9eca510e24c87dc7874e56d52d793e66 100644 (file)
@@ -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()
index 393c10ee643d83510f1170a8f3c9b2df32cf15f4..6b02983d684de89d6ba59c5c1b0f18903c35ec55 100644 (file)
       <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">
         </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">
         </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>
       <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>
        </spacer>
       </item>
       <item row="1" column="2">
-       <widget class="QToolButton" name="removeAircraftPath">
+       <widget class="QToolButton" name="addAircraftPath">
         <property name="sizePolicy">
          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
           <horstretch>0</horstretch>
          </size>
         </property>
         <property name="text">
-         <string>-</string>
+         <string>+</string>
         </property>
        </widget>
       </item>
-      <item row="1" column="1">
-       <widget class="QToolButton" name="addAircraftPath">
+      <item row="1" column="3">
+       <widget class="QToolButton" name="removeAircraftPath">
         <property name="sizePolicy">
          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
           <horstretch>0</horstretch>
          </size>
         </property>
         <property name="text">
-         <string>+</string>
+         <string>-</string>
         </property>
        </widget>
       </item>
+      <item row="1" column="0">
+       <widget class="QLabel" name="label_3">
+        <property name="text">
+         <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>