Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version number in about:welcome and about dialog #49

Merged
merged 3 commits into from Dec 31, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/Platform_Core/org/lobobrowser/main/PlatformInit.java
Expand Up @@ -288,18 +288,21 @@ public void init(final boolean exitWhenAllWindowsAreClosed, final boolean initCo
initExtensions();
}

public final Properties relProps = new Properties();
public static final String RELEASE_VERSION_RELEASE_DATE = "version.releaseDate";
public static final String RELEASE_VERSION_STRING = "version.string";

private void checkReleaseDate() {
final InputStream relStream = getClass().getResourceAsStream("/properties/release.properties");
final Properties relProps = new Properties();
try {
relProps.load(relStream);
final String dateStr = relProps.getProperty("version.releaseDate");
final String dateStr = relProps.getProperty(RELEASE_VERSION_RELEASE_DATE);
final SimpleDateFormat yyyyMMDDFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
final Date releaseDate = yyyyMMDDFormat.parse(dateStr);
final Date releaseDatePlus30Days = new Date(releaseDate.getTime() + THIRTY_DAYS_MILLIS);
final Date currDate = new Date(System.currentTimeMillis());
if (releaseDatePlus30Days.before(currDate)) {
final String version = relProps.getProperty("version.string");
final String version = relProps.getProperty(RELEASE_VERSION_STRING);
final String checkForUpdatesMessage = "<html><h3><center>This version of gngr is old</center></h3><p>gngr "
+ version
+ "</p><p>Released on: "
Expand Down
Expand Up @@ -25,13 +25,15 @@
import java.net.URLEncoder;
import java.util.Collection;
import java.util.LinkedList;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JFileChooser;

import org.lobobrowser.main.PlatformInit;
import org.lobobrowser.primary.gui.SearchDialog;
import org.lobobrowser.primary.gui.prefs.PreferencesDialog;
import org.lobobrowser.primary.settings.ToolsSettings;
Expand Down Expand Up @@ -292,9 +294,12 @@ public void actionPerformed(final ActionEvent e) {
}

class AboutAction extends AbstractAction {
final Properties relProps = PlatformInit.getInstance().relProps;
public void actionPerformed(final ActionEvent e) {
window.getTopFrame().alert(
"gngr, a pure java web browser.\r\n"
+ "Version " + relProps.getProperty(PlatformInit.RELEASE_VERSION_STRING) + "\r\n"
+ "Published on: " + relProps.getProperty(PlatformInit.RELEASE_VERSION_RELEASE_DATE) + "\r\n"
+ "copyright (c) 2014 Uproot Labs\r\n"
+ "copyright (c) 2005, 2008 The Lobo Project.\r\n"
+ window.getUserAgent().getInfoUrl());
Expand Down
Expand Up @@ -35,6 +35,7 @@
import java.util.Properties;
import java.util.TreeSet;

import org.lobobrowser.main.PlatformInit;
import org.lobobrowser.primary.ext.BookmarkInfo;
import org.lobobrowser.primary.ext.BookmarksHistory;
import org.lobobrowser.primary.ext.HistoryEntry;
Expand Down Expand Up @@ -122,11 +123,14 @@ private String getURLText(final java.net.URL url) {
}

private static String getWelcomeMessage() {
final Properties relProps = PlatformInit.getInstance().relProps;

return
"<div style='max-width:900px;margin:0 auto;text-align:center;'>"
+
"<h1>Welcome to gngr</h1>"
+
"<h1>Welcome to gngr</h1>" +
"<p>Version: " + relProps.getProperty(PlatformInit.RELEASE_VERSION_STRING) + "<br/>" +
"Published on: " + relProps.getProperty(PlatformInit.RELEASE_VERSION_RELEASE_DATE) + "</p>" +
"<p><b>gngr</b> is a browser that cares deeply about privacy.</p>"
+
"<p>It is currently a proof-of-concept, and not very stable or secure.</p>"
Expand Down