diff --git a/Locales/ja.qm b/Locales/ja.qm
index fd5d786..d1ea8e5 100644
Binary files a/Locales/ja.qm and b/Locales/ja.qm differ
diff --git a/Locales/zh.qm b/Locales/zh.qm
index f7054dc..5edcdbd 100644
Binary files a/Locales/zh.qm and b/Locales/zh.qm differ
diff --git a/Locales/zh_TW.qm b/Locales/zh_TW.qm
index 65d3d8c..4011207 100644
Binary files a/Locales/zh_TW.qm and b/Locales/zh_TW.qm differ
diff --git a/Presets/Circle/settings.xml b/Presets/Circle/settings.xml
index c4a591e..f2148c7 100644
--- a/Presets/Circle/settings.xml
+++ b/Presets/Circle/settings.xml
@@ -1,5 +1,5 @@
\ No newline at end of file
diff --git a/Presets/Line/settings.xml b/Presets/Line/settings.xml
index a7efee6..c78de8a 100644
--- a/Presets/Line/settings.xml
+++ b/Presets/Line/settings.xml
@@ -1,5 +1,5 @@
\ No newline at end of file
diff --git a/package.json b/package.json
index 462844a..f16ab71 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "top.mashiros.widget.advp",
- "version": "1.4.4",
+ "version": "1.5.0",
"title": {
"en": "ADV Plugin",
diff --git a/styles/Preset_circle/Style.qml b/styles/Preset_circle/Style.qml
index 0703fe2..a8e4e4e 100644
--- a/styles/Preset_circle/Style.qml
+++ b/styles/Preset_circle/Style.qml
@@ -90,6 +90,9 @@ AdvpStyleTemplate {
readonly property real halfHeight: height/2
readonly property real halfMinLength: minLength/2
+ readonly property int linecap: configs["Line Cap"]
+ readonly property bool mirror: configs["Mirror"]
+
onConfigsUpdated: {
gradientStyle = configs["Gradient Style"];
@@ -117,16 +120,32 @@ AdvpStyleTemplate {
let deg, deltaR, r1, r2, _rhmLen;
_rhmLen = mainRatio*halfMinLength;
- for (let j=0; j < channel; j++) {
- for (let i=0; i < dataLength; i++) {
- 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);
- outerPos.push([halfWidth+Math.cos(deg)*r1,halfHeight+Math.sin(deg)*r1]);
- innerPos.push([halfWidth+Math.cos(deg)*r2,halfHeight+Math.sin(deg)*r2]);
+ if (mirror) {
+ for (let j=0; j < channel; j++) {
+ for (let i=0; i < dataLength; i++) {
+ deg = degUnit*((i+j*dataLength)*dotGap+offsetAngle*(1-2*rotationDirection));
+ deltaR = audioData[reverse*(dataLength+((2*i+1)*j-i-1))+(!reverse)*((2*dataLength-2*i-1)*j+i)] * ratio;
+ // deltaR = audioData[reverse*(dataLength-(i+1)*(j===0)+i*(j===1))+(!reverse)*(i*(j===0)+(dataLength*2-i-1)*(j===1))] * ratio;
+ r1 = _rhmLen+1+deltaR*(linePosition!==2);
+ r2 = _rhmLen-1-deltaR*(linePosition!==1);
+ outerPos.push([halfWidth+Math.cos(deg)*r1,halfHeight+Math.sin(deg)*r1]);
+ innerPos.push([halfWidth+Math.cos(deg)*r2,halfHeight+Math.sin(deg)*r2]);
+ }
+ }
+ } else {
+ for (let j=0; j < channel; j++) {
+ for (let i=0; i < dataLength; i++) {
+ deg = degUnit*((i+j*dataLength)*dotGap+offsetAngle*(1-2*rotationDirection));
+ deltaR = audioData[reverse*(dataLength*(j+1)-i-1)+(!reverse)*(i+j*dataLength)] * ratio;
+ r1 = _rhmLen+1+deltaR*(linePosition!==2);
+ r2 = _rhmLen-1-deltaR*(linePosition!==1);
+ outerPos.push([halfWidth+Math.cos(deg)*r1,halfHeight+Math.sin(deg)*r1]);
+ innerPos.push([halfWidth+Math.cos(deg)*r2,halfHeight+Math.sin(deg)*r2]);
+ }
}
}
+
+
conicalGradient.angle = offsetAngle*(2*rotationDirection-1);
offsetAngle = rotateFlag ? ((offsetAngle + rSpeed) % 360) : angle;
}
@@ -152,7 +171,7 @@ AdvpStyleTemplate {
audioData[i] /= (uDataLen * normalizing_ratio);
}
}
-
+ context.lineCap=["butt", "round", "square"][linecap];
context.clearRect(0, 0, width+32, height+32);
createPoint();
@@ -179,7 +198,7 @@ AdvpStyleTemplate {
}
defaultValues: {
- "Version": "1.2.2",
+ "Version": "1.3.0",
"Gradient Style": 0,
"Radial Gradient Settings": {
"Inside Position Color": "#f44336",
@@ -200,8 +219,10 @@ AdvpStyleTemplate {
"Line Width": 1,
"Max Range": 80,
"Data Length": 0,
+ "Line Cap": 0,
"Channel": 2,
"Reverse": false,
+ "Mirror": false,
"Rotate": false,
"Rotation Direction": 0,
"Ratate Speed": 10,
@@ -354,9 +375,17 @@ AdvpStyleTemplate {
model: [64, 32, 16, 8]
}
+ P.SelectPreference {
+ name: "Line Cap"
+ label: qsTr("Line Cap")
+ defaultValue: defaultValues["Line Cap"]
+ model: [qsTr("butt"), qsTr("round"), qsTr("square")]
+ }
+
P.Separator {}
P.SpinPreference {
+ id: _cfg_channel
name: "Channel"
label: qsTr("Channel")
message: "1 to 2"
@@ -368,6 +397,13 @@ AdvpStyleTemplate {
}
P.SwitchPreference {
+ name: "Mirror"
+ label: qsTr("Mirror Spectrum")
+ defaultValue: defaultValues["Mirror"]
+ visible: _cfg_channel.value > 1
+ }
+
+ P.SwitchPreference {
name: "Reverse"
label: qsTr("Reverse Spectrum")
defaultValue: defaultValues["Reverse"]
diff --git a/styles/Preset_line/Style.qml b/styles/Preset_line/Style.qml
index 179059b..b2d367e 100644
--- a/styles/Preset_line/Style.qml
+++ b/styles/Preset_line/Style.qml
@@ -56,6 +56,19 @@ AdvpStyleTemplate {
property real radialGradient_xOffset
property real radialGradient_yOffset
+ property bool centerRotateFlag
+ property bool lineRotateFlag
+ property real centerRotateAngleTangent
+ property real lineRotateAngleTangent
+ property real xOffset
+ property real yOffset
+ property real xScale
+ property real yScale
+
+ property real halfHeight
+ property real _dx
+ property real minv_ratio
+
Canvas {
id: centerLine
anchors.fill: parent
@@ -67,18 +80,28 @@ AdvpStyleTemplate {
context.clearRect(0, 0, width+32, height+32);
context.fillStyle = center_color;
if (vertical_flag) {
- if (linePosition) {
+ if(lineRotateFlag || centerRotateFlag) {
+ context.transform(yScale, lineRotateAngleTangent, -centerRotateAngleTangent, xScale, 2*_y_dy+yOffset*height, xOffset*width-lineRotateAngleTangent*(halfHeight-_y_dy));
+ context.fillRect(halfHeight-_y_dy-center_width/2, 0, center_width, height);
+ context.resetTransform();
+ }
+ else if (linePosition) {
let _y = width/2 + width/2*(3-2*linePosition)*Boolean(linePosition);
context.fillRect(_y+(linePosition-2)*center_width, 0, center_width, height);
} else {
- context.fillRect(width/2-_y_dy-center_width/2, 0, center_width, width);
+ context.fillRect(halfHeight-_y_dy-center_width/2, 0, center_width, height);
}
} else {
- if (linePosition) {
+ if(lineRotateFlag || centerRotateFlag) {
+ context.transform(xScale, centerRotateAngleTangent, -lineRotateAngleTangent, yScale, xOffset*width+lineRotateAngleTangent*(halfHeight-_y_dy), yOffset*height);
+ context.fillRect(0, halfHeight-_y_dy-center_width/2, width, center_width);
+ context.resetTransform();
+ }
+ else if (linePosition) {
let _y = height/2 + height/2*(3-2*linePosition)*Boolean(linePosition);
context.fillRect(0, _y+(linePosition-2)*center_width, width, center_width);
} else {
- context.fillRect(0, height/2-_y_dy-center_width/2, width, center_width);
+ context.fillRect(0, halfHeight-_y_dy-center_width/2, width, center_width);
}
}
}
@@ -93,33 +116,43 @@ AdvpStyleTemplate {
readonly property int uDataLen: Math.pow(2, configs["Data Length"]);
readonly property int dataLength: 64/uDataLen
readonly property int channel: configs["Channel"]
- readonly property bool centerRotateFlag: configs["Rotate Settings"]["Center Enable"]
- readonly property real centerRotateAngleTangent: centerRotateFlag*Math.tan(configs["Rotate Settings"]["Center Angle"]*Math.PI/180)
- readonly property bool lineRotateFlag: configs["Rotate Settings"]["Line Enable"]
- readonly property real lineRotateAngleTangent: lineRotateFlag*Math.tan(configs["Rotate Settings"]["Line Angle"]*Math.PI/180)
+
readonly property bool autoNormalizing: configs["Data Settings"]["Auto Normalizing"]
readonly property real amplitude: 400.0/configs["Data Settings"]["Amplitude"]
readonly property int unitStyle: configs["Data Settings"]["Unit Style"]
- readonly property real xOffset: configs["Rotate Settings"]["X Offset"]/100
- readonly property real yOffset: configs["Rotate Settings"]["Y Offset"]/100
- readonly property real xScale: configs["Rotate Settings"]["X Scale"]/100
- readonly property real yScale: configs["Rotate Settings"]["Y Scale"]/100
-
readonly property real halfWidth: vertical_flag ? height/2 : width/2
- readonly property real halfHeight: vertical_flag ? width/2 : height/2
readonly property int l_start: (channel===1)*dataLength
readonly property int r_stop: dataLength+dataLength*(channel!==0)
readonly property int total: r_stop-l_start
readonly property real _ux: halfWidth*2/(r_stop-l_start)
- readonly property real _dx: Math.round(_ux/2)
+
+ readonly property int linecap: configs["Line Cap"]
+
+ function roundRect(context, x, y, w, h, r, lc) {
+ context.beginPath();
+ context.lineCap=lc;
+ context.lineWidth=r;
+ context.moveTo(x, y);
+ context.lineTo(x+w, y+h);
+ context.stroke();
+ context.closePath();
+ }
+
+ on_UxChanged: {
+ _dx = _ux/2;
+ }
onWidthChanged: {
if (gradientStyle === 1) {
linearGradient.x2 = width*(configs["Linear Gradient Settings"]["Gradient Direction"]!==1);
linearGradient.y2 = height*(configs["Linear Gradient Settings"]["Gradient Direction"]%2);
}
+
+ halfHeight = vertical_flag ? width/2 : height/2;
+ _dx = _ux/2;
+
centerLine.requestPaint();
}
@@ -130,6 +163,10 @@ AdvpStyleTemplate {
linearGradient.x2 = width*(configs["Linear Gradient Settings"]["Gradient Direction"]!==1);
linearGradient.y2 = height*(configs["Linear Gradient Settings"]["Gradient Direction"]%2);
}
+
+ halfHeight = vertical_flag ? width/2 : height/2;
+ _dx = _ux/2;
+
centerLine.requestPaint();
}
@@ -162,6 +199,21 @@ AdvpStyleTemplate {
radialGradient_xOffset = configs["Radial Gradient Settings"]["Center X Offset"];
radialGradient_yOffset = configs["Radial Gradient Settings"]["Center Y Offset"];
}
+
+ centerRotateFlag = configs["Rotate Settings"]["Center Enable"];
+ lineRotateFlag = configs["Rotate Settings"]["Line Enable"];
+ centerRotateAngleTangent = centerRotateFlag*Math.tan(configs["Rotate Settings"]["Center Angle"]*Math.PI/180);
+ lineRotateAngleTangent = lineRotateFlag*Math.tan(configs["Rotate Settings"]["Line Angle"]*Math.PI/180);
+ xOffset = configs["Rotate Settings"]["X Offset"]/100;
+ yOffset = configs["Rotate Settings"]["Y Offset"]/100;
+ xScale = configs["Rotate Settings"]["X Scale"]/100;
+ yScale = configs["Rotate Settings"]["Y Scale"]/100;
+
+ minv_ratio = configs["Initial Point Size"]/100;
+
+ halfHeight = vertical_flag ? width/2 : height/2;
+ _dx = _ux/2;
+
centerLine.requestPaint();
}
@@ -205,14 +257,16 @@ AdvpStyleTemplate {
let _y;
let _dy;
+ let lc = ["butt", "round", "square"][linecap];
if (vertical_flag) {
if(lineRotateFlag || centerRotateFlag) {
context.transform(yScale, lineRotateAngleTangent, -centerRotateAngleTangent, xScale, 2*_y_dy+yOffset*height, xOffset*width-lineRotateAngleTangent*(halfHeight-_y_dy));
- context.fillStyle = line_color;
+ context.strokeStyle = line_color;
for (let i=l_start; i