From 8165fb38703cc41a454c847cd8046f20a873d7e6 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 6 Oct 2011 06:49:30 +0000 Subject: [PATCH] Pull version and build number from CMake build system; Change About dialog wording to match native viewer git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4713 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- doc/dev/version_numbers | 1 - java/src/com/tigervnc/vncviewer/CConn.java | 2 +- .../src/com/tigervnc/vncviewer/VncViewer.java | 24 +++++++++++++++---- java/src/com/tigervnc/vncviewer/timestamp.in | 2 ++ 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/doc/dev/version_numbers b/doc/dev/version_numbers index f635e891..e6678370 100644 --- a/doc/dev/version_numbers +++ b/doc/dev/version_numbers @@ -2,5 +2,4 @@ Files written below contain release numbers which should be changed during release process. CMakeLists.txt -java/src/com/tigervnc/vncviewer/VncViewer.java unix/xserver/hw/vnc/xvnc.cc diff --git a/java/src/com/tigervnc/vncviewer/CConn.java b/java/src/com/tigervnc/vncviewer/CConn.java index 5dea315c..7d76beed 100644 --- a/java/src/com/tigervnc/vncviewer/CConn.java +++ b/java/src/com/tigervnc/vncviewer/CConn.java @@ -666,7 +666,7 @@ public class CConn extends CConnection pkgTime = attributes.getValue("Package-Time"); } catch (IOException e) { } JOptionPane.showMessageDialog((viewport != null ? viewport : null), - VncViewer.about1+"\n" + VncViewer.about1+" v"+VncViewer.version+" ("+VncViewer.build+")\n" +"Built on "+pkgDate+" at "+pkgTime+"\n" +VncViewer.about2+"\n" +VncViewer.about3, diff --git a/java/src/com/tigervnc/vncviewer/VncViewer.java b/java/src/com/tigervnc/vncviewer/VncViewer.java index 95afacfc..bea486b0 100644 --- a/java/src/com/tigervnc/vncviewer/VncViewer.java +++ b/java/src/com/tigervnc/vncviewer/VncViewer.java @@ -33,6 +33,9 @@ import java.awt.Graphics; import java.awt.Image; import java.awt.image.*; import java.awt.Label; +import java.io.InputStream; +import java.util.jar.Attributes; +import java.util.jar.Manifest; import javax.swing.*; import java.net.URL; @@ -42,12 +45,13 @@ import com.tigervnc.rfb.Exception; public class VncViewer extends java.applet.Applet implements Runnable { - public static final String version = "1.1.80"; - public static final String about1 = "TigerVNC Viewer for Java "+version; + public static final String about1 = "TigerVNC Viewer for Java"; public static final String about2 = "Copyright (C) 1998-2011 "+ - "[many holders]"; - public static final String about3 = "Visit www.tigervnc.org "+ + "TigerVNC Team and many others (see README)"; + public static final String about3 = "Visit http://www.tigervnc.org "+ "for information on TigerVNC."; + public static String version = null; + public static String build = null; public static void main(String[] argv) { try { @@ -150,6 +154,16 @@ public class VncViewer extends java.applet.Applet implements Runnable public void start() { vlog.debug("start called"); + if (version == null || build == null) { + ClassLoader cl = this.getClass().getClassLoader(); + InputStream stream = cl.getResourceAsStream("com/tigervnc/vncviewer/timestamp"); + try { + Manifest manifest = new Manifest(stream); + Attributes attributes = manifest.getMainAttributes(); + version = attributes.getValue("Version"); + build = attributes.getValue("Build"); + } catch (java.io.IOException e) { } + } nViewers++; if (firstApplet) { alwaysShowServerDialog.setParam(true); @@ -169,7 +183,7 @@ public class VncViewer extends java.applet.Applet implements Runnable public void paint(Graphics g) { g.drawImage(logo, 0, 0, this); int h = logo.getHeight(this)+20; - g.drawString(about1, 0, h); + g.drawString(about1+" v"+version+" ("+build+")", 0, h); h += g.getFontMetrics().getHeight(); g.drawString(about2, 0, h); h += g.getFontMetrics().getHeight(); diff --git a/java/src/com/tigervnc/vncviewer/timestamp.in b/java/src/com/tigervnc/vncviewer/timestamp.in index 5f6326aa..b666e7c0 100644 --- a/java/src/com/tigervnc/vncviewer/timestamp.in +++ b/java/src/com/tigervnc/vncviewer/timestamp.in @@ -2,3 +2,5 @@ Manifest-Version: 1.0 Main-Class: com.tigervnc.vncviewer.VncViewer Package-Date: @JAVA_DATE@ Package-Time: @JAVA_TIME@ +Version: @VERSION@ +Build: @BUILD@ -- 2.39.5