X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Fsave%2FExifSaver.java;h=6533fcbed0e39f3043bde1bca12cf22c762374f2;hb=54b9d8bc8f0025ccf97a67d9dd217ef1f9cf082f;hp=1e597201d5f2842197531159ec3452f542fb428c;hpb=5625a1abadb5f2ca5f017fe7dbda1d5141cb637b;p=GpsPrune.git diff --git a/tim/prune/save/ExifSaver.java b/tim/prune/save/ExifSaver.java index 1e59720..6533fcb 100644 --- a/tim/prune/save/ExifSaver.java +++ b/tim/prune/save/ExifSaver.java @@ -21,12 +21,12 @@ import javax.swing.JTable; import tim.prune.ExternalTools; import tim.prune.I18nManager; +import tim.prune.UpdateMessageBroker; import tim.prune.data.Altitude; import tim.prune.data.Coordinate; import tim.prune.data.DataPoint; import tim.prune.data.Photo; import tim.prune.data.PhotoList; -import tim.prune.data.PhotoStatus; /** * Class to call Exiftool to save coordinate information in jpg files @@ -35,9 +35,11 @@ public class ExifSaver implements Runnable { private Frame _parentFrame = null; private JDialog _dialog = null; + private JButton _okButton = null; private JCheckBox _overwriteCheckbox = null; private JProgressBar _progressBar = null; private PhotoTableModel _photoTableModel = null; + private boolean _saveCancelled = false; // To preserve timestamps of file use parameter -P @@ -72,6 +74,7 @@ public class ExifSaver implements Runnable * Save exif information to all photos in the list * whose coordinate information has changed since loading * @param inPhotoList list of photos to save + * @return true if saved */ public boolean saveExifInformation(PhotoList inPhotoList) { @@ -111,7 +114,7 @@ public class ExifSaver implements Runnable _dialog.pack(); // set progress bar and show dialog _progressBar.setVisible(false); - _dialog.show(); + _dialog.setVisible(true); return true; } @@ -166,19 +169,22 @@ public class ExifSaver implements Runnable // Lower panel with ok and cancel buttons JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); - JButton okButton = new JButton(I18nManager.getText("button.ok")); - okButton.addActionListener(new ActionListener() { + _okButton = new JButton(I18nManager.getText("button.ok")); + _okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { + // disable ok button + _okButton.setEnabled(false); // start new thread to do save new Thread(ExifSaver.this).start(); } }); - buttonPanel.add(okButton); + buttonPanel.add(_okButton); JButton cancelButton = new JButton(I18nManager.getText("button.cancel")); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { + _saveCancelled = true; _dialog.dispose(); } }); @@ -208,6 +214,7 @@ public class ExifSaver implements Runnable */ public void run() { + _saveCancelled = false; PhotoTableEntry entry = null; Photo photo = null; int numPhotos = _photoTableModel.getRowCount(); @@ -220,7 +227,7 @@ public class ExifSaver implements Runnable for (int i=0; i