mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-09-30 00:56:56 +13:00
Add setting to debug local shell
This commit is contained in:
parent
e8566ea137
commit
af8904ea7a
3 changed files with 93 additions and 32 deletions
|
@ -231,35 +231,35 @@ public class AppPrefs {
|
|||
.editable(System.getProperty(DEVELOPER_MODE_PROP) == null)
|
||||
.render(() -> new CustomToggleControl());
|
||||
|
||||
private final BooleanProperty developerDisableUpdateVersionCheck =
|
||||
final BooleanProperty developerDisableUpdateVersionCheck =
|
||||
typed(new SimpleBooleanProperty(false), Boolean.class);
|
||||
private final BooleanField developerDisableUpdateVersionCheckField =
|
||||
final BooleanField developerDisableUpdateVersionCheckField =
|
||||
BooleanField.ofBooleanType(developerDisableUpdateVersionCheck).render(() -> new CustomToggleControl());
|
||||
private final ObservableBooleanValue developerDisableUpdateVersionCheckEffective =
|
||||
bindDeveloperTrue(developerDisableUpdateVersionCheck);
|
||||
|
||||
private final BooleanProperty developerDisableGuiRestrictions =
|
||||
final BooleanProperty developerDisableGuiRestrictions =
|
||||
typed(new SimpleBooleanProperty(false), Boolean.class);
|
||||
private final BooleanField developerDisableGuiRestrictionsField =
|
||||
final BooleanField developerDisableGuiRestrictionsField =
|
||||
BooleanField.ofBooleanType(developerDisableGuiRestrictions).render(() -> new CustomToggleControl());
|
||||
private final ObservableBooleanValue developerDisableGuiRestrictionsEffective =
|
||||
bindDeveloperTrue(developerDisableGuiRestrictions);
|
||||
|
||||
private final BooleanProperty developerShowHiddenProviders = typed(new SimpleBooleanProperty(false), Boolean.class);
|
||||
private final BooleanField developerShowHiddenProvidersField =
|
||||
final BooleanProperty developerShowHiddenProviders = typed(new SimpleBooleanProperty(false), Boolean.class);
|
||||
final BooleanField developerShowHiddenProvidersField =
|
||||
BooleanField.ofBooleanType(developerShowHiddenProviders).render(() -> new CustomToggleControl());
|
||||
private final ObservableBooleanValue developerShowHiddenProvidersEffective =
|
||||
bindDeveloperTrue(developerShowHiddenProviders);
|
||||
|
||||
private final BooleanProperty developerShowHiddenEntries = typed(new SimpleBooleanProperty(false), Boolean.class);
|
||||
private final BooleanField developerShowHiddenEntriesField =
|
||||
final BooleanProperty developerShowHiddenEntries = typed(new SimpleBooleanProperty(false), Boolean.class);
|
||||
final BooleanField developerShowHiddenEntriesField =
|
||||
BooleanField.ofBooleanType(developerShowHiddenEntries).render(() -> new CustomToggleControl());
|
||||
private final ObservableBooleanValue developerShowHiddenEntriesEffective =
|
||||
bindDeveloperTrue(developerShowHiddenEntries);
|
||||
|
||||
private final BooleanProperty developerDisableConnectorInstallationVersionCheck =
|
||||
final BooleanProperty developerDisableConnectorInstallationVersionCheck =
|
||||
typed(new SimpleBooleanProperty(false), Boolean.class);
|
||||
private final BooleanField developerDisableConnectorInstallationVersionCheckField = BooleanField.ofBooleanType(
|
||||
final BooleanField developerDisableConnectorInstallationVersionCheckField = BooleanField.ofBooleanType(
|
||||
developerDisableConnectorInstallationVersionCheck)
|
||||
.render(() -> new CustomToggleControl());
|
||||
private final ObservableBooleanValue developerDisableConnectorInstallationVersionCheckEffective =
|
||||
|
@ -627,28 +627,7 @@ public class AppPrefs {
|
|||
.applyVisibility(VisibilityProperty.of(
|
||||
terminalType.isEqualTo(ExternalTerminalType.CUSTOM))),
|
||||
Setting.of("preferTerminalTabs", preferTerminalTabsField, preferTerminalTabs))),
|
||||
Category.of(
|
||||
"developer",
|
||||
Setting.of(
|
||||
"developerDisableUpdateVersionCheck",
|
||||
developerDisableUpdateVersionCheckField,
|
||||
developerDisableUpdateVersionCheck),
|
||||
Setting.of(
|
||||
"developerDisableGuiRestrictions",
|
||||
developerDisableGuiRestrictionsField,
|
||||
developerDisableGuiRestrictions),
|
||||
Setting.of(
|
||||
"developerDisableConnectorInstallationVersionCheck",
|
||||
developerDisableConnectorInstallationVersionCheckField,
|
||||
developerDisableConnectorInstallationVersionCheck),
|
||||
Setting.of(
|
||||
"developerShowHiddenEntries",
|
||||
developerShowHiddenEntriesField,
|
||||
developerShowHiddenEntries),
|
||||
Setting.of(
|
||||
"developerShowHiddenProviders",
|
||||
developerShowHiddenProvidersField,
|
||||
developerShowHiddenProviders)),
|
||||
new DeveloperCategory(this).create(),
|
||||
Category.of("troubleshoot", Group.of(troubleshoot))));
|
||||
|
||||
categories.get(categories.size() - 2).setVisibilityProperty(VisibilityProperty.of(developerMode()));
|
||||
|
|
81
app/src/main/java/io/xpipe/app/prefs/DeveloperCategory.java
Normal file
81
app/src/main/java/io/xpipe/app/prefs/DeveloperCategory.java
Normal file
|
@ -0,0 +1,81 @@
|
|||
package io.xpipe.app.prefs;
|
||||
|
||||
import atlantafx.base.theme.Styles;
|
||||
import com.dlsc.preferencesfx.model.Category;
|
||||
import com.dlsc.preferencesfx.model.Group;
|
||||
import com.dlsc.preferencesfx.model.Setting;
|
||||
import io.xpipe.app.comp.base.ButtonComp;
|
||||
import io.xpipe.app.fxcomps.impl.HorizontalComp;
|
||||
import io.xpipe.app.fxcomps.impl.TextFieldComp;
|
||||
import io.xpipe.app.util.LocalShell;
|
||||
import io.xpipe.app.util.ThreadHelper;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import lombok.SneakyThrows;
|
||||
import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DeveloperCategory extends AppPrefsCategory {
|
||||
|
||||
public DeveloperCategory(AppPrefs prefs) {
|
||||
super(prefs);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public Category create() {
|
||||
var localCommand = new SimpleStringProperty();
|
||||
Runnable test = () -> {
|
||||
prefs.save();
|
||||
var cmd = localCommand.get();
|
||||
if (cmd == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ThreadHelper.runFailableAsync(() -> {
|
||||
LocalShell.getShell().executeSimpleStringCommandAndCheck(cmd);
|
||||
});
|
||||
};
|
||||
|
||||
var runLocalCommand = lazyNode(
|
||||
"shellCommandTest",
|
||||
new HorizontalComp(List.of(
|
||||
new TextFieldComp(localCommand)
|
||||
.apply(struc -> struc.get().setPromptText("Local command"))
|
||||
.styleClass(Styles.LEFT_PILL)
|
||||
.grow(false, true),
|
||||
new ButtonComp(null, new FontIcon("mdi2p-play"), test)
|
||||
.styleClass(Styles.RIGHT_PILL)
|
||||
.grow(false, true)))
|
||||
.padding(new Insets(15, 0, 0, 0))
|
||||
.apply(struc -> struc.get().setAlignment(Pos.CENTER_LEFT))
|
||||
.apply(struc -> struc.get().setFillHeight(true)),
|
||||
null);
|
||||
return Category.of(
|
||||
"developer", Group.of(
|
||||
Setting.of(
|
||||
"developerDisableUpdateVersionCheck",
|
||||
prefs.developerDisableUpdateVersionCheckField,
|
||||
prefs.developerDisableUpdateVersionCheck),
|
||||
Setting.of(
|
||||
"developerDisableGuiRestrictions",
|
||||
prefs.developerDisableGuiRestrictionsField,
|
||||
prefs.developerDisableGuiRestrictions),
|
||||
Setting.of(
|
||||
"developerDisableConnectorInstallationVersionCheck",
|
||||
prefs.developerDisableConnectorInstallationVersionCheckField,
|
||||
prefs.developerDisableConnectorInstallationVersionCheck),
|
||||
Setting.of(
|
||||
"developerShowHiddenEntries",
|
||||
prefs.developerShowHiddenEntriesField,
|
||||
prefs.developerShowHiddenEntries),
|
||||
Setting.of(
|
||||
"developerShowHiddenProviders",
|
||||
prefs.developerShowHiddenProvidersField,
|
||||
prefs.developerShowHiddenProviders)),
|
||||
Group.of("shellCommandTest",
|
||||
runLocalCommand)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -108,6 +108,7 @@ developerShowHiddenProviders=Show hidden providers
|
|||
developerShowHiddenProvidersDescription=Controls whether hidden and internal connection and data source providers will be shown in the creation dialog.
|
||||
developerDisableConnectorInstallationVersionCheck=Disable Connector Version Check
|
||||
developerDisableConnectorInstallationVersionCheckDescription=Controls whether the update checker will ignore the version number when inspecting the version of an XPipe connector installed on a remote machine.
|
||||
shellCommandTest=Shell Command Test
|
||||
konsole=Konsole
|
||||
xfce=Xfce 4
|
||||
elementaryTerminal=Elementary Terminal
|
||||
|
|
Loading…
Reference in a new issue