mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-21 23:20:23 +00:00
Cleanup
This commit is contained in:
parent
1ff39b2182
commit
2df431ae79
16 changed files with 77 additions and 102 deletions
|
@ -21,7 +21,9 @@ public class DaemonVersionExchangeImpl extends DaemonVersionExchange {
|
|||
var version = AppProperties.get().getVersion();
|
||||
return Response.builder()
|
||||
.version(version)
|
||||
.canonicalVersion(AppVersion.parse(version).map(appVersion -> appVersion.toString()).orElse("?"))
|
||||
.canonicalVersion(AppVersion.parse(version)
|
||||
.map(appVersion -> appVersion.toString())
|
||||
.orElse("?"))
|
||||
.buildVersion(AppProperties.get().getBuild())
|
||||
.jvmVersion(jvmVersion)
|
||||
.build();
|
||||
|
|
|
@ -11,6 +11,7 @@ import io.xpipe.app.fxcomps.augment.DragOverPseudoClassAugment;
|
|||
import io.xpipe.app.fxcomps.impl.*;
|
||||
import io.xpipe.app.fxcomps.util.DerivedObservableList;
|
||||
import io.xpipe.app.fxcomps.util.PlatformThread;
|
||||
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.geometry.Insets;
|
||||
|
@ -18,6 +19,7 @@ import javafx.scene.image.Image;
|
|||
import javafx.scene.input.Dragboard;
|
||||
import javafx.scene.input.TransferMode;
|
||||
import javafx.scene.layout.Region;
|
||||
|
||||
import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -89,7 +91,8 @@ public class BrowserTransferComp extends SimpleComp {
|
|||
})
|
||||
.hide(Bindings.isEmpty(syncItems));
|
||||
|
||||
var bottom = new HorizontalComp(List.of(dragNotice, Comp.hspacer(), downloadButton, Comp.hspacer(4), clearButton));
|
||||
var bottom =
|
||||
new HorizontalComp(List.of(dragNotice, Comp.hspacer(), downloadButton, Comp.hspacer(4), clearButton));
|
||||
var listBox = new VerticalComp(List.of(list, bottom))
|
||||
.spacing(5)
|
||||
.padding(new Insets(10, 10, 5, 10))
|
||||
|
|
|
@ -11,6 +11,7 @@ import io.xpipe.app.prefs.AppPrefs;
|
|||
import io.xpipe.app.util.Hyperlinks;
|
||||
import io.xpipe.app.util.MarkdownHelper;
|
||||
import io.xpipe.app.util.ShellTemp;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
|
@ -19,6 +20,7 @@ import javafx.scene.layout.StackPane;
|
|||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.web.WebEngine;
|
||||
import javafx.scene.web.WebView;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -146,16 +146,16 @@ public class SideMenuBarComp extends Comp<CompStructure<VBox>> {
|
|||
vbox.getChildren().add(b.createRegion());
|
||||
}
|
||||
|
||||
// {
|
||||
// var b = new IconButtonComp("mdi2t-translate", () -> Hyperlinks.open(Hyperlinks.TRANSLATE))
|
||||
// .tooltipKey("translate")
|
||||
// .apply(simpleBorders)
|
||||
// .accessibleTextKey("translate");
|
||||
// b.apply(struc -> {
|
||||
// AppFont.setSize(struc.get(), 2);
|
||||
// });
|
||||
// vbox.getChildren().add(b.createRegion());
|
||||
// }
|
||||
// {
|
||||
// var b = new IconButtonComp("mdi2t-translate", () -> Hyperlinks.open(Hyperlinks.TRANSLATE))
|
||||
// .tooltipKey("translate")
|
||||
// .apply(simpleBorders)
|
||||
// .accessibleTextKey("translate");
|
||||
// b.apply(struc -> {
|
||||
// AppFont.setSize(struc.get(), 2);
|
||||
// });
|
||||
// vbox.getChildren().add(b.createRegion());
|
||||
// }
|
||||
|
||||
{
|
||||
var b = new IconButtonComp(
|
||||
|
|
|
@ -371,7 +371,8 @@ public class StoreCreationComp extends DialogComp {
|
|||
if (staticDisplay) {
|
||||
struc.get().requestFocus();
|
||||
}
|
||||
}).createRegion();
|
||||
})
|
||||
.createRegion();
|
||||
}
|
||||
|
||||
private void commit(boolean validated) {
|
||||
|
|
|
@ -67,8 +67,12 @@ public class StoreNotesComp extends Comp<StoreNotesComp.Structure> {
|
|||
});
|
||||
n.addListener((observable, oldValue, s) -> {
|
||||
prop.set(s.getCurrent());
|
||||
// Check for scene existence. If we exited the platform immediately after adding notes, this might throw an exception
|
||||
if (s.getCurrent() != null && oldValue.getCommited() == null && oldValue.isCommited() && button.getScene() != null) {
|
||||
// Check for scene existence. If we exited the platform immediately after adding notes, this might throw an
|
||||
// exception
|
||||
if (s.getCurrent() != null
|
||||
&& oldValue.getCommited() == null
|
||||
&& oldValue.isCommited()
|
||||
&& button.getScene() != null) {
|
||||
Platform.runLater(() -> {
|
||||
popover.set(createPopover(popover, prop));
|
||||
popover.get().show(button);
|
||||
|
|
|
@ -55,8 +55,8 @@ public interface StoreSortMode {
|
|||
.isUsable())
|
||||
.map(this::representative),
|
||||
Stream.of(s))
|
||||
.max(Comparator.comparing(
|
||||
section -> section.getWrapper().getLastAccessApplied().getValue()))
|
||||
.max(Comparator.comparing(section ->
|
||||
section.getWrapper().getLastAccessApplied().getValue()))
|
||||
.orElseThrow();
|
||||
}
|
||||
|
||||
|
@ -83,8 +83,8 @@ public interface StoreSortMode {
|
|||
.isUsable())
|
||||
.map(this::representative),
|
||||
Stream.of(s))
|
||||
.max(Comparator.comparing(
|
||||
section -> section.getWrapper().getLastAccessApplied().getValue()))
|
||||
.max(Comparator.comparing(section ->
|
||||
section.getWrapper().getLastAccessApplied().getValue()))
|
||||
.orElseThrow();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
package io.xpipe.app.core.window;
|
||||
|
||||
public enum DmwaWindowAttribute {
|
||||
DWMWA_USE_IMMERSIVE_DARK_MODE(20),
|
||||
DWMWA_SYSTEMBACKDROP_TYPE(38);
|
||||
|
||||
private final int value;
|
||||
|
||||
DmwaWindowAttribute(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int get() {
|
||||
return value;
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
package io.xpipe.app.core.window;
|
||||
|
||||
public enum DwmSystemBackDropType {
|
||||
NONE(1),
|
||||
MICA(2),
|
||||
MICA_ALT(4),
|
||||
ACRYLIC(3);
|
||||
|
||||
private final int value;
|
||||
|
||||
DwmSystemBackDropType(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int get() {
|
||||
return value;
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package io.xpipe.app.core.window;
|
||||
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Dialog;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.Window;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
|
||||
public class ModifiedAlertStage {
|
||||
|
||||
@SneakyThrows
|
||||
public static void setForAlert(Alert alert) {
|
||||
var dialogClass = Dialog.class;
|
||||
var dialogField = dialogClass.getDeclaredField("dialog");
|
||||
dialogField.setAccessible(true);
|
||||
var dialog = (Dialog<?>) dialogField.get(alert);
|
||||
|
||||
var c = Class.forName("javafx.scene.control.HeavyweightDialog");
|
||||
var positionStageMethod = c.getDeclaredMethod("positionStage");
|
||||
positionStageMethod.setAccessible(true);
|
||||
|
||||
var stageField = c.getDeclaredField("stage");
|
||||
stageField.setAccessible(true);
|
||||
|
||||
var m = new Stage() {
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public void centerOnScreen() {
|
||||
Window owner = getOwner();
|
||||
if (owner != null) {
|
||||
positionStageMethod.invoke(dialog);
|
||||
} else {
|
||||
if (getWidth() > 0 && getHeight() > 0) {
|
||||
super.centerOnScreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
stageField.set(alert, m);
|
||||
}
|
||||
}
|
|
@ -58,13 +58,13 @@ public class ModifiedStage extends Stage {
|
|||
|
||||
var ctrl = new NativeWinWindowControl(stage);
|
||||
ctrl.setWindowAttribute(
|
||||
DmwaWindowAttribute.DWMWA_USE_IMMERSIVE_DARK_MODE.get(),
|
||||
NativeWinWindowControl.DmwaWindowAttribute.DWMWA_USE_IMMERSIVE_DARK_MODE.get(),
|
||||
AppPrefs.get().theme.getValue().isDark());
|
||||
boolean backdrop;
|
||||
if (AppPrefs.get().performanceMode().get()) {
|
||||
backdrop = false;
|
||||
} else {
|
||||
backdrop = ctrl.setWindowBackdrop(DwmSystemBackDropType.MICA_ALT);
|
||||
backdrop = ctrl.setWindowBackdrop(NativeWinWindowControl.DwmSystemBackDropType.MICA_ALT);
|
||||
}
|
||||
stage.getScene().getRoot().pseudoClassStateChanged(PseudoClass.getPseudoClass("seamless-frame"), backdrop);
|
||||
stage.getScene().getRoot().pseudoClassStateChanged(PseudoClass.getPseudoClass("separate-frame"), !backdrop);
|
||||
|
|
|
@ -3,6 +3,7 @@ package io.xpipe.app.core.window;
|
|||
import javafx.stage.Window;
|
||||
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.PointerType;
|
||||
import com.sun.jna.platform.win32.User32;
|
||||
|
@ -58,9 +59,41 @@ public class NativeWinWindowControl {
|
|||
|
||||
public interface Dwm extends Library {
|
||||
|
||||
Dwm INSTANCE = com.sun.jna.Native.load("dwmapi", Dwm.class);
|
||||
Dwm INSTANCE = Native.load("dwmapi", Dwm.class);
|
||||
|
||||
WinNT.HRESULT DwmSetWindowAttribute(
|
||||
WinDef.HWND hwnd, int dwAttribute, PointerType pvAttribute, int cbAttribute);
|
||||
}
|
||||
|
||||
public enum DmwaWindowAttribute {
|
||||
DWMWA_USE_IMMERSIVE_DARK_MODE(20),
|
||||
DWMWA_SYSTEMBACKDROP_TYPE(38);
|
||||
|
||||
private final int value;
|
||||
|
||||
DmwaWindowAttribute(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int get() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
public enum DwmSystemBackDropType {
|
||||
NONE(1),
|
||||
MICA(2),
|
||||
MICA_ALT(4),
|
||||
ACRYLIC(3);
|
||||
|
||||
private final int value;
|
||||
|
||||
DwmSystemBackDropType(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int get() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package io.xpipe.app.fxcomps.impl;
|
|||
import io.xpipe.app.fxcomps.Comp;
|
||||
import io.xpipe.app.fxcomps.CompStructure;
|
||||
import io.xpipe.app.fxcomps.SimpleCompStructure;
|
||||
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.scene.control.ScrollBar;
|
||||
import javafx.scene.control.ScrollPane;
|
||||
|
@ -13,7 +14,9 @@ public class ScrollComp extends Comp<CompStructure<ScrollPane>> {
|
|||
|
||||
private final Comp<?> content;
|
||||
|
||||
public ScrollComp(Comp<?> content) {this.content = content;}
|
||||
public ScrollComp(Comp<?> content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompStructure<ScrollPane> createBase() {
|
||||
|
|
|
@ -2,6 +2,7 @@ package io.xpipe.app.fxcomps.impl;
|
|||
|
||||
import io.xpipe.app.comp.store.StoreCategoryWrapper;
|
||||
import io.xpipe.app.fxcomps.SimpleComp;
|
||||
|
||||
import javafx.scene.layout.Region;
|
||||
|
||||
public class StoreCategoryListComp extends SimpleComp {
|
||||
|
|
|
@ -4,6 +4,7 @@ import io.xpipe.app.fxcomps.Comp;
|
|||
import io.xpipe.app.fxcomps.CompStructure;
|
||||
import io.xpipe.app.fxcomps.SimpleCompStructure;
|
||||
import io.xpipe.app.fxcomps.util.PlatformThread;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.collections.ObservableList;
|
||||
|
|
|
@ -17,6 +17,7 @@ import io.xpipe.beacon.api.DaemonOpenExchange;
|
|||
import io.xpipe.core.process.OsType;
|
||||
import io.xpipe.core.util.XPipeDaemonMode;
|
||||
import io.xpipe.core.util.XPipeInstallation;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
import picocli.CommandLine;
|
||||
|
||||
|
@ -117,8 +118,9 @@ public class LauncherCommand implements Callable<Integer> {
|
|||
// there might be another instance running, for example
|
||||
// starting up or listening on another port
|
||||
if (!AppDataLock.lock()) {
|
||||
TrackEvent.info("Data directory " + AppProperties.get().getDataDir().toString()
|
||||
+ " is already locked. Is another instance running?");
|
||||
TrackEvent.info(
|
||||
"Data directory " + AppProperties.get().getDataDir().toString()
|
||||
+ " is already locked. Is another instance running?");
|
||||
OperationMode.halt(1);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
|
|
Loading…
Reference in a new issue