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,14 +103,26 @@ public abstract class StoreEntryComp extends SimpleComp {
}); });
}); });
button.addEventFilter(MouseEvent.MOUSE_CLICKED, event -> { button.addEventFilter(MouseEvent.MOUSE_CLICKED, event -> {
if (event.getClickCount() > 1) { if (AppPrefs.get().requireDoubleClickForConnections().get()) {
if (event.getButton() == MouseButton.PRIMARY && event.getClickCount() != 2) {
event.consume(); event.consume();
} }
} else {
if (event.getButton() == MouseButton.PRIMARY && event.getClickCount() > 1) {
event.consume();
}
}
}); });
button.addEventFilter(MouseEvent.MOUSE_PRESSED, event -> { button.addEventFilter(MouseEvent.MOUSE_PRESSED, event -> {
if (event.getClickCount() > 1) { if (AppPrefs.get().requireDoubleClickForConnections().get()) {
if (event.getButton() == MouseButton.PRIMARY && event.getClickCount() != 2) {
event.consume(); event.consume();
} }
} else {
if (event.getButton() == MouseButton.PRIMARY && event.getClickCount() > 1) {
event.consume();
}
}
}); });
new ContextMenuAugment<>( new ContextMenuAugment<>(
mouseEvent -> mouseEvent.getButton() == MouseButton.SECONDARY, mouseEvent -> mouseEvent.getButton() == MouseButton.SECONDARY,

View file

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

View file

@ -49,10 +49,6 @@ public class AppearanceCategory extends AppPrefsCategory {
.addToggle(prefs.condenseConnectionDisplay) .addToggle(prefs.condenseConnectionDisplay)
.nameAndDescription("showChildCategoriesInParentCategory") .nameAndDescription("showChildCategoriesInParentCategory")
.addToggle(prefs.showChildCategoriesInParentCategory)) .addToggle(prefs.showChildCategoriesInParentCategory))
.addTitle("workflow")
.sub(new OptionsBuilder()
.nameAndDescription("openConnectionSearchWindowOnConnectionCreation")
.addToggle(prefs.openConnectionSearchWindowOnConnectionCreation))
.addTitle("windowOptions") .addTitle("windowOptions")
.sub(new OptionsBuilder() .sub(new OptionsBuilder()
.nameAndDescription("windowOpacity") .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); stateObj.set("persistentState", storePersistentStateNode);
obj.set("configuration", mapper.valueToTree(configuration)); obj.set("configuration", mapper.valueToTree(configuration));
stateObj.put("expanded", expanded); stateObj.put("expanded", expanded);
stateObj.put("orderBefore", explicitOrder != null ? explicitOrder.toString() : null); stateObj.set("order", mapper.valueToTree(explicitOrder));
var entryString = mapper.writeValueAsString(obj); var entryString = mapper.writeValueAsString(obj);
var stateString = mapper.writeValueAsString(stateObj); 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 and the APIs and the CLI. It provides an API that supports all kinds
of different operations. of different operations.
For a full documentation, see the [OpenAPI spec](/../openapi.yaml)
### Inner Workings ### Inner Workings
- The underlying communication is realized through an HTTP server on port `21721` - 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. - 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 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. As a result, all data structures exchanged must be serializable/deserializable with jackson.
## Configuration ## Configuration
#### Custom port #### 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. Note that if both sides do not have the same port setting, they won't be able to reach each other.
#### Custom launch command #### Custom launch command

View file

@ -477,3 +477,5 @@ areOnlySupportedLimit=are only supported with a professional license when having
enabled=Enabled 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. 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.