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

Small improvements in preferences dialog #6130

Merged
merged 10 commits into from
Mar 16, 2020
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve

- We improved the arXiv fetcher. Now it should find entries even more reliably and does no longer include the version (e.g `v1`) in the `eprint` field. [forum#1941](https://discourse.jabref.org/t/remove-version-in-arxiv-import/1941)
- We moved the group search bar and the button "New group" from bottom to top position to make it more prominent. [#6112](https://github.com/JabRef/jabref/pull/6112)

- We changed the buttons for import/export/show all/reset of preferences to smaller icon buttons in the preferences dialog. [#6130](https://github.com/JabRef/jabref/pull/6130)

### Fixed

- We fixed an issue where opening a library from the recent libraries menu was not possible. [#5939](https://github.com/JabRef/jabref/issues/5939)
- We fixed an issue with inconsistent capitalization of file extensions when downloading files [#6115](https://github.com/JabRef/jabref/issues/6115)
- We fixed the display of language and encoding in the preferences dialog. [#6130](https://github.com/JabRef/jabref/pull/6130)

### Removed

- We removed the obsolete `External programs / Open PDF` section in the preferences, as the default application to open PDFs is now set in the `Manage external file types` dialog. [#6130](https://github.com/JabRef/jabref/pull/6130)

## [5.0] – 2020-03-06

### Changed
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/org/jabref/gui/desktop/os/DefaultDesktop.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -33,11 +32,6 @@ public void openConsole(String absolutePath) throws IOException {
LOGGER.error("This feature is not supported by your Operating System.");
}

@Override
public void openPdfWithParameters(String filePath, List<String> parameters) throws IOException {
//TODO imlement default
}

@Override
public String detectProgramPath(String programName, String directoryName) {
return programName;
Expand Down
23 changes: 0 additions & 23 deletions src/main/java/org/jabref/gui/desktop/os/Linux.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,17 @@
import java.io.InputStreamReader;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import java.util.StringJoiner;

import org.jabref.JabRefExecutorService;
import org.jabref.gui.externalfiletype.ExternalFileType;
import org.jabref.gui.externalfiletype.ExternalFileTypes;
import org.jabref.gui.util.StreamGobbler;
import org.jabref.preferences.JabRefPreferences;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.jabref.preferences.JabRefPreferences.ADOBE_ACROBAT_COMMAND;
import static org.jabref.preferences.JabRefPreferences.USE_PDF_READER;

public class Linux implements NativeDesktop {

private static final Logger LOGGER = LoggerFactory.getLogger(Linux.class);
Expand Down Expand Up @@ -108,23 +102,6 @@ public void openConsole(String absolutePath) throws IOException {
}
}

@Override
public void openPdfWithParameters(String filePath, List<String> parameters) throws IOException {

String application;
if (JabRefPreferences.getInstance().get(USE_PDF_READER).equals(JabRefPreferences.getInstance().get(ADOBE_ACROBAT_COMMAND))) {
application = "acroread";

StringJoiner sj = new StringJoiner(" ");
sj.add(application);
parameters.forEach((param) -> sj.add(param));

openFileWithApplication(filePath, sj.toString());
} else {
openFile(filePath, "PDF");
}
}

@Override
public String detectProgramPath(String programName, String directoryName) {
return programName;
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/org/jabref/gui/desktop/os/NativeDesktop.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;

public interface NativeDesktop {
void openFile(String filePath, String fileType) throws IOException;
Expand All @@ -21,14 +20,6 @@ public interface NativeDesktop {

void openConsole(String absolutePath) throws IOException;

/**
* This method opens a pdf using the giving the parameters to the executing pdf reader
* @param filePath absolute path to the pdf file to be opened
* @param parameters console parameters depending on the pdf reader
* @throws IOException
*/
void openPdfWithParameters(String filePath, List<String> parameters) throws IOException;

String detectProgramPath(String programName, String directoryName);

/**
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/org/jabref/gui/desktop/os/OSX.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Optional;

import org.jabref.gui.externalfiletype.ExternalFileType;
Expand Down Expand Up @@ -42,11 +41,6 @@ public void openConsole(String absolutePath) throws IOException {
Runtime.getRuntime().exec("open -a Terminal " + absolutePath, null, new File(absolutePath));
}

@Override
public void openPdfWithParameters(String filePath, List<String> parameters) throws IOException {
//TODO implement
}

@Override
public String detectProgramPath(String programName, String directoryName) {
return programName;
Expand Down
22 changes: 0 additions & 22 deletions src/main/java/org/jabref/gui/desktop/os/Windows.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,10 @@
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Optional;

import org.jabref.gui.externalfiletype.ExternalFileType;
import org.jabref.gui.externalfiletype.ExternalFileTypes;
import org.jabref.preferences.JabRefPreferences;

import static org.jabref.preferences.JabRefPreferences.ADOBE_ACROBAT_COMMAND;
import static org.jabref.preferences.JabRefPreferences.SUMATRA_PDF_COMMAND;
import static org.jabref.preferences.JabRefPreferences.USE_PDF_READER;

public class Windows implements NativeDesktop {
private static String DEFAULT_EXECUTABLE_EXTENSION = ".exe";
Expand Down Expand Up @@ -69,20 +63,4 @@ public void openConsole(String absolutePath) throws IOException {
process.directory(new File(absolutePath));
process.start();
}

@Override
public void openPdfWithParameters(String filePath, List<String> parameters) throws IOException {
String pdfReaderPath = JabRefPreferences.getInstance().get(USE_PDF_READER);
if (pdfReaderPath.equals(SUMATRA_PDF_COMMAND) || pdfReaderPath.equals(ADOBE_ACROBAT_COMMAND)) {
String[] command = new String[parameters.size() + 2];
command[0] = "\"" + Paths.get(pdfReaderPath).toString() + "\"";
for (int i = 1; i < command.length - 1; i++) {
command[i] = "\"" + parameters.get(i - 1) + "\"";
}
command[command.length - 1] = "\"" + filePath + "\"";
new ProcessBuilder(command).start();
} else {
openFile(filePath, "PDF");
}
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/exporter/SaveAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
public class SaveAction extends SimpleCommand {

public enum SaveMethod {SAVE, SAVE_AS, SAVE_SELECTED}
public enum SaveMethod { SAVE, SAVE_AS, SAVE_SELECTED }

private final SaveMethod saveMethod;
private final JabRefFrame frame;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/jabref/gui/icon/IconTheme.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ public enum JabRefIcons implements JabRefIcon {
GITHUB(MaterialDesignIcon.GITHUB_CIRCLE), /*css: github-circle*/
TOGGLE_ENTRY_PREVIEW(MaterialDesignIcon.LIBRARY_BOOKS), /*css: library-books */
TOGGLE_GROUPS(MaterialDesignIcon.VIEW_LIST), /*css: view-list */
SHOW_PREFERENCES_LIST(MaterialDesignIcon.VIEW_LIST), /*css: view-list */
WRITE_XMP(MaterialDesignIcon.IMPORT), /* css: import */
FILE_WORD(MaterialDesignIcon.FILE_WORD), /*css: file-word */
FILE_EXCEL(MaterialDesignIcon.FILE_EXCEL), /*css: file-excel */
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/jabref/gui/preferences/AppearanceTab.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<?import javafx.scene.layout.VBox?>

<?import javafx.scene.layout.HBox?>
<?import javafx.scene.control.TextField?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Spinner?>
<fx:root prefWidth="650.0" spacing="10.0" type="VBox" xmlns="http://javafx.com/javafx/11.0.1"
xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.jabref.gui.preferences.AppearanceTabView">
<fx:define>
Expand All @@ -18,9 +18,9 @@

<Label styleClass="sectionHeader" text="%Font"/>
<CheckBox fx:id="fontOverride" text="%Override default font settings"/>
<HBox spacing="4.0" alignment="CENTER_LEFT">
<Label text="%Size:" disable="${!fontOverride.selected}"/>
<TextField fx:id="fontSize" prefWidth="40" alignment="CENTER_RIGHT" disable="${!fontOverride.selected}"/>
<HBox alignment="CENTER_LEFT" spacing="4.0">
<Label text="%Size" disable="${!fontOverride.selected}"/>
<Spinner fx:id="fontSize" prefWidth="60.0" editable="true"/>
<padding>
<Insets left="20.0"/>
</padding>
Expand Down
14 changes: 9 additions & 5 deletions src/main/java/org/jabref/gui/preferences/AppearanceTabView.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.geometry.Pos;
import javafx.scene.control.CheckBox;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextField;
import javafx.scene.control.Spinner;

import org.jabref.gui.util.ControlHelper;
import org.jabref.gui.util.IconValidationDecorator;
import org.jabref.logic.l10n.Localization;
import org.jabref.preferences.JabRefPreferences;
Expand All @@ -17,7 +17,7 @@
public class AppearanceTabView extends AbstractPreferenceTabView<AppearanceTabViewModel> implements PreferencesTab {

@FXML public CheckBox fontOverride;
@FXML public TextField fontSize;
@FXML public Spinner<Integer> fontSize;
@FXML public RadioButton themeLight;
@FXML public RadioButton themeDark;

Expand All @@ -38,8 +38,12 @@ public void initialize () {
this.viewModel = new AppearanceTabViewModel(dialogService, preferences);

fontOverride.selectedProperty().bindBidirectional(viewModel.fontOverrideProperty());
fontSize.setTextFormatter(ControlHelper.getIntegerTextFormatter());
fontSize.textProperty().bindBidirectional(viewModel.fontSizeProperty());

// Spinner does neither support alignment nor disableProperty in FXML
fontSize.disableProperty().bind(fontOverride.selectedProperty().not());
fontSize.getEditor().setAlignment(Pos.CENTER_RIGHT);
fontSize.setValueFactory(AppearanceTabViewModel.fontSizeValueFactory);
fontSize.getEditor().textProperty().bindBidirectional(viewModel.fontSizeProperty());

themeLight.selectedProperty().bindBidirectional(viewModel.themeLightProperty());
themeDark.selectedProperty().bindBidirectional(viewModel.themeDarkProperty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.scene.control.SpinnerValueFactory;

import org.jabref.gui.DialogService;
import org.jabref.gui.util.ThemeLoader;
Expand All @@ -20,6 +21,9 @@

public class AppearanceTabViewModel implements PreferenceTabViewModel {

public static SpinnerValueFactory<Integer> fontSizeValueFactory =
new SpinnerValueFactory.IntegerSpinnerValueFactory(9, Integer.MAX_VALUE);

private final BooleanProperty fontOverrideProperty = new SimpleBooleanProperty();
private final StringProperty fontSizeProperty = new SimpleStringProperty();
private final BooleanProperty themeLightProperty = new SimpleBooleanProperty();
Expand Down
21 changes: 0 additions & 21 deletions src/main/java/org/jabref/gui/preferences/ExternalTab.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,6 @@
GridPane.columnIndex="2" GridPane.rowIndex="1"/>
</GridPane>

<Label styleClass="sectionHeader" text="%Open PDF"/>
<GridPane alignment="CENTER_LEFT" hgap="10.0" vgap="4.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0"/>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="350.0"/>
<ColumnConstraints hgrow="SOMETIMES"/>
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="30.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="30.0" vgrow="SOMETIMES"/>
</rowConstraints>
<RadioButton fx:id="usePDFAcrobat" text="%Adobe Acrobat Reader" toggleGroup="$openPDF"/>
<TextField fx:id="usePDFAcrobatCommand" prefWidth="350.0" GridPane.columnIndex="1"/>
<Button fx:id="usePDFAcrobatBrowse" onAction="#usePDFAcrobatCommandBrowse" text="%Browse"
GridPane.columnIndex="2"/>
<RadioButton fx:id="usePDFSumatra" text="%Sumatra Reader" toggleGroup="$openPDF" GridPane.rowIndex="1"/>
<TextField fx:id="usePDFSumatraCommand" prefWidth="350.0" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
<Button fx:id="usePDFSumatraBrowse" onAction="#usePDFSumatraCommandBrowse" text="%Browse"
GridPane.columnIndex="2" GridPane.rowIndex="1"/>
</GridPane>

<Label styleClass="sectionHeader" text="%Open File Browser"/>
<GridPane alignment="CENTER_LEFT" hgap="10.0" vgap="4.0">
<columnConstraints>
Expand Down
17 changes: 0 additions & 17 deletions src/main/java/org/jabref/gui/preferences/ExternalTabView.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ public class ExternalTabView extends AbstractPreferenceTabView<ExternalTabViewMo
@FXML private TextField useTerminalCommand;
@FXML private Button useTerminalBrowse;

@FXML private RadioButton usePDFAcrobat;
@FXML private TextField usePDFAcrobatCommand;
@FXML private Button usePDFAcrobatBrowse;
@FXML private RadioButton usePDFSumatra;
@FXML private TextField usePDFSumatraCommand;
@FXML private Button usePDFSumatraBrowse;

@FXML private RadioButton useFileBrowserDefault;
@FXML private RadioButton useFileBrowserSpecial;
@FXML private TextField useFileBrowserSpecialCommand;
Expand Down Expand Up @@ -75,16 +68,6 @@ public void initialize() {
useTerminalCommand.disableProperty().bind(useTerminalSpecial.selectedProperty().not());
useTerminalBrowse.disableProperty().bind(useTerminalSpecial.selectedProperty().not());

usePDFAcrobat.selectedProperty().bindBidirectional(viewModel.usePDFAcrobatProperty());
usePDFAcrobatCommand.textProperty().bindBidirectional(viewModel.usePDFAcrobatCommandProperty());
usePDFAcrobatCommand.disableProperty().bind(usePDFAcrobat.selectedProperty().not());
usePDFAcrobatBrowse.disableProperty().bind(usePDFAcrobat.selectedProperty().not());

usePDFSumatra.selectedProperty().bindBidirectional(viewModel.usePDFSumatraProperty());
usePDFSumatraCommand.textProperty().bindBidirectional(viewModel.usePDFSumatraCommandProperty());
usePDFSumatraCommand.disableProperty().bind(usePDFSumatra.selectedProperty().not());
usePDFSumatraBrowse.disableProperty().bind(usePDFSumatra.selectedProperty().not());

useFileBrowserDefault.selectedProperty().bindBidirectional(viewModel.useFileBrowserDefaultProperty());
useFileBrowserSpecial.selectedProperty().bindBidirectional(viewModel.useFileBrowserSpecialProperty());
useFileBrowserSpecialCommand.textProperty().bindBidirectional(viewModel.useFileBrowserSpecialCommandProperty());
Expand Down
22 changes: 0 additions & 22 deletions src/main/java/org/jabref/gui/preferences/ExternalTabViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.jabref.gui.push.PushToApplicationsManager;
import org.jabref.gui.util.FileDialogConfiguration;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.OS;
import org.jabref.model.strings.StringUtil;
import org.jabref.preferences.JabRefPreferences;

Expand Down Expand Up @@ -74,17 +73,6 @@ public void setValues() {
useTerminalCommandProperty.setValue(preferences.get(JabRefPreferences.CONSOLE_COMMAND));
useTerminalSpecialProperty.setValue(!preferences.getBoolean(JabRefPreferences.USE_DEFAULT_CONSOLE_APPLICATION));

usePDFAcrobatCommandProperty.setValue(preferences.get(JabRefPreferences.ADOBE_ACROBAT_COMMAND));
if (OS.WINDOWS) {
usePDFSumatraCommandProperty.setValue(preferences.get(JabRefPreferences.SUMATRA_PDF_COMMAND));

if (preferences.get(JabRefPreferences.USE_PDF_READER).equals(usePDFAcrobatCommandProperty.getValue())) {
usePDFAcrobatProperty.setValue(true);
} else if (preferences.get(JabRefPreferences.USE_PDF_READER).equals(usePDFSumatraCommandProperty.getValue())) {
usePDFSumatraProperty.setValue(true);
}
}

useFileBrowserDefaultProperty.setValue(preferences.getBoolean(JabRefPreferences.USE_DEFAULT_FILE_BROWSER_APPLICATION));
useFileBrowserSpecialProperty.setValue(!preferences.getBoolean(JabRefPreferences.USE_DEFAULT_FILE_BROWSER_APPLICATION));
useFileBrowserSpecialCommandProperty.setValue(preferences.get(JabRefPreferences.FILE_BROWSER_COMMAND));
Expand All @@ -100,16 +88,6 @@ public void storeSettings() {
preferences.putBoolean(JabRefPreferences.USE_DEFAULT_CONSOLE_APPLICATION, useTerminalDefaultProperty.getValue());
preferences.put(JabRefPreferences.CONSOLE_COMMAND, useTerminalCommandProperty.getValue());

preferences.put(JabRefPreferences.ADOBE_ACROBAT_COMMAND, usePDFAcrobatCommandProperty.getValue());
if (OS.WINDOWS) {
preferences.put(JabRefPreferences.SUMATRA_PDF_COMMAND, usePDFSumatraCommandProperty.getValue());
}
if (usePDFAcrobatProperty.getValue()) {
preferences.put(JabRefPreferences.USE_PDF_READER, usePDFAcrobatCommandProperty.getValue());
} else if (usePDFSumatraProperty.getValue()) {
preferences.put(JabRefPreferences.USE_PDF_READER, usePDFSumatraCommandProperty.getValue());
}

preferences.putBoolean(JabRefPreferences.USE_DEFAULT_FILE_BROWSER_APPLICATION, useFileBrowserDefaultProperty.getValue());
if (StringUtil.isNotBlank(useFileBrowserSpecialCommandProperty.getValue())) {
preferences.put(JabRefPreferences.FILE_BROWSER_COMMAND, useFileBrowserSpecialCommandProperty.getValue());
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/jabref/gui/preferences/FileTabView.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.jabref.gui.actions.StandardActions;
import org.jabref.gui.help.HelpAction;
import org.jabref.gui.util.IconValidationDecorator;
import org.jabref.gui.util.ViewModelListCellFactory;
import org.jabref.logic.help.HelpFile;
import org.jabref.logic.l10n.Localization;
import org.jabref.preferences.JabRefPreferences;
Expand Down Expand Up @@ -68,6 +69,9 @@ public void initialize() {
resolveStringsAll.selectedProperty().bindBidirectional(viewModel.resolveStringsAllProperty());
resolveStringsExcept.textProperty().bindBidirectional(viewModel.resolvStringsExceptProperty());
resolveStringsExcept.disableProperty().bind(resolveStringsAll.selectedProperty().not());
new ViewModelListCellFactory<NewLineSeparator>()
.withText(NewLineSeparator::getDisplayName)
.install(newLineSeparator);
newLineSeparator.itemsProperty().bind(viewModel.newLineSeparatorListProperty());
newLineSeparator.valueProperty().bindBidirectional(viewModel.selectedNewLineSeparatorProperty());
alwaysReformatBib.selectedProperty().bindBidirectional(viewModel.alwaysReformatBibProperty());
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/preferences/GeneralTab.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<CheckBox fx:id="allowIntegerEdition" text="%Allow integers in 'edition' field in BibTeX mode"/>
<CheckBox fx:id="memoryStickMode"
text="%Load and Save preferences from/to jabref.xml on start-up (memory stick mode)"/>
<CheckBox fx:id="collectTelemetry" text="%Collect and share telemetry data to help improve JabRef."/>
<CheckBox fx:id="collectTelemetry" text="%Collect and share telemetry data to help improve JabRef"/>
<CheckBox fx:id="showAdvancedHints"
text="%Show advanced hints (i.e. helpful tooltips, suggestions and explanation)"/>

Expand Down
Loading