Skip to content

Commit

Permalink
Redesigned about dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
boceckts committed Sep 11, 2016
1 parent 4196077 commit f3ececf
Show file tree
Hide file tree
Showing 23 changed files with 240 additions and 180 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ dependencies {
compile 'com.google.guava:guava:19.0'

compile 'com.airhacks:afterburner.fx:1.6.3'
compile 'de.codecentric.centerdevice:javafxsvg:1.2.1'

compile 'commons-logging:commons-logging:1.2'

Expand Down
5 changes: 5 additions & 0 deletions external-libraries.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,9 @@ Project: afterburner.fx
URL: https://github.com/AdamBien/afterburner.fx
License: Apache 2.0

Id: de.codecentric.centerdevice
Project: javafxsvg
URL: https://github.com/codecentric/javafxsvg
License: BSD 3-Clause

The last entry has to end with an empty line. Otherwise the entry is not present in About.html.
15 changes: 0 additions & 15 deletions src/main/java/net/sf/jabref/gui/help/AboutDialogView.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
/* Copyright (C) 2016 JabRef contributors.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package net.sf.jabref.gui.help;

import javafx.scene.control.Alert.AlertType;
Expand Down
120 changes: 43 additions & 77 deletions src/main/java/net/sf/jabref/gui/help/AboutDialogViewModel.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
/* Copyright (C) 2016 JabRef contributors.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package net.sf.jabref.gui.help;

import java.io.IOException;
Expand All @@ -21,74 +6,53 @@
import javafx.beans.property.ReadOnlyStringWrapper;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.stage.Stage;

import net.sf.jabref.Globals;
import net.sf.jabref.JabRefGUI;
import net.sf.jabref.gui.ClipBoardManager;
import net.sf.jabref.gui.desktop.JabRefDesktop;
import net.sf.jabref.logic.l10n.Localization;
import net.sf.jabref.logic.util.BuildInfo;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class AboutDialogViewModel {

private final String HOMEPAGE = "http://www.jabref.org";
private final String DONATION = "http://www.jabref.org/#donations";
private final String LIBRARIES = "https://github.com/JabRef/jabref/blob/master/external-libraries.txt";
private final String GITHUB = "https://github.com/JabRef/jabref";
private final String CHANGELOG = "https://github.com/JabRef/jabref/blob/master/CHANGELOG.md";
private final String LICENSE = "https://opensource.org/licenses/mit-license.php";
private final Log logger = LogFactory.getLog(AboutDialogViewModel.class);
private final ReadOnlyStringWrapper website = new ReadOnlyStringWrapper();
private final ReadOnlyStringWrapper websiteLibraries = new ReadOnlyStringWrapper();
private final ReadOnlyStringWrapper websiteGithub = new ReadOnlyStringWrapper();
private final ReadOnlyStringWrapper license = new ReadOnlyStringWrapper();
private final ReadOnlyStringWrapper heading = new ReadOnlyStringWrapper();
private final ReadOnlyStringWrapper years = new ReadOnlyStringWrapper();
private final ReadOnlyStringWrapper authors = new ReadOnlyStringWrapper();
private final ReadOnlyStringWrapper developers = new ReadOnlyStringWrapper();

@FXML
private Button closeButton;
@FXML
private ImageView iconImage;


@FXML
private void initialize() {

heading.set("JabRef " + Globals.BUILD_INFO.getVersion());

years.set(String.format("2003-%s", Globals.BUILD_INFO.getYear()));

website.set("http://www.jabref.org");

license.set("GNU General Public License v2 or later");

developers.set(Globals.BUILD_INFO.getDevelopers());

authors.set(Globals.BUILD_INFO.getAuthors());

websiteLibraries.set("https://github.com/JabRef/jabref/blob/master/external-libraries.txt");

websiteGithub.set("https://github.com/JabRef/jabref");
}

public ReadOnlyStringProperty websiteProperty() {
return website.getReadOnlyProperty();
}

public String getWebsite() {
return website.get();
}

public ReadOnlyStringProperty websiteLibrariesProperty() {
return websiteLibraries.getReadOnlyProperty();
}

public String getWebsiteLibraries() {
return websiteLibraries.get();
}
String licenseText = String.format("MIT License (2003 - %s)", Globals.BUILD_INFO.getYear());
license.set(licenseText);

public ReadOnlyStringProperty websiteGithubProperty() {
return websiteGithub.getReadOnlyProperty();
}

public String getWebsiteGithub() {
return websiteGithub.get();
SvgImageLoaderFactory.install();
Image icon = new Image(this.getClass().getResourceAsStream("/images/icons/JabRef-icon.svg"));
iconImage.setImage(icon);
}

public ReadOnlyStringProperty licenseProperty() {
Expand Down Expand Up @@ -123,14 +87,6 @@ public String getHeading() {
return heading.get();
}

public ReadOnlyStringProperty yearsProperty() {
return years.getReadOnlyProperty();
}

public String getYears() {
return years.get();
}

@FXML
private void closeAboutDialog() {
Stage stage = (Stage) closeButton.getScene().getWindow();
Expand All @@ -139,35 +95,45 @@ private void closeAboutDialog() {

@FXML
private void copyVersionToClipboard() {
new ClipBoardManager().setClipboardContents(Globals.BUILD_INFO.getVersion().getFullVersion());
String message = String.format("%s - %s", Localization.lang("Copied version information to clipboard"), Globals.BUILD_INFO.getVersion());
JabRefGUI.getMainFrame().output(message);
String info = String.format("JabRef %s%n%s %s %s %nJava %s", Globals.BUILD_INFO.getVersion(), BuildInfo.OS,
BuildInfo.OS_VERSION, BuildInfo.OS_ARCH, BuildInfo.JAVA_VERSION);
new ClipBoardManager().setClipboardContents(info);
JabRefGUI.getMainFrame().output(Localization.lang("Copied version to clipboard"));
}

@FXML
private void openJabrefWebsite() {
try {
JabRefDesktop.openBrowser(website.get());
} catch (IOException e) {
JabRefGUI.getMainFrame().output(Localization.lang("Error") + ": " + e.getLocalizedMessage());
logger.debug("Could not open default browser.", e);
}
openWebsite(HOMEPAGE);
}

@FXML
private void openExternalLibrariesWebsite() {
try {
JabRefDesktop.openBrowser(websiteLibraries.get());
} catch (IOException e) {
JabRefGUI.getMainFrame().output(Localization.lang("Error") + ": " + e.getLocalizedMessage());
logger.debug("Could not open default browser.", e);
}
openWebsite(LIBRARIES);
}

@FXML
private void openGithub() {
openWebsite(GITHUB);
}

@FXML
private void openChangeLog() {
openWebsite(CHANGELOG);
}

@FXML
public void openLicense() {
openWebsite(LICENSE);
}

@FXML
public void openDonation() {
openWebsite(DONATION);
}

private void openWebsite(String url) {
try {
JabRefDesktop.openBrowser(websiteGithub.get());
JabRefDesktop.openBrowser(url);
} catch (IOException e) {
JabRefGUI.getMainFrame().output(Localization.lang("Error") + ": " + e.getLocalizedMessage());
logger.debug("Could not open default browser.", e);
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/l10n/JabRef_da.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1793,3 +1793,9 @@ Remember_password?=
shared=

Tools=

What\'s_new_in_this_version=
Want_to_help?=
Make_a_donation=
get_involved=
Used_Libraries=
6 changes: 6 additions & 0 deletions src/main/resources/l10n/JabRef_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2565,3 +2565,9 @@ should_have_the_first_letter_capitalized=
Download=
Download_completed=
Tools=

What\'s_new_in_this_version=
Want_to_help?=
Make_a_donation=
get_involved=
Used_Libraries=
5 changes: 5 additions & 0 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2310,3 +2310,8 @@ shared=shared
should_contain_an_integer_or_a_literal=should_contain_an_integer_or_a_literal
should_have_the_first_letter_capitalized=should_have_the_first_letter_capitalized
Tools=Tools
What\'s_new_in_this_version=What\'s_new_in_this_version
Want_to_help?=Want_to_help?
Make_a_donation=Make_a_donation
get_involved=get_involved
Used_Libraries=Used_Libraries
6 changes: 6 additions & 0 deletions src/main/resources/l10n/JabRef_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1694,3 +1694,9 @@ Remember_password?=
shared=

Tools=

What\'s_new_in_this_version=
Want_to_help?=
Make_a_donation=
get_involved=
Used_Libraries=
6 changes: 6 additions & 0 deletions src/main/resources/l10n/JabRef_fa.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2474,3 +2474,9 @@ shared=
Download=
Download_completed=
Tools=

What\'s_new_in_this_version=
Want_to_help?=
Make_a_donation=
get_involved=
Used_Libraries=
6 changes: 6 additions & 0 deletions src/main/resources/l10n/JabRef_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1741,3 +1741,9 @@ Error_downloading_file_'%0'=
Download_failed=
%0_databases_will_be_imported=
Tools=
What\'s_new_in_this_version=
Want_to_help?=
Make_a_donation=
get_involved=
Used_Libraries=
6 changes: 6 additions & 0 deletions src/main/resources/l10n/JabRef_in.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1710,3 +1710,9 @@ Error_downloading_file_'%0'=
Download_failed=
%0_databases_will_be_imported=
Tools=

What\'s_new_in_this_version=
Want_to_help?=
Make_a_donation=
get_involved=
Used_Libraries=
6 changes: 6 additions & 0 deletions src/main/resources/l10n/JabRef_it.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1812,3 +1812,9 @@ Error_downloading_file_'%0'=
Download_failed=
%0_databases_will_be_imported=
Tools=

What\'s_new_in_this_version=
Want_to_help?=
Make_a_donation=
get_involved=
Used_Libraries=
6 changes: 6 additions & 0 deletions src/main/resources/l10n/JabRef_ja.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2457,3 +2457,9 @@ Download=
Download_completed=
%0_databases_will_be_imported=
Tools=

What\'s_new_in_this_version=
Want_to_help?=
Make_a_donation=
get_involved=
Used_Libraries=
6 changes: 6 additions & 0 deletions src/main/resources/l10n/JabRef_nl.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2483,3 +2483,9 @@ Error_downloading_file_'%0'=
Download_failed=
%0_databases_will_be_imported=
Tools=

What\'s_new_in_this_version=
Want_to_help?=
Make_a_donation=
get_involved=
Used_Libraries=
6 changes: 6 additions & 0 deletions src/main/resources/l10n/JabRef_no.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2876,3 +2876,9 @@ Error_downloading_file_'%0'=
Download_failed=
%0_databases_will_be_imported=
Tools=

What\'s_new_in_this_version=
Want_to_help?=
Make_a_donation=
get_involved=
Used_Libraries=
6 changes: 6 additions & 0 deletions src/main/resources/l10n/JabRef_pt_BR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1708,3 +1708,9 @@ shared=

%0_databases_will_be_imported=
Tools=

What\'s_new_in_this_version=
Want_to_help?=
Make_a_donation=
get_involved=
Used_Libraries=
6 changes: 6 additions & 0 deletions src/main/resources/l10n/JabRef_ru.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2452,3 +2452,9 @@ shared=
Download=
Download_completed=
Tools=

What\'s_new_in_this_version=
Want_to_help?=
Make_a_donation=
get_involved=
Used_Libraries=
6 changes: 6 additions & 0 deletions src/main/resources/l10n/JabRef_sv.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1660,3 +1660,9 @@ should_have_the_first_letter_capitalized=
Error_downloading_file_'%0'=
%0_databases_will_be_imported=
Tools=

What\'s_new_in_this_version=
Want_to_help?=
Make_a_donation=
get_involved=
Used_Libraries=
6 changes: 6 additions & 0 deletions src/main/resources/l10n/JabRef_tr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1733,3 +1733,9 @@ Remember_password?=
shared=

Tools=

What\'s_new_in_this_version=
Want_to_help?=
Make_a_donation=
get_involved=
Used_Libraries=
6 changes: 6 additions & 0 deletions src/main/resources/l10n/JabRef_vi.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2478,3 +2478,9 @@ Error_downloading_file_'%0'=
Download_failed=
%0_databases_will_be_imported=
Tools=

What\'s_new_in_this_version=
Want_to_help?=
Make_a_donation=
get_involved=
Used_Libraries=
6 changes: 6 additions & 0 deletions src/main/resources/l10n/JabRef_zh.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1719,3 +1719,9 @@ Error_downloading_file_'%0'=
Download_failed=
%0_databases_will_be_imported=
Tools=

What\'s_new_in_this_version=
Want_to_help?=
Make_a_donation=
get_involved=
Used_Libraries=
Loading

0 comments on commit f3ececf

Please sign in to comment.