Skip to content

Commit

Permalink
Merge pull request #9866 from JabRef/library_prefs
Browse files Browse the repository at this point in the history
Preferences ui cleanup B
  • Loading branch information
Siedlerchr authored May 15, 2023
2 parents dc60b4d + baf2947 commit 14a52c9
Show file tree
Hide file tree
Showing 72 changed files with 1,088 additions and 1,077 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We reorganized the order of tabs and settings in the library properties. [#9836](https://github.com/JabRef/jabref/pull/9836)
- We changed the handling of an "overflow" of authors at `[authIniN]`: JabRef uses `+` to indicate an overflow. Example: `[authIni2]` produces `A+` (instead of `AB`) for `Aachen and Berlin and Chemnitz`. [#9703](https://github.com/JabRef/jabref/pull/9703)
- We moved the preferences option to open the last edited files on startup to the 'General' tab. [#9808](https://github.com/JabRef/jabref/pull/9808)
- We split the 'Import and Export' tab into 'Web Search' and 'Export'. [#9839](https://github.com/JabRef/jabref/pull/9839)
- We improved the recognition of DOIs when pasting a link containing a DOI on the maintable [#9864](https://github.com/JabRef/jabref/issues/9864s)
- We reordered the preferences dialog. [#9839](https://github.com/JabRef/jabref/pull/9839)
- We split the 'Import and Export' tab into 'Web Search' and 'Export'. [#9839](https://github.com/JabRef/jabref/pull/9839)
- We moved the option to run JabRef in memory stick mode into the preferences dialog toolbar. [#9866](https://github.com/JabRef/jabref/pull/9866)
- In case the library contains empty entries, they are not written to disk. [#8645](https://github.com/JabRef/jabref/issues/8645)
- The formatter `remove_unicode_ligatures` is now called `replace_unicode_ligatures`. [#9890](https://github.com/JabRef/jabref/pull/9890)

Expand Down Expand Up @@ -77,6 +79,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue when overwriting the owner was disabled. [#9896](https://github.com/JabRef/jabref/pull/9896)
- We fixed an issue regarding recording redundant prefixes in search history. [#9685](https://github.com/JabRef/jabref/issues/9685)
- We fixed an issue where passing a URL containing a DOI led to a "No entry found" notification. [#9821](https://github.com/JabRef/jabref/issues/9821)
- We fixed some minor visual inconsistencies and issues in the preferences dialog. [#9866](https://github.com/JabRef/jabref/pull/9866)
- The order of save actions is now retained. [#9890](https://github.com/JabRef/jabref/pull/9890)

### Removed
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/cli/ArgumentProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ private List<ParserResult> processArguments() {
cli.getWriteMetadatatoPdf(),
preferencesService.getXmpPreferences(),
preferencesService.getFilePreferences(),
preferencesService.getGeneralPreferences().getDefaultBibDatabaseMode(),
preferencesService.getLibraryPreferences().getDefaultBibDatabaseMode(),
Globals.entryTypesManager,
preferencesService.getFieldPreferences(),
cli.isWriteXMPtoPdf() || cli.isWriteMetadatatoPdf(),
Expand Down Expand Up @@ -534,7 +534,7 @@ private void saveDatabase(BibDatabase newBase, String subName) {
BibWriter bibWriter = new BibWriter(fileWriter, OS.NEWLINE);
SaveConfiguration saveConfiguration = new SaveConfiguration()
.withMetadataSaveOrder(true)
.withReformatOnSave(preferencesService.getExportPreferences().shouldAlwaysReformatOnSave());
.withReformatOnSave(preferencesService.getLibraryPreferences().shouldAlwaysReformatOnSave());

BibDatabaseWriter databaseWriter = new BibtexDatabaseWriter(
bibWriter,
Expand Down
39 changes: 29 additions & 10 deletions src/main/java/org/jabref/gui/Base.css
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,10 @@ TextFlow > .tooltip-text-monospaced {
-fx-padding: 0.5em 1em 0.5em 1em;
}

.menu-button > .label {
-fx-padding: 0 8 0 8;
}

.button:hover {
-fx-background-color: rgba(0, 0, 0, 0.12);
}
Expand Down Expand Up @@ -529,6 +533,12 @@ TextFlow > .tooltip-text-monospaced {
-fx-padding: 0.0em 0.666667em 0.0em 0.666667em;
}

.menu-bar .menu-button {
-fx-border-color: transparent;
-fx-border-width: 0;
-fx-border-radius: 0;
}

.menu-item {
-fx-padding: 0.5em 0.41777em 0.5em 0.41777em;
}
Expand Down Expand Up @@ -622,12 +632,14 @@ TextFlow > .tooltip-text-monospaced {
-fx-background-color: -jr-green;
}

.table-view {
.table-view,
.tree-table-view {
-fx-background-insets: 0;
-fx-padding: 0;
}

.table-view:focused {
.table-view:focused,
.tree-table-view:focused {
-fx-background-insets: 0;
}

Expand Down Expand Up @@ -751,6 +763,9 @@ TextFlow > .tooltip-text-monospaced {
-fx-background-color: -fx-control-inner-background;
-fx-background-insets: 0;
-fx-effect: null;
-fx-border-width: 1;
-fx-border-color: -fx-outer-border;
-fx-padding: 0;
}

.combo-box-popup > .list-view > .virtual-flow > .clipped-container > .sheet > .list-cell {
Expand Down Expand Up @@ -1086,24 +1101,26 @@ We want to have a look that matches our icons in the tool-bar */
-fx-background-color: -fx-mark-highlight-color, derive(-jr-theme-text, -30%);
}

.table-view {
.table-view,
.tree-table-view {
-fx-border-width: 0;
-fx-padding: 0;
-fx-border-insets: 0;
-fx-table-cell-border-color: transparent;
}

.table-view .column-header-background {
.column-header-background {
-fx-background-color: -fx-control-inner-background;
-fx-border-width: 0;
}

.table-view .column-header-background:hover {
.column-header-background:hover {
-fx-background-color: -fx-outer-border;
}

.table-view .column-header,
.table-view .filler {
.column-header,
.table-view .filler,
.tree-table-view .filler {
-fx-background-color: transparent, -fx-control-inner-background;
-fx-background-insets: 0, 0 0.02em 0 0.02em;
-fx-font-weight: bold;
Expand All @@ -1112,20 +1129,22 @@ We want to have a look that matches our icons in the tool-bar */
-fx-border-color: -fx-outer-border;
}

.table-view .column-header > .label {
.column-header > .label {
-fx-padding: 0 1em 0 1em;
-fx-alignment: center-left;
-fx-text-fill: -jr-head-fg;
}

.table-view .column-header .glyph-icon {
.column-header .glyph-icon {
-fx-alignment: baseline-center;
-fx-text-fill: -jr-head-fg;
-fx-fill: -jr-head-fg;
}

.table-cell,
.table-cell .glyph-icon {
.tree-table-cell,
.table-cell .glyph-icon,
.tree-table-cell .glyph-icon {
-fx-padding: 0.5em 1em 0.5em 1em;
-fx-cell-size: 4.0em;
-fx-text-fill: -fx-text-background-color;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/Globals.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static synchronized ClipBoardManager getClipboardManager() {
public static synchronized ThemeManager getThemeManager() {
if (themeManager == null) {
themeManager = new ThemeManager(
prefs.getAppearancePreferences(),
prefs.getWorkspacePreferences(),
getFileUpdateMonitor(),
Runnable::run);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ public void about() {
* set to true
*/
private void tearDownJabRef(List<String> filenames) {
if (prefs.getGeneralPreferences().shouldOpenLastEdited()) {
if (prefs.getWorkspacePreferences().shouldOpenLastEdited()) {
// Here we store the names of all current files. If there is no current file, we remove any
// previously stored filename.
if (filenames.isEmpty()) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/JabRefGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private void openWindow(Stage mainStage) {

private void openDatabases() {
// If the option is enabled, open the last edited libraries, if any.
if (!isBlank && preferencesService.getGeneralPreferences().shouldOpenLastEdited()) {
if (!isBlank && preferencesService.getWorkspacePreferences().shouldOpenLastEdited()) {
openLastEditedDatabases();
}

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/jabref/gui/LibraryTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public void installAutosaveManagerAndBackupManager() {
private boolean isDatabaseReadyForAutoSave(BibDatabaseContext context) {
return ((context.getLocation() == DatabaseLocation.SHARED)
|| ((context.getLocation() == DatabaseLocation.LOCAL)
&& preferencesService.getExportPreferences().shouldAutoSave()))
&& preferencesService.getLibraryPreferences().shouldAutoSave()))
&& context.getDatabasePath().isPresent();
}

Expand All @@ -313,7 +313,7 @@ private boolean isDatabaseReadyForBackup(BibDatabaseContext context) {
* Example: *jabref-authors.bib – testbib
*/
public void updateTabTitle(boolean isChanged) {
boolean isAutosaveEnabled = preferencesService.getExportPreferences().shouldAutoSave();
boolean isAutosaveEnabled = preferencesService.getLibraryPreferences().shouldAutoSave();

DatabaseLocation databaseLocation = bibDatabaseContext.getLocation();
Optional<Path> file = bibDatabaseContext.getDatabasePath();
Expand Down Expand Up @@ -664,7 +664,7 @@ public BibDatabase getDatabase() {
}

private boolean showDeleteConfirmationDialog(int numberOfEntries) {
if (preferencesService.getGeneralPreferences().shouldConfirmDelete()) {
if (preferencesService.getWorkspacePreferences().shouldConfirmDelete()) {
String title = Localization.lang("Delete entry");
String message = Localization.lang("Really delete the selected entry?");
String okButton = Localization.lang("Delete entry");
Expand All @@ -681,7 +681,7 @@ private boolean showDeleteConfirmationDialog(int numberOfEntries) {
okButton,
cancelButton,
Localization.lang("Do not ask again"),
optOut -> preferencesService.getGeneralPreferences().setConfirmDelete(!optOut));
optOut -> preferencesService.getWorkspacePreferences().setConfirmDelete(!optOut));
} else {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public DeprecatedFieldsTab(BibDatabaseContext databaseContext,
this.entryTypesManager = entryTypesManager;

setText(Localization.lang("Deprecated fields"));
EasyBind.subscribe(preferences.getGeneralPreferences().showAdvancedHintsProperty(), advancedHints -> {
EasyBind.subscribe(preferences.getWorkspacePreferences().showAdvancedHintsProperty(), advancedHints -> {
if (advancedHints) {
setTooltip(new Tooltip(Localization.lang("Shows fields having a successor in biblatex.\nFor instance, the publication month should be part of the date field.\nUse the Cleanup Entries functionality to convert the entry to biblatex.")));
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private StackPane getRelatedArticlesPane(BibEntry entry) {
ProgressIndicator progress = new ProgressIndicator();
progress.setMaxSize(100, 100);

MrDLibFetcher fetcher = new MrDLibFetcher(preferencesService.getGeneralPreferences().getLanguage().name(),
MrDLibFetcher fetcher = new MrDLibFetcher(preferencesService.getWorkspacePreferences().getLanguage().name(),
Globals.BUILD_INFO.version, preferencesService.getMrDlibPreferences());
BackgroundTask
.wrap(() -> fetcher.performSearch(entry))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ private boolean saveDatabase(Path file, boolean selectedOnly, Charset encoding,
SaveConfiguration saveConfiguration = new SaveConfiguration()
.withSaveType(saveType)
.withMetadataSaveOrder(true)
.withReformatOnSave(preferences.getExportPreferences().shouldAlwaysReformatOnSave());
.withReformatOnSave(preferences.getLibraryPreferences().shouldAlwaysReformatOnSave());
BibDatabaseContext bibDatabaseContext = libraryTab.getBibDatabaseContext();
synchronized (bibDatabaseContext) {
try (AtomicFileWriter fileWriter = new AtomicFileWriter(file, encoding, saveConfiguration.shouldMakeBackup())) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/gui/groups/GroupTreeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ private StackPane createNumberCell(GroupNodeViewModel group) {

text.styleProperty().bind(Bindings.createStringBinding(() -> {
double reducedFontSize;
double font_size = preferencesService.getAppearancePreferences().getMainFontSize();
double font_size = preferencesService.getWorkspacePreferences().getMainFontSize();
// For each breaking point, the font size is reduced 0.20 em to fix issue 8797
if (font_size > 26.0) {
reducedFontSize = 0.25;
Expand All @@ -301,7 +301,7 @@ private StackPane createNumberCell(GroupNodeViewModel group) {
reducedFontSize = 0.75;
}
return String.format("-fx-font-size: %fem;", reducedFontSize);
}, preferencesService.getAppearancePreferences().mainFontSizeProperty()));
}, preferencesService.getWorkspacePreferences().mainFontSizeProperty()));

node.getChildren().add(text);
node.setMaxWidth(Control.USE_PREF_SIZE);
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 @@ -189,6 +189,7 @@ public enum JabRefIcons implements JabRefIcon {
UNDO(MaterialDesignU.UNDO),
MARKER(MaterialDesignM.MARKER),
REFRESH(MaterialDesignR.REFRESH),
MEMORYSTICK(MaterialDesignU.USB_FLASH_DRIVE_OUTLINE),
DELETE_ENTRY(MaterialDesignD.DELETE),
SEARCH(MaterialDesignM.MAGNIFY),
FILE_SEARCH(MaterialDesignF.FILE_FIND),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public NewDatabaseAction(JabRefFrame jabRefFrame, PreferencesService preferences
@Override
public void execute() {
BibDatabaseContext bibDatabaseContext = new BibDatabaseContext();
bibDatabaseContext.setMode(preferencesService.getGeneralPreferences().getDefaultBibDatabaseMode());
bibDatabaseContext.setMode(preferencesService.getLibraryPreferences().getDefaultBibDatabaseMode());
jabRefFrame.addTab(bibDatabaseContext, true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ private List<BibEntryType> getListOfUnknownAndUnequalCustomizations(ParserResult
}

private BibDatabaseMode getBibDatabaseModeFromParserResult(ParserResult parserResult) {
return parserResult.getMetaData().getMode().orElse(Globals.prefs.getGeneralPreferences().getDefaultBibDatabaseMode());
return parserResult.getMetaData().getMode().orElse(Globals.prefs.getLibraryPreferences().getDefaultBibDatabaseMode());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void setValues() {
viewModel.setValues();
bibtexKeyPatternTable.setValues(
bibEntryTypesManager.getAllTypes(databaseContext.getMetaData().getMode()
.orElse(preferencesService.getGeneralPreferences()
.orElse(preferencesService.getLibraryPreferences()
.getDefaultBibDatabaseMode())),
databaseContext.getMetaData().getCiteKeyPattern(preferencesService.getCitationKeyPatternPreferences().getKeyPattern()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<?import javafx.scene.control.ListView?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.ToggleButton?>
<?import javafx.scene.control.Tooltip?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
Expand Down Expand Up @@ -61,6 +62,14 @@
<Tooltip text="%Reset preferences"/>
</tooltip>
</Button>
<ToggleButton fx:id="memoryStickMode" styleClass="icon-button,narrow" maxWidth="Infinity" HBox.hgrow="ALWAYS">
<graphic>
<JabRefIconView glyph="MEMORYSTICK"/>
</graphic>
<tooltip>
<Tooltip text="%Memory stick mode - Store preferences in 'jabref.xml' in the app folder."/>
</tooltip>
</ToggleButton>
</HBox>
</VBox>
<ScrollPane fx:id="preferencesContainer"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import javafx.scene.control.ButtonType;
import javafx.scene.control.ListView;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.ToggleButton;
import javafx.scene.input.KeyCode;

import org.jabref.gui.DialogService;
Expand Down Expand Up @@ -35,6 +36,7 @@ public class PreferencesDialogView extends BaseDialog<PreferencesDialogViewModel
@FXML private ListView<PreferencesTab> preferenceTabList;
@FXML private ScrollPane preferencesContainer;
@FXML private ButtonType saveButton;
@FXML private ToggleButton memoryStickMode;

@Inject private DialogService dialogService;
@Inject private PreferencesService preferencesService;
Expand Down Expand Up @@ -105,6 +107,8 @@ private void initialize() {
.withText(PreferencesTab::getTabName)
.install(preferenceTabList);

memoryStickMode.selectedProperty().bindBidirectional(viewModel.getMemoryStickProperty());

viewModel.setValues();
}

Expand Down
Loading

0 comments on commit 14a52c9

Please sign in to comment.