Add double click option

This commit is contained in:
crschnick 2024-06-18 20:23:40 +00:00
parent 20093becf3
commit 734fac9af6
7 changed files with 57 additions and 12 deletions

View file

@ -103,13 +103,25 @@ public abstract class StoreEntryComp extends SimpleComp {
});
});
button.addEventFilter(MouseEvent.MOUSE_CLICKED, event -> {
if (event.getClickCount() > 1) {
event.consume();
if (AppPrefs.get().requireDoubleClickForConnections().get()) {
if (event.getButton() == MouseButton.PRIMARY && event.getClickCount() != 2) {
event.consume();
}
} else {
if (event.getButton() == MouseButton.PRIMARY && event.getClickCount() > 1) {
event.consume();
}
}
});
button.addEventFilter(MouseEvent.MOUSE_PRESSED, event -> {
if (event.getClickCount() > 1) {
event.consume();
if (AppPrefs.get().requireDoubleClickForConnections().get()) {
if (event.getButton() == MouseButton.PRIMARY && event.getClickCount() != 2) {
event.consume();
}
} else {
if (event.getButton() == MouseButton.PRIMARY && event.getClickCount() > 1) {
event.consume();
}
}
});
new ContextMenuAugment<>(

View file

@ -112,6 +112,13 @@ public class AppPrefs {
final ObjectProperty<SupportedLocale> language =
map(new SimpleObjectProperty<>(SupportedLocale.getEnglish()), "language", SupportedLocale.class);
final BooleanProperty requireDoubleClickForConnections =
map(new SimpleBooleanProperty(false), "requireDoubleClickForConnections", Boolean.class);
public ObservableBooleanValue requireDoubleClickForConnections() {
return requireDoubleClickForConnections;
}
@Getter
private final Property<InPlaceSecretValue> lockPassword = new SimpleObjectProperty<>();
@ -165,6 +172,7 @@ public class AppPrefs {
new LocalShellCategory(),
new SecurityCategory(),
new HttpApiCategory(),
new WorkflowCategory(),
new TroubleshootCategory(),
new DeveloperCategory())
.filter(appPrefsCategory -> appPrefsCategory.show())

View file

@ -49,10 +49,6 @@ public class AppearanceCategory extends AppPrefsCategory {
.addToggle(prefs.condenseConnectionDisplay)
.nameAndDescription("showChildCategoriesInParentCategory")
.addToggle(prefs.showChildCategoriesInParentCategory))
.addTitle("workflow")
.sub(new OptionsBuilder()
.nameAndDescription("openConnectionSearchWindowOnConnectionCreation")
.addToggle(prefs.openConnectionSearchWindowOnConnectionCreation))
.addTitle("windowOptions")
.sub(new OptionsBuilder()
.nameAndDescription("windowOpacity")

View file

@ -0,0 +1,25 @@
package io.xpipe.app.prefs;
import io.xpipe.app.fxcomps.Comp;
import io.xpipe.app.util.OptionsBuilder;
public class WorkflowCategory extends AppPrefsCategory {
@Override
protected String getId() {
return "workflow";
}
@Override
protected Comp<?> create() {
var prefs = AppPrefs.get();
return new OptionsBuilder()
.addTitle("workflow")
.sub(new OptionsBuilder()
.nameAndDescription("openConnectionSearchWindowOnConnectionCreation")
.addToggle(prefs.openConnectionSearchWindowOnConnectionCreation)
.nameAndDescription("requireDoubleClickForConnections")
.addToggle(prefs.requireDoubleClickForConnections))
.buildComp();
}
}

View file

@ -417,7 +417,7 @@ public class DataStoreEntry extends StorageElement {
stateObj.set("persistentState", storePersistentStateNode);
obj.set("configuration", mapper.valueToTree(configuration));
stateObj.put("expanded", expanded);
stateObj.put("orderBefore", explicitOrder != null ? explicitOrder.toString() : null);
stateObj.set("order", mapper.valueToTree(explicitOrder));
var entryString = mapper.writeValueAsString(obj);
var stateString = mapper.writeValueAsString(stateObj);

View file

@ -7,6 +7,8 @@ The XPipe beacon component is responsible for handling all communications betwee
and the APIs and the CLI. It provides an API that supports all kinds
of different operations.
For a full documentation, see the [OpenAPI spec](/../openapi.yaml)
### Inner Workings
- The underlying communication is realized through an HTTP server on port `21721`
@ -17,14 +19,14 @@ of different operations.
- Every exchange is initiated from the outside by sending a request message to the XPipe daemon.
The daemon then always sends a response message.
- The body of a message is formatted in the json format.
- The body of a message is usually formatted in the json format.
As a result, all data structures exchanged must be serializable/deserializable with jackson.
## Configuration
#### Custom port
The default port can be changed by passing the property `io.xpipe.beacon.port=<port>` to the daemon or changing it in the settings menu.
The default port can be changed by passing the property `io.xpipe.beacon.port=<port>` to the daemon.
Note that if both sides do not have the same port setting, they won't be able to reach each other.
#### Custom launch command

View file

@ -476,4 +476,6 @@ isOnlySupportedLimit=is only supported with a professional license when having m
areOnlySupportedLimit=are only supported with a professional license when having more than $COUNT$ connections
enabled=Enabled
enableGitStoragePtbDisabled=Git synchronization is disabled for public test builds to prevent usage with regular release git repositories and to discourage using a PTB build as your daily driver.
copyId=Copy ID
copyId=Copy ID
requireDoubleClickForConnections=Require double click for connections
requireDoubleClickForConnectionsDescription=If enabled, you have to double-click connections to launch them. This is useful if you're used to double-clicking things.