Changeset 1509 in josm for trunk/src/org


Ignore:
Timestamp:
2009-03-20T08:17:45+01:00 (15 years ago)
Author:
stoecker
Message:

Version information now directly in webpage

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/GpxExportAction.java

    r1397 r1509  
    132132            gpxData = ((GpxLayer)layer).data;
    133133        else
    134             gpxData = OsmDataLayer.toGpxData(Main.ds);
     134            gpxData = OsmDataLayer.toGpxData(Main.ds, file);
    135135        // TODO: add copyright, etc.
    136136        try {
  • trunk/src/org/openstreetmap/josm/gui/GettingStarted.java

    r1507 r1509  
    8585                }
    8686            }
    87             try {
    88                 vers = wr.read(baseurl + "/version?format=txt");
    89                 motd = motd.replace("</html>", getVersionNumber(vers)+"</html>");
    90             } catch (IOException ioe) {}
     87            motd = motd.replace("<!-- VERSION -->", tr("- running version is {0}",
     88            AboutAction.getVersionString()));
    9189            // Save this to prefs in case JOSM is updated so MOTD can be refreshed
    9290            Main.pref.putInteger("cache.motd.html.version", myVersion);
     
    105103            //    everytime because of something we can't read.
    106104            return Main.pref.getInteger("cache.motd.html.version", myVersion) == myVersion;
    107         }
    108 
    109         /**
    110          * Tries to read the version number from a given Future<String>
    111          * @param Future<String> that contains the version page
    112          * @return String with HTML Code
    113          */
    114         private String getVersionNumber(String str) {
    115             try {
    116                 Matcher m = Pattern.compile(".*josm-tested\\.jar: *(\\d+).*", Pattern.DOTALL).matcher(str);
    117                 m.matches();
    118                 int curVersion = Integer.parseInt(m.group(1));
    119                 m = Pattern.compile(".*josm-latest\\.jar: *(\\d+).*", Pattern.DOTALL).matcher(str);
    120                 m.matches();
    121                 int latest = Integer.parseInt(m.group(1));
    122                 return "<div style=\"text-align:right;font-size:small;font-weight:normal;\">"
    123                 + "<b>"
    124                 + (curVersion > myVersion ? tr("Update available") + " &#151; ": "")
    125                 + tr("Version Details:") + "</b> "
    126                 + tr("Yours: {2}; Current: {0}; <font style=\"font-size:x-small\">"
    127                 + "(latest untested: {1} &#150; not recommended)</font>",
    128                 curVersion, latest, myVersion)
    129                 + "</div>";
    130             } catch(Exception e) {
    131               // e.printStackTrace();
    132             }
    133 
    134             return "";
    135105        }
    136106    }
Note: See TracChangeset for help on using the changeset viewer.