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

Disable fit to width by default and rename linked file settings #8148

Merged
merged 11 commits into from
Oct 23, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve

### Changed

- The option "Fit table horiontically on screen" in the "Entry table" preferences is now disabled by default [#8148](https://github.com/JabRef/jabref/pull/8148)
- We improved the preferences and descriptions in the "Linked files" preferences tab [#8148](https://github.com/JabRef/jabref/pull/8148)
- We slightly changed the layout of the Journal tab in the preferences for ui consistency. [#7937](https://github.com/JabRef/jabref/pull/7937)
- The JabRefHost on Windows now writes a temporary file and calls `-importToOpen` instead of passing the bibtex via `-importBibtex`. [#7374](https://github.com/JabRef/jabref/issues/7374), [JabRef Browser Ext #274](https://github.com/JabRef/JabRef-Browser-Extension/issues/274)
- We reordered some entries in the right-click menu of the main table. [#6099](https://github.com/JabRef/jabref/issues/6099)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
fx:controller="org.jabref.gui.preferences.linkedfiles.LinkedFilesTab">
<fx:define>
<ToggleGroup fx:id="autolinkToggleGroup"/>
<ToggleGroup fx:id="fileDirectoryToggleGroup"/>
</fx:define>
<Label styleClass="titleHeader" text="%Linked files"/>

<Label styleClass="sectionHeader" text="%File directory"/>
<HBox alignment="CENTER_LEFT" spacing="10.0">
<Label text="%Main file directory"/>
<RadioButton fx:id="useMainFileDirectory" text="%Main file directory" toggleGroup="$fileDirectoryToggleGroup"></RadioButton>
<TextField fx:id="mainFileDirectory" HBox.hgrow="ALWAYS"/>
<Button onAction="#mainFileDirBrowse"
<Button fx:id="browseDirectory" onAction="#mainFileDirBrowse"
styleClass="icon-button,narrow"
prefHeight="20.0" prefWidth="20.0" GridPane.columnIndex="2">
<graphic>
Expand All @@ -36,12 +37,12 @@
</tooltip>
</Button>
</HBox>
<CheckBox fx:id="useBibLocationAsPrimary" text="%Search and store files relative to library file location">
<RadioButton fx:id="useBibLocationAsPrimary" text="%Search and store files relative to library file location" toggleGroup="$fileDirectoryToggleGroup">
<tooltip>
<Tooltip
text="%When downloading files, or moving linked files to the file directory, prefer the BIB file location rather than the file directory set above"/>
text="%When downloading files, or moving linked files to the file directory, use the bib file location. This takes precedence over all other configured file directories."/>
</tooltip>
</CheckBox>
</RadioButton>
<Label styleClass="sectionHeader" text="%Autolink files"/>
<RadioButton fx:id="autolinkFileStartsBibtex" text="%Autolink files with names starting with the citation key"
toggleGroup="$autolinkToggleGroup"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ComboBox;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextField;
Expand All @@ -24,7 +23,9 @@
public class LinkedFilesTab extends AbstractPreferenceTabView<LinkedFilesTabViewModel> implements PreferencesTab {

@FXML private TextField mainFileDirectory;
@FXML private CheckBox useBibLocationAsPrimary;
@FXML private RadioButton useMainFileDirectory;
@FXML private RadioButton useBibLocationAsPrimary;
@FXML private Button browseDirectory;
@FXML private Button autolinkRegexHelp;
@FXML private RadioButton autolinkFileStartsBibtex;
@FXML private RadioButton autolinkFileExactBibtex;
Expand All @@ -51,7 +52,11 @@ public void initialize() {
this.viewModel = new LinkedFilesTabViewModel(dialogService, preferencesService);

mainFileDirectory.textProperty().bindBidirectional(viewModel.mainFileDirectoryProperty());
mainFileDirectory.disableProperty().bind(viewModel.useBibLocationAsPrimaryProperty());
browseDirectory.disableProperty().bind(viewModel.useBibLocationAsPrimaryProperty());
useBibLocationAsPrimary.selectedProperty().bindBidirectional(viewModel.useBibLocationAsPrimaryProperty());
useMainFileDirectory.selectedProperty().bindBidirectional(viewModel.useMainFileDirectoryProperty());

autolinkFileStartsBibtex.selectedProperty().bindBidirectional(viewModel.autolinkFileStartsBibtexProperty());
autolinkFileExactBibtex.selectedProperty().bindBidirectional(viewModel.autolinkFileExactBibtexProperty());
autolinkUseRegex.selectedProperty().bindBidirectional(viewModel.autolinkUseRegexProperty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
public class LinkedFilesTabViewModel implements PreferenceTabViewModel {

private final StringProperty mainFileDirectoryProperty = new SimpleStringProperty("");
private final BooleanProperty useMainFileDirectoryProperty = new SimpleBooleanProperty();
Copy link
Member

Choose a reason for hiding this comment

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

Is that property used at all? If not, I would just delete it and let the radio option handle handle the other property, since that is the only one, that is stored in the preferences

Copy link
Member Author

@Siedlerchr Siedlerchr Oct 22, 2021

Choose a reason for hiding this comment

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

Yes, I first had it with the radio button only, but it didn't toggle the radio button correctly and I can't have a bidirectional-binding with not()
Edit// When closing and opening the dialog none of the radio buttons was then selected

Copy link
Member

Choose a reason for hiding this comment

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

Ok, i see

private final BooleanProperty useBibLocationAsPrimaryProperty = new SimpleBooleanProperty();
private final BooleanProperty autolinkFileStartsBibtexProperty = new SimpleBooleanProperty();
private final BooleanProperty autolinkFileExactBibtexProperty = new SimpleBooleanProperty();
Expand Down Expand Up @@ -75,6 +76,7 @@ public LinkedFilesTabViewModel(DialogService dialogService, PreferencesService p
public void setValues() {
// External files preferences / Attached files preferences / File preferences
mainFileDirectoryProperty.setValue(filePreferences.getFileDirectory().orElse(Path.of("")).toString());
useMainFileDirectoryProperty.setValue(!filePreferences.shouldStoreFilesRelativeToBibFile());
useBibLocationAsPrimaryProperty.setValue(filePreferences.shouldStoreFilesRelativeToBibFile());
fileNamePatternProperty.setValue(filePreferences.getFileNamePattern());
fileDirectoryPatternProperty.setValue(filePreferences.getFileDirectoryPattern());
Expand Down Expand Up @@ -136,7 +138,6 @@ public void mainFileDirBrowse() {
}

// External file links

public StringProperty mainFileDirectoryProperty() {
return mainFileDirectoryProperty;
}
Expand Down Expand Up @@ -172,5 +173,9 @@ public StringProperty fileNamePatternProperty() {
public StringProperty fileDirectoryPatternProperty() {
return fileDirectoryPatternProperty;
}

public BooleanProperty useMainFileDirectoryProperty() {
return useMainFileDirectoryProperty;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ private JabRefPreferences() {
defaults.put(SIZE_X, 1024);
defaults.put(SIZE_Y, 768);
defaults.put(WINDOW_MAXIMISED, Boolean.TRUE);
defaults.put(AUTO_RESIZE_MODE, Boolean.TRUE);
defaults.put(AUTO_RESIZE_MODE, Boolean.FALSE); // By default disable "Fit table horizontally on the screen"
defaults.put(ENTRY_EDITOR_HEIGHT, 0.65);
defaults.put(NAMES_AS_IS, Boolean.FALSE); // "Show names unchanged"
defaults.put(NAMES_FIRST_LAST, Boolean.FALSE); // "Show 'Firstname Lastname'"
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,7 @@ Style\ selection=Style selection
No\ valid\ style\ file\ defined=No valid style file defined
Choose\ pattern=Choose pattern
Search\ and\ store\ files\ relative\ to\ library\ file\ location=Search and store files relative to library file location
File\ directory=File directory
Could\ not\ run\ the\ gnuclient/emacsclient\ program.\ Make\ sure\ you\ have\ the\ emacsclient/gnuclient\ program\ installed\ and\ available\ in\ the\ PATH.=Could not run the gnuclient/emacsclient program. Make sure you have the emacsclient/gnuclient program installed and available in the PATH.
You\ must\ select\ either\ a\ valid\ style\ file,\ or\ use\ one\ of\ the\ default\ styles.=You must select either a valid style file, or use one of the default styles.

Expand Down Expand Up @@ -1162,7 +1163,7 @@ Removed\ all\ subgroups\ of\ group\ "%0".=Removed all subgroups of group "%0".
To\ disable\ the\ memory\ stick\ mode\ rename\ or\ remove\ the\ jabref.xml\ file\ in\ the\ same\ folder\ as\ JabRef.=To disable the memory stick mode rename or remove the jabref.xml file in the same folder as JabRef.
Unable\ to\ connect.\ One\ possible\ reason\ is\ that\ JabRef\ and\ OpenOffice/LibreOffice\ are\ not\ both\ running\ in\ either\ 32\ bit\ mode\ or\ 64\ bit\ mode.=Unable to connect. One possible reason is that JabRef and OpenOffice/LibreOffice are not both running in either 32 bit mode or 64 bit mode.
Delimiter(s)=Delimiter(s)
When\ downloading\ files,\ or\ moving\ linked\ files\ to\ the\ file\ directory,\ prefer\ the\ BIB\ file\ location\ rather\ than\ the\ file\ directory\ set\ above=When downloading files, or moving linked files to the file directory, prefer the BIB file location rather than the file directory set above
When\ downloading\ files,\ or\ moving\ linked\ files\ to\ the\ file\ directory,\ use\ the\ bib\ file\ location.\ This\ takes\ precedence\ over\ all\ other\ configured\ file\ directories.=When downloading files, or moving linked files to the file directory, use the bib file location. This takes precedence over all other configured file directories.
Your\ style\ file\ specifies\ the\ character\ format\ '%0',\ which\ is\ undefined\ in\ your\ current\ OpenOffice/LibreOffice\ document.=Your style file specifies the character format '%0', which is undefined in your current OpenOffice/LibreOffice document.
Your\ style\ file\ specifies\ the\ paragraph\ format\ '%0',\ which\ is\ undefined\ in\ your\ current\ OpenOffice/LibreOffice\ document.=Your style file specifies the paragraph format '%0', which is undefined in your current OpenOffice/LibreOffice document.

Expand Down