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

Fix Unclear function of preference “Default bibliography mode” #6539

Closed
wants to merge 13 commits into from
Closed
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve

### Changed

- we deleted the `Default bibliography mode` in the Preference/General tab since it is a redundant setting. [#6470](https://github.com/JabRef/jabref/issues/6470)
- 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)
- When JabRef finds a `.sav` file without changes, there is no dialog asking for acceptance of changes anymore.
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/jabref/gui/preferences/GeneralTab.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
<ComboBox fx:id="language" prefWidth="200.0" GridPane.columnIndex="1"/>
<Label text="%Default encoding" GridPane.rowIndex="1"/>
<ComboBox fx:id="defaultEncoding" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
<Label text="%Default bibliography mode" GridPane.rowIndex="2"/>
<ComboBox fx:id="biblatexMode" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="2"/>
</GridPane>
<CheckBox fx:id="inspectionWarningDuplicate"
text="%Warn about unresolved duplicates when closing inspection window"/>
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/org/jabref/gui/preferences/GeneralTabView.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.jabref.logic.help.HelpFile;
import org.jabref.logic.l10n.Language;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.database.BibDatabaseMode;
import org.jabref.preferences.JabRefPreferences;

import com.airhacks.afterburner.views.ViewLoader;
Expand All @@ -29,7 +28,6 @@ public class GeneralTabView extends AbstractPreferenceTabView<GeneralTabViewMode

@FXML private ComboBox<Language> language;
@FXML private ComboBox<Charset> defaultEncoding;
@FXML private ComboBox<BibDatabaseMode> biblatexMode;
@FXML private CheckBox inspectionWarningDuplicate;
@FXML private CheckBox confirmDelete;
@FXML private CheckBox allowIntegerEdition;
Expand Down Expand Up @@ -79,12 +77,6 @@ public void initialize() {
defaultEncoding.itemsProperty().bind(viewModel.encodingsListProperty());
defaultEncoding.valueProperty().bindBidirectional(viewModel.selectedEncodingProperty());

new ViewModelListCellFactory<BibDatabaseMode>()
.withText(BibDatabaseMode::getFormattedName)
.install(biblatexMode);
biblatexMode.itemsProperty().bind(viewModel.biblatexModeListProperty());
biblatexMode.valueProperty().bindBidirectional(viewModel.selectedBiblatexModeProperty());

inspectionWarningDuplicate.selectedProperty().bindBidirectional(viewModel.inspectionWarningDuplicateProperty());
confirmDelete.selectedProperty().bindBidirectional(viewModel.confirmDeleteProperty());
allowIntegerEdition.selectedProperty().bindBidirectional(viewModel.allowIntegerEditionProperty());
Expand Down
16 changes: 2 additions & 14 deletions src/main/java/org/jabref/gui/preferences/GeneralTabViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.jabref.model.database.BibDatabaseMode;
import org.jabref.model.entry.field.FieldFactory;
import org.jabref.preferences.GeneralPreferences;
import org.jabref.preferences.JabRefPreferences;
import org.jabref.preferences.PreferencesService;

import de.saxsys.mvvmfx.utils.validation.FunctionBasedValidator;
Expand All @@ -36,8 +37,6 @@ public class GeneralTabViewModel implements PreferenceTabViewModel {
private final ObjectProperty<Language> selectedLanguageProperty = new SimpleObjectProperty<>();
private final ListProperty<Charset> encodingsListProperty = new SimpleListProperty<>();
private final ObjectProperty<Charset> selectedEncodingProperty = new SimpleObjectProperty<>();
private final ListProperty<BibDatabaseMode> bibliographyModeListProperty = new SimpleListProperty<>();
private final ObjectProperty<BibDatabaseMode> selectedBiblatexModeProperty = new SimpleObjectProperty<>();

private final BooleanProperty inspectionWarningDuplicateProperty = new SimpleBooleanProperty();
private final BooleanProperty confirmDeleteProperty = new SimpleBooleanProperty();
Expand Down Expand Up @@ -99,9 +98,6 @@ public void setValues() {
encodingsListProperty.setValue(FXCollections.observableArrayList(Encodings.getCharsets()));
selectedEncodingProperty.setValue(initialGeneralPreferences.getDefaultEncoding());

bibliographyModeListProperty.setValue(FXCollections.observableArrayList(BibDatabaseMode.values()));
selectedBiblatexModeProperty.setValue(initialGeneralPreferences.getDefaultBibDatabaseMode());

inspectionWarningDuplicateProperty.setValue(initialGeneralPreferences.isWarnAboutDuplicatesInInspection());
confirmDeleteProperty.setValue(initialGeneralPreferences.isConfirmDelete());
allowIntegerEditionProperty.setValue(initialGeneralPreferences.isAllowIntegerEditionBibtex());
Expand Down Expand Up @@ -136,7 +132,7 @@ public void storeSettings() {

preferencesService.storeGeneralPreferences(new GeneralPreferences(
selectedEncodingProperty.getValue(),
selectedBiblatexModeProperty.getValue(),
((JabRefPreferences) preferencesService).getBoolean(JabRefPreferences.BIBLATEX_DEFAULT_MODE) ? BibDatabaseMode.BIBLATEX : BibDatabaseMode.BIBTEX,
Copy link
Member

Choose a reason for hiding this comment

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

Where does the user have the possibility to change that value (JabRefPreferences.BIBLATEX_DEFAULT_MODE)? Is it more a constant now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean the variable itself or the value it point to in JabRefPreferences.prefs? If you mean the variable itself, the access modifier for it is final, so I think it is a constant. If you mean the value it point to in JabRefPreferences.prefs, I think GeneralTabViewModel.storeSettings() does something to change it.

Copy link
Member

Choose a reason for hiding this comment

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

Hi, thank you for your interest in preferences refactoring and simplifying. However, there are some architectural decisions we probably failed yet to communicate enough publicly.

Please do not use direct calls to JabRefPreferences::get etc. anymore. We are working in abstracting access to the preferences to modularize JabRef in the long run.
You can use preferences objects instead which can be received by calls to a PreferencesService. (getGeneralPreferences or similar)

Besides that, I agree with @Siedlerchr , there are some places and case scenarios, people will need to rely on bibtex mode instead of biblatex as default. So we shouldn't kill a feature in JabRef, without a strong necessity.

Thank you anyways. Don't hesitate to ask us about the roadmap of JabRef, about ideas you have and want to realize etc. The JabRef developer chat in gitter is open for discussion. Free software is meant for developers to discuss things and to help each other.

inspectionWarningDuplicateProperty.getValue(),
confirmDeleteProperty.getValue(),
allowIntegerEditionProperty.getValue(),
Expand Down Expand Up @@ -194,14 +190,6 @@ public ObjectProperty<Charset> selectedEncodingProperty() {
return this.selectedEncodingProperty;
}

public ListProperty<BibDatabaseMode> biblatexModeListProperty() {
return this.bibliographyModeListProperty;
}

public ObjectProperty<BibDatabaseMode> selectedBiblatexModeProperty() {
return this.selectedBiblatexModeProperty;
}

public BooleanProperty inspectionWarningDuplicateProperty() {
return this.inspectionWarningDuplicateProperty;
}
Expand Down