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

Improve user friendliness of automatically linked files #7484

Merged
merged 12 commits into from
Mar 9, 2021
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- The export to MS Office XML now uses the month name for the field `MonthAcessed` instead of the two digit number [#7354](https://github.com/JabRef/jabref/issues/7354)
- We included some standalone dialogs from the options menu in the main preference dialog and fixed some visual issues in the preferences dialog. [#7384](https://github.com/JabRef/jabref/pull/7384)
- We improved the linking of the `python3` interpreter via the shebang to dynamically use the systems default Python. Related to [JabRef-Browser-Extension #177](https://github.com/JabRef/JabRef-Browser-Extension/issues/177)
- Automatically found pdf files now have the linking button to the far left and uses the icon LINK_PLUS instead of BRIEFCASE_CHECK. The file name also has lowered opacity(70%) until added. [#3607](https://github.com/JabRef/JabRef-Browser-Extension/issues/3607)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link to the issue is not correct. Moreover, the changelog is for users, so please don't use technical terms such as LINK_PLUS.


### Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public class LinkedFileViewModel extends AbstractViewModel {
private final XmpPreferences xmpPreferences;
private final LinkedFileHandler linkedFileHandler;
private final ExternalFileTypes externalFileTypes;
private final DoubleProperty opacityProperty = new SimpleDoubleProperty(1.0);

private final Validator fileExistsValidator;

Expand Down Expand Up @@ -508,4 +509,12 @@ public LinkedFile getFile() {
public ValidationStatus fileExistsValidationStatus() {
return fileExistsValidator.getValidationStatus();
}

public DoubleProperty opacityProperty() {
return opacityProperty;
}

public void setOpacityProperty(double v) {
opacityProperty.setValue(v);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ private static Node createFileDisplay(LinkedFileViewModel linkedFile) {
Node icon = linkedFile.getTypeIcon().getGraphicNode();
icon.setOnMouseClicked(event -> linkedFile.open());
Text link = new Text();
link.opacityProperty().bind(linkedFile.opacityProperty());
link.textProperty().bind(linkedFile.linkProperty());
link.getStyleClass().setAll("file-row-text");
Text desc = new Text();
Expand All @@ -157,7 +158,11 @@ private static Node createFileDisplay(LinkedFileViewModel linkedFile) {
Button acceptAutoLinkedFile = IconTheme.JabRefIcons.AUTO_LINKED_FILE.asButton();
acceptAutoLinkedFile.setTooltip(new Tooltip(Localization.lang("This file was found automatically. Do you want to link it to this entry?")));
acceptAutoLinkedFile.visibleProperty().bind(linkedFile.isAutomaticallyFoundProperty());
acceptAutoLinkedFile.setOnAction(event -> linkedFile.acceptAsLinked());
acceptAutoLinkedFile.managedProperty().bind(linkedFile.isAutomaticallyFoundProperty());
acceptAutoLinkedFile.setOnAction(event -> {
linkedFile.acceptAsLinked();
linkedFile.setOpacityProperty(1.0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move linkedFile.setOpacityProperty(1.0); into acceptAsLinked. The viewmodel should contain all the logic.

});
acceptAutoLinkedFile.getStyleClass().setAll("icon-button");

Button writeXMPMetadata = IconTheme.JabRefIcons.IMPORT.asButton();
Expand All @@ -169,7 +174,7 @@ private static Node createFileDisplay(LinkedFileViewModel linkedFile) {
HBox container = new HBox(10);
container.setPrefHeight(Double.NEGATIVE_INFINITY);

container.getChildren().addAll(info, acceptAutoLinkedFile, writeXMPMetadata);
container.getChildren().addAll(acceptAutoLinkedFile, info, writeXMPMetadata);

return container;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ private List<LinkedFileViewModel> findAssociatedNotLinkedFiles(BibEntry entry) {
preferences.getFilePreferences(),
externalFileTypes);
newLinkedFile.markAsAutomaticallyFound();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move newLinkedFile.setOpacityProperty(0.3); to markAsAutomaticallyFound so that it is consistent, even if some other code marks a file as automatically found.

newLinkedFile.setOpacityProperty(0.3);
result.add(newLinkedFile);
}
} catch (IOException e) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/icon/IconTheme.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public enum JabRefIcons implements JabRefIcon {
RENAME(MaterialDesignR.RENAME_BOX),
DELETE_FILE(MaterialDesignD.DELETE_FOREVER),
REMOVE_LINK(MaterialDesignL.LINK_OFF),
AUTO_LINKED_FILE(MaterialDesignB.BRIEFCASE_CHECK),
AUTO_LINKED_FILE(MaterialDesignL.LINK_PLUS),
QUALITY_ASSURED(MaterialDesignC.CERTIFICATE),
QUALITY(MaterialDesignC.CERTIFICATE),
OPEN(MaterialDesignF.FOLDER_OUTLINE),
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1732,6 +1732,7 @@ Don't\ share=Don't share
Share\ anonymous\ statistics=Share anonymous statistics
Telemetry\:\ Help\ make\ JabRef\ better=Telemetry: Help make JabRef better
To\ improve\ the\ user\ experience,\ we\ would\ like\ to\ collect\ anonymous\ statistics\ on\ the\ features\ you\ use.\ We\ will\ only\ record\ what\ features\ you\ access\ and\ how\ often\ you\ do\ it.\ We\ will\ neither\ collect\ any\ personal\ data\ nor\ the\ content\ of\ bibliographic\ items.\ If\ you\ choose\ to\ allow\ data\ collection,\ you\ can\ later\ disable\ it\ via\ Options\ ->\ Preferences\ ->\ General.=To improve the user experience, we would like to collect anonymous statistics on the features you use. We will only record what features you access and how often you do it. We will neither collect any personal data nor the content of bibliographic items. If you choose to allow data collection, you can later disable it via Options -> Preferences -> General.
(Auto)=(Auto)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer needed, I guess.

This\ file\ was\ found\ automatically.\ Do\ you\ want\ to\ link\ it\ to\ this\ entry?=This file was found automatically. Do you want to link it to this entry?
Names\ are\ not\ in\ the\ standard\ %0\ format.=Names are not in the standard %0 format.

Expand Down