telegps: Add scan UI
[fw/altos] / altosui / AltosEepromManage.java
index b8de77dabbc93721437defb51cbe24cc545d101e..aa43ab9ee3c4f740187bc3f391f387b14ec54f19 100644 (file)
@@ -21,7 +21,8 @@ import java.awt.event.*;
 import javax.swing.*;
 import java.io.*;
 import java.util.concurrent.*;
-import org.altusmetrum.AltosLib.*;
+import org.altusmetrum.altoslib_4.*;
+import org.altusmetrum.altosuilib_2.*;
 
 public class AltosEepromManage implements ActionListener {
 
@@ -44,6 +45,15 @@ public class AltosEepromManage implements ActionListener {
                }
        }
 
+       private int countDeletedFlights() {
+               int count = 0;
+               for (AltosEepromLog flight : flights) {
+                       if (flight.selected)
+                               count++;
+               }
+               return count;
+       }
+
        private String showDeletedFlights() {
                String  result = "";
 
@@ -93,7 +103,8 @@ public class AltosEepromManage implements ActionListener {
                } else if (cmd.equals("delete")) {
                        if (success) {
                                JOptionPane.showMessageDialog(frame,
-                                                             String.format("Flights erased: %s",
+                                                             String.format("%d flights erased: %s",
+                                                                           countDeletedFlights(),
                                                                            showDeletedFlights()),
                                                              serial_line.device.toShortString(),
                                                              JOptionPane.INFORMATION_MESSAGE);
@@ -122,11 +133,13 @@ public class AltosEepromManage implements ActionListener {
                                        for (AltosEepromLog flight : flights)
                                                any_selected = any_selected || flight.selected;
                                        if (any_selected) {
-                                               download = new AltosEepromDownload(frame,
+                                               AltosEepromMonitorUI monitor = new AltosEepromMonitorUI(frame);
+                                               monitor.addActionListener(this);
+                                               serial_line.set_frame(frame);
+                                               download = new AltosEepromDownload(monitor,
                                                                                   serial_line,
                                                                                   remote,
                                                                                   flights);
-                                               download.addActionListener(this);
                                                /*
                                                 * Start flight log download
                                                 */
@@ -197,7 +210,7 @@ public class AltosEepromManage implements ActionListener {
                //boolean       running = false;
 
                frame = given_frame;
-               device = AltosDeviceDialog.show(frame, Altos.product_any);
+               device = AltosDeviceUIDialog.show(frame, Altos.product_any);
 
                remote = false;