- [线][波浪]样式新增"径向渐变"选项
- 修复挂件在启动器与桌面切换时的闪烁问题 - 优化渐变样式性能
This commit is contained in:
parent
beffc3a791
commit
95fdef825d
BIN
Locales/ja.qm
BIN
Locales/ja.qm
Binary file not shown.
BIN
Locales/zh.qm
BIN
Locales/zh.qm
Binary file not shown.
BIN
Locales/zh_TW.qm
BIN
Locales/zh_TW.qm
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map>
|
||||
<value name="current_style">"nvg://advp.widget.mashiros.top/advp-style-preset/circle"</value>
|
||||
<value name="nvg://advp.widget.mashiros.top/advp-style-preset/circle">{"Gradient Style":0,"Radial Gradient Settings":{"Inside Position Color":"#f44336","Middle Position Color":"#4caf50","Outside Position Color":"#03a9f4","Inside Position":40,"Middle Position":60,"Outside Position":80},"Conical Gradient Settings":{"Start Position Color":"#f44336","Quarter Position Color":"#4caf50","Middle Position Color":"#03a9f4","End Position Color":"#ffeb3b"},"Main Color":"#ff4500","Line Position":0,"Line Width":1,"Max Range":80,"Data Length":0,"Channel":2,"Reverse":false,"Rotate":false,"Ratate Speed":10,"Angle":0,"Data Settings":{"Auto Normalizing":true,"Amplitude":10,"Unit Style":0}}</value>
|
||||
<value name="nvg://advp.widget.mashiros.top/advp-style-preset/circle">{"Gradient Style":0,"Radial Gradient Settings":{"Inside Position Color":"#f44336","Middle Position Color":"#4caf50","Outside Position Color":"#03a9f4","Inside Position":40,"Middle Position":60,"Outside Position":80},"Conical Gradient Settings":{"Start Position Color":"#f44336","Quarter Position Color":"#4caf50","Middle Position Color":"#03a9f4","End Position Color":"#ffeb3b"},"Main Color":"#ff4500","Line Position":0,"Line Width":1,"Max Range":80,"Data Length":0,"Channel":2,"Reverse":false,"Rotate":false,"Rotation Direction":0,"Ratate Speed":10,"Angle":0,"Data Settings":{"Auto Normalizing":true,"Amplitude":10,"Unit Style":0}}</value>
|
||||
</map>
|
||||
4
Presets/Gradient_Line/preset.json
Normal file
4
Presets/Gradient_Line/preset.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"source": "nvg://advp.widget.mashiros.top/widget",
|
||||
"settings": "settings.xml"
|
||||
}
|
||||
BIN
Presets/Gradient_Line/preview.png
Normal file
BIN
Presets/Gradient_Line/preview.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
5
Presets/Gradient_Line/settings.xml
Normal file
5
Presets/Gradient_Line/settings.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map>
|
||||
<value name="current_style">"nvg://advp.widget.mashiros.top/advp-style-preset/line"</value>
|
||||
<value name="nvg://advp.widget.mashiros.top/advp-style-preset/line">{"Gradient Style":1,"Linear Gradient Settings":{"Gradient Direction":0,"Start Position Color":"#f44336","Middle Position Color":"#4caf50","End Position Color":"#03a9f4"},"Radial Gradient Settings":{"Inside Position Color":"#f44336","Middle Position Color":"#4caf50","Outside Position Color":"#03a9f4","Inside Position":0,"Middle Position":50,"Outside Position":100,"Center X Offset":0,"Center Y Offset":0},"Center Line":true,"Center Color":"#ff4500","Center Width":20,"Direction":0,"Line Color":"#ff4500","Line Position":0,"Data Length":0,"Channel":2,"Rotate Settings":{"Center Enable":false,"Center Angle":10,"Line Enable":false,"Line Angle":10,"X Scale":100,"Y Scale":100,"X Offset":0,"Y Offset":0},"Data Settings":{"Auto Normalizing":true,"Amplitude":10,"Unit Style":0}}</value>
|
||||
</map>
|
||||
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map>
|
||||
<value name="nvg://advp.widget.mashiros.top/advp-style-preset/line">{"Enable Gradient":false,"Gradient Direction":0,"Start Position Color":"#f44336","Middle Position Color":"#4caf50","End Position Color":"#03a9f4","Center Line":true,"Center Color":"#ff4500","Center Width":20,"Line Color":"#ff4500","Line Position":0,"Data Length":0,"Channel":2,"Direction":0,"Rotate Settings":{"Center Enable":false,"Center Angle":10,"Line Enable":false,"Line Angle":10,"X Scale":100,"Y Scale":100,"X Offset":0,"Y Offset":0},"Data Settings":{"Auto Normalizing":true,"Amplitude":10,"Unit Style":0}}</value>
|
||||
<value name="nvg://advp.widget.mashiros.top/advp-style-preset/line">{"Gradient Style":0,"Linear Gradient Settings":{"Gradient Direction":0,"Start Position Color":"#f44336","Middle Position Color":"#4caf50","End Position Color":"#03a9f4"},"Radial Gradient Settings":{"Inside Position Color":"#f44336","Middle Position Color":"#4caf50","Outside Position Color":"#03a9f4","Inside Position":0,"Middle Position":50,"Outside Position":100,"Center X Offset":0,"Center Y Offset":0},"Center Line":true,"Center Color":"#ff4500","Center Width":20,"Direction":0,"Line Color":"#ff4500","Line Position":0,"Data Length":0,"Channel":2,"Rotate Settings":{"Center Enable":false,"Center Angle":10,"Line Enable":false,"Line Angle":10,"X Scale":100,"Y Scale":100,"X Offset":0,"Y Offset":0},"Data Settings":{"Auto Normalizing":true,"Amplitude":10,"Unit Style":0}}</value>
|
||||
<value name="current_style">"nvg://advp.widget.mashiros.top/advp-style-preset/line"</value>
|
||||
</map>
|
||||
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map>
|
||||
<value name="current_style">"nvg://advp.widget.mashiros.top/advp-style-preset/solidcircle"</value>
|
||||
<value name="nvg://advp.widget.mashiros.top/advp-style-preset/solidcircle">{"Gradient Style":0,"Radial Gradient Settings":{"Inside Position Color":"#f44336","Middle Position Color":"#4caf50","Outside Position Color":"#03a9f4","Inside Position":40,"Middle Position":60,"Outside Position":80},"Conical Gradient Settings":{"Start Position Color":"#f44336","Quarter Position Color":"#4caf50","Middle Position Color":"#03a9f4","End Position Color":"#ffeb3b"},"Main Color":"#ff4500","Line Position":0,"Line Width":1,"Max Range":80,"Data Length":0,"Channel":2,"Reverse":false,"Rotate":false,"Ratate Speed":10,"Angle":0,"Data Settings":{"Auto Normalizing":true,"Amplitude":10,"Unit Style":0}}</value>
|
||||
<value name="nvg://advp.widget.mashiros.top/advp-style-preset/solidcircle">{"Gradient Style":0,"Radial Gradient Settings":{"Inside Position Color":"#f44336","Middle Position Color":"#4caf50","Outside Position Color":"#03a9f4","Inside Position":40,"Middle Position":60,"Outside Position":80},"Conical Gradient Settings":{"Start Position Color":"#f44336","Quarter Position Color":"#4caf50","Middle Position Color":"#03a9f4","End Position Color":"#ffeb3b"},"Main Color":"#ff4500","Line Position":0,"Line Width":1,"Max Range":80,"Data Length":0,"Channel":2,"Reverse":false,"Rotate":false,"Rotation Direction":0,"Ratate Speed":10,"Angle":0,"Data Settings":{"Auto Normalizing":true,"Amplitude":10,"Unit Style":0}}</value>
|
||||
</map>
|
||||
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map>
|
||||
<value name="current_style">"nvg://advp.widget.mashiros.top/advp-style-preset/waves"</value>
|
||||
<value name="nvg://advp.widget.mashiros.top/advp-style-preset/waves">{"Enable Gradient":false,"Gradient Direction":0,"Start Position Color":"#f44336","Middle Position Color":"#4caf50","End Position Color":"#03a9f4","Direction":0,"Line Color":"#ff4500","Line Width":1,"Data Length":0,"Rotate Settings":{"Center Enable":false,"Center Angle":10,"Line Enable":false,"Line Angle":10,"X Scale":100,"Y Scale":100,"X Offset":0,"Y Offset":0},"Data Settings":{"Auto Normalizing":true,"Amplitude":10,"Unit Style":0}}</value>
|
||||
<value name="nvg://advp.widget.mashiros.top/advp-style-preset/waves">{"Gradient Style":0,"Linear Gradient Settings":{"Gradient Direction":0,"Start Position Color":"#f44336","Middle Position Color":"#4caf50","End Position Color":"#03a9f4"},"Radial Gradient Settings":{"Inside Position Color":"#f44336","Middle Position Color":"#4caf50","Outside Position Color":"#03a9f4","Inside Position":0,"Middle Position":50,"Outside Position":100,"Center X Offset":0,"Center Y Offset":0},"Direction":0,"Line Color":"#ff4500","Line Width":1,"Data Length":0,"Rotate Settings":{"Center Enable":false,"Center Angle":10,"Line Enable":false,"Line Angle":10,"X Scale":100,"Y Scale":100,"X Offset":0,"Y Offset":0},"Data Settings":{"Auto Normalizing":true,"Amplitude":10,"Unit Style":0}}</value>
|
||||
</map>
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "top.mashiros.widget.advp",
|
||||
"version": "1.4.0",
|
||||
"version": "1.4.1",
|
||||
|
||||
"title": {
|
||||
"en": "ADV Plugin",
|
||||
|
||||
@ -179,8 +179,10 @@ Item {
|
||||
if (force || !debug && wsocket.active && rebootFlag) {
|
||||
console.log("Try to reboot ADVServer...");
|
||||
execute(serverEXE, "-reboot");
|
||||
wsocket.active = false;
|
||||
wsocket.active = true;
|
||||
if (widgetsNum) {
|
||||
wsocket.active = false;
|
||||
wsocket.active = true;
|
||||
}
|
||||
rebootFlag = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ Canvas {
|
||||
return Common.updateObject(Common.deepClone(target), Common.deepClone(source));
|
||||
}
|
||||
|
||||
onVersionUpdated: {
|
||||
function updateConfiguration() {
|
||||
delete widget.settings[widget.settings.current_style]["Version"];
|
||||
widget.settings[widget.settings.current_style] = updateObject(defaultValues, widget.settings[widget.settings.current_style]);
|
||||
}
|
||||
|
||||
@ -115,6 +115,10 @@ AdvpStyleTemplate {
|
||||
audioData[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
onVersionUpdated: {
|
||||
updateConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
defaultValues: {
|
||||
|
||||
@ -1,42 +1,56 @@
|
||||
import QtQuick 2.12
|
||||
import QtGraphicalEffects 1.12
|
||||
import QtQuick.Shapes 1.12
|
||||
import NERvGear.Preferences 1.0 as P
|
||||
|
||||
import "../../qml/api"
|
||||
|
||||
AdvpStyleTemplate {
|
||||
style: Rectangle {
|
||||
id: main
|
||||
width: widget.width;
|
||||
height: widget.height;
|
||||
style: Shape {
|
||||
id: shape
|
||||
width: widget.width
|
||||
height: widget.height
|
||||
|
||||
property int gradientStyle
|
||||
property string main_color: "transparent"
|
||||
|
||||
LinearGradient {
|
||||
id: pureGradient
|
||||
GradientStop { color: main_color}
|
||||
}
|
||||
|
||||
RadialGradient {
|
||||
id: radialGradient
|
||||
anchors.fill: parent
|
||||
visible: gradientStyle===1
|
||||
horizontalRadius: Math.min(width, height)/2
|
||||
verticalRadius: horizontalRadius
|
||||
gradient: Gradient {
|
||||
GradientStop {id: radialGradient_pstart}
|
||||
GradientStop {id: radialGradient_pmiddle}
|
||||
GradientStop {id: radialGradient_pend}
|
||||
}
|
||||
centerX: widget.width/2
|
||||
centerY: widget.height/2
|
||||
focalX: centerX
|
||||
focalY: centerY
|
||||
centerRadius: Math.min(width, height)/2
|
||||
GradientStop {id: radialGradient_pstart; color: "transparent"}
|
||||
GradientStop {id: radialGradient_pmiddle; color: "transparent"}
|
||||
GradientStop {id: radialGradient_pend; color: "transparent"}
|
||||
}
|
||||
|
||||
ConicalGradient {
|
||||
id: conicalGradient
|
||||
anchors.fill: parent
|
||||
visible: gradientStyle===2
|
||||
angle: -90;
|
||||
gradient: Gradient {
|
||||
GradientStop{id: conicalGradient_pstart; position: 0.0}
|
||||
GradientStop{id: conicalGradient_pquarter; position: 0.25}
|
||||
GradientStop {id: conicalGradient_phalf; position: 0.5}
|
||||
GradientStop {id: conicalGradient_p3quarter; position: 0.75}
|
||||
GradientStop{id: conicalGradient_pend; position: 1.0}
|
||||
}
|
||||
angle: -90
|
||||
centerX: widget.width/2
|
||||
centerY: widget.height/2
|
||||
GradientStop{id: conicalGradient_pstart; position: 0.0; color: "transparent"}
|
||||
GradientStop{id: conicalGradient_pquarter; position: 0.25; color: "transparent"}
|
||||
GradientStop {id: conicalGradient_phalf; position: 0.5; color: "transparent"}
|
||||
GradientStop {id: conicalGradient_p3quarter; position: 0.75; color: "transparent"}
|
||||
GradientStop{id: conicalGradient_pend; position: 1.0; color: "transparent"}
|
||||
}
|
||||
|
||||
ShapePath {
|
||||
id: main
|
||||
fillGradient: [pureGradient, radialGradient, conicalGradient][gradientStyle]
|
||||
startX: -1
|
||||
startY: -1
|
||||
PathLine { x: widget.width+1; y: -1 }
|
||||
PathLine { x: widget.width+1; y: widget.height+1 }
|
||||
PathLine { x: -1; y: widget.height+1 }
|
||||
}
|
||||
|
||||
layer.enabled: true
|
||||
@ -57,6 +71,7 @@ AdvpStyleTemplate {
|
||||
readonly property bool autoNormalizing: configs["Data Settings"]["Auto Normalizing"]
|
||||
readonly property real amplitude: 400/configs["Data Settings"]["Amplitude"]
|
||||
readonly property int unitStyle: configs["Data Settings"]["Unit Style"]
|
||||
readonly property int rotationDirection: configs["Rotation Direction"]
|
||||
|
||||
readonly property int total: channel*dataLength
|
||||
|
||||
@ -79,7 +94,7 @@ AdvpStyleTemplate {
|
||||
onConfigsUpdated: {
|
||||
gradientStyle = configs["Gradient Style"];
|
||||
context.lineWidth = configs["Line Width"];
|
||||
main.color = configs["Main Color"];
|
||||
main_color = configs["Main Color"];
|
||||
if (gradientStyle === 1) {
|
||||
radialGradient_pstart.color = configs["Radial Gradient Settings"]["Inside Position Color"];
|
||||
radialGradient_pstart.position = configs["Radial Gradient Settings"]["Inside Position"]/100;
|
||||
@ -104,7 +119,7 @@ AdvpStyleTemplate {
|
||||
|
||||
for (let j=0; j < channel; j++) {
|
||||
for (let i=0; i < dataLength; i++) {
|
||||
deg = degUnit*((i+j*dataLength)*dotGap+offsetAngle);
|
||||
deg = degUnit*((i+j*dataLength)*dotGap+offsetAngle*(1-2*rotationDirection));
|
||||
deltaR = audioData[reverse*(dataLength-i-1)+(!reverse)*(i+j*dataLength)] * ratio;
|
||||
r1 = _rhmLen+1+deltaR*(linePosition!==2);
|
||||
r2 = _rhmLen-1-deltaR*(linePosition!==1);
|
||||
@ -112,7 +127,7 @@ AdvpStyleTemplate {
|
||||
innerPos.push([halfWidth+Math.cos(deg)*r2,halfHeight+Math.sin(deg)*r2]);
|
||||
}
|
||||
}
|
||||
conicalGradient.rotation = offsetAngle;
|
||||
conicalGradient.angle = offsetAngle*(2*rotationDirection-1);
|
||||
offsetAngle = rotateFlag ? ((offsetAngle + rSpeed) % 360) : angle;
|
||||
}
|
||||
|
||||
@ -155,12 +170,16 @@ AdvpStyleTemplate {
|
||||
audioData[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
onVersionUpdated: {
|
||||
updateConfiguration();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
defaultValues: {
|
||||
"Version": "1.2.0",
|
||||
"Version": "1.2.2",
|
||||
"Gradient Style": 0,
|
||||
"Radial Gradient Settings": {
|
||||
"Inside Position Color": "#f44336",
|
||||
@ -184,6 +203,7 @@ AdvpStyleTemplate {
|
||||
"Channel": 2,
|
||||
"Reverse": false,
|
||||
"Rotate": false,
|
||||
"Rotation Direction": 0,
|
||||
"Ratate Speed": 10,
|
||||
"Angle": 0,
|
||||
"Data Settings": {
|
||||
@ -362,6 +382,13 @@ AdvpStyleTemplate {
|
||||
defaultValue: defaultValues["Rotate"]
|
||||
}
|
||||
|
||||
P.SelectPreference {
|
||||
name: "Rotation Direction"
|
||||
label: qsTr("Rotation Direction")
|
||||
defaultValue: defaultValues["Rotation Direction"]
|
||||
model: [qsTr("Clockwise"), qsTr("Counterclockwise")]
|
||||
}
|
||||
|
||||
P.SliderPreference {
|
||||
name: "Ratate Speed"
|
||||
label: qsTr("Ratate Speed")
|
||||
|
||||
@ -1,33 +1,60 @@
|
||||
import QtQuick 2.12
|
||||
import QtGraphicalEffects 1.12
|
||||
import QtQuick.Shapes 1.12
|
||||
import NERvGear.Preferences 1.0 as P
|
||||
|
||||
import "../../qml/api"
|
||||
|
||||
AdvpStyleTemplate {
|
||||
style: Rectangle {
|
||||
id: main
|
||||
width: widget.width;
|
||||
height: widget.height;
|
||||
style: Shape {
|
||||
width: widget.width
|
||||
height: widget.height
|
||||
|
||||
property int gradientStyle
|
||||
|
||||
LinearGradient {
|
||||
id: linearGradient
|
||||
GradientStop { id: p_start; color: "transparent"; position: 0.0 }
|
||||
GradientStop { id: p_middle; color: "transparent"; position: 0.5 }
|
||||
GradientStop { id: p_end; color: "transparent"; position: 1.0 }
|
||||
}
|
||||
|
||||
LinearGradient {
|
||||
id: pureGradient
|
||||
GradientStop { color: main_color}
|
||||
}
|
||||
|
||||
RadialGradient {
|
||||
id: radialGradient
|
||||
centerX: widget.width/2*(1+radialGradient_xOffset/100)
|
||||
centerY: widget.height/2*(1+radialGradient_yOffset/100)
|
||||
focalX: centerX
|
||||
focalY: centerY
|
||||
centerRadius: Math.max(width, height)/2
|
||||
GradientStop {id: radialGradient_pstart; color: "transparent"}
|
||||
GradientStop {id: radialGradient_pmiddle; color: "transparent"}
|
||||
GradientStop {id: radialGradient_pend; color: "transparent"}
|
||||
}
|
||||
|
||||
ShapePath {
|
||||
id: main
|
||||
fillGradient: [pureGradient, linearGradient, radialGradient][gradientStyle]
|
||||
startX: -1
|
||||
startY: -1
|
||||
PathLine { x: widget.width+1; y: -1 }
|
||||
PathLine { x: widget.width+1; y: widget.height+1 }
|
||||
PathLine { x: -1; y: widget.height+1 }
|
||||
}
|
||||
|
||||
property bool gradientEnable
|
||||
property bool centerLineFlag
|
||||
property string center_color
|
||||
property real center_width
|
||||
property int linePosition
|
||||
property string main_color: "transparent"
|
||||
property bool vertical_flag
|
||||
property real _y_dy
|
||||
|
||||
LinearGradient {
|
||||
id: gradient_mask
|
||||
anchors.fill: parent
|
||||
visible: gradientEnable
|
||||
gradient: Gradient {
|
||||
GradientStop { id: p_start; position: 0.0 }
|
||||
GradientStop { id: p_middle; position: 0.5 }
|
||||
GradientStop { id: p_end; position: 1.0 }
|
||||
}
|
||||
}
|
||||
property real radialGradient_xOffset
|
||||
property real radialGradient_yOffset
|
||||
|
||||
Canvas {
|
||||
id: centerLine
|
||||
@ -35,7 +62,7 @@ AdvpStyleTemplate {
|
||||
contextType: "2d"
|
||||
renderTarget: Canvas.FramebufferObject
|
||||
renderStrategy: Canvas.Cooperative
|
||||
visible: centerLineFlag && !gradientEnable
|
||||
visible: centerLineFlag && !gradientStyle
|
||||
onPaint: {
|
||||
context.clearRect(0, 0, width+32, height+32);
|
||||
context.fillStyle = center_color;
|
||||
@ -89,16 +116,19 @@ AdvpStyleTemplate {
|
||||
readonly property real _dx: Math.round(_ux/2)
|
||||
|
||||
onWidthChanged: {
|
||||
if (gradientEnable) {
|
||||
gradient_mask.end = Qt.point(width*(configs["Gradient Direction"]!==1), height*(configs["Gradient Direction"]%2));
|
||||
if (gradientStyle === 1) {
|
||||
linearGradient.x2 = width*(configs["Linear Gradient Settings"]["Gradient Direction"]!==1);
|
||||
linearGradient.y2 = height*(configs["Linear Gradient Settings"]["Gradient Direction"]%2);
|
||||
}
|
||||
centerLine.requestPaint();
|
||||
}
|
||||
|
||||
onHeightChanged: {
|
||||
if (gradientEnable) {
|
||||
gradient_mask.start = Qt.point(0, height*(configs["Gradient Direction"]===2));
|
||||
gradient_mask.end = Qt.point(width*(configs["Gradient Direction"]!==1), height*(configs["Gradient Direction"]%2));
|
||||
if (gradientStyle === 1) {
|
||||
linearGradient.x1 = 0;
|
||||
linearGradient.y1 = height*(configs["Linear Gradient Settings"]["Gradient Direction"]===2);
|
||||
linearGradient.x2 = width*(configs["Linear Gradient Settings"]["Gradient Direction"]!==1);
|
||||
linearGradient.y2 = height*(configs["Linear Gradient Settings"]["Gradient Direction"]%2);
|
||||
}
|
||||
centerLine.requestPaint();
|
||||
}
|
||||
@ -110,16 +140,27 @@ AdvpStyleTemplate {
|
||||
center_width = configs["Center Width"]/10;
|
||||
linePosition = configs["Line Position"];
|
||||
vertical_flag = configs["Direction"];
|
||||
gradientEnable = configs["Enable Gradient"];
|
||||
gradientStyle = configs["Gradient Style"];
|
||||
context.lineWidth = configs["Line Width"];
|
||||
main.color = configs["Line Color"];
|
||||
main_color = configs["Line Color"];
|
||||
_y_dy = configs["Rotate Settings"]["Center Enable"]*Math.tan(configs["Rotate Settings"]["Center Angle"]*Math.PI/180)*(vertical_flag ? height/2 : width/2);
|
||||
if (gradientEnable) {
|
||||
gradient_mask.start = Qt.point(0, height*(configs["Gradient Direction"]===2));
|
||||
gradient_mask.end = Qt.point(width*(configs["Gradient Direction"]!==1), height*(configs["Gradient Direction"]%2));
|
||||
p_start.color = configs["Start Position Color"];
|
||||
p_middle.color = configs["Middle Position Color"];
|
||||
p_end.color = configs["End Position Color"];
|
||||
if (gradientStyle === 1) {
|
||||
linearGradient.x1 = 0;
|
||||
linearGradient.y1 = height*(configs["Linear Gradient Settings"]["Gradient Direction"]===2);
|
||||
linearGradient.x2 = width*(configs["Linear Gradient Settings"]["Gradient Direction"]!==1);
|
||||
linearGradient.y2 = height*(configs["Linear Gradient Settings"]["Gradient Direction"]%2);
|
||||
p_start.color = configs["Linear Gradient Settings"]["Start Position Color"];
|
||||
p_middle.color = configs["Linear Gradient Settings"]["Middle Position Color"];
|
||||
p_end.color = configs["Linear Gradient Settings"]["End Position Color"];
|
||||
} else if (gradientStyle === 2) {
|
||||
radialGradient_pstart.color = configs["Radial Gradient Settings"]["Inside Position Color"];
|
||||
radialGradient_pstart.position = configs["Radial Gradient Settings"]["Inside Position"]/100;
|
||||
radialGradient_pmiddle.color = configs["Radial Gradient Settings"]["Middle Position Color"];
|
||||
radialGradient_pmiddle.position = configs["Radial Gradient Settings"]["Middle Position"]/100;
|
||||
radialGradient_pend.color = configs["Radial Gradient Settings"]["Outside Position Color"];
|
||||
radialGradient_pend.position = configs["Radial Gradient Settings"]["Outside Position"]/100;
|
||||
radialGradient_xOffset = configs["Radial Gradient Settings"]["Center X Offset"];
|
||||
radialGradient_yOffset = configs["Radial Gradient Settings"]["Center Y Offset"];
|
||||
}
|
||||
centerLine.requestPaint();
|
||||
}
|
||||
@ -247,25 +288,51 @@ AdvpStyleTemplate {
|
||||
}
|
||||
|
||||
onVersionUpdated: {
|
||||
//1.2.0 -> 1.3.0
|
||||
if (widget.settings.current_style === "nvg://advp.widget.mashiros.top/advp-style-preset/gradient_line") {
|
||||
widget.settings.current_style = "nvg://advp.widget.mashiros.top/advp-style-preset/line";
|
||||
widget.settings[widget.settings.current_style] = updateObject(widget.settings["nvg://advp.widget.mashiros.top/advp-style-preset/gradient_line"], widget.settings[widget.settings.current_style]);
|
||||
widget.settings[widget.settings.current_style]["Enable Gradient"] = true;
|
||||
widget.settings[widget.settings.current_style]["Enable Gradient"] = 1;
|
||||
}
|
||||
delete widget.settings[widget.settings.current_style]["Version"];
|
||||
widget.settings[widget.settings.current_style] = updateObject(defaultValues, widget.settings[widget.settings.current_style]);
|
||||
//1.3.0 -> 1.3.2
|
||||
if(widget.settings[widget.settings.current_style]["Gradient Style"] === undefined) {
|
||||
if (widget.settings[widget.settings.current_style]["Enable Gradient"] === undefined) {
|
||||
widget.settings[widget.settings.current_style]["Gradient Style"] = 0;
|
||||
} else {
|
||||
widget.settings[widget.settings.current_style]["Gradient Style"] = widget.settings[widget.settings.current_style]["Enable Gradient"]+0;
|
||||
}
|
||||
widget.settings[widget.settings.current_style]["Linear Gradient Settings"] = {
|
||||
"Gradient Direction": widget.settings[widget.settings.current_style]["Gradient Direction"],
|
||||
"Start Position Color": widget.settings[widget.settings.current_style]["Start Position Color"],
|
||||
"Middle Position Color": widget.settings[widget.settings.current_style]["Middle Position Color"],
|
||||
"End Position Color": widget.settings[widget.settings.current_style]["End Position Color"]
|
||||
};
|
||||
}
|
||||
updateConfiguration();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
defaultValues: {
|
||||
"Version": "1.3.0",
|
||||
"Enable Gradient": false,
|
||||
"Gradient Direction": 0,
|
||||
"Start Position Color": "#f44336",
|
||||
"Middle Position Color": "#4caf50",
|
||||
"End Position Color": "#03a9f4",
|
||||
"Version": "1.3.2",
|
||||
"Gradient Style": 0,
|
||||
"Linear Gradient Settings": {
|
||||
"Gradient Direction": 0,
|
||||
"Start Position Color": "#f44336",
|
||||
"Middle Position Color": "#4caf50",
|
||||
"End Position Color": "#03a9f4"
|
||||
},
|
||||
"Radial Gradient Settings": {
|
||||
"Inside Position Color": "#f44336",
|
||||
"Middle Position Color": "#4caf50",
|
||||
"Outside Position Color": "#03a9f4",
|
||||
"Inside Position": 0,
|
||||
"Middle Position": 50,
|
||||
"Outside Position": 100,
|
||||
"Center X Offset": 0,
|
||||
"Center Y Offset": 0
|
||||
},
|
||||
"Center Line": true,
|
||||
"Center Color": "#ff4500",
|
||||
"Center Width": 20,
|
||||
@ -294,40 +361,121 @@ AdvpStyleTemplate {
|
||||
preference: AdvpPreference {
|
||||
version: defaultValues["Version"]
|
||||
|
||||
P.SwitchPreference {
|
||||
id: _cfg_enable_gradient
|
||||
name: "Enable Gradient"
|
||||
label: qsTr("Enable Gradient")
|
||||
defaultValue: defaultValues["Enable Gradient"]
|
||||
}
|
||||
|
||||
P.SelectPreference {
|
||||
name: "Gradient Direction"
|
||||
label: qsTr("Gradient Direction")
|
||||
visible: _cfg_enable_gradient.value
|
||||
defaultValue: defaultValues["Gradient Direction"]
|
||||
model: [qsTr("Horizontal"), qsTr("Vertical"), qsTr("Oblique Upward"), qsTr("Oblique downward")]
|
||||
id: _cfg_gradient_style
|
||||
name: "Gradient Style"
|
||||
label: qsTr("Gradient Style")
|
||||
defaultValue: defaultValues["Gradient Style"]
|
||||
model: [qsTr("None"), qsTr("Linear Gradient"), qsTr("Radial Gradient")]
|
||||
}
|
||||
|
||||
P.ColorPreference {
|
||||
name: "Start Position Color"
|
||||
label: qsTr("Start Position Color")
|
||||
visible: _cfg_enable_gradient.value
|
||||
defaultValue: defaultValues["Start Position Color"]
|
||||
P.DialogPreference {
|
||||
name: "Linear Gradient Settings"
|
||||
label: qsTr("Linear Gradient Settings")
|
||||
live: true
|
||||
visible: _cfg_gradient_style.value===1
|
||||
|
||||
P.SelectPreference {
|
||||
name: "Gradient Direction"
|
||||
label: qsTr("Gradient Direction")
|
||||
defaultValue: defaultValues["Linear Gradient Settings"]["Gradient Direction"]
|
||||
model: [qsTr("Horizontal"), qsTr("Vertical"), qsTr("Oblique Upward"), qsTr("Oblique downward")]
|
||||
}
|
||||
|
||||
P.ColorPreference {
|
||||
name: "Start Position Color"
|
||||
label: qsTr("Start Position Color")
|
||||
defaultValue: defaultValues["Linear Gradient Settings"]["Start Position Color"]
|
||||
}
|
||||
|
||||
P.ColorPreference {
|
||||
name: "Middle Position Color"
|
||||
label: qsTr("Middle Position Color")
|
||||
defaultValue: defaultValues["Linear Gradient Settings"]["Middle Position Color"]
|
||||
}
|
||||
|
||||
P.ColorPreference {
|
||||
name: "End Position Color"
|
||||
label: qsTr("End Position Color")
|
||||
defaultValue: defaultValues["Linear Gradient Settings"]["End Position Color"]
|
||||
}
|
||||
}
|
||||
|
||||
P.ColorPreference {
|
||||
name: "Middle Position Color"
|
||||
label: qsTr("Middle Position Color")
|
||||
visible: _cfg_enable_gradient.value
|
||||
defaultValue: defaultValues["Middle Position Color"]
|
||||
}
|
||||
P.DialogPreference {
|
||||
name: "Radial Gradient Settings"
|
||||
label: qsTr("Radial Gradient Settings")
|
||||
live: true
|
||||
visible: _cfg_gradient_style.value===2
|
||||
|
||||
P.ColorPreference {
|
||||
name: "End Position Color"
|
||||
label: qsTr("End Position Color")
|
||||
visible: _cfg_enable_gradient.value
|
||||
defaultValue: defaultValues["End Position Color"]
|
||||
P.ColorPreference {
|
||||
name: "Inside Position Color"
|
||||
label: qsTr("Inside Position Color")
|
||||
defaultValue: defaultValues["Radial Gradient Settings"]["Inside Position Color"]
|
||||
}
|
||||
|
||||
P.ColorPreference {
|
||||
name: "Middle Position Color"
|
||||
label: qsTr("Middle Position Color")
|
||||
defaultValue: defaultValues["Radial Gradient Settings"]["Middle Position Color"]
|
||||
}
|
||||
|
||||
P.ColorPreference {
|
||||
name: "Outside Position Color"
|
||||
label: qsTr("Outside Position Color")
|
||||
defaultValue: defaultValues["Radial Gradient Settings"]["Outside Position Color"]
|
||||
}
|
||||
|
||||
P.SliderPreference {
|
||||
id: _cfg_gradient_settings_inside_position
|
||||
name: "Inside Position"
|
||||
label: qsTr("Inside Position")
|
||||
from: 0
|
||||
to: 75
|
||||
stepSize: 1
|
||||
defaultValue: defaultValues["Radial Gradient Settings"]["Inside Position"]
|
||||
displayValue: value + "%"
|
||||
}
|
||||
|
||||
P.SliderPreference {
|
||||
id: _cfg_gradient_settings_middle_position
|
||||
name: "Middle Position"
|
||||
label: qsTr("Middle Position")
|
||||
from: _cfg_gradient_settings_inside_position.value + 1
|
||||
to: 90
|
||||
stepSize: 1
|
||||
defaultValue: defaultValues["Radial Gradient Settings"]["Middle Position"]
|
||||
displayValue: value + "%"
|
||||
}
|
||||
|
||||
P.SliderPreference {
|
||||
name: "Outside Position"
|
||||
label: qsTr("Outside Position")
|
||||
from: _cfg_gradient_settings_middle_position.value + 1
|
||||
to: 100
|
||||
stepSize: 1
|
||||
defaultValue: defaultValues["Radial Gradient Settings"]["Outside Position"]
|
||||
displayValue: value + "%"
|
||||
}
|
||||
|
||||
P.SliderPreference {
|
||||
name: "Center X Offset"
|
||||
label: qsTr("X Offset")
|
||||
from: -100
|
||||
to: 100
|
||||
stepSize: 1
|
||||
defaultValue: defaultValues["Radial Gradient Settings"]["Center X Offset"]
|
||||
displayValue: value + "%"
|
||||
}
|
||||
|
||||
P.SliderPreference {
|
||||
name: "Center Y Offset"
|
||||
label: qsTr("Y Offset")
|
||||
from: -100
|
||||
to: 100
|
||||
stepSize: 1
|
||||
defaultValue: defaultValues["Radial Gradient Settings"]["Center Y Offset"]
|
||||
displayValue: value + "%"
|
||||
}
|
||||
}
|
||||
|
||||
P.Separator {}
|
||||
@ -342,7 +490,7 @@ AdvpStyleTemplate {
|
||||
P.ColorPreference {
|
||||
name: "Center Color"
|
||||
label: qsTr("Center Line Color")
|
||||
visible: !_cfg_enable_gradient.value && _cfg_preset_line_Center_Line.value
|
||||
visible: !_cfg_gradient_style.value && _cfg_preset_line_Center_Line.value
|
||||
defaultValue: defaultValues["Center Color"]
|
||||
}
|
||||
|
||||
@ -370,7 +518,7 @@ AdvpStyleTemplate {
|
||||
P.ColorPreference {
|
||||
name: "Line Color"
|
||||
label: qsTr("Spectrum Line Color")
|
||||
visible: !_cfg_enable_gradient.value
|
||||
visible: !_cfg_gradient_style.value
|
||||
defaultValue: defaultValues["Line Color"]
|
||||
}
|
||||
|
||||
|
||||
@ -1,42 +1,56 @@
|
||||
import QtQuick 2.12
|
||||
import QtGraphicalEffects 1.12
|
||||
import QtQuick.Shapes 1.12
|
||||
import NERvGear.Preferences 1.0 as P
|
||||
|
||||
import "../../qml/api"
|
||||
|
||||
AdvpStyleTemplate {
|
||||
style: Rectangle {
|
||||
id: main
|
||||
width: widget.width;
|
||||
height: widget.height;
|
||||
style: Shape {
|
||||
id: shape
|
||||
width: widget.width
|
||||
height: widget.height
|
||||
|
||||
property int gradientStyle
|
||||
property string main_color: "transparent"
|
||||
|
||||
LinearGradient {
|
||||
id: pureGradient
|
||||
GradientStop { color: main_color}
|
||||
}
|
||||
|
||||
RadialGradient {
|
||||
id: radialGradient
|
||||
anchors.fill: parent
|
||||
visible: gradientStyle===1
|
||||
horizontalRadius: Math.min(width, height)/2
|
||||
verticalRadius: horizontalRadius
|
||||
gradient: Gradient {
|
||||
GradientStop {id: radialGradient_pstart}
|
||||
GradientStop {id: radialGradient_pmiddle}
|
||||
GradientStop {id: radialGradient_pend}
|
||||
}
|
||||
centerX: widget.width/2
|
||||
centerY: widget.height/2
|
||||
focalX: centerX
|
||||
focalY: centerY
|
||||
centerRadius: Math.min(width, height)/2
|
||||
GradientStop {id: radialGradient_pstart; color: "transparent"}
|
||||
GradientStop {id: radialGradient_pmiddle; color: "transparent"}
|
||||
GradientStop {id: radialGradient_pend; color: "transparent"}
|
||||
}
|
||||
|
||||
ConicalGradient {
|
||||
id: conicalGradient
|
||||
anchors.fill: parent
|
||||
visible: gradientStyle===2
|
||||
angle: -90;
|
||||
gradient: Gradient {
|
||||
GradientStop{id: conicalGradient_pstart; position: 0.0}
|
||||
GradientStop{id: conicalGradient_pquarter; position: 0.25}
|
||||
GradientStop {id: conicalGradient_phalf; position: 0.5}
|
||||
GradientStop {id: conicalGradient_p3quarter; position: 0.75}
|
||||
GradientStop{id: conicalGradient_pend; position: 1.0}
|
||||
}
|
||||
angle: -90
|
||||
centerX: widget.width/2
|
||||
centerY: widget.height/2
|
||||
GradientStop{id: conicalGradient_pstart; position: 0.0; color: "transparent"}
|
||||
GradientStop{id: conicalGradient_pquarter; position: 0.25; color: "transparent"}
|
||||
GradientStop {id: conicalGradient_phalf; position: 0.5; color: "transparent"}
|
||||
GradientStop {id: conicalGradient_p3quarter; position: 0.75; color: "transparent"}
|
||||
GradientStop{id: conicalGradient_pend; position: 1.0; color: "transparent"}
|
||||
}
|
||||
|
||||
ShapePath {
|
||||
id: main
|
||||
fillGradient: [pureGradient, radialGradient, conicalGradient][gradientStyle]
|
||||
startX: -1
|
||||
startY: -1
|
||||
PathLine { x: widget.width+1; y: -1 }
|
||||
PathLine { x: widget.width+1; y: widget.height+1 }
|
||||
PathLine { x: -1; y: widget.height+1 }
|
||||
}
|
||||
|
||||
layer.enabled: true
|
||||
@ -57,6 +71,7 @@ AdvpStyleTemplate {
|
||||
readonly property bool autoNormalizing: configs["Data Settings"]["Auto Normalizing"]
|
||||
readonly property real amplitude: 400/configs["Data Settings"]["Amplitude"]
|
||||
readonly property int unitStyle: configs["Data Settings"]["Unit Style"]
|
||||
readonly property int rotationDirection: configs["Rotation Direction"]
|
||||
|
||||
readonly property int total: channel*dataLength
|
||||
|
||||
@ -79,7 +94,7 @@ AdvpStyleTemplate {
|
||||
onConfigsUpdated: {
|
||||
gradientStyle = configs["Gradient Style"];
|
||||
context.lineWidth = configs["Line Width"];
|
||||
main.color = configs["Main Color"];
|
||||
main_color = configs["Main Color"];
|
||||
if (gradientStyle === 1) {
|
||||
radialGradient_pstart.color = configs["Radial Gradient Settings"]["Inside Position Color"];
|
||||
radialGradient_pstart.position = configs["Radial Gradient Settings"]["Inside Position"]/100;
|
||||
@ -104,7 +119,7 @@ AdvpStyleTemplate {
|
||||
|
||||
for (let j=0; j < channel; j++) {
|
||||
for (let i=0; i < dataLength; i++) {
|
||||
deg = degUnit*((i+j*dataLength)*dotGap+offsetAngle);
|
||||
deg = degUnit*((i+j*dataLength)*dotGap+offsetAngle*(1-2*rotationDirection));
|
||||
deltaR = audioData[reverse*(dataLength-i-1)+(!reverse)*(i+j*dataLength)] * ratio;
|
||||
r1 = _rhmLen+1+deltaR*(linePosition!==2);
|
||||
r2 = _rhmLen-1-deltaR*(linePosition!==1);
|
||||
@ -112,7 +127,7 @@ AdvpStyleTemplate {
|
||||
innerPos.push([halfWidth+Math.cos(deg)*r2,halfHeight+Math.sin(deg)*r2]);
|
||||
}
|
||||
}
|
||||
conicalGradient.rotation = offsetAngle;
|
||||
conicalGradient.angle = offsetAngle*(2*rotationDirection-1);
|
||||
offsetAngle = rotateFlag ? ((offsetAngle + rSpeed) % 360) : angle;
|
||||
}
|
||||
|
||||
@ -171,12 +186,16 @@ AdvpStyleTemplate {
|
||||
audioData[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
onVersionUpdated: {
|
||||
updateConfiguration();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
defaultValues: {
|
||||
"Version": "1.2.0",
|
||||
"Version": "1.2.2",
|
||||
"Gradient Style": 0,
|
||||
"Radial Gradient Settings": {
|
||||
"Inside Position Color": "#f44336",
|
||||
@ -200,6 +219,7 @@ AdvpStyleTemplate {
|
||||
"Channel": 2,
|
||||
"Reverse": false,
|
||||
"Rotate": false,
|
||||
"Rotation Direction": 0,
|
||||
"Ratate Speed": 10,
|
||||
"Angle": 0,
|
||||
"Data Settings": {
|
||||
@ -378,6 +398,13 @@ AdvpStyleTemplate {
|
||||
defaultValue: defaultValues["Rotate"]
|
||||
}
|
||||
|
||||
P.SelectPreference {
|
||||
name: "Rotation Direction"
|
||||
label: qsTr("Rotation Direction")
|
||||
defaultValue: defaultValues["Rotation Direction"]
|
||||
model: [qsTr("Clockwise"), qsTr("Counterclockwise")]
|
||||
}
|
||||
|
||||
P.SliderPreference {
|
||||
name: "Ratate Speed"
|
||||
label: qsTr("Ratate Speed")
|
||||
|
||||
@ -1,26 +1,52 @@
|
||||
import QtQuick 2.12
|
||||
import QtGraphicalEffects 1.12
|
||||
import QtQuick.Shapes 1.12
|
||||
import NERvGear.Preferences 1.0 as P
|
||||
|
||||
import "../../qml/api"
|
||||
|
||||
AdvpStyleTemplate {
|
||||
style: Rectangle {
|
||||
id: main
|
||||
width: widget.width;
|
||||
height: widget.height;
|
||||
style: Shape {
|
||||
width: widget.width
|
||||
height: widget.height
|
||||
|
||||
property bool gradientEnable
|
||||
property int gradientStyle
|
||||
property string main_color: "transparent"
|
||||
property real radialGradient_xOffset
|
||||
property real radialGradient_yOffset
|
||||
|
||||
LinearGradient {
|
||||
id: gradient_mask
|
||||
anchors.fill: parent
|
||||
visible: gradientEnable
|
||||
gradient: Gradient {
|
||||
GradientStop { id: p_start; position: 0.0 }
|
||||
GradientStop { id: p_middle; position: 0.5 }
|
||||
GradientStop { id: p_end; position: 1.0 }
|
||||
}
|
||||
id: pureGradient
|
||||
GradientStop { color: main_color}
|
||||
}
|
||||
|
||||
LinearGradient {
|
||||
id: linearGradient
|
||||
GradientStop { id: p_start; color: "transparent"; position: 0.0 }
|
||||
GradientStop { id: p_middle; color: "transparent"; position: 0.5 }
|
||||
GradientStop { id: p_end; color: "transparent"; position: 1.0 }
|
||||
}
|
||||
|
||||
RadialGradient {
|
||||
id: radialGradient
|
||||
centerX: widget.width/2*(1+radialGradient_xOffset/100)
|
||||
centerY: widget.height/2*(1+radialGradient_yOffset/100)
|
||||
focalX: centerX
|
||||
focalY: centerY
|
||||
centerRadius: Math.max(width, height)/2
|
||||
GradientStop {id: radialGradient_pstart; color: "transparent"}
|
||||
GradientStop {id: radialGradient_pmiddle; color: "transparent"}
|
||||
GradientStop {id: radialGradient_pend; color: "transparent"}
|
||||
}
|
||||
|
||||
ShapePath {
|
||||
id: main
|
||||
fillGradient: [pureGradient, linearGradient, radialGradient][gradientStyle]
|
||||
startX: -1
|
||||
startY: -1
|
||||
PathLine { x: widget.width+1; y: -1 }
|
||||
PathLine { x: widget.width+1; y: widget.height+1 }
|
||||
PathLine { x: -1; y: widget.height+1 }
|
||||
}
|
||||
|
||||
layer.enabled: true
|
||||
@ -54,25 +80,43 @@ AdvpStyleTemplate {
|
||||
readonly property real yScale: configs["Rotate Settings"]["Y Scale"]/100
|
||||
|
||||
onWidthChanged: {
|
||||
gradient_mask.end = Qt.point(width*(configs["Gradient Direction"]!==1), height*(configs["Gradient Direction"]%2));
|
||||
if (gradientStyle === 1) {
|
||||
linearGradient.x2 = width*(configs["Linear Gradient Settings"]["Gradient Direction"]!==1);
|
||||
linearGradient.y2 = height*(configs["Linear Gradient Settings"]["Gradient Direction"]%2);
|
||||
}
|
||||
}
|
||||
|
||||
onHeightChanged: {
|
||||
gradient_mask.start = Qt.point(0, height*(configs["Gradient Direction"]===2));
|
||||
gradient_mask.end = Qt.point(width*(configs["Gradient Direction"]!==1), height*(configs["Gradient Direction"]%2));
|
||||
if (gradientStyle === 1) {
|
||||
linearGradient.x1 = 0;
|
||||
linearGradient.y1 = height*(configs["Linear Gradient Settings"]["Gradient Direction"]===2);
|
||||
linearGradient.x2 = width*(configs["Linear Gradient Settings"]["Gradient Direction"]!==1);
|
||||
linearGradient.y2 = height*(configs["Linear Gradient Settings"]["Gradient Direction"]%2);
|
||||
}
|
||||
}
|
||||
|
||||
onConfigsUpdated: {
|
||||
//尽量不要使用绑定configs的属性以免造成竞争,若一定要使用推荐使用Qt.callLater(()=>{})
|
||||
gradientEnable = configs["Enable Gradient"];
|
||||
gradientStyle = configs["Gradient Style"];
|
||||
context.lineWidth = configs["Line Width"];
|
||||
main.color = configs["Line Color"];
|
||||
if (gradientEnable) {
|
||||
gradient_mask.start = Qt.point(0, height*(configs["Gradient Direction"]===2));
|
||||
gradient_mask.end = Qt.point(width*(configs["Gradient Direction"]!==1), height*(configs["Gradient Direction"]%2));
|
||||
p_start.color = configs["Start Position Color"];
|
||||
p_middle.color = configs["Middle Position Color"];
|
||||
p_end.color = configs["End Position Color"];
|
||||
main_color = configs["Line Color"];
|
||||
if (gradientStyle === 1) {
|
||||
linearGradient.x1 = 0;
|
||||
linearGradient.y1 = height*(configs["Linear Gradient Settings"]["Gradient Direction"]===2);
|
||||
linearGradient.x2 = width*(configs["Linear Gradient Settings"]["Gradient Direction"]!==1);
|
||||
linearGradient.y2 = height*(configs["Linear Gradient Settings"]["Gradient Direction"]%2);
|
||||
p_start.color = configs["Linear Gradient Settings"]["Start Position Color"];
|
||||
p_middle.color = configs["Linear Gradient Settings"]["Middle Position Color"];
|
||||
p_end.color = configs["Linear Gradient Settings"]["End Position Color"];
|
||||
} else if (gradientStyle === 2) {
|
||||
radialGradient_pstart.color = configs["Radial Gradient Settings"]["Inside Position Color"];
|
||||
radialGradient_pstart.position = configs["Radial Gradient Settings"]["Inside Position"]/100;
|
||||
radialGradient_pmiddle.color = configs["Radial Gradient Settings"]["Middle Position Color"];
|
||||
radialGradient_pmiddle.position = configs["Radial Gradient Settings"]["Middle Position"]/100;
|
||||
radialGradient_pend.color = configs["Radial Gradient Settings"]["Outside Position Color"];
|
||||
radialGradient_pend.position = configs["Radial Gradient Settings"]["Outside Position"]/100;
|
||||
radialGradient_xOffset = configs["Radial Gradient Settings"]["Center X Offset"];
|
||||
radialGradient_yOffset = configs["Radial Gradient Settings"]["Center Y Offset"];
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,17 +193,47 @@ AdvpStyleTemplate {
|
||||
audioData[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
onVersionUpdated: {
|
||||
//1.2.0 -> 1.2.2
|
||||
if(widget.settings[widget.settings.current_style]["Gradient Style"] === undefined) {
|
||||
if (widget.settings[widget.settings.current_style]["Enable Gradient"] === undefined) {
|
||||
widget.settings[widget.settings.current_style]["Gradient Style"] = 0;
|
||||
} else {
|
||||
widget.settings[widget.settings.current_style]["Gradient Style"] = widget.settings[widget.settings.current_style]["Enable Gradient"]+0;
|
||||
}
|
||||
widget.settings[widget.settings.current_style]["Linear Gradient Settings"] = {
|
||||
"Gradient Direction": widget.settings[widget.settings.current_style]["Gradient Direction"],
|
||||
"Start Position Color": widget.settings[widget.settings.current_style]["Start Position Color"],
|
||||
"Middle Position Color": widget.settings[widget.settings.current_style]["Middle Position Color"],
|
||||
"End Position Color": widget.settings[widget.settings.current_style]["End Position Color"]
|
||||
};
|
||||
}
|
||||
updateConfiguration();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
defaultValues: {
|
||||
"Version": "1.2.0",
|
||||
"Enable Gradient": false,
|
||||
"Gradient Direction": 0,
|
||||
"Start Position Color": "#f44336",
|
||||
"Middle Position Color": "#4caf50",
|
||||
"End Position Color": "#03a9f4",
|
||||
"Version": "1.2.2",
|
||||
"Gradient Style": 0,
|
||||
"Linear Gradient Settings": {
|
||||
"Gradient Direction": 0,
|
||||
"Start Position Color": "#f44336",
|
||||
"Middle Position Color": "#4caf50",
|
||||
"End Position Color": "#03a9f4"
|
||||
},
|
||||
"Radial Gradient Settings": {
|
||||
"Inside Position Color": "#f44336",
|
||||
"Middle Position Color": "#4caf50",
|
||||
"Outside Position Color": "#03a9f4",
|
||||
"Inside Position": 0,
|
||||
"Middle Position": 50,
|
||||
"Outside Position": 100,
|
||||
"Center X Offset": 0,
|
||||
"Center Y Offset": 0
|
||||
},
|
||||
"Line Color": "#ff4500",
|
||||
"Line Width": 1,
|
||||
"Data Length": 0,
|
||||
@ -184,40 +258,121 @@ AdvpStyleTemplate {
|
||||
preference: AdvpPreference {
|
||||
version: defaultValues["Version"]
|
||||
|
||||
P.SwitchPreference {
|
||||
id: _cfg_enable_gradient
|
||||
name: "Enable Gradient"
|
||||
label: qsTr("Enable Gradient")
|
||||
defaultValue: defaultValues["Enable Gradient"]
|
||||
}
|
||||
|
||||
P.SelectPreference {
|
||||
name: "Gradient Direction"
|
||||
label: qsTr("Gradient Direction")
|
||||
visible: _cfg_enable_gradient.value
|
||||
defaultValue: defaultValues["Gradient Direction"]
|
||||
model: [qsTr("Horizontal"), qsTr("Vertical"), qsTr("Oblique Upward"), qsTr("Oblique downward")]
|
||||
id: _cfg_gradient_style
|
||||
name: "Gradient Style"
|
||||
label: qsTr("Gradient Style")
|
||||
defaultValue: defaultValues["Gradient Style"]
|
||||
model: [qsTr("None"), qsTr("Linear Gradient"), qsTr("Radial Gradient")]
|
||||
}
|
||||
|
||||
P.ColorPreference {
|
||||
name: "Start Position Color"
|
||||
label: qsTr("Start Position Color")
|
||||
visible: _cfg_enable_gradient.value
|
||||
defaultValue: defaultValues["Start Position Color"]
|
||||
P.DialogPreference {
|
||||
name: "Linear Gradient Settings"
|
||||
label: qsTr("Linear Gradient Settings")
|
||||
live: true
|
||||
visible: _cfg_gradient_style.value===1
|
||||
|
||||
P.SelectPreference {
|
||||
name: "Gradient Direction"
|
||||
label: qsTr("Gradient Direction")
|
||||
defaultValue: defaultValues["Linear Gradient Settings"]["Gradient Direction"]
|
||||
model: [qsTr("Horizontal"), qsTr("Vertical"), qsTr("Oblique Upward"), qsTr("Oblique downward")]
|
||||
}
|
||||
|
||||
P.ColorPreference {
|
||||
name: "Start Position Color"
|
||||
label: qsTr("Start Position Color")
|
||||
defaultValue: defaultValues["Linear Gradient Settings"]["Start Position Color"]
|
||||
}
|
||||
|
||||
P.ColorPreference {
|
||||
name: "Middle Position Color"
|
||||
label: qsTr("Middle Position Color")
|
||||
defaultValue: defaultValues["Linear Gradient Settings"]["Middle Position Color"]
|
||||
}
|
||||
|
||||
P.ColorPreference {
|
||||
name: "End Position Color"
|
||||
label: qsTr("End Position Color")
|
||||
defaultValue: defaultValues["Linear Gradient Settings"]["End Position Color"]
|
||||
}
|
||||
}
|
||||
|
||||
P.ColorPreference {
|
||||
name: "Middle Position Color"
|
||||
label: qsTr("Middle Position Color")
|
||||
visible: _cfg_enable_gradient.value
|
||||
defaultValue: defaultValues["Middle Position Color"]
|
||||
}
|
||||
P.DialogPreference {
|
||||
name: "Radial Gradient Settings"
|
||||
label: qsTr("Radial Gradient Settings")
|
||||
live: true
|
||||
visible: _cfg_gradient_style.value===2
|
||||
|
||||
P.ColorPreference {
|
||||
name: "End Position Color"
|
||||
label: qsTr("End Position Color")
|
||||
visible: _cfg_enable_gradient.value
|
||||
defaultValue: defaultValues["End Position Color"]
|
||||
P.ColorPreference {
|
||||
name: "Inside Position Color"
|
||||
label: qsTr("Inside Position Color")
|
||||
defaultValue: defaultValues["Radial Gradient Settings"]["Inside Position Color"]
|
||||
}
|
||||
|
||||
P.ColorPreference {
|
||||
name: "Middle Position Color"
|
||||
label: qsTr("Middle Position Color")
|
||||
defaultValue: defaultValues["Radial Gradient Settings"]["Middle Position Color"]
|
||||
}
|
||||
|
||||
P.ColorPreference {
|
||||
name: "Outside Position Color"
|
||||
label: qsTr("Outside Position Color")
|
||||
defaultValue: defaultValues["Radial Gradient Settings"]["Outside Position Color"]
|
||||
}
|
||||
|
||||
P.SliderPreference {
|
||||
id: _cfg_gradient_settings_inside_position
|
||||
name: "Inside Position"
|
||||
label: qsTr("Inside Position")
|
||||
from: 0
|
||||
to: 75
|
||||
stepSize: 1
|
||||
defaultValue: defaultValues["Radial Gradient Settings"]["Inside Position"]
|
||||
displayValue: value + "%"
|
||||
}
|
||||
|
||||
P.SliderPreference {
|
||||
id: _cfg_gradient_settings_middle_position
|
||||
name: "Middle Position"
|
||||
label: qsTr("Middle Position")
|
||||
from: _cfg_gradient_settings_inside_position.value + 1
|
||||
to: 90
|
||||
stepSize: 1
|
||||
defaultValue: defaultValues["Radial Gradient Settings"]["Middle Position"]
|
||||
displayValue: value + "%"
|
||||
}
|
||||
|
||||
P.SliderPreference {
|
||||
name: "Outside Position"
|
||||
label: qsTr("Outside Position")
|
||||
from: _cfg_gradient_settings_middle_position.value + 1
|
||||
to: 100
|
||||
stepSize: 1
|
||||
defaultValue: defaultValues["Radial Gradient Settings"]["Outside Position"]
|
||||
displayValue: value + "%"
|
||||
}
|
||||
|
||||
P.SliderPreference {
|
||||
name: "Center X Offset"
|
||||
label: qsTr("X Offset")
|
||||
from: -100
|
||||
to: 100
|
||||
stepSize: 1
|
||||
defaultValue: defaultValues["Radial Gradient Settings"]["Center X Offset"]
|
||||
displayValue: value + "%"
|
||||
}
|
||||
|
||||
P.SliderPreference {
|
||||
name: "Center Y Offset"
|
||||
label: qsTr("Y Offset")
|
||||
from: -100
|
||||
to: 100
|
||||
stepSize: 1
|
||||
defaultValue: defaultValues["Radial Gradient Settings"]["Center Y Offset"]
|
||||
displayValue: value + "%"
|
||||
}
|
||||
}
|
||||
|
||||
P.Separator {}
|
||||
@ -232,7 +387,7 @@ AdvpStyleTemplate {
|
||||
P.ColorPreference {
|
||||
name: "Line Color"
|
||||
label: qsTr("Spectrum Line Color")
|
||||
visible: !_cfg_enable_gradient.value
|
||||
visible: !_cfg_gradient_style.value
|
||||
defaultValue: defaultValues["Line Color"]
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user