- removed config panel : settings is handle via command switches
- widget's 'target' parameter is parsed as an array directly - closured sendOsc function
This commit is contained in:
parent
0f1507ada5
commit
44dd1ed08e
6 changed files with 96 additions and 169 deletions
|
|
@ -1,7 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>OSCGUI</title>
|
||||
<link rel="stylesheet" href="fonts/font-awesome.min.css"/>
|
||||
<link rel="stylesheet" href="css/style.css"/>
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -121,11 +121,6 @@ init = function(session,callback) {
|
|||
click:function(){ipc.send('fullscreen')},
|
||||
icon:'tv'
|
||||
},
|
||||
{
|
||||
label:'Preferences',
|
||||
icon:'gears',
|
||||
click:configPanel
|
||||
},
|
||||
{
|
||||
html:'<div class="inspector btn">\
|
||||
Inspector\
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ parsewidgets = function(widgets,parent) {
|
|||
style= widgetData.width?`width:${width*100}rem;min-width:${width*100}rem`:''
|
||||
|
||||
widgetData.path = path
|
||||
widgetData.target = widgetData.target?(Array.isArray(widgetData.target)?widgetData.target:[widgetData.target]):false
|
||||
|
||||
var widgetContainer = $(`
|
||||
<div class="widget ${type}-container" widgetType="${type}" widgetId="${id}" path="${path}" style="${style}">
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
sendOsc = function(data){
|
||||
// Unpack args for osc sending function
|
||||
if (data[0]) {
|
||||
ipc.send('sendOsc', {target:data[0],path:data[1],args:data[2]})
|
||||
}
|
||||
ipc.send('sendOsc', {target:data[0],path:data[1],args:data[2]})
|
||||
}
|
||||
|
||||
saveState = function () {
|
||||
|
|
@ -146,74 +144,6 @@ createPopup = function(title,content) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var remote = require('remote')
|
||||
configPanel = function(){
|
||||
var readEditableConfig = remote.getGlobal('readEditableConfig')
|
||||
var writeConfig = remote.getGlobal('writeConfig')
|
||||
var config = readEditableConfig()
|
||||
|
||||
var form = $('<form></form>')
|
||||
|
||||
|
||||
$.each(config,function(i) {
|
||||
var item = $(`
|
||||
<div>
|
||||
<label for="${i}">${i}</label>
|
||||
<p class="info">${config[i].info}</p>
|
||||
</div>
|
||||
`)
|
||||
|
||||
|
||||
var input = $(`<input name="${i}" value="${config[i].value}"/>`)
|
||||
|
||||
input.change(function(){
|
||||
var v = input.val().trim().replace(/[\s]+/,' ')
|
||||
input.val(v)
|
||||
console.log([v,v.match(config[i].match)])
|
||||
if (v.match(config[i].match)==null) {
|
||||
input.addClass('invalid')
|
||||
} else {
|
||||
input.removeClass('invalid')
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
item.append(input)
|
||||
|
||||
form.append(item)
|
||||
|
||||
})
|
||||
|
||||
var submit = $(`<a class="btn submit">${icon('save')} Save</a>`)
|
||||
|
||||
form.append(submit)
|
||||
|
||||
popup = createPopup(icon('gear')+' Preferences',form)
|
||||
|
||||
submit.click(function(e){
|
||||
e.preventDefault()
|
||||
|
||||
if ($('input.invalid').length>0) {
|
||||
return
|
||||
}
|
||||
|
||||
var data = form.serializeArray(),
|
||||
newconfig = {}
|
||||
|
||||
for (i in data) {
|
||||
newconfig[data[i].name] = data[i].value
|
||||
}
|
||||
|
||||
writeConfig(newconfig)
|
||||
|
||||
popup.close()
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
hsbToRgb = function (hsb) {
|
||||
var rgb = {}
|
||||
var h = hsb.h
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue