X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Fload%2FJpegLoader.java;h=08b29fad02e6b32ec2cfc6bafa663869d76cbefa;hb=1ee49ae3c8ef3aa2e63eadd458531e5f8bd4f92c;hp=7939f1b0080310f28076c6dceff6b317e22d2644;hpb=54b9d8bc8f0025ccf97a67d9dd217ef1f9cf082f;p=GpsPrune.git diff --git a/tim/prune/load/JpegLoader.java b/tim/prune/load/JpegLoader.java index 7939f1b..08b29fa 100644 --- a/tim/prune/load/JpegLoader.java +++ b/tim/prune/load/JpegLoader.java @@ -17,8 +17,8 @@ import javax.swing.JPanel; import javax.swing.JProgressBar; import tim.prune.App; -import tim.prune.Config; import tim.prune.I18nManager; +import tim.prune.config.Config; import tim.prune.data.Altitude; import tim.prune.data.DataPoint; import tim.prune.data.LatLonRectangle; @@ -92,8 +92,9 @@ public class JpegLoader implements Runnable panel.add(_outsideAreaCheckbox); _fileChooser.setAccessory(panel); // start from directory in config if already set by other operations - File configDir = Config.getWorkingDirectory(); - if (configDir != null) {_fileChooser.setCurrentDirectory(configDir);} + String configDir = Config.getConfigString(Config.KEY_PHOTO_DIR); + if (configDir == null) {configDir = Config.getConfigString(Config.KEY_TRACK_DIR);} + if (configDir != null) {_fileChooser.setCurrentDirectory(new File(configDir));} } // enable/disable track checkbox _trackRectangle = inRectangle; @@ -102,16 +103,23 @@ public class JpegLoader implements Runnable if (_fileChooser.showOpenDialog(_parentFrame) == JFileChooser.APPROVE_OPTION) { // Bring up dialog before starting - showDialog(); + if (_progressDialog == null) { + createProgressDialog(); + } + // reset dialog and show it + _progressBar.setValue(0); + _progressBar.setString(""); + _progressDialog.setVisible(true); + // start thread for processing new Thread(this).start(); } } /** - * Show the main dialog + * Create the dialog to show the progress */ - private void showDialog() + private void createProgressDialog() { _progressDialog = new JDialog(_parentFrame, I18nManager.getText("dialog.jpegload.progress.title")); _progressDialog.setLocationRelativeTo(_parentFrame); @@ -134,7 +142,6 @@ public class JpegLoader implements Runnable panel.add(cancelButton); _progressDialog.getContentPane().add(panel); _progressDialog.pack(); - _progressDialog.setVisible(true); } @@ -157,6 +164,7 @@ public class JpegLoader implements Runnable // Process the files recursively and build lists of photos processFileList(files, true, _subdirCheckbox.isSelected()); _progressDialog.setVisible(false); + _progressDialog.dispose(); // Sometimes dialog doesn't disappear without this dispose if (_cancelled) {return;} //System.out.println("Finished - counts are: " + _fileCounts[0] + ", " + _fileCounts[1] @@ -200,7 +208,7 @@ public class JpegLoader implements Runnable if (inFiles != null) { // Loop over elements in array - for (int i=0; i