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

Preferences ui cleanup B #9866

Merged
merged 37 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
cf5f82b
Introduced library preferences tab
calixtus May 8, 2023
d555ffa
Moved language setting to AppearanceTab
calixtus May 9, 2023
75e551a
Changed theme radio buttons to combobox
calixtus May 9, 2023
0d5f846
Moved four settings to AppearanceTab
calixtus May 9, 2023
c1bf900
Removed GeneralTab, moved memory stick button to prefs toolbar
calixtus May 9, 2023
949bff2
Moved default library to EntryTab
calixtus May 9, 2023
ea38b9b
Moved telemetry prefs to AppearanceTab
calixtus May 9, 2023
6cf3d9d
Moved default library to LibraryTab
calixtus May 9, 2023
6dd2c76
Fixed AppearancePreferences
calixtus May 9, 2023
7ea1fdc
Moved memory stick mode to InternalPreferences
calixtus May 9, 2023
70571ba
Moved language to AppearancePreferences
calixtus May 9, 2023
c889560
Renamed GeneralPreferences to LibraryPreferences, moved reformatting …
calixtus May 9, 2023
adf7cdb
Fixed ui
calixtus May 9, 2023
4ce19e4
CHANGELOG.md
calixtus May 9, 2023
137710a
Fixed backup branch merge conflicts
calixtus May 9, 2023
455edf5
Fixed backup branch merge conflicts
calixtus May 9, 2023
5cd19df
Fixed checkstyle
calixtus May 9, 2023
8cf533a
Reworded getGeneralPreferences
calixtus May 9, 2023
0b69aa4
Fixed ThemeManagerTest
calixtus May 9, 2023
8332684
Polished KeyBindingsTab
calixtus May 10, 2023
8106f87
Added missing symbols in CustomImporter/ExporterTab
calixtus May 10, 2023
cbc76f0
Added small border to combobox popups
calixtus May 10, 2023
f857059
Merge remote-tracking branch 'upstream/main' into library_prefs
calixtus May 10, 2023
47e4ef1
CHANGELOG.md
calixtus May 10, 2023
e178ef4
l10n
calixtus May 10, 2023
cb02a2e
Merge remote-tracking branch 'upstream/main' into library_prefs
calixtus May 10, 2023
4a54aa0
Reworded AppearanceTab to WorkspaceTab
calixtus May 10, 2023
aabf62d
Reworded AppearanceTab to WorkspaceTab
calixtus May 10, 2023
c0e52fe
Merged WorkspaceTab and LibraryTab
calixtus May 10, 2023
bc5c4fc
Moved Autocompletion to new tab and moved Custom tab editor to EntryE…
calixtus May 10, 2023
cb5ce9f
CHANGELOG.md
calixtus May 10, 2023
d81d37f
Merge branch 'main' into library_prefs
koppor May 12, 2023
beb59e2
Readded Hint on 9839
koppor May 12, 2023
e488e3b
Merge branch 'main' into library_prefs
calixtus May 15, 2023
57b0649
Renamed workspace tab back to general tab
calixtus May 15, 2023
df6e42f
Update Javadoc
calixtus May 15, 2023
baf2947
Merge branch 'main' into library_prefs
calixtus May 15, 2023
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
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