mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-17 02:01:27 +00:00
add notification marker for new events
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
package org.cryptomator.ui.mainwindow;
|
||||
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
import org.cryptomator.common.EventMap;
|
||||
import org.cryptomator.common.settings.Settings;
|
||||
import org.cryptomator.common.vaults.Vault;
|
||||
import org.cryptomator.common.vaults.VaultListManager;
|
||||
import org.cryptomator.cryptofs.CryptoFileSystemProvider;
|
||||
import org.cryptomator.cryptofs.DirStructure;
|
||||
import org.cryptomator.event.VaultEvent;
|
||||
import org.cryptomator.ui.addvaultwizard.AddVaultWizardComponent;
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
import org.cryptomator.ui.common.VaultService;
|
||||
@@ -23,6 +25,7 @@ import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.collections.MapChangeListener;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.geometry.Side;
|
||||
@@ -35,7 +38,6 @@ import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.input.TransferMode;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.stage.Stage;
|
||||
import java.io.File;
|
||||
@@ -67,6 +69,8 @@ public class VaultListController implements FxController {
|
||||
private final VaultListCellFactory cellFactory;
|
||||
private final AddVaultWizardComponent.Builder addVaultWizard;
|
||||
private final BooleanBinding emptyVaultList;
|
||||
private final EventMap eventMap;
|
||||
private final BooleanProperty newEventsPresent;
|
||||
private final VaultListManager vaultListManager;
|
||||
private final BooleanProperty draggingVaultOver = new SimpleBooleanProperty();
|
||||
private final ResourceBundle resourceBundle;
|
||||
@@ -92,7 +96,8 @@ public class VaultListController implements FxController {
|
||||
ResourceBundle resourceBundle, //
|
||||
FxApplicationWindows appWindows, //
|
||||
Settings settings, //
|
||||
Dialogs dialogs) {
|
||||
Dialogs dialogs, //
|
||||
EventMap eventMap) {
|
||||
this.mainWindow = mainWindow;
|
||||
this.vaults = vaults;
|
||||
this.selectedVault = selectedVault;
|
||||
@@ -105,6 +110,13 @@ public class VaultListController implements FxController {
|
||||
this.dialogs = dialogs;
|
||||
|
||||
this.emptyVaultList = Bindings.isEmpty(vaults);
|
||||
this.eventMap = eventMap;
|
||||
this.newEventsPresent = new SimpleBooleanProperty(false);
|
||||
eventMap.addListener((MapChangeListener<? super EventMap.EventKey, ? super VaultEvent>) change -> {
|
||||
if (change.wasAdded()) {
|
||||
newEventsPresent.setValue(true);
|
||||
}
|
||||
});
|
||||
|
||||
selectedVault.addListener(this::selectedVaultDidChange);
|
||||
cellSize = settings.compactMode.map(compact -> compact ? 30.0 : 60.0);
|
||||
@@ -267,6 +279,7 @@ public class VaultListController implements FxController {
|
||||
@FXML
|
||||
public void showEventViewer() {
|
||||
appWindows.showEventViewer();
|
||||
newEventsPresent.setValue(false);
|
||||
}
|
||||
// Getter and Setter
|
||||
|
||||
@@ -294,4 +307,11 @@ public class VaultListController implements FxController {
|
||||
return cellSize.getValue();
|
||||
}
|
||||
|
||||
public ObservableValue<Boolean> newEventsPresentProperty() {
|
||||
return newEventsPresent;
|
||||
}
|
||||
|
||||
public boolean getNewEventsPresent() {
|
||||
return newEventsPresent.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,6 +215,13 @@
|
||||
-fx-background-color: CONTROL_BORDER_NORMAL, CONTROL_BG_ARMED;
|
||||
}
|
||||
|
||||
.update-indicator {
|
||||
-fx-background-color: white, RED_5;
|
||||
-fx-background-insets: 1px, 2px;
|
||||
-fx-background-radius: 6px, 5px;
|
||||
-fx-effect: dropshadow(three-pass-box, rgba(0, 0, 0, 0.8), 2, 0, 0, 0);
|
||||
}
|
||||
|
||||
.event-window .button-bar {
|
||||
-fx-min-height:42px;
|
||||
-fx-max-height:42px;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<?import org.cryptomator.ui.controls.FontAwesome5IconView?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.ListView?>
|
||||
<?import javafx.scene.control.Tooltip?>
|
||||
<?import javafx.scene.layout.Region?>
|
||||
<?import javafx.scene.layout.StackPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
@@ -42,11 +43,17 @@
|
||||
</graphic>
|
||||
</Button>
|
||||
<Region HBox.hgrow="ALWAYS"/>
|
||||
<Button onMouseClicked="#showEventViewer" styleClass="button-right" alignment="CENTER" minWidth="20" contentDisplay="GRAPHIC_ONLY">
|
||||
<graphic>
|
||||
<FontAwesome5IconView glyph="BELL" glyphSize="16"/>
|
||||
</graphic>
|
||||
</Button>
|
||||
<StackPane>
|
||||
<Button onMouseClicked="#showEventViewer" styleClass="button-right" minWidth="20" contentDisplay="GRAPHIC_ONLY" mnemonicParsing="false">
|
||||
<graphic>
|
||||
<FontAwesome5IconView glyph="BELL" glyphSize="16"/>
|
||||
</graphic>
|
||||
<tooltip>
|
||||
<Tooltip text="%main.vaultlist.showEventsButton.tooltip"/>
|
||||
</tooltip>
|
||||
</Button>
|
||||
<Region styleClass="update-indicator" visible="${controller.newEventsPresent}" mouseTransparent="true" StackPane.alignment="TOP_RIGHT" prefWidth="12" prefHeight="12" maxWidth="-Infinity" maxHeight="-Infinity"/>
|
||||
</StackPane>
|
||||
<Button onMouseClicked="#showPreferences" styleClass="button-right" alignment="CENTER" minWidth="20" contentDisplay="GRAPHIC_ONLY">
|
||||
<graphic>
|
||||
<FontAwesome5IconView glyph="COG" glyphSize="16"/>
|
||||
|
||||
@@ -396,6 +396,7 @@ main.vaultlist.contextMenu.vaultoptions=Show Vault Options
|
||||
main.vaultlist.contextMenu.reveal=Reveal Drive
|
||||
main.vaultlist.addVaultBtn.menuItemNew=Create New Vault...
|
||||
main.vaultlist.addVaultBtn.menuItemExisting=Open Existing Vault...
|
||||
main.vaultlist.showEventsButton.tooltip=Open event view
|
||||
##Notificaition
|
||||
main.notification.updateAvailable=Update is available.
|
||||
main.notification.support=Support Cryptomator.
|
||||
|
||||
Reference in New Issue
Block a user