mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-22 12:41:27 +00:00
first proper design draft
This commit is contained in:
@@ -59,7 +59,7 @@ open module org.cryptomator.desktop {
|
||||
|
||||
uses org.cryptomator.common.locationpresets.LocationPresetsProvider;
|
||||
uses SSLContextProvider;
|
||||
uses org.cryptomator.notify.NotificationHandler;
|
||||
uses org.cryptomator.event.NotificationHandler;
|
||||
|
||||
provides TrayMenuController with AwtTrayMenuController;
|
||||
provides Configurator with LogbackConfiguratorFactory;
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.cryptomator.common.vaults.VaultComponent;
|
||||
import org.cryptomator.common.vaults.VaultListModule;
|
||||
import org.cryptomator.cryptolib.common.MasterkeyFileAccess;
|
||||
import org.cryptomator.integrations.revealpath.RevealPathService;
|
||||
import org.cryptomator.notify.Event;
|
||||
import org.cryptomator.event.Event;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ public class Environment {
|
||||
* @return App version or "SNAPSHOT", if undefined
|
||||
*/
|
||||
public String getAppVersion() {
|
||||
return System.getProperty(APP_VERSION_PROP_NAME, "SNAPSHOT");
|
||||
return System.getProperty(APP_VERSION_PROP_NAME, "1.14.2");
|
||||
}
|
||||
|
||||
public Optional<String> getBuildNumber() {
|
||||
|
||||
@@ -27,8 +27,8 @@ import org.cryptomator.integrations.mount.Mountpoint;
|
||||
import org.cryptomator.integrations.mount.UnmountFailedException;
|
||||
import org.cryptomator.integrations.quickaccess.QuickAccessService;
|
||||
import org.cryptomator.integrations.quickaccess.QuickAccessServiceException;
|
||||
import org.cryptomator.notify.Event;
|
||||
import org.cryptomator.notify.VaultEvent;
|
||||
import org.cryptomator.event.Event;
|
||||
import org.cryptomator.event.VaultEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.cryptomator.notify;
|
||||
package org.cryptomator.event;
|
||||
|
||||
public sealed interface Answer permits Answer.DoNothing, Answer.DoSomething {
|
||||
|
||||
15
src/main/java/org/cryptomator/event/Event.java
Normal file
15
src/main/java/org/cryptomator/event/Event.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package org.cryptomator.event;
|
||||
|
||||
public sealed interface Event extends Comparable<Event> permits UpdateEvent, VaultEvent {
|
||||
|
||||
long getTimestampMilli();
|
||||
|
||||
default int compareTo(Event other) {
|
||||
long timeDiff = this.getTimestampMilli() - other.getTimestampMilli();
|
||||
if (timeDiff != 0) {
|
||||
return (int) timeDiff;
|
||||
}
|
||||
return this.equals(other) ? 0 : this.getClass().getName().compareTo(other.getClass().getName());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.cryptomator.notify;
|
||||
package org.cryptomator.event;
|
||||
|
||||
import org.cryptomator.integrations.common.IntegrationsLoader;
|
||||
|
||||
17
src/main/java/org/cryptomator/event/UpdateEvent.java
Normal file
17
src/main/java/org/cryptomator/event/UpdateEvent.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package org.cryptomator.event;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
public record UpdateEvent(long timestamp, String newVersion) implements Event {
|
||||
|
||||
public UpdateEvent(String newVersion) {
|
||||
this(Instant.now().toEpochMilli(), newVersion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTimestampMilli() {
|
||||
return timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
17
src/main/java/org/cryptomator/event/VaultEvent.java
Normal file
17
src/main/java/org/cryptomator/event/VaultEvent.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package org.cryptomator.event;
|
||||
|
||||
import org.cryptomator.cryptofs.event.FilesystemEvent;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
public record VaultEvent(long timestamp, String vaultId, String displayName, FilesystemEvent actualEvent) implements Event {
|
||||
|
||||
public VaultEvent(String vaultId, String displayName, FilesystemEvent actualEvent) {
|
||||
this(Instant.now().toEpochMilli(), vaultId, displayName, actualEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTimestampMilli() {
|
||||
return timestamp;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package org.cryptomator.notify;
|
||||
|
||||
public sealed interface Event permits UpdateEvent, VaultEvent {
|
||||
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
package org.cryptomator.notify;
|
||||
|
||||
public record UpdateEvent(String newVersion) implements Event {}
|
||||
@@ -1,7 +0,0 @@
|
||||
package org.cryptomator.notify;
|
||||
|
||||
import org.cryptomator.cryptofs.event.FilesystemEvent;
|
||||
|
||||
public record VaultEvent(String vaultId, String path, FilesystemEvent actualEvent) implements Event {
|
||||
|
||||
}
|
||||
@@ -1,14 +1,39 @@
|
||||
package org.cryptomator.ui.eventviewer;
|
||||
|
||||
import org.cryptomator.event.Event;
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.collections.transformation.SortedList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.ListView;
|
||||
import java.util.Comparator;
|
||||
|
||||
@EventViewerScoped
|
||||
public class EventViewController implements FxController {
|
||||
|
||||
@Inject
|
||||
public EventViewController() {
|
||||
private final SortedList<Event> reversedEventList;
|
||||
private final ObservableList<Event> eventList;
|
||||
|
||||
@FXML
|
||||
ListView<Event> eventListView;
|
||||
|
||||
@Inject
|
||||
public EventViewController(ObservableList<Event> eventList) {
|
||||
reversedEventList = new SortedList<>(eventList, Comparator.reverseOrder());
|
||||
this.eventList = eventList;
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
eventListView.setItems(reversedEventList);
|
||||
}
|
||||
|
||||
@FXML
|
||||
void emptyEventList() {
|
||||
eventList.clear();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ abstract class EventViewerModule {
|
||||
Stage stage = factory.create();
|
||||
stage.setTitle("TODO EVENTVIEWER");
|
||||
stage.setResizable(true);
|
||||
stage.initModality(Modality.WINDOW_MODAL); //TODO: or not modal at all?
|
||||
stage.initModality(Modality.NONE);
|
||||
stage.initOwner(owner);
|
||||
return stage;
|
||||
}
|
||||
@@ -42,11 +42,6 @@ abstract class EventViewerModule {
|
||||
return new FxmlLoaderFactory(factories, sceneFactory, resourceBundle);
|
||||
}
|
||||
|
||||
@Binds
|
||||
@IntoMap
|
||||
@FxControllerKey(EventViewController.class)
|
||||
abstract FxController bindEventViewController(EventViewController controller);
|
||||
|
||||
@Provides
|
||||
@FxmlScene(FxmlFile.EVENT_VIEWER)
|
||||
@EventViewerScoped
|
||||
@@ -54,4 +49,14 @@ abstract class EventViewerModule {
|
||||
return fxmlLoaders.createScene(FxmlFile.EVENT_VIEWER);
|
||||
}
|
||||
|
||||
|
||||
@Binds
|
||||
@IntoMap
|
||||
@FxControllerKey(EventViewController.class)
|
||||
abstract FxController bindEventViewController(EventViewController controller);
|
||||
|
||||
@Binds
|
||||
@IntoMap
|
||||
@FxControllerKey(UpdateEventViewController.class)
|
||||
abstract FxController bindUpdateEventViewController(UpdateEventViewController controller);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.cryptomator.ui.eventviewer;
|
||||
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@EventViewerScoped
|
||||
public class UpdateEventViewController implements FxController {
|
||||
|
||||
@Inject
|
||||
public UpdateEventViewController() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -204,10 +204,14 @@ public class FxApplicationWindows {
|
||||
}
|
||||
}
|
||||
|
||||
public CompletionStage<Void> showEventViewer(@Nullable Stage owner) {
|
||||
public CompletionStage<Object> showEventViewer(@Nullable Stage owner) {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
eventViewWindow.create(owner).showEventViewerWindow();
|
||||
return null;
|
||||
}, Platform::runLater);
|
||||
}, Platform::runLater).exceptionally(t -> {
|
||||
LOG.error("Unable to display event viewer.", t);
|
||||
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ package org.cryptomator.ui.fxapp;
|
||||
import org.cryptomator.common.Environment;
|
||||
import org.cryptomator.common.SemVerComparator;
|
||||
import org.cryptomator.common.settings.Settings;
|
||||
import org.cryptomator.notify.Event;
|
||||
import org.cryptomator.notify.UpdateEvent;
|
||||
import org.cryptomator.event.Event;
|
||||
import org.cryptomator.event.UpdateEvent;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
@@ -215,6 +215,26 @@
|
||||
-fx-background-color: CONTROL_BORDER_NORMAL, CONTROL_BG_ARMED;
|
||||
}
|
||||
|
||||
.event-window .button-bar .button-right {
|
||||
-fx-border-color: CONTROL_BORDER_NORMAL;
|
||||
-fx-border-width: 0 0 0 1px;
|
||||
-fx-background-color: MAIN_BG;
|
||||
-fx-background-radius: 0px;
|
||||
-fx-min-height: 42px;
|
||||
-fx-max-height: 42px;
|
||||
}
|
||||
|
||||
.event-window .button-bar .button-right:armed {
|
||||
-fx-background-color: CONTROL_BORDER_NORMAL, CONTROL_BG_ARMED;
|
||||
}
|
||||
|
||||
.event-window .button-bar {
|
||||
-fx-min-height:42px;
|
||||
-fx-max-height:42px;
|
||||
-fx-background-color: MAIN_BG;
|
||||
-fx-border-color: CONTROL_BORDER_NORMAL transparent transparent transparent;
|
||||
-fx-border-width: 1px 0 0 0;
|
||||
}
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* TabPane *
|
||||
|
||||
@@ -1,32 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import org.cryptomator.ui.controls.FontAwesome5IconView?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.Group?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.ListView?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.StackPane?>
|
||||
<?import javafx.scene.layout.Region?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.shape.Circle?>
|
||||
<HBox xmlns:fx="http://javafx.com/fxml"
|
||||
<VBox xmlns:fx="http://javafx.com/fxml"
|
||||
xmlns="http://javafx.com/javafx"
|
||||
fx:controller="org.cryptomator.ui.eventviewer.EventViewController"
|
||||
minWidth="450"
|
||||
minWidth="300"
|
||||
minHeight="450"
|
||||
prefWidth="450"
|
||||
prefWidth="300"
|
||||
prefHeight="450"
|
||||
spacing="12">
|
||||
<padding>
|
||||
<Insets topRightBottomLeft="24"/>
|
||||
</padding>
|
||||
<Group>
|
||||
<StackPane>
|
||||
<padding>
|
||||
<Insets topRightBottomLeft="6"/>
|
||||
</padding>
|
||||
<Circle styleClass="glyph-icon-primary" radius="24"/>
|
||||
<FontAwesome5IconView styleClass="glyph-icon-white" glyph="BELL" glyphSize="24"/>
|
||||
</StackPane>
|
||||
</Group>
|
||||
<VBox HBox.hgrow="ALWAYS">
|
||||
</VBox>
|
||||
</HBox>
|
||||
styleClass="event-window"
|
||||
>
|
||||
<HBox styleClass="button-bar">
|
||||
<Region HBox.hgrow="ALWAYS"/>
|
||||
<Button text="Clear" styleClass="button-right" onAction="#emptyEventList" />
|
||||
</HBox>
|
||||
<ListView fx:id="eventListView" fixedCellSize="60"/>
|
||||
</VBox>
|
||||
|
||||
12
src/main/resources/fxml/eventviewer_update.fxml
Normal file
12
src/main/resources/fxml/eventviewer_update.fxml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Text?>
|
||||
<VBox xmlns:fx="http://javafx.com/fxml"
|
||||
xmlns="http://javafx.com/javafx"
|
||||
fx:controller="org.cryptomator.ui.eventviewer.UpdateEventViewController"
|
||||
alignment="TOP_CENTER"
|
||||
spacing="9">
|
||||
|
||||
<Text>Update Available!</Text>
|
||||
</VBox>
|
||||
Reference in New Issue
Block a user