summaryrefslogtreecommitdiff
path: root/altosui
diff options
context:
space:
mode:
Diffstat (limited to 'altosui')
-rw-r--r--altosui/.gitignore2
-rw-r--r--altosui/Altos.java4
-rw-r--r--altosui/AltosAscent.java4
-rw-r--r--altosui/AltosCompanionInfo.java4
-rw-r--r--altosui/AltosConfig.java4
-rw-r--r--altosui/AltosConfigPyroUI.java23
-rw-r--r--altosui/AltosConfigTD.java39
-rw-r--r--altosui/AltosConfigTDUI.java41
-rw-r--r--altosui/AltosConfigUI.java174
-rw-r--r--altosui/AltosConfigureUI.java10
-rw-r--r--altosui/AltosDescent.java4
-rw-r--r--altosui/AltosFlightStatus.java4
-rw-r--r--altosui/AltosFlightStatusTableModel.java2
-rw-r--r--altosui/AltosFlightStatusUpdate.java2
-rw-r--r--altosui/AltosFlightUI.java64
-rw-r--r--altosui/AltosGraphUI.java4
-rw-r--r--altosui/AltosIdleMonitorUI.java24
-rw-r--r--altosui/AltosIgniteUI.java4
-rw-r--r--altosui/AltosIgnitor.java4
-rw-r--r--altosui/AltosLanded.java10
-rw-r--r--altosui/AltosLaunch.java2
-rw-r--r--altosui/AltosLaunchUI.java2
-rw-r--r--altosui/AltosPad.java39
-rw-r--r--altosui/AltosUI.java19
-rw-r--r--altosui/AltosUIPreferencesBackend.java2
-rw-r--r--altosui/Info.plist.in29
-rw-r--r--altosui/Instdrv/NSIS/Includes/java.nsh126
-rw-r--r--altosui/Instdrv/NSIS/Includes/refresh-sh.nsh14
-rw-r--r--altosui/Makefile.am73
-rw-r--r--altosui/altos-windows.nsi.in140
-rw-r--r--altosui/altusmetrum-altosui.desktop.in (renamed from altosui/altos.desktop.in)5
-rw-r--r--altosui/linux-install.sh79
32 files changed, 747 insertions, 210 deletions
diff --git a/altosui/.gitignore b/altosui/.gitignore
index 10b600e4..a9b80aa4 100644
--- a/altosui/.gitignore
+++ b/altosui/.gitignore
@@ -17,7 +17,7 @@ Altos-Linux-*.tar.bz2
Altos-Linux-*.sh
Altos-Mac-*.zip
Altos-Windows-*.exe
-altos.desktop
+.desktop
*.dll
*.dylib
*.so
diff --git a/altosui/Altos.java b/altosui/Altos.java
index 28038ad6..74b45f1c 100644
--- a/altosui/Altos.java
+++ b/altosui/Altos.java
@@ -20,8 +20,8 @@ package altosui;
import java.awt.*;
import libaltosJNI.*;
-import org.altusmetrum.altoslib_4.*;
-import org.altusmetrum.altosuilib_2.*;
+import org.altusmetrum.altoslib_5.*;
+import org.altusmetrum.altosuilib_3.*;
public class Altos extends AltosUILib {
diff --git a/altosui/AltosAscent.java b/altosui/AltosAscent.java
index 3bc80406..24fc362f 100644
--- a/altosui/AltosAscent.java
+++ b/altosui/AltosAscent.java
@@ -21,8 +21,8 @@ import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
-import org.altusmetrum.altoslib_4.*;
-import org.altusmetrum.altosuilib_2.*;
+import org.altusmetrum.altoslib_5.*;
+import org.altusmetrum.altosuilib_3.*;
public class AltosAscent extends AltosUIFlightTab {
JLabel cur, max;
diff --git a/altosui/AltosCompanionInfo.java b/altosui/AltosCompanionInfo.java
index e7b335ac..7ac53dd8 100644
--- a/altosui/AltosCompanionInfo.java
+++ b/altosui/AltosCompanionInfo.java
@@ -19,8 +19,8 @@ package altosui;
import java.awt.*;
import javax.swing.*;
-import org.altusmetrum.altoslib_4.*;
-import org.altusmetrum.altosuilib_2.*;
+import org.altusmetrum.altoslib_5.*;
+import org.altusmetrum.altosuilib_3.*;
public class AltosCompanionInfo extends JTable implements AltosFlightDisplay {
private AltosFlightInfoTableModel model;
diff --git a/altosui/AltosConfig.java b/altosui/AltosConfig.java
index 6eb7d40c..40f7ebec 100644
--- a/altosui/AltosConfig.java
+++ b/altosui/AltosConfig.java
@@ -22,8 +22,8 @@ import javax.swing.*;
import java.io.*;
import java.util.concurrent.*;
import java.text.*;
-import org.altusmetrum.altoslib_4.*;
-import org.altusmetrum.altosuilib_2.*;
+import org.altusmetrum.altoslib_5.*;
+import org.altusmetrum.altosuilib_3.*;
public class AltosConfig implements ActionListener {
diff --git a/altosui/AltosConfigPyroUI.java b/altosui/AltosConfigPyroUI.java
index f0b4f0f9..64336c8e 100644
--- a/altosui/AltosConfigPyroUI.java
+++ b/altosui/AltosConfigPyroUI.java
@@ -21,8 +21,8 @@ import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
-import org.altusmetrum.altoslib_4.*;
-import org.altusmetrum.altosuilib_2.*;
+import org.altusmetrum.altoslib_5.*;
+import org.altusmetrum.altosuilib_3.*;
public class AltosConfigPyroUI
extends AltosUIDialog
@@ -285,9 +285,13 @@ public class AltosConfigPyroUI
"0.050", "0.100", "0.250", "0.500", "1.0", "2.0"
};
+ boolean initializing;
+
public void set_pyro_firing_time(double new_pyro_firing_time) {
+ initializing = true;
pyro_firing_time_value.setSelectedItem(Double.toString(new_pyro_firing_time));
pyro_firing_time_value.setEnabled(new_pyro_firing_time >= 0);
+ initializing = false;
}
public double get_pyro_firing_time() throws AltosConfigDataException {
@@ -301,23 +305,28 @@ public class AltosConfigPyroUI
}
public void set_dirty() {
- owner.set_dirty();
+ if (!initializing)
+ owner.set_dirty();
}
public void itemStateChanged(ItemEvent e) {
- owner.set_dirty();
+ if (!initializing)
+ owner.set_dirty();
}
public void changedUpdate(DocumentEvent e) {
- owner.set_dirty();
+ if (!initializing)
+ owner.set_dirty();
}
public void insertUpdate(DocumentEvent e) {
- owner.set_dirty();
+ if (!initializing)
+ owner.set_dirty();
}
public void removeUpdate(DocumentEvent e) {
- owner.set_dirty();
+ if (!initializing)
+ owner.set_dirty();
}
public void units_changed(boolean imperial_units) {
diff --git a/altosui/AltosConfigTD.java b/altosui/AltosConfigTD.java
index bfbd2c77..9020ed9d 100644
--- a/altosui/AltosConfigTD.java
+++ b/altosui/AltosConfigTD.java
@@ -21,8 +21,8 @@ import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.util.concurrent.*;
-import org.altusmetrum.altoslib_4.*;
-import org.altusmetrum.altosuilib_2.*;
+import org.altusmetrum.altoslib_5.*;
+import org.altusmetrum.altosuilib_3.*;
public class AltosConfigTD implements ActionListener {
@@ -62,6 +62,7 @@ public class AltosConfigTD implements ActionListener {
int_ref radio_calibration;
int_ref radio_setting;
int_ref radio_frequency;
+ int_ref telemetry_rate;
string_ref config_version;
string_ref version;
string_ref product;
@@ -105,6 +106,7 @@ public class AltosConfigTD implements ActionListener {
config_ui.set_version(version.get());
config_ui.set_radio_frequency(frequency());
config_ui.set_radio_calibration(radio_calibration.get());
+ config_ui.set_telemetry_rate(telemetry_rate.get());
config_ui.set_clean();
if (!made_visible) {
made_visible = true;
@@ -140,6 +142,7 @@ public class AltosConfigTD implements ActionListener {
get_int(line, "Radio cal:", radio_calibration);
get_int(line, "Frequency:", radio_frequency);
get_int(line, "Radio setting:", radio_setting);
+ get_int(line, "Telemetry rate:", telemetry_rate);
get_string(line,"software-version", version);
get_string(line,"product", product);
}
@@ -151,6 +154,7 @@ public class AltosConfigTD implements ActionListener {
radio_setting.set(0);
radio_frequency.set(0);
radio_calibration.set(1186611);
+ telemetry_rate.set(Altos.ao_telemetry_rate_38400);
config_version.set("0.0");
version.set("unknown");
product.set("unknown");
@@ -178,6 +182,17 @@ public class AltosConfigTD implements ActionListener {
}
}
+ synchronized int telemetry_rate() {
+ return telemetry_rate.get();
+ }
+
+ synchronized void set_telemetry_rate(int new_telemetry_rate){
+ int rate = telemetry_rate.get();
+
+ if (rate >= 0)
+ telemetry_rate.set(new_telemetry_rate);
+ }
+
final static int serial_mode_read = 0;
final static int serial_mode_save = 1;
final static int serial_mode_reboot = 2;
@@ -208,8 +223,10 @@ public class AltosConfigTD implements ActionListener {
if (!config_version.get().equals("0.0"))
break;
been_there = true;
- config.serial_line.printf("C\n ");
- config.serial_line.flush_input();
+ if (config != null && config.serial_line != null) {
+ config.serial_line.printf("C\n ");
+ config.serial_line.flush_input();
+ }
}
} catch (InterruptedException ie) {
}
@@ -218,6 +235,7 @@ public class AltosConfigTD implements ActionListener {
* available firmware version might place on the actual frequency
*/
config.set_frequency(AltosPreferences.frequency(serial.get()));
+ config.set_telemetry_rate(AltosPreferences.telemetry_rate(serial.get()));
config.process_line("all finished");
}
@@ -226,6 +244,8 @@ public class AltosConfigTD implements ActionListener {
if (frequency != 0)
AltosPreferences.set_frequency(serial.get(),
frequency);
+ AltosPreferences.set_telemetry_rate(serial.get(),
+ telemetry_rate());
}
public void run () {
@@ -259,8 +279,10 @@ public class AltosConfigTD implements ActionListener {
}
void abort() {
- serial_line.close();
- serial_line = null;
+ if (serial_line != null) {
+ serial_line.close();
+ serial_line = null;
+ }
JOptionPane.showMessageDialog(owner,
String.format("Connection to \"%s\" failed",
device.toShortString()),
@@ -279,6 +301,8 @@ public class AltosConfigTD implements ActionListener {
void save_data() {
double freq = config_ui.radio_frequency();
set_frequency(freq);
+ int telemetry_rate = config_ui.telemetry_rate();
+ set_telemetry_rate(telemetry_rate);
run_serial_thread(serial_mode_save);
}
@@ -311,6 +335,7 @@ public class AltosConfigTD implements ActionListener {
radio_setting = new int_ref(0);
radio_frequency = new int_ref(0);
radio_calibration = new int_ref(1186611);
+ telemetry_rate = new int_ref(AltosLib.ao_telemetry_rate_38400);
config_version = new string_ref("0.0");
version = new string_ref("unknown");
product = new string_ref("unknown");
@@ -340,4 +365,4 @@ public class AltosConfigTD implements ActionListener {
}
}
}
-} \ No newline at end of file
+}
diff --git a/altosui/AltosConfigTDUI.java b/altosui/AltosConfigTDUI.java
index 22b3384d..b677ad23 100644
--- a/altosui/AltosConfigTDUI.java
+++ b/altosui/AltosConfigTDUI.java
@@ -21,8 +21,8 @@ import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
-import org.altusmetrum.altoslib_4.*;
-import org.altusmetrum.altosuilib_2.*;
+import org.altusmetrum.altoslib_5.*;
+import org.altusmetrum.altosuilib_3.*;
public class AltosConfigTDUI
extends AltosUIDialog
@@ -37,6 +37,7 @@ public class AltosConfigTDUI
JLabel frequency_label;
JLabel radio_calibration_label;
JLabel radio_frequency_label;
+ JLabel rate_label;
public boolean dirty;
@@ -44,8 +45,9 @@ public class AltosConfigTDUI
JLabel product_value;
JLabel version_value;
JLabel serial_value;
- AltosFreqList radio_frequency_value;
+ AltosUIFreqList radio_frequency_value;
JLabel radio_calibration_value;
+ AltosUIRateList rate_value;
JButton save;
JButton reset;
@@ -54,7 +56,6 @@ public class AltosConfigTDUI
ActionListener listener;
-
/* A window listener to catch closing events and tell the config code */
class ConfigListener extends WindowAdapter {
AltosConfigTDUI ui;
@@ -166,7 +167,7 @@ public class AltosConfigTDUI
c.anchor = GridBagConstraints.LINE_START;
c.insets = ir;
c.ipady = 5;
- radio_frequency_value = new AltosFreqList();
+ radio_frequency_value = new AltosUIFreqList();
radio_frequency_value.addItemListener(this);
pane.add(radio_frequency_value, c);
radio_frequency_value.setToolTipText("Telemetry, RDF and packet frequency");
@@ -193,6 +194,28 @@ public class AltosConfigTDUI
radio_calibration_value = new JLabel(String.format("%d", 1186611));
pane.add(radio_calibration_value, c);
+ /* Telemetry Rate */
+ c = new GridBagConstraints();
+ c.gridx = 0; c.gridy = 7;
+ c.gridwidth = 4;
+ c.fill = GridBagConstraints.NONE;
+ c.anchor = GridBagConstraints.LINE_START;
+ c.insets = il;
+ c.ipady = 5;
+ rate_label = new JLabel("Telemetry Rate:");
+ pane.add(rate_label, c);
+
+ c = new GridBagConstraints();
+ c.gridx = 4; c.gridy = 7;
+ c.gridwidth = 4;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ c.weightx = 1;
+ c.anchor = GridBagConstraints.LINE_START;
+ c.insets = ir;
+ c.ipady = 5;
+ rate_value = new AltosUIRateList();
+ pane.add(rate_value, c);
+
/* Buttons */
c = new GridBagConstraints();
c.gridx = 0; c.gridy = 12;
@@ -340,6 +363,14 @@ public class AltosConfigTDUI
radio_calibration_value.setText(String.format("%d", calibration));
}
+ public int telemetry_rate() {
+ return rate_value.getSelectedIndex();
+ }
+
+ public void set_telemetry_rate(int rate) {
+ rate_value.setSelectedIndex(rate);
+ }
+
public void set_clean() {
dirty = false;
}
diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java
index 1b5ff988..9fcace61 100644
--- a/altosui/AltosConfigUI.java
+++ b/altosui/AltosConfigUI.java
@@ -21,8 +21,8 @@ import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
-import org.altusmetrum.altoslib_4.*;
-import org.altusmetrum.altosuilib_2.*;
+import org.altusmetrum.altoslib_5.*;
+import org.altusmetrum.altosuilib_3.*;
public class AltosConfigUI
extends AltosUIDialog
@@ -40,7 +40,9 @@ public class AltosConfigUI
JLabel radio_calibration_label;
JLabel radio_frequency_label;
JLabel radio_enable_label;
+ JLabel rate_label;
JLabel aprs_interval_label;
+ JLabel aprs_ssid_label;
JLabel flight_log_max_label;
JLabel ignite_mode_label;
JLabel pad_orientation_label;
@@ -58,10 +60,12 @@ public class AltosConfigUI
JComboBox<String> main_deploy_value;
JComboBox<String> apogee_delay_value;
JComboBox<String> apogee_lockout_value;
- AltosFreqList radio_frequency_value;
+ AltosUIFreqList radio_frequency_value;
JTextField radio_calibration_value;
JRadioButton radio_enable_value;
+ AltosUIRateList rate_value;
JComboBox<String> aprs_interval_value;
+ JComboBox<Integer> aprs_ssid_value;
JComboBox<String> flight_log_max_value;
JComboBox<String> ignite_mode_value;
JComboBox<String> pad_orientation_value;
@@ -113,6 +117,10 @@ public class AltosConfigUI
"10"
};
+ static Integer[] aprs_ssid_values = {
+ 0, 1, 2 ,3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
+ };
+
static String[] beep_values = {
"3750",
"4000",
@@ -194,6 +202,13 @@ public class AltosConfigUI
radio_enable_value.setToolTipText("Firmware version does not support disabling radio");
}
+ void set_rate_tool_tip() {
+ if (rate_value.isEnabled())
+ rate_value.setToolTipText("Select telemetry baud rate");
+ else
+ rate_value.setToolTipText("Firmware version does not support variable telemetry rates");
+ }
+
void set_aprs_interval_tool_tip() {
if (aprs_interval_value.isEnabled())
aprs_interval_value.setToolTipText("Enable APRS and set the interval between APRS reports");
@@ -201,6 +216,15 @@ public class AltosConfigUI
aprs_interval_value.setToolTipText("Hardware doesn't support APRS");
}
+ void set_aprs_ssid_tool_tip() {
+ if (aprs_ssid_value.isEnabled())
+ aprs_interval_value.setToolTipText("Set the APRS SSID (secondary station identifier)");
+ else if (aprs_interval_value.isEnabled())
+ aprs_interval_value.setToolTipText("Software version doesn't support setting the APRS SSID");
+ else
+ aprs_interval_value.setToolTipText("Hardware doesn't support APRS");
+ }
+
void set_flight_log_max_tool_tip() {
if (flight_log_max_value.isEnabled())
flight_log_max_value.setToolTipText("Size reserved for each flight log (in kB)");
@@ -417,7 +441,7 @@ public class AltosConfigUI
c.anchor = GridBagConstraints.LINE_START;
c.insets = ir;
c.ipady = 5;
- radio_frequency_value = new AltosFreqList();
+ radio_frequency_value = new AltosUIFreqList();
radio_frequency_value.addItemListener(this);
pane.add(radio_frequency_value, c);
radio_frequency_value.setToolTipText("Telemetry, RDF and packet frequency");
@@ -475,6 +499,31 @@ public class AltosConfigUI
set_radio_enable_tool_tip();
row++;
+ /* Telemetry Rate */
+ c = new GridBagConstraints();
+ c.gridx = 0; c.gridy = row;
+ c.gridwidth = 4;
+ c.fill = GridBagConstraints.NONE;
+ c.anchor = GridBagConstraints.LINE_START;
+ c.insets = il;
+ c.ipady = 5;
+ rate_label = new JLabel("Telemetry baud rate:");
+ pane.add(rate_label, c);
+
+ c = new GridBagConstraints();
+ c.gridx = 4; c.gridy = row;
+ c.gridwidth = 4;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ c.weightx = 1;
+ c.anchor = GridBagConstraints.LINE_START;
+ c.insets = ir;
+ c.ipady = 5;
+ rate_value = new AltosUIRateList();
+ rate_value.addItemListener(this);
+ pane.add(rate_value, c);
+ set_rate_tool_tip();
+ row++;
+
/* APRS interval */
c = new GridBagConstraints();
c.gridx = 0; c.gridy = row;
@@ -501,6 +550,33 @@ public class AltosConfigUI
set_aprs_interval_tool_tip();
row++;
+ /* APRS SSID */
+ c = new GridBagConstraints();
+ c.gridx = 0; c.gridy = row;
+ c.gridwidth = 4;
+ c.fill = GridBagConstraints.NONE;
+ c.anchor = GridBagConstraints.LINE_START;
+ c.insets = il;
+ c.ipady = 5;
+ aprs_ssid_label = new JLabel("APRS SSID:");
+ pane.add(aprs_ssid_label, c);
+
+ c = new GridBagConstraints();
+ c.gridx = 4; c.gridy = row;
+ c.gridwidth = 4;
+ c.fill = GridBagConstraints.HORIZONTAL;
+ c.weightx = 1;
+ c.anchor = GridBagConstraints.LINE_START;
+ c.insets = ir;
+ c.ipady = 5;
+ aprs_ssid_value = new JComboBox<Integer>(aprs_ssid_values);
+ aprs_ssid_value.setEditable(false);
+ aprs_ssid_value.addItemListener(this);
+ aprs_ssid_value.setMaximumRowCount(aprs_ssid_values.length);
+ pane.add(aprs_ssid_value, c);
+ set_aprs_ssid_tool_tip();
+ row++;
+
/* Callsign */
c = new GridBagConstraints();
c.gridx = 0; c.gridy = row;
@@ -850,9 +926,16 @@ public class AltosConfigUI
serial_value.setText(String.format("%d", serial));
}
+ public void set_altitude_32(int altitude_32) {
+ }
+
public void set_main_deploy(int new_main_deploy) {
main_deploy_value.setSelectedItem(AltosConvert.height.say(new_main_deploy));
main_deploy_value.setEnabled(new_main_deploy >= 0);
+
+ main_deploy_value.setVisible(new_main_deploy >= 0);
+ main_deploy_label.setVisible(new_main_deploy >= 0);
+
}
public int main_deploy() {
@@ -880,6 +963,8 @@ public class AltosConfigUI
}
public void units_changed(boolean imperial_units) {
+ boolean was_dirty = dirty;
+
String v = main_deploy_value.getSelectedItem().toString();
main_deploy_label.setText(get_main_deploy_label());
set_main_deploy_values();
@@ -892,9 +977,15 @@ public class AltosConfigUI
set_tracker_motion_values();
set_tracker_motion((int) (AltosConvert.height.parse(motion, !imperial_units) + 0.5));
}
+
+ if (!was_dirty)
+ set_clean();
}
public void set_apogee_delay(int new_apogee_delay) {
+ apogee_delay_value.setVisible(new_apogee_delay >= 0);
+ apogee_delay_label.setVisible(new_apogee_delay >= 0);
+
apogee_delay_value.setSelectedItem(Integer.toString(new_apogee_delay));
apogee_delay_value.setEnabled(new_apogee_delay >= 0);
}
@@ -917,6 +1008,9 @@ public class AltosConfigUI
public void set_apogee_lockout(int new_apogee_lockout) {
apogee_lockout_value.setSelectedItem(Integer.toString(new_apogee_lockout));
apogee_lockout_value.setEnabled(new_apogee_lockout >= 0);
+
+ apogee_lockout_value.setVisible(new_apogee_lockout >= 0);
+ apogee_lockout_label.setVisible(new_apogee_lockout >= 0);
}
public int apogee_lockout() throws AltosConfigDataException {
@@ -924,6 +1018,7 @@ public class AltosConfigUI
}
public void set_radio_frequency(double new_radio_frequency) {
+ radio_frequency_label.setVisible(new_radio_frequency >= 0);
radio_frequency_value.set_frequency(new_radio_frequency);
}
@@ -933,6 +1028,8 @@ public class AltosConfigUI
public void set_radio_calibration(int new_radio_calibration) {
radio_calibration_value.setVisible(new_radio_calibration >= 0);
+ radio_calibration_label.setVisible(new_radio_calibration >= 0);
+
if (new_radio_calibration < 0)
radio_calibration_value.setText("Disabled");
else
@@ -944,12 +1041,14 @@ public class AltosConfigUI
}
public void set_radio_enable(int new_radio_enable) {
+ radio_enable_label.setVisible(new_radio_enable >= 0);
+ radio_enable_value.setVisible(new_radio_enable >= 0);
+
if (new_radio_enable >= 0) {
radio_enable_value.setSelected(new_radio_enable > 0);
radio_enable_value.setEnabled(true);
} else {
radio_enable_value.setSelected(true);
- radio_enable_value.setVisible(radio_frequency() > 0);
radio_enable_value.setEnabled(false);
}
set_radio_enable_tool_tip();
@@ -962,8 +1061,20 @@ public class AltosConfigUI
return -1;
}
+ public void set_telemetry_rate(int new_rate) {
+ rate_label.setVisible(new_rate >= 0);
+
+ rate_value.set_rate(new_rate);
+ }
+
+ public int telemetry_rate() {
+ return rate_value.rate();
+ }
+
public void set_callsign(String new_callsign) {
callsign_value.setVisible(new_callsign != null);
+ callsign_label.setVisible(new_callsign != null);
+
callsign_value.setText(new_callsign);
}
@@ -985,6 +1096,9 @@ public class AltosConfigUI
}
public void set_flight_log_max(int new_flight_log_max) {
+ flight_log_max_value.setVisible(new_flight_log_max >= 0);
+ flight_log_max_label.setVisible(new_flight_log_max >= 0);
+
flight_log_max_value.setSelectedItem(flight_log_max_label(new_flight_log_max));
flight_log_max = new_flight_log_max;
set_flight_log_max_tool_tip();
@@ -1011,6 +1125,9 @@ public class AltosConfigUI
}
public void set_ignite_mode(int new_ignite_mode) {
+ ignite_mode_value.setVisible(new_ignite_mode >= 0);
+ ignite_mode_label.setVisible(new_ignite_mode >= 0);
+
if (new_ignite_mode >= ignite_mode_values.length)
new_ignite_mode = 0;
if (new_ignite_mode < 0) {
@@ -1032,14 +1149,13 @@ public class AltosConfigUI
public void set_pad_orientation(int new_pad_orientation) {
+ pad_orientation_value.setVisible(new_pad_orientation >= 0);
+ pad_orientation_label.setVisible(new_pad_orientation >= 0);
+
if (new_pad_orientation >= pad_orientation_values.length)
new_pad_orientation = 0;
- if (new_pad_orientation < 0) {
- pad_orientation_value.setVisible(false);
+ if (new_pad_orientation < 0)
new_pad_orientation = 0;
- } else {
- pad_orientation_value.setVisible(true);
- }
pad_orientation_value.setSelectedIndex(new_pad_orientation);
set_pad_orientation_tool_tip();
}
@@ -1052,6 +1168,9 @@ public class AltosConfigUI
}
public void set_beep(int new_beep) {
+ beep_value.setVisible(new_beep >= 0);
+ beep_label.setVisible(new_beep >= 0);
+
int new_freq = (int) Math.floor (AltosConvert.beep_value_to_freq(new_beep) + 0.5);
for (int i = 0; i < beep_values.length; i++)
if (new_beep == AltosConvert.beep_freq_to_value(Integer.parseInt(beep_values[i]))) {
@@ -1103,12 +1222,13 @@ public class AltosConfigUI
}
public void set_tracker_motion(int tracker_motion) {
+ tracker_motion_label.setVisible(tracker_motion >= 0);
+ tracker_motion_value.setVisible(tracker_motion >= 0);
+
if (tracker_motion < 0) {
- tracker_motion_label.setVisible(false);
- tracker_motion_value.setVisible(false);
+ tracker_motion_value.setEnabled(false);
} else {
- tracker_motion_label.setVisible(true);
- tracker_motion_value.setVisible(true);
+ tracker_motion_value.setEnabled(true);
tracker_motion_value.setSelectedItem(AltosConvert.height.say(tracker_motion));
}
}
@@ -1118,12 +1238,13 @@ public class AltosConfigUI
}
public void set_tracker_interval(int tracker_interval) {
+ tracker_interval_label.setVisible(tracker_interval >= 0);
+ tracker_interval_value.setVisible(tracker_interval >= 0);
+
if (tracker_interval< 0) {
- tracker_interval_label.setVisible(false);
- tracker_interval_value.setVisible(false);
+ tracker_interval_value.setEnabled(false);
} else {
- tracker_interval_label.setVisible(true);
- tracker_interval_value.setVisible(true);
+ tracker_interval_value.setEnabled(true);
tracker_interval_value.setSelectedItem(String.format("%d", tracker_interval));
}
}
@@ -1159,6 +1280,9 @@ public class AltosConfigUI
}
public void set_aprs_interval(int new_aprs_interval) {
+ aprs_interval_value.setVisible(new_aprs_interval >= 0);
+ aprs_interval_label.setVisible(new_aprs_interval >= 0);
+
String s;
if (new_aprs_interval <= 0)
@@ -1166,7 +1290,6 @@ public class AltosConfigUI
else
s = Integer.toString(new_aprs_interval);
aprs_interval_value.setSelectedItem(s);
- aprs_interval_value.setVisible(new_aprs_interval >= 0);
set_aprs_interval_tool_tip();
}
@@ -1177,4 +1300,17 @@ public class AltosConfigUI
return 0;
return parse_int("aprs interval", s, false);
}
+
+ public void set_aprs_ssid(int new_aprs_ssid) {
+ aprs_ssid_value.setVisible(new_aprs_ssid >= 0);
+ aprs_ssid_label.setVisible(new_aprs_ssid >= 0);
+
+ aprs_ssid_value.setSelectedItem(Math.max(0,new_aprs_ssid));
+ set_aprs_ssid_tool_tip();
+ }
+
+ public int aprs_ssid() throws AltosConfigDataException {
+ Integer i = (Integer) aprs_ssid_value.getSelectedItem();
+ return i;
+ }
}
diff --git a/altosui/AltosConfigureUI.java b/altosui/AltosConfigureUI.java
index e61a4a5b..85a3f6c0 100644
--- a/altosui/AltosConfigureUI.java
+++ b/altosui/AltosConfigureUI.java
@@ -22,7 +22,7 @@ import java.awt.event.*;
import java.beans.*;
import javax.swing.*;
import javax.swing.event.*;
-import org.altusmetrum.altosuilib_2.*;
+import org.altusmetrum.altosuilib_3.*;
public class AltosConfigureUI
extends AltosUIConfigure
@@ -89,6 +89,8 @@ public class AltosConfigureUI
row++;
}
+ boolean has_bluetooth;
+
public void add_bluetooth() {
JButton manage_bluetooth = new JButton("Manage Bluetooth");
manage_bluetooth.addActionListener(new ActionListener() {
@@ -98,6 +100,7 @@ public class AltosConfigureUI
});
pane.add(manage_bluetooth, constraints(0, 2));
/* in the same row as add_frequencies, so don't bump row */
+ has_bluetooth = true;
}
public void add_frequencies() {
@@ -108,7 +111,10 @@ public class AltosConfigureUI
}
});
manage_frequencies.setToolTipText("Configure which values are shown in frequency menus");
- pane.add(manage_frequencies, constraints(2, 1));
+ if (has_bluetooth)
+ pane.add(manage_frequencies, constraints(2, 1));
+ else
+ pane.add(manage_frequencies, constraints(0, 3));
row++;
}
diff --git a/altosui/AltosDescent.java b/altosui/AltosDescent.java
index 36fc1613..e38b35ed 100644
--- a/altosui/AltosDescent.java
+++ b/altosui/AltosDescent.java
@@ -21,8 +21,8 @@ import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
-import org.altusmetrum.altoslib_4.*;
-import org.altusmetrum.altosuilib_2.*;
+import org.altusmetrum.altoslib_5.*;
+import org.altusmetrum.altosuilib_3.*;
public class AltosDescent extends AltosUIFlightTab {
diff --git a/altosui/AltosFlightStatus.java b/altosui/AltosFlightStatus.java
index 46c0b387..7e7efa64 100644
--- a/altosui/AltosFlightStatus.java
+++ b/altosui/AltosFlightStatus.java
@@ -19,8 +19,8 @@ package altosui;
import java.awt.*;
import javax.swing.*;
-import org.altusmetrum.altoslib_4.*;
-import org.altusmetrum.altosuilib_2.*;
+import org.altusmetrum.altoslib_5.*;
+import org.altusmetrum.altosuilib_3.*;
public class AltosFlightStatus extends JComponent implements AltosFlightDisplay {
GridBagLayout layout;
diff --git a/altosui/AltosFlightStatusTableModel.java b/altosui/AltosFlightStatusTableModel.java
index b33f40a4..336b44aa 100644
--- a/altosui/AltosFlightStatusTableModel.java
+++ b/altosui/AltosFlightStatusTableModel.java
@@ -27,7 +27,7 @@ import java.util.*;
import java.text.*;
import java.util.prefs.*;
import java.util.concurrent.LinkedBlockingQueue;
-import org.altusmetrum.altoslib_4.*;
+import org.altusmetrum.altoslib_5.*;
public class AltosFlightStatusTableModel extends AbstractTableModel {
private String[] columnNames = {
diff --git a/altosui/AltosFlightStatusUpdate.java b/altosui/AltosFlightStatusUpdate.java
index 0daec04e..3ba78c19 100644
--- a/altosui/AltosFlightStatusUpdate.java
+++ b/altosui/AltosFlightStatusUpdate.java
@@ -18,7 +18,7 @@
package altosui;
import java.awt.event.*;
-import org.altusmetrum.altoslib_4.*;
+import org.altusmetrum.altoslib_5.*;
public class AltosFlightStatusUpdate implements ActionListener {
diff --git a/altosui/AltosFlightUI.java b/altosui/AltosFlightUI.java
index 43deb631..6af345ea 100644
--- a/altosui/AltosFlightUI.java
+++ b/altosui/AltosFlightUI.java
@@ -22,8 +22,8 @@ import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import java.util.concurrent.*;
-import org.altusmetrum.altoslib_4.*;
-import org.altusmetrum.altosuilib_2.*;
+import org.altusmetrum.altoslib_5.*;
+import org.altusmetrum.altosuilib_3.*;
public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay {
AltosVoice voice;
@@ -169,10 +169,11 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay {
exit_on_close = true;
}
- Container bag;
- AltosFreqList frequencies;
- JComboBox<String> telemetries;
- JLabel telemetry;
+ Container bag;
+ AltosUIFreqList frequencies;
+ AltosUIRateList rates;
+ AltosUITelemetryList telemetries;
+ JLabel telemetry;
ActionListener show_timer;
@@ -193,8 +194,8 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay {
/* Stick channel selector at top of table for telemetry monitoring */
if (serial >= 0) {
- // Channel menu
- frequencies = new AltosFreqList(AltosUIPreferences.frequency(serial));
+ // Frequency menu
+ frequencies = new AltosUIFreqList(AltosUIPreferences.frequency(serial));
frequencies.set_product("Monitor");
frequencies.set_serial(serial);
frequencies.addActionListener(new ActionListener() {
@@ -217,27 +218,40 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay {
c.anchor = GridBagConstraints.WEST;
bag.add (frequencies, c);
- // Telemetry format menu
+ // Telemetry rate list
+ rates = new AltosUIRateList(AltosUIPreferences.telemetry_rate(serial));
+ rates.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ int rate = rates.rate();
+ try {
+ reader.set_telemetry_rate(rate);
+ } catch (TimeoutException te) {
+ } catch (InterruptedException ie) {
+ }
+ reader.save_telemetry_rate();
+ }
+ });
+ rates.setEnabled(reader.supports_telemetry_rate(AltosLib.ao_telemetry_rate_2400));
+ c.gridx = 1;
+ c.gridy = 0;
+ c.weightx = 0;
+ c.weighty = 0;
+ c.insets = new Insets(3, 3, 3, 3);
+ c.fill = GridBagConstraints.NONE;
+ c.anchor = GridBagConstraints.WEST;
+ bag.add (rates, c);
+
+ // Telemetry format list
if (reader.supports_telemetry(Altos.ao_telemetry_standard)) {
- telemetries = new JComboBox<String>();
- for (int i = 1; i <= Altos.ao_telemetry_max; i++)
- telemetries.addItem(Altos.telemetry_name(i));
- int telemetry = AltosPreferences.telemetry(serial);
- if (telemetry <= Altos.ao_telemetry_off ||
- telemetry > Altos.ao_telemetry_max)
- telemetry = Altos.ao_telemetry_standard;
- telemetries.setSelectedIndex(telemetry - 1);
- telemetries.setMaximumRowCount(Altos.ao_telemetry_max);
- telemetries.setPreferredSize(null);
- telemetries.revalidate();
+ telemetries = new AltosUITelemetryList(serial);
telemetries.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
- int telemetry = telemetries.getSelectedIndex() + 1;
+ int telemetry = telemetries.get_selected();
reader.set_telemetry(telemetry);
reader.save_telemetry();
}
});
- c.gridx = 1;
+ c.gridx = 2;
c.gridy = 0;
c.weightx = 0;
c.weighty = 0;
@@ -256,7 +270,7 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay {
version = "Telemetry: None";
telemetry = new JLabel(version);
- c.gridx = 1;
+ c.gridx = 2;
c.gridy = 0;
c.weightx = 0;
c.weighty = 0;
@@ -274,9 +288,8 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay {
c.gridy = 1;
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 1;
- c.gridwidth = 2;
+ c.gridwidth = 3;
bag.add(flightStatus, c);
- c.gridwidth = 1;
/* The rest of the window uses a tabbed pane to
* show one of the alternate data views
@@ -315,7 +328,6 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay {
c.fill = GridBagConstraints.BOTH;
c.weightx = 1;
c.weighty = 1;
- c.gridwidth = 2;
bag.add(pane, c);
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
diff --git a/altosui/AltosGraphUI.java b/altosui/AltosGraphUI.java
index 07fe9317..ddd281a6 100644
--- a/altosui/AltosGraphUI.java
+++ b/altosui/AltosGraphUI.java
@@ -23,8 +23,8 @@ import java.util.ArrayList;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
-import org.altusmetrum.altoslib_4.*;
-import org.altusmetrum.altosuilib_2.*;
+import org.altusmetrum.altoslib_5.*;
+import org.altusmetrum.altosuilib_3.*;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
diff --git a/altosui/AltosIdleMonitorUI.java b/altosui/AltosIdleMonitorUI.java
index 042111ec..67b7a989 100644
--- a/altosui/AltosIdleMonitorUI.java
+++ b/altosui/AltosIdleMonitorUI.java
@@ -24,8 +24,8 @@ import javax.swing.event.*;
import java.io.*;
import java.util.concurrent.*;
import java.util.Arrays;
-import org.altusmetrum.altoslib_4.*;
-import org.altusmetrum.altosuilib_2.*;
+import org.altusmetrum.altoslib_5.*;
+import org.altusmetrum.altosuilib_3.*;
public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDisplay, AltosIdleMonitorListener, DocumentListener {
AltosDevice device;
@@ -33,9 +33,11 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
AltosPad pad;
AltosInfoTable flightInfo;
AltosFlightStatus flightStatus;
+ AltosIgnitor ignitor;
AltosIdleMonitor thread;
int serial;
boolean remote;
+ boolean has_ignitor;
void stop_display() {
if (thread != null) {
@@ -70,10 +72,22 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
public void show(AltosState state, AltosListenerState listener_state) {
status_update.saved_state = state;
+ if (ignitor.should_show(state)) {
+ if (!has_ignitor) {
+ pane.add("Ignitor", ignitor);
+ has_ignitor = true;
+ }
+ } else {
+ if (has_ignitor) {
+ pane.remove(ignitor);
+ has_ignitor = false;
+ }
+ }
// try {
pad.show(state, listener_state);
flightStatus.show(state, listener_state);
flightInfo.show(state, listener_state);
+ ignitor.show(state, listener_state);
// } catch (Exception e) {
// System.out.print("Show exception " + e);
// }
@@ -89,7 +103,7 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
}
Container bag;
- AltosFreqList frequencies;
+ AltosUIFreqList frequencies;
JTextField callsign_value;
/* DocumentListener interface methods */
@@ -186,7 +200,7 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
/* Stick frequency selector at top of table for telemetry monitoring */
if (remote && serial >= 0) {
// Frequency menu
- frequencies = new AltosFreqList(AltosUIPreferences.frequency(serial));
+ frequencies = new AltosUIFreqList(AltosUIPreferences.frequency(serial));
frequencies.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
double frequency = frequencies.frequency();
@@ -222,6 +236,8 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
flightInfo = new AltosInfoTable();
pane.add("Table", new JScrollPane(flightInfo));
+ ignitor = new AltosIgnitor();
+
/* Make the tabbed pane use the rest of the window space */
bag.add(pane, constraints(0, 3, GridBagConstraints.BOTH));
diff --git a/altosui/AltosIgniteUI.java b/altosui/AltosIgniteUI.java
index c251bbe2..15a81e57 100644
--- a/altosui/AltosIgniteUI.java
+++ b/altosui/AltosIgniteUI.java
@@ -24,8 +24,8 @@ import java.io.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
-import org.altusmetrum.altoslib_4.*;
-import org.altusmetrum.altosuilib_2.*;
+import org.altusmetrum.altoslib_5.*;
+import org.altusmetrum.altosuilib_3.*;
public class AltosIgniteUI
extends AltosUIDialog
diff --git a/altosui/AltosIgnitor.java b/altosui/AltosIgnitor.java
index 990a87e6..117def09 100644
--- a/altosui/AltosIgnitor.java
+++ b/altosui/AltosIgnitor.java
@@ -20,8 +20,8 @@ package altosui;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
-import org.altusmetrum.altoslib_4.*;
-import org.altusmetrum.altosuilib_2.*;
+import org.altusmetrum.altoslib_5.*;
+import org.altusmetrum.altosuilib_3.*;
public class AltosIgnitor extends AltosUIFlightTab {
diff --git a/altosui/AltosLanded.java b/altosui/AltosLanded.java
index dd5cf9ab..7c50adac 100644
--- a/altosui/AltosLanded.java
+++ b/altosui/AltosLanded.java
@@ -21,8 +21,8 @@ import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
-import org.altusmetrum.altoslib_4.*;
-import org.altusmetrum.altosuilib_2.*;
+import org.altusmetrum.altoslib_5.*;
+import org.altusmetrum.altosuilib_3.*;
public class AltosLanded extends AltosUIFlightTab implements ActionListener {
@@ -151,6 +151,12 @@ public class AltosLanded extends AltosUIFlightTab implements ActionListener {
return "Landed";
}
+ public void show(AltosState state, AltosListenerState listener_state) {
+ super.show(state, listener_state);
+ if (reader.backing_file() != null)
+ graph.setEnabled(true);
+ }
+
public AltosLanded(AltosFlightReader in_reader) {
reader = in_reader;
diff --git a/altosui/AltosLaunch.java b/altosui/AltosLaunch.java
index 9ac1e44c..17178616 100644
--- a/altosui/AltosLaunch.java
+++ b/altosui/AltosLaunch.java
@@ -20,7 +20,7 @@ package altosui;
import java.io.*;
import java.util.concurrent.*;
import java.awt.*;
-import org.altusmetrum.altosuilib_2.*;
+import org.altusmetrum.altosuilib_3.*;
public class AltosLaunch {
AltosDevice device;
diff --git a/altosui/AltosLaunchUI.java b/altosui/AltosLaunchUI.java
index cc082542..3320e675 100644
--- a/altosui/AltosLaunchUI.java
+++ b/altosui/AltosLaunchUI.java
@@ -23,7 +23,7 @@ import javax.swing.*;
import java.io.*;
import java.text.*;
import java.util.concurrent.*;
-import org.altusmetrum.altosuilib_2.*;
+import org.altusmetrum.altosuilib_3.*;
class FireButton extends JButton {
protected void processMouseEvent(MouseEvent e) {
diff --git a/altosui/AltosPad.java b/altosui/AltosPad.java
index 6b5fd150..eb0c5644 100644
--- a/altosui/AltosPad.java
+++ b/altosui/AltosPad.java
@@ -18,8 +18,8 @@
package altosui;
import java.util.*;
-import org.altusmetrum.altoslib_4.*;
-import org.altusmetrum.altosuilib_2.*;
+import org.altusmetrum.altoslib_5.*;
+import org.altusmetrum.altosuilib_3.*;
public class AltosPad extends AltosUIFlightTab {
@@ -117,6 +117,17 @@ public class AltosPad extends AltosUIFlightTab {
}
}
+ boolean report_pad(AltosState state) {
+ if ((state.state == AltosLib.ao_flight_stateless ||
+ state.state < AltosLib.ao_flight_pad) &&
+ state.gps != null &&
+ state.gps.lat != AltosLib.MISSING)
+ {
+ return false;
+ }
+ return true;
+ }
+
class PadLat extends AltosUIIndicator {
double last_lat = AltosLib.MISSING - 1;
@@ -126,12 +137,12 @@ public class AltosPad extends AltosUIFlightTab {
String label = null;
if (state != null) {
- if (state.state < AltosLib.ao_flight_pad && state.gps != null && state.gps.lat != AltosLib.MISSING) {
- lat = state.gps.lat;
- label = "Latitude";
- } else {
+ if (report_pad(state)) {
lat = state.pad_lat;
label = "Pad Latitude";
+ } else {
+ lat = state.gps.lat;
+ label = "Latitude";
}
}
if (lat != last_lat) {
@@ -163,12 +174,12 @@ public class AltosPad extends AltosUIFlightTab {
String label = null;
if (state != null) {
- if (state.state < AltosLib.ao_flight_pad && state.gps != null && state.gps.lon != AltosLib.MISSING) {
- lon = state.gps.lon;
- label = "Longitude";
- } else {
+ if (report_pad(state)) {
lon = state.pad_lon;
label = "Pad Longitude";
+ } else {
+ lon = state.gps.lon;
+ label = "Longitude";
}
}
if (lon != last_lon) {
@@ -200,12 +211,12 @@ public class AltosPad extends AltosUIFlightTab {
String label = null;
if (state != null) {
- if (state.state < AltosLib.ao_flight_pad && state.gps != null && state.gps.alt != AltosLib.MISSING) {
- alt = state.gps.alt;
- label = "Altitude";
- } else {
+ if (report_pad(state)) {
alt = state.pad_alt;
label = "Pad Altitude";
+ } else {
+ alt = state.gps.alt;
+ label = "Altitude";
}
}
if (alt != last_alt) {
diff --git a/altosui/AltosUI.java b/altosui/AltosUI.java
index 6137487c..0aa5d03c 100644
--- a/altosui/AltosUI.java
+++ b/altosui/AltosUI.java
@@ -22,8 +22,8 @@ import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.util.concurrent.*;
-import org.altusmetrum.altoslib_4.*;
-import org.altusmetrum.altosuilib_2.*;
+import org.altusmetrum.altoslib_5.*;
+import org.altusmetrum.altosuilib_3.*;
public class AltosUI extends AltosUIFrame {
public AltosVoice voice = new AltosVoice();
@@ -99,10 +99,25 @@ public class AltosUI extends AltosUIFrame {
return b;
}
+ /* OSXAdapter interfaces */
+ public void macosx_file_handler(String path) {
+ process_graph(new File(path));
+ }
+
+ public void macosx_quit_handler() {
+ System.exit(0);
+ }
+
+ public void macosx_preferences_handler() {
+ ConfigureAltosUI();
+ }
+
public AltosUI() {
load_library(null);
+ register_for_macosx_events();
+
AltosUIPreferences.set_component(this);
pane = getContentPane();
diff --git a/altosui/AltosUIPreferencesBackend.java b/altosui/AltosUIPreferencesBackend.java
index 28047086..b229d7b2 100644
--- a/altosui/AltosUIPreferencesBackend.java
+++ b/altosui/AltosUIPreferencesBackend.java
@@ -19,7 +19,7 @@ package altosui;
import java.io.File;
import java.util.prefs.*;
-import org.altusmetrum.altoslib_4.*;
+import org.altusmetrum.altoslib_5.*;
import javax.swing.filechooser.FileSystemView;
public class AltosUIPreferencesBackend implements AltosPreferencesBackend {
diff --git a/altosui/Info.plist.in b/altosui/Info.plist.in
index 46dea171..8dc797d6 100644
--- a/altosui/Info.plist.in
+++ b/altosui/Info.plist.in
@@ -23,7 +23,34 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleIconFile</key>
- <string>AltosUIIcon.icns</string>
+ <string>altusmetrum-altosui.icns</string>
+ <key>CFBundleDocumentTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeName</key>
+ <string>Telemetry</string>
+ <key>CFBundleTypeIconFile</key>
+ <string>application-vnd.altusmetrum.telemetry.icns</string>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>telem</string>
+ </array>
+ <key>CFBundleTypeRole</key>
+ <string>Editor</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeName</key>
+ <string>Eeprom</string>
+ <key>CFBundleTypeIconFile</key>
+ <string>application-vnd.altusmetrum.eeprom.icns</string>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>eeprom</string>
+ </array>
+ <key>CFBundleTypeRole</key>
+ <string>Editor</string>
+ </dict>
+ </array>
<key>Java</key>
<dict>
<key>MainClass</key>
diff --git a/altosui/Instdrv/NSIS/Includes/java.nsh b/altosui/Instdrv/NSIS/Includes/java.nsh
index ebf1c5b9..cd47c1b5 100644
--- a/altosui/Instdrv/NSIS/Includes/java.nsh
+++ b/altosui/Instdrv/NSIS/Includes/java.nsh
@@ -32,19 +32,135 @@ Function GetJRE
Delete $2
FunctionEnd
-Function DetectJRE
+Function DoDetectJRE
+
+ DetailPrint "Desired Java version ${JRE_VERSION}"
+
+ ; Check in HKCU for CurrentVersion
+
+ ClearErrors
+ ReadRegStr $2 HKCU "SOFTWARE\JavaSoft\Java Runtime Environment" \
+ "CurrentVersion"
+
+ IfErrors hklm_version
+
+ DetailPrint "HKEY_CURRENT_USER Java version $2"
+
+ ${VersionCompare} $2 ${JRE_VERSION} $3
+
+ IntCmp $3 1 yes yes no
+
+hklm_version:
+
+ ; Check in HKLM for CurrentVersion
+
+ ClearErrors
ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" \
"CurrentVersion"
+
+ IfErrors hkcu_any
- DetailPrint "Desired Java version ${JRE_VERSION}"
- DetailPrint "Actual Java version $2"
+ DetailPrint "HKEY_LOCAL_MACHINE Java version $2"
${VersionCompare} $2 ${JRE_VERSION} $3
- IntCmp $3 1 done done
+ IntCmp $3 1 yes yes no
- Call GetJRE
+hkcu_any:
+
+ ; Check in HKCU for any Java install
+
+ StrCpy $0 0
+
+hkcu_any_loop:
+ EnumRegKey $1 HKCU "SOFTWARE\JavaSoft" $0
+
+ StrCmp $1 "Java Runtime Environment" found_hkcu
+
+ StrCmp $1 "" hklm_any
+
+ IntOp $0 $0 + 1
+
+ Goto hkcu_any_loop
+
+found_hkcu:
+
+ DetailPrint "HKEY_CURRENT_USER has SOFTWARE\JavaSoft\$1"
+
+ Goto maybe
+
+hklm_any:
+
+ ; Check in HKCU for any Java install
+
+ StrCpy $0 0
+
+hklm_any_loop:
+ EnumRegKey $1 HKLM "SOFTWARE\JavaSoft" $0
+
+ StrCmp $1 "Java Runtime Environment" found_hklm
+
+ StrCmp $1 "" no
+
+ IntOp $0 $0 + 1
+
+ Goto hklm_any_loop
+
+found_hklm:
+
+ DetailPrint "HKEY_CURRENT_USER has SOFTWARE\JavaSoft\$1"
+
+ Goto maybe
+
+yes:
+ StrCpy $0 2
+ Goto done
+
+maybe:
+ StrCpy $0 1
+ Goto done
+
+no:
+ StrCpy $0 0
+ Goto done
done:
FunctionEnd
+
+var dialog
+var hwnd
+var null
+
+var install
+var quit
+var skip
+
+Function DetectJRE
+
+ Call DoDetectJRE
+
+ IntCmp $0 1 ask_maybe ask_no yes
+
+ask_no:
+ StrCpy $0 "No Java detected. Download and install?"
+ Goto ask
+
+ask_maybe:
+ StrCpy $0 "Cannot determine installed Java version. Download and install?"
+ Goto ask
+
+ask:
+ MessageBox MB_YESNOCANCEL $0 IDYES do_java IDNO skip_java
+
+bail:
+ Abort
+
+do_java:
+ Call GetJRE
+
+
+skip_java:
+yes:
+
+FunctionEnd
diff --git a/altosui/Instdrv/NSIS/Includes/refresh-sh.nsh b/altosui/Instdrv/NSIS/Includes/refresh-sh.nsh
new file mode 100644
index 00000000..23d8e5e4
--- /dev/null
+++ b/altosui/Instdrv/NSIS/Includes/refresh-sh.nsh
@@ -0,0 +1,14 @@
+!define SHCNE_ASSOCCHANGED 0x08000000
+!define SHCNF_IDLIST 0
+
+Function RefreshShellIcons
+ ; By jerome tremblay - april 2003
+ ${DisableX64FSRedirection}
+ System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)'
+FunctionEnd
+
+Function un.RefreshShellIcons
+ ; By jerome tremblay - april 2003
+ ${DisableX64FSRedirection}
+ System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)'
+FunctionEnd
diff --git a/altosui/Makefile.am b/altosui/Makefile.am
index 4cb5df58..48f58933 100644
--- a/altosui/Makefile.am
+++ b/altosui/Makefile.am
@@ -64,7 +64,7 @@ LIBALTOS= \
altos.dll
desktopdir = $(datadir)/applications
-desktop_file = altos.desktop
+desktop_file = altusmetrum-altosui.desktop
desktop_SCRIPTS = $(desktop_file)
JAR=altosui.jar
@@ -72,26 +72,45 @@ JAR=altosui.jar
FATJAR=altosui-fat.jar
# Icons
-ICONDIR=$(top_srcdir)/icon
+ICONDIR=../icon
JAVA_ICONS=\
- $(ICONDIR)/altus-metrum-16.png \
- $(ICONDIR)/altus-metrum-32.png \
- $(ICONDIR)/altus-metrum-48.png \
- $(ICONDIR)/altus-metrum-64.png \
- $(ICONDIR)/altus-metrum-128.png \
- $(ICONDIR)/altus-metrum-256.png
+ $(ICONDIR)/altusmetrum-altosui-16.png \
+ $(ICONDIR)/altusmetrum-altosui-32.png \
+ $(ICONDIR)/altusmetrum-altosui-48.png \
+ $(ICONDIR)/altusmetrum-altosui-64.png \
+ $(ICONDIR)/altusmetrum-altosui-128.png\
+ $(ICONDIR)/altusmetrum-altosui-256.png
# icon base names for jar
-ICONJAR= -C $(ICONDIR) altus-metrum-16.png \
- -C $(ICONDIR) altus-metrum-32.png \
- -C $(ICONDIR) altus-metrum-48.png \
- -C $(ICONDIR) altus-metrum-64.png \
- -C $(ICONDIR) altus-metrum-128.png \
- -C $(ICONDIR) altus-metrum-256.png
-
-WINDOWS_ICON=$(ICONDIR)/altus-metrum.ico
-MACOSX_ICON=$(ICONDIR)/AltosUIIcon.icns
+ICONJAR= \
+ -C $(ICONDIR) altusmetrum-altosui-16.png \
+ -C $(ICONDIR) altusmetrum-altosui-32.png \
+ -C $(ICONDIR) altusmetrum-altosui-48.png \
+ -C $(ICONDIR) altusmetrum-altosui-64.png \
+ -C $(ICONDIR) altusmetrum-altosui-128.png\
+ -C $(ICONDIR) altusmetrum-altosui-256.png
+
+WINDOWS_ICONS =\
+ $(ICONDIR)/altusmetrum-altosui.ico \
+ $(ICONDIR)/altusmetrum-altosui.exe
+ $(ICONDIR)/application-vnd.altusmetrum.eeprom.ico \
+ $(ICONDIR)/application-vnd.altusmetrum.eeprom.exe \
+ $(ICONDIR)/application-vnd.altusmetrum.telemetry.ico \
+ $(ICONDIR)/application-vnd.altusmetrum.telemetry.exe
+
+MACOSX_ICONS =\
+ $(ICONDIR)/altusmetrum-altosui.icns \
+ $(ICONDIR)/application-vnd.altusmetrum.eeprom.icns \
+ $(ICONDIR)/application-vnd.altusmetrum.telemetry.icns
+
+LINUX_ICONS =\
+ $(ICONDIR)/altusmetrum-altosui.svg \
+ $(ICONDIR)/application-vnd.altusmetrum.eeprom.svg \
+ $(ICONDIR)/application-vnd.altusmetrum.telemetry.svg
+
+LINUX_MIMETYPE =\
+ $(ICONDIR)/org-altusmetrum-mimetypes.xml
# Firmware
FIRMWARE_TD_0_2=$(top_srcdir)/src/teledongle-v0.2/teledongle-v0.2-$(VERSION).ihx
@@ -115,10 +134,13 @@ FIRMWARE_TMEGA=$(FIRMWARE_TMEGA_1_0)
FIRMWARE_EMINI_1_0=$(top_srcdir)/src/easymini-v1.0/easymini-v1.0-$(VERSION).ihx
FIRMWARE_EMINI=$(FIRMWARE_EMINI_1_0)
+FIRMWARE_EMEGA_1_0=$(top_srcdir)/src/easymega-v1.0/easymega-v1.0-$(VERSION).ihx
+FIRMWARE_EMEGA=$(FIRMWARE_EMEGA_1_0)
+
FIRMWARE_TGPS_1_0=$(top_srcdir)/src/telegps-v1.0/telegps-v1.0-$(VERSION).ihx
FIRMWARE_TGPS=$(FIRMWARE_TGPS_1_0)
-FIRMWARE=$(FIRMWARE_TM) $(FIRMWARE_TELEMINI) $(FIRMWARE_TD) $(FIRMWARE_TBT) $(FIRMWARE_TMEGA) $(FIRMWARE_EMINI) $(FIRMWARE_TGPS)
+FIRMWARE=$(FIRMWARE_TM) $(FIRMWARE_TELEMINI) $(FIRMWARE_TD) $(FIRMWARE_TBT) $(FIRMWARE_TMEGA) $(FIRMWARE_EMINI) $(FIRMWARE_TGPS) $(FIRMWARE_EMEGA)
ALTUSMETRUM_DOC=$(top_srcdir)/doc/altusmetrum.pdf
ALTOS_DOC=$(top_srcdir)/doc/altos.pdf
@@ -141,14 +163,14 @@ FAT_FILES=$(FATJAR) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS_CLASS) $(JFR
LINUX_LIBS=libaltos32.so libaltos64.so
-LINUX_FILES=$(FAT_FILES) $(LINUX_LIBS) $(FIRMWARE) $(DOC) altos.desktop.in ../icon/altusmetrum.svg
+LINUX_FILES=$(FAT_FILES) $(LINUX_LIBS) $(FIRMWARE) $(DOC) $(desktop_file).in $(LINUX_ICONS) $(LINUX_MIMETYPE)
LINUX_EXTRA=altosui-fat
MACOSX_INFO_PLIST=Info.plist
-MACOSX_FILES=$(FAT_FILES) libaltos.dylib $(MACOSX_INFO_PLIST) $(DOC) ReadMe-Mac.rtf $(MACOSX_ICON)
+MACOSX_FILES=$(FAT_FILES) libaltos.dylib $(MACOSX_INFO_PLIST) $(DOC) ReadMe-Mac.rtf $(MACOSX_ICONS)
MACOSX_EXTRA=$(FIRMWARE)
-WINDOWS_FILES=$(FAT_FILES) $(FIRMWARE) altos.dll altos64.dll $(top_srcdir)/altusmetrum.inf $(top_srcdir)/altusmetrum.cat $(WINDOWS_ICON)
+WINDOWS_FILES=$(FAT_FILES) $(FIRMWARE) altos.dll altos64.dll $(top_srcdir)/altusmetrum.inf $(top_srcdir)/altusmetrum.cat $(WINDOWS_ICONS)
all-local: classes/altosui $(JAR) altosui altosui-test altosui-jdb
@@ -156,12 +178,12 @@ clean-local:
-rm -rf classes $(JAR) $(FATJAR) \
$(LINUX_DIST) $(LINUX_SH) $(MACOSX_DIST) windows $(WINDOWS_DIST) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS_CLASS) \
$(JFREECHART_CLASS) $(JCOMMON_CLASS) $(LIBALTOS) Manifest.txt Manifest-fat.txt altos-windows.log altos-windows.nsi \
- altosui altosui-test altosui-jdb macosx linux
+ altosui altosui-test altosui-jdb macosx linux *.desktop
EXTRA_DIST = $(desktop_file).in
$(desktop_file): $(desktop_file).in
- sed -e 's#%bindir%#@bindir@#' -e 's#%icondir%#$(datadir)/icons/hicolor/scalable/apps#' ${srcdir}/altos.desktop.in > $@
+ sed -e 's#%bindir%#@bindir@#' -e 's#%icondir%#$(datadir)/icons/hicolor/scalable/apps#' ${srcdir}/$(desktop_file).in > $@
chmod +x $@
if FATINSTALL
@@ -195,7 +217,6 @@ else
fat: $(LINUX_DIST) $(LINUX_SH) $(MACOSX_DIST) $(WINDOWS_DIST)
endif
-
altosuidir=$(datadir)/java
install-altosuiJAVA: altosui.jar
@@ -325,7 +346,7 @@ $(MACOSX_DIST): $(MACOSX_FILES) $(MACOSX_EXTRA) Makefile
cp -a $(DOC) macosx/Doc
cp -p Info.plist macosx/AltosUI.app/Contents
mkdir -p macosx/AltOS-$(VERSION) macosx/AltosUI.app/Contents/Resources/Java
- cp -p $(MACOSX_ICON) macosx/AltosUI.app/Contents/Resources
+ cp -p $(MACOSX_ICONS) macosx/AltosUI.app/Contents/Resources
cp -p $(FATJAR) macosx/AltosUI.app/Contents/Resources/Java/altosui.jar
cp -p libaltos.dylib macosx/AltosUI.app/Contents/Resources/Java
cp -p $(ALTOSLIB_CLASS) macosx/AltosUI.app/Contents/Resources/Java
@@ -336,6 +357,6 @@ $(MACOSX_DIST): $(MACOSX_FILES) $(MACOSX_EXTRA) Makefile
cp -p $(MACOSX_EXTRA) macosx/AltOS-$(VERSION)
genisoimage -D -V AltOS-$(VERSION) -no-pad -r -apple -o $@ macosx
-$(WINDOWS_DIST): $(WINDOWS_FILES) altos-windows.nsi
+$(WINDOWS_DIST): $(WINDOWS_FILES) altos-windows.nsi Instdrv/NSIS/Includes/java.nsh
-rm -f $@
makensis -Oaltos-windows.log "-XOutFile $@" "-DVERSION=$(VERSION)" altos-windows.nsi || (cat altos-windows.log && exit 1)
diff --git a/altosui/altos-windows.nsi.in b/altosui/altos-windows.nsi.in
index 2e2a46f1..11c1dc07 100644
--- a/altosui/altos-windows.nsi.in
+++ b/altosui/altos-windows.nsi.in
@@ -2,16 +2,24 @@
!addincludedir Instdrv/NSIS/Includes
!include x64.nsh
!include java.nsh
+!include refresh-sh.nsh
-!define PRODUCT_NAME "Altus Metrum Windows Software"
+!define REG_NAME "Altus Metrum"
+!define PROG_ID_TELEM "altusmetrum.altosui.telem.1"
+!define PROG_ID_EEPROM "altusmetrum.altosui.eeprom.1"
+!define FAT_NAME "altosui-fat.jar"
+!define WIN_APP_ICON "altusmetrum-altosui.ico"
+!define WIN_APP_EXE "altusmetrum-altosui.exe"
+!define WIN_TELEM_EXE "application-vnd.altusmetrum.telemetry.exe"
+!define WIN_EEPROM_EXE "application-vnd.altusmetrum.eeprom.exe"
-Name "Altus Metrum Installer"
+Name "${REG_NAME} Installer"
; Default install directory
InstallDir "$PROGRAMFILES\AltusMetrum"
; Tell the installer where to re-install a new version
-InstallDirRegKey HKLM "Software\AltusMetrum" "Install_Dir"
+InstallDirRegKey HKLM "Software\${REG_NAME}" "Install_Dir"
LicenseText "GNU General Public License Version 2"
LicenseData "../COPYING"
@@ -21,7 +29,7 @@ RequestExecutionLevel admin
ShowInstDetails Show
-ComponentText "Altus Metrum Software and Driver Installer"
+ComponentText "${REG_NAME} Software and Driver Installer"
Function .onInit
DetailPrint "Checking host operating system"
@@ -33,6 +41,16 @@ Function .onInit
${EndIf}
FunctionEnd
+Function un.onInit
+ DetailPrint "Checking host operating system"
+ ${If} ${RunningX64}
+ DetailPrint "Installer running on 64-bit host"
+ SetRegView 64
+ StrCpy $INSTDIR "$PROGRAMFILES64\AltusMetrum"
+ ${DisableX64FSRedirection}
+ ${EndIf}
+FunctionEnd
+
; Pages to present
Page license
@@ -68,12 +86,12 @@ done:
SectionEnd
-Section "AltosUI Application"
+Section "${REG_NAME} Application"
Call DetectJRE
SetOutPath $INSTDIR
- File "altosui-fat.jar"
+ File "${FAT_NAME}"
File "altoslib_@ALTOSLIB_VERSION@.jar"
File "altosuilib_@ALTOSUILIB_VERSION@.jar"
File "cmudict04.jar"
@@ -88,16 +106,16 @@ Section "AltosUI Application"
File "*.dll"
- File "../icon/*.ico"
+ File "../icon/${WIN_APP_ICON}"
- CreateShortCut "$SMPROGRAMS\AltusMetrum.lnk" "$SYSDIR\javaw.exe" "-jar altosui-fat.jar" "$INSTDIR\altus-metrum.ico"
+ CreateShortCut "$SMPROGRAMS\${REG_NAME}.lnk" "$SYSDIR\javaw.exe" "-jar ${FAT_NAME}" "$INSTDIR\${WIN_APP_ICON}"
SectionEnd
-Section "AltosUI Desktop Shortcut"
- CreateShortCut "$DESKTOP\AltusMetrum.lnk" "$INSTDIR\altosui-fat.jar" "" "$INSTDIR\altus-metrum.ico"
+Section "${REG_NAME} Desktop Shortcut"
+ CreateShortCut "$DESKTOP\${REG_NAME}.lnk" "$INSTDIR\${FAT_NAME}" "" "$INSTDIR\${WIN_APP_ICON}"
SectionEnd
-Section "TeleMetrum, TeleDongle and TeleBT Firmware"
+Section "Firmware"
SetOutPath $INSTDIR
@@ -111,6 +129,7 @@ Section "TeleMetrum, TeleDongle and TeleBT Firmware"
File "../src/telebt-v1.0/telebt-v1.0-${VERSION}.ihx"
File "../src/telemega-v1.0/telemega-v1.0-${VERSION}.ihx"
File "../src/easymini-v1.0/easymini-v1.0-${VERSION}.ihx"
+ File "../src/easymega-v1.0/easymega-v1.0-${VERSION}.ihx"
SectionEnd
@@ -127,38 +146,105 @@ Section "Documentation"
File "../doc/telemini.pdf"
SectionEnd
+Section "File Associations"
+
+ ${DisableX64FSRedirection}
+
+ SetOutPath $INSTDIR
+
+ File "../icon/${WIN_APP_EXE}"
+ File "../icon/${WIN_TELEM_EXE}"
+ File "../icon/${WIN_EEPROM_EXE}"
+
+ DeleteRegKey HKCR "${PROG_ID_TELEM}"
+ DeleteRegKey HKCR "${PROG_ID_EEPROM}"
+
+ DeleteRegKey HKCR ".eeprom\${PROG_ID_EEPROM}"
+ DeleteRegValue HKCR ".eeprom\OpenWithProgids" "${PROG_ID_EEPROM}"
+ DeleteRegKey HKCR ".telem\${PROG_ID_EEPROM}"
+ DeleteRegValue HKCR ".telem\OpenWithProgids" "${PROG_ID_EEPROM}"
+
+ ; .eeprom elements
+
+ WriteRegStr HKCR "${PROG_ID_EEPROM}" "" "Altus Metrum Log File"
+ WriteRegStr HKCR "${PROG_ID_EEPROM}" "FriendlyTypeName" "Altus Metrum Log File"
+ WriteRegStr HKCR "${PROG_ID_EEPROM}\CurVer" "" "${PROG_ID_EEPROM}"
+ WriteRegStr HKCR "${PROG_ID_EEPROM}\DefaultIcon" "" '"$INSTDIR\${WIN_EEPROM_EXE}",-101'
+ WriteRegExpandStr HKCR "${PROG_ID_EEPROM}\shell\open\command" "" '"%SYSTEMROOT%\System32\javaw.exe" -Djava.library.path="$INSTDIR" -jar "$INSTDIR\${FAT_NAME}" "%1"'
+
+ WriteRegStr HKCR ".eeprom" "" "${PROG_ID_EEPROM}"
+ WriteRegStr HKCR ".eeprom" "PerceivedType" "Altus Metrum Log File"
+ WriteRegStr HKCR ".eeprom" "Content Type" "application/vnd.altusmetrum.eeprom"
+
+ WriteRegStr HKCR ".eeprom\OpenWithProgids" "${PROG_ID_EEPROM}" ""
+ WriteRegStr HKCR ".eeprom\${PROG_ID_EEPROM}" "" "${REG_NAME}"
+
+ ; .telem elements
+
+ WriteRegStr HKCR "${PROG_ID_TELEM}" "" "Altus Metrum Telemetry File"
+ WriteRegStr HKCR "${PROG_ID_TELEM}" "FriendlyTypeName" "Altus Metrum Telemetry File"
+ WriteRegStr HKCR "${PROG_ID_TELEM}\CurVer" "" "${PROG_ID_TELEM}"
+ WriteRegStr HKCR "${PROG_ID_TELEM}\DefaultIcon" "" '"$INSTDIR\${WIN_TELEM_EXE}",-101'
+ WriteRegExpandStr HKCR "${PROG_ID_TELEM}\shell\open\command" "" '"%SYSTEMROOT%\System32\javaw.exe" -Djava.library.path="$INSTDIR" -jar "$INSTDIR\${FAT_NAME}" "%1"'
+
+ WriteRegStr HKCR ".telem" "" "${PROG_ID_TELEM}"
+ WriteRegStr HKCR ".telem" "PerceivedType" "Altus Metrum Telemetry File"
+ WriteRegStr HKCR ".telem" "Content Type" "application/vnd.altusmetrum.telemetry"
+
+ WriteRegStr HKCR ".telem\OpenWithProgids" "${PROG_ID_TELEM}" ""
+ WriteRegStr HKCR ".telem\${PROG_ID_TELEM}" "" "${REG_NAME}"
+
+ Call RefreshShellIcons
+SectionEnd
+
Section "Uninstaller"
; Deal with the uninstaller
+ ${DisableX64FSRedirection}
SetOutPath $INSTDIR
; Write the install path to the registry
- WriteRegStr HKLM SOFTWARE\AltusMetrum "Install_Dir" "$INSTDIR"
+ WriteRegStr HKLM "SOFTWARE\${REG_NAME}" "Install_Dir" "$INSTDIR"
; Write the uninstall keys for windows
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "DisplayName" "Altus Metrum"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "UninstallString" '"$INSTDIR\uninstall.exe"'
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoModify" "1"
- WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoRepair" "1"
+ WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "DisplayName" "${REG_NAME}"
+ WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "UninstallString" '"$INSTDIR\uninstall-${REG_NAME}.exe"'
+ WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoModify" "1"
+ WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}" "NoRepair" "1"
- WriteUninstaller "uninstall.exe"
+ WriteUninstaller "uninstall-${REG_NAME}.exe"
SectionEnd
Section "Uninstall"
- DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum"
- DeleteRegKey HKLM "Software\AltusMetrum"
- Delete "$INSTDIR\*.*"
- RMDir "$INSTDIR"
+ ${DisableX64FSRedirection}
- ; Remove devices
- InstDrv::InitDriverSetup /NOUNLOAD {4D36E96D-E325-11CE-BFC1-08002BE10318} AltusMetrumSerial
- InstDrv::DeleteOemInfFiles /NOUNLOAD
- InstDrv::RemoveAllDevices
+ DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_NAME}"
+ DeleteRegKey HKLM "SOFTWARE\${REG_NAME}"
+
+ DetailPrint "Delete uninstall reg entries"
+
+ DeleteRegKey HKCR "${PROG_ID_EEPROM}"
+ DeleteRegKey HKCR "${PROG_ID_TELEM}"
+
+ DeleteRegKey HKCR ".eeprom\${PROG_ID_EEPROM}"
+ DeleteRegValue HKCR ".eeprom\OpenWithProgids" "${PROG_ID_EEPROM}"
+
+ DeleteRegKey HKCR ".telem\${PROG_ID_TELEM}"
+ DeleteRegValue HKCR ".telem\OpenWithProgids" "${PROG_ID_TELEM}"
+
+ DetailPrint "Delete file association reg entries"
+
+ Delete "$INSTDIR\${FAT_NAME}"
+ Delete "$INSTDIR\uninstall-${REG_NAME}.exe"
+
+ Delete "$INSTDIR\${WIN_APP_ICON}"
+ Delete "$INSTDIR\${WIN_APP_EXE}"
; Remove shortcuts, if any
- Delete "$SMPROGRAMS\AltusMetrum.lnk"
- Delete "$DESKTOP\AltusMetrum.lnk"
+ Delete "$SMPROGRAMS\${REG_NAME}.lnk"
+ Delete "$DESKTOP\${REG_NAME}.lnk"
+ Call un.RefreshShellIcons
SectionEnd
diff --git a/altosui/altos.desktop.in b/altosui/altusmetrum-altosui.desktop.in
index 66114348..10fd9e9d 100644
--- a/altosui/altos.desktop.in
+++ b/altosui/altusmetrum-altosui.desktop.in
@@ -1,10 +1,11 @@
[Desktop Entry]
Type=Application
+Version=1.0
Name=AltOS UI
GenericName=Altus Metrum Ground Station
Comment=View and log downlink data from Altus Metrum products
-Icon=%icondir%/altusmetrum.svg
+Icon=%icondir%/altusmetrum-altosui.svg
Exec=%bindir%/altosui %f
Terminal=false
-MimeType=text/plain;
+MimeType=application/vnd.altusmetrum.telemetry;application/vnd.altusmetrum.eeprom
Categories=Education;Electronics;Science;
diff --git a/altosui/linux-install.sh b/altosui/linux-install.sh
index 957b1aad..2e44c2aa 100644
--- a/altosui/linux-install.sh
+++ b/altosui/linux-install.sh
@@ -130,6 +130,7 @@ esac
#
# Create the .desktop file by editing the paths
#
+
case "$target" in
/*)
target_abs="$target"
@@ -149,43 +150,46 @@ for infile in "$target"/AltOS/*.desktop.in; do
done
#
-# Figure out where to install the .desktop files. If we can, write it
-# to the public /usr/share/applications, otherwise, write it to the
-# per-user ~/.local/share/applications
+# Install the .desktop file
#
-public=/usr/share/applications
-private=$HOME/.local/share/applications
-apps=""
+for desktop in "$target"/AltOS/*.desktop; do
+ case `id -u` in
+ 0)
+ xdg-desktop-menu install --mode system "$desktop"
+ ;;
+ *)
+ xdg-desktop-menu install --mode user "$desktop"
+ ;;
+ esac
+done
-if [ -d "$public" -a -w "$public" ]; then
- apps="$public"
-else
- mkdir -p "$private" >/dev/null 2>&1
- if [ -d "$private" -a -w "$private" ]; then
- apps="$private"
- fi
-fi
-
-case "$apps" in
-"")
- echo "Cannot install application icon"
- finish 1
- ;;
-esac
+#
+# Install mime type file
+#
+
+for mimetype in "$target"/AltOS/*-mimetypes.xml; do
+ case `id -u` in
+ 0)
+ xdg-mime install --mode system "$mimetype"
+ ;;
+ *)
+ xdg-mime install --mode user "$mimetype"
+ ;;
+ esac
+done
-echo -n "Installing .desktop files to $apps..."
+#
+# Install icons
+#
-cp "$target"/AltOS/*.desktop "$apps"
+for icon_dir in /usr/share/icons/hicolor/scalable/mimetypes "$HOME/.icons" "$HOME/.kde/share/icons"; do
+ if [ -w "$icon_dir" ]; then
+ cp "$target"/AltOS/*.svg "$icon_dir"
+ update-icon-caches "$icon_dir"
+ fi
+done
-case "$?" in
-0)
- echo " done."
- ;;
-*)
- echo " failed."
- ;;
-esac
#
# Install icon to desktop if desired
@@ -222,13 +226,14 @@ if [ -d $HOME/Desktop ]; then
esac
done
- echo -n "Installing desktop icons..."
case "$do_desktop" in
- [yY]*)
- for d in "$target"/AltOS/*.desktop; do
- ln -f -s "$d" "$HOME/Desktop/"
- done
- ;;
+ [yY]*)
+ echo -n "Installing desktop icons..."
+ for d in "$target"/AltOS/*.desktop; do
+ base=`basename $d`
+ cp --remove-destination "$d" "$HOME/Desktop/"
+ done
+ ;;
esac
echo " done."