X-Git-Url: https://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Ffunction%2FAboutScreen.java;h=c2dc3fee7d08f1d1f7791408757b7d3cefbdfb67;hb=649c5da6ee1bbc590699e11a92316ece2ea8512d;hp=e0334b583ead9ff891aabb13a2f4edac69a4c091;hpb=c0387c124840c9407e040600fda88f3c3e8f6aa6;p=GpsPrune.git diff --git a/tim/prune/function/AboutScreen.java b/tim/prune/function/AboutScreen.java index e0334b5..c2dc3fe 100644 --- a/tim/prune/function/AboutScreen.java +++ b/tim/prune/function/AboutScreen.java @@ -32,7 +32,7 @@ import javax.swing.JTextArea; import tim.prune.App; import tim.prune.ExternalTools; import tim.prune.GenericFunction; -import tim.prune.GpsPruner; +import tim.prune.GpsPrune; import tim.prune.I18nManager; import tim.prune.jpeg.ExifGateway; import tim.prune.threedee.WindowFactory; @@ -45,6 +45,7 @@ public class AboutScreen extends GenericFunction private JDialog _dialog = null; private JTabbedPane _tabs = null; private JButton _okButton = null; + private JTextArea _aboutTextArea = null; /** Labels for whether tools installed or not */ private JLabel[] _installedLabels = null; @@ -80,14 +81,14 @@ public class AboutScreen extends GenericFunction JPanel aboutPanel = new JPanel(); aboutPanel.setLayout(new BoxLayout(aboutPanel, BoxLayout.Y_AXIS)); aboutPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - JLabel titleLabel = new JLabel("Prune"); + JLabel titleLabel = new JLabel("GpsPrune"); titleLabel.setFont(new Font("SansSerif", Font.BOLD, 24)); titleLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT); aboutPanel.add(titleLabel); - JLabel versionLabel = new JLabel(I18nManager.getText("dialog.about.version") + ": " + GpsPruner.VERSION_NUMBER); + JLabel versionLabel = new JLabel(I18nManager.getText("dialog.about.version") + ": " + GpsPrune.VERSION_NUMBER); versionLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT); aboutPanel.add(versionLabel); - JLabel buildLabel = new JLabel(I18nManager.getText("dialog.about.build") + ": " + GpsPruner.BUILD_NUMBER); + JLabel buildLabel = new JLabel(I18nManager.getText("dialog.about.build") + ": " + GpsPrune.BUILD_NUMBER); buildLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT); aboutPanel.add(buildLabel); aboutPanel.add(new JLabel(" ")); @@ -96,9 +97,9 @@ public class AboutScreen extends GenericFunction descBuffer.append("

").append(I18nManager.getText("dialog.about.summarytext2")).append("

"); descBuffer.append("

").append(I18nManager.getText("dialog.about.summarytext3")).append("

"); descBuffer.append("

").append(I18nManager.getText("dialog.about.languages")).append(" : ") - .append("deutsch, english, espa\u00F1ol, fran\u00E7ais, italiano, polski, \u4e2d\u6587; (chinese)
" + - "schwiizerd\u00FC\u00FCtsch, \u65E5\u672C\u8A9E (japanese), t\u00FCrk\u00E7e, portugu\u00EAs, " + - "bahasa indonesia, rom\u00E2n\u0103").append("

"); + .append("\u010de\u0161tina, deutsch, english, espa\u00F1ol, fran\u00E7ais, italiano, magyar,
" + + " nederlands, polski, portugu\u00EAs, \u4e2d\u6587 (chinese), \u65E5\u672C\u8A9E (japanese), \uD55C\uAD6D\uC5B4/\uC870\uC120\uB9D0 (korean),
" + + " schwiizerd\u00FC\u00FCtsch, t\u00FCrk\u00E7e, rom\u00E2n\u0103, afrikaans, bahasa indonesia

"); descBuffer.append("

").append(I18nManager.getText("dialog.about.translatedby")).append("

"); JEditorPane descPane = new JEditorPane("text/html", descBuffer.toString()); descPane.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); @@ -194,7 +195,7 @@ public class AboutScreen extends GenericFunction new JLabel(" theYinYeti, Rothermographer, Sam, Rudolph, nazotoko,"), 1, 4); addToGridBagPanel(creditsPanel, gridBag, constraints, - new JLabel(" katpatuka, R\u00E9mi"), + new JLabel(" katpatuka, R\u00E9mi, Marcus, Ali, Javier, Jeroen, prot_d, Gy\u00F6rgy, HooAU"), 1, 5); addToGridBagPanel(creditsPanel, gridBag, constraints, new JLabel(I18nManager.getText("dialog.about.credits.translations") + " : "), @@ -225,10 +226,16 @@ public class AboutScreen extends GenericFunction // Read me JPanel readmePanel = new JPanel(); readmePanel.setLayout(new BorderLayout()); - JTextArea textArea = new JTextArea(getReadmeText()); - textArea.setEditable(false); - textArea.setLineWrap(true); textArea.setWrapStyleWord(true); - JScrollPane scrollPane = new JScrollPane(textArea); + _aboutTextArea = new JTextArea(I18nManager.getText("details.photo.loading")); + // Set readme text in separate thread so that about screen pops up sooner + new Thread(new Runnable() { + public void run() { + _aboutTextArea.setText(getReadmeText()); + } + }).start(); + _aboutTextArea.setEditable(false); + _aboutTextArea.setLineWrap(true); _aboutTextArea.setWrapStyleWord(true); + JScrollPane scrollPane = new JScrollPane(_aboutTextArea); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setPreferredSize(new Dimension(600, 130)); readmePanel.add(scrollPane, BorderLayout.CENTER); @@ -290,20 +297,27 @@ public class AboutScreen extends GenericFunction // First, try locally-held readme.txt if available (as it normally should be) // Readme file can either be in file system or packed in the same jar as code String errorMessage = null; + String readme = null; + InputStream in = null; try { // For some reason using ../readme.txt doesn't work, so need absolute path - InputStream in = AboutScreen.class.getResourceAsStream("/tim/prune/readme.txt"); + in = AboutScreen.class.getResourceAsStream("/tim/prune/readme.txt"); if (in != null) { byte[] buffer = new byte[in.available()]; in.read(buffer); in.close(); - return new String(buffer); + readme = new String(buffer); } } catch (IOException e) { errorMessage = e.getMessage(); } + finally { + try {in.close();} catch (Exception e) {} + } + if (readme != null) {return readme;} + // Locally-held file failed, so try to find gz file installed on system (eg Debian) try { @@ -311,7 +325,7 @@ public class AboutScreen extends GenericFunction if (gzFile.exists()) { // Copy decompressed bytes from gz file into out - InputStream in = new GZIPInputStream(new FileInputStream(gzFile)); + in = new GZIPInputStream(new FileInputStream(gzFile)); ByteArrayOutputStream out = new ByteArrayOutputStream(); byte[] buffer = new byte[8 * 1024]; int count = 0; @@ -321,12 +335,16 @@ public class AboutScreen extends GenericFunction } while (count != -1); out.close(); in.close(); - return out.toString(); + readme = out.toString(); } } catch (IOException e) { System.err.println("Exception trying to get readme.gz : " + e.getMessage()); } + finally { + try {in.close();} catch (Exception e) {} + } + if (readme != null) {return readme;} // Only show first error message if couldn't get readme from gz either if (errorMessage != null) { System.err.println("Exception trying to get readme: " + errorMessage);