refactor service.conf

This commit is contained in:
Robin Davies
2022-07-12 21:10:49 -04:00
parent 2133403f7e
commit fa9888914d
38 changed files with 1181 additions and 1733 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
{
"socket_server_port": 8080,
"socket_server_port": 80,
"socket_server_address": "*",
"debug": true,
"max_upload_size": 1048576,
"fakeAndroid": true,
"fakeAndroid": false,
"ui_plugins": []
}
+6 -1
View File
@@ -44,6 +44,7 @@ export class Port implements Deserializable<Port> {
this.supports_midi = input.supports_midi;
this.supports_time_position = input.supports_time_position;
this.port_group = input.port_group;
this.comment = input.comment;
return this;
}
@@ -73,6 +74,7 @@ export class Port implements Deserializable<Port> {
supports_midi: boolean = false;
supports_time_position: boolean = false;
port_group: string = "";
comment: string = "";
}
export class PortGroup {
@@ -221,8 +223,11 @@ export class UiControl implements Deserializable<UiControl> {
this.scale_points = ScalePoint.deserialize_array(input.scale_points);
this.port_group = input.port_group;
this.units = input.units as Units;
this.comment = input.comment;
this.controlType = ControlType.Dial;
if (this.enumeration_property && this.scale_points.length === 2)
{
this.controlType = ControlType.Toggle;
@@ -239,7 +244,6 @@ export class UiControl implements Deserializable<UiControl> {
{
this.controlType = ControlType.Select;
}
return this;
}
@@ -271,6 +275,7 @@ export class UiControl implements Deserializable<UiControl> {
scale_points: ScalePoint[] = [];
port_group: string = "";
units: Units = Units.none;
comment: string = "";
// Return the value of the closest scale_point.
clampSelectValue(value: number): number{
-1
View File
@@ -503,7 +503,6 @@ export const MainPage =
GetControlView(pedalBoardItem)
)
}
</div>
<MidiBindingsDialog open={this.state.showMidiBindingsDialog}
onClose={()=> this.setState({showMidiBindingsDialog: false} ) }
+5 -1
View File
@@ -2020,14 +2020,18 @@ class PiPedalModelImpl implements PiPedalModel {
let oldSettings = this.wifiDirectConfigSettings.get();
wifiDirectConfigSettings = wifiDirectConfigSettings.clone();
if ((!oldSettings.enable) && (!wifiDirectConfigSettings.enable)) {
if ((!oldSettings.enable) && (!wifiDirectConfigSettings.enable)
&& (oldSettings.hotspotName == wifiDirectConfigSettings.hotspotName)
) {
// no effective change.
resolve();
return;
}
if (!wifiDirectConfigSettings.enable) {
let t = wifiDirectConfigSettings.hotspotName; // hotspot name can be changed when disabled because it's also the mDNS service name.
wifiDirectConfigSettings = oldSettings.clone();
wifiDirectConfigSettings.enable = false;
wifiDirectConfigSettings.hotspotName = t;
} else {
if (wifiDirectConfigSettings.countryCode === oldSettings.countryCode
&& wifiDirectConfigSettings.channel === oldSettings.channel
+6 -1
View File
@@ -455,7 +455,12 @@ const PluginControlView =
{
nodes
}
<div style={{ flex: "0 0 40px", width: 40, height: 1 }} />
<div style={{ flex: "0 0 40px", width: 40, height: 40 }} />
{
(!this.state.landscapeGrid) && (
<div style={{ flex: "0 1 100%", width: "0px", height: 40 }} />
)
}
</div>
<FullScreenIME uiControl={this.state.imeUiControl} value={this.state.imeValue}
+70 -23
View File
@@ -134,22 +134,63 @@ function makeParagraphs(description: string) {
);
}
function makeControls(controls: UiControl[]) {
return (
<Grid container direction="row" justifyContent="flex-start" alignItems="flex-start" spacing={1} style={{ paddingLeft: "24px" }}>
{
controls.map((control) => (
<Grid xs={6} sm={4} key={control.symbol} >
<Typography variant="body2">
let hasComments = false;
for (let i = 0; i < controls.length; ++i) {
if (controls[i].comment !== "") {
hasComments = true;
break;
}
}
if (hasComments) {
let trs: React.ReactElement[] = [];
for (let i = 0; i < controls.length; ++i) {
let control = controls[i];
trs.push((
<tr>
<td style={{ verticalAlign: "top" }}>
<Typography variant="body2" style={{ whiteSpace: "nowrap" }}>
{control.name}
</Typography>
</Grid>
))
}
</Grid>
);
</td>
<td style={{ paddingLeft: "16px", verticalAlign: "top" }}>
<Typography variant="body2">
{control.comment}
</Typography>
</td>
</tr >
));
}
return (
<table style={{ paddingLeft: "24px", verticalAlign: "top" }}>
{
trs
}
</table>
);
} else {
return (
<Grid container direction="row" justifyContent="flex-start" alignItems="flex-start" spacing={1} style={{ paddingLeft: "24px" }}>
{
controls.map((control) => (
<Grid xs={6} sm={4} key={control.symbol + "x"} >
<Typography variant="body2">
{control.name}
</Typography>
</Grid>
))
}
</Grid>
);
}
}
const PluginInfoDialog = withStyles(styles)((props: PluginInfoProps) => {
let model = PiPedalModelFactory.getInstance();
@@ -205,19 +246,25 @@ const PluginInfoDialog = withStyles(styles)((props: PluginInfoProps) => {
</div>
</MuiDialogTitle>
<PluginInfoDialogContent dividers style={{ width: "100%", maxHeight: "80%", overflowX: "hidden" }}>
<Typography gutterBottom>
Author:&nbsp;
{(plugin.author_homepage !== "")
? <a href={plugin.author_homepage} target="_blank" rel="noreferrer">{plugin.author_name}</a>
: (
plugin.author_name
)
}
</Typography>
<Typography gutterBottom>
{ioDescription(plugin)}
</Typography>
<div style={{ width: "100%",display: "flex", flexFlow: "row", justifyItems: "stretch", flexWrap: "nowrap" }} >
<div style={{ flex: "1 1 100%" }}>
<Typography gutterBottom >
Author:&nbsp;
{(plugin.author_homepage !== "")
? <a href={plugin.author_homepage} target="_blank" rel="noreferrer">{plugin.author_name}</a>
: (
plugin.author_name
)
}
</Typography>
</div>
<div style={{ flex: "0 0 auto" }}>
<Typography gutterBottom >
{ioDescription(plugin)}
</Typography>
</div>
</div>
<Typography variant="body1" gutterBottom style={{ paddingTop: "1em" }}>
Controls:
</Typography>
+7
View File
@@ -38,7 +38,14 @@ export interface ControlEntry {
};
const Utility = class {
static isLandscape(): boolean {
return window.innerWidth > window.innerHeight;
}
static isTouchDevice(): boolean {
if (!this.isLandscape()) return false;
if (window.innerHeight > 500) return false;
return (('ontouchstart' in window) &&
((navigator.maxTouchPoints??0) > 0) );
}
+18 -17
View File
@@ -339,7 +339,7 @@ const WifiDirectConfigDialog = withStyles(styles, { withTheme: true })(
autoComplete="off"
id="name"
spellCheck="false"
label="SSID"
label="Service Name"
type="text"
size={this.state.controlSize}
fullWidth
@@ -348,11 +348,11 @@ const WifiDirectConfigDialog = withStyles(styles, { withTheme: true })(
value={this.state.name}
onChange={(e) => this.setState({ name: e.target.value, nameError: false, nameErrorMessage: NBSP })}
inputRef={this.refName}
disabled={!this.state.enabled}
variant="filled"
/>
<TextField
required
inputRef={this.refPassword}
sx={{ maxWidth: this.state.controlWidth }}
@@ -377,7 +377,7 @@ const WifiDirectConfigDialog = withStyles(styles, { withTheme: true })(
</div>
</div>
<div style={{ marginTop: 0, display: 'flex', alignItems: 'stretch', gap: 16 }}>
<TextField select label="Country" size={this.state.controlSize} value={this.state.countryCode} variant="filled"
<TextField required select label="Country" size={this.state.controlSize} value={this.state.countryCode} variant="filled"
sx={{ width: this.state.controlWidth }}
disabled={!this.state.enabled}
onChange={(event) => { this.handleCountryChanged(event); }}
@@ -413,17 +413,18 @@ const WifiDirectConfigDialog = withStyles(styles, { withTheme: true })(
)}
{(!this.state.landscapeLayout) && (
<DialogContent sx={{minHeight: 96}} >
<FormControlLabel
control={(
<Switch
checked={this.state.enabled}
onChange={(e: any) => this.handleEnableChanged(e)}
color="secondary"
/>
)}
label="Wi-Fi Direct Hotspot"
/>
<div style={{ marginTop: 16 }}>
<div>
<FormControlLabel
control={(
<Switch
checked={this.state.enabled}
onChange={(e: any) => this.handleEnableChanged(e)}
color="secondary"
/>
)}
label="Wi-Fi Direct Hotspot"
/>
</div><div style={{ marginTop: 16 }}>
<TextField
required
@@ -431,7 +432,7 @@ const WifiDirectConfigDialog = withStyles(styles, { withTheme: true })(
autoComplete="off"
id="name"
spellCheck="false"
label="SSID"
label="Service Name"
type="text"
size={this.state.controlSize}
fullWidth
@@ -440,10 +441,10 @@ const WifiDirectConfigDialog = withStyles(styles, { withTheme: true })(
value={this.state.name}
onChange={(e) => this.setState({ name: e.target.value, nameError: false, nameErrorMessage: NBSP })}
inputRef={this.refName}
disabled={!this.state.enabled}
variant="filled"
/>
</div><div>
</div>
<div>
<TextField
inputRef={this.refPassword}
sx={{ maxWidth: this.state.controlWidth }}