Browse Source

- 修改设置布局

- 修改Line样式频谱线上下的位置
- 优化翻译
- 修改翻译文件名
master
mashiros 2 years ago
parent
commit
2e339d7e57
  1. 0
      Locales/ja.qm
  2. 0
      Locales/zh_TW.qm
  3. 98
      package.json
  4. 1
      qml/Main.qml
  5. 31
      qml/StylePreferences.qml
  6. 17
      qml/api/AdvpPreference.qml
  7. 4
      readme.md
  8. 1
      styles/Preset_Ordinal_Scale_UI_bottom/Style.qml
  9. 1
      styles/Preset_circle/Style.qml
  10. 61
      styles/Preset_gradient_line/Style.qml
  11. 68
      styles/Preset_line/Style.qml
  12. 1
      styles/Preset_solidcircle/Style.qml
  13. 1
      styles/Preset_waves/Style.qml

0
Locales/ja_JP.qm → Locales/ja.qm

0
Locales/zh_CN.qm → Locales/zh_TW.qm

98
package.json

@ -1,6 +1,6 @@
{
"name": "top.mashiros.widget.advp",
"version": "1.2.0",
"version": "1.2.1",
"title": {
"en": "ADV Plugin",
@ -54,10 +54,10 @@
"location": "/advp-style-preset/line",
"catalog": "top.mashiros.advp-style",
"title": {
"en": "Preset Line",
"zh": "预置 线",
"zh_TW": "預置 線",
"ja": "プリセット 線"
"en": "Line",
"zh": "线",
"zh_TW": "線",
"ja": "線"
},
"entry": "./styles/Preset_line/Style.qml"
},
@ -65,10 +65,10 @@
"location": "/advp-style-preset/gradient_line",
"catalog": "top.mashiros.advp-style",
"title": {
"en": "Preset Gradient Line",
"zh": "预置 渐变线",
"zh_TW": "預置 漸變線",
"ja": "プリセット グラデーションライン"
"en": "Gradient Line",
"zh": "渐变线",
"zh_TW": "漸變線",
"ja": "グラデーションライン"
},
"entry": "./styles/Preset_gradient_line/Style.qml"
},
@ -76,10 +76,10 @@
"location": "/advp-style-preset/waves",
"catalog": "top.mashiros.advp-style",
"title": {
"en": "Preset Waves",
"zh": "预置 波浪",
"zh_TW": "預置 波浪",
"ja": "プリセット 波浪"
"en": "Waves",
"zh": "波浪",
"zh_TW": "波浪",
"ja": "波浪"
},
"entry": "./styles/Preset_waves/Style.qml"
},
@ -87,10 +87,10 @@
"location": "/advp-style-preset/circle",
"catalog": "top.mashiros.advp-style",
"title": {
"en": "Preset Circle",
"zh": "预置 圆",
"zh_TW": "預置 圓",
"ja": "プリセット 円"
"en": "Circle",
"zh": "圆",
"zh_TW": "圓",
"ja": "円"
},
"entry": "./styles/Preset_circle/Style.qml"
},
@ -98,10 +98,10 @@
"location": "/advp-style-preset/solidcircle",
"catalog": "top.mashiros.advp-style",
"title": {
"en": "Preset Solid-circle",
"zh": "预置 实心圆",
"zh_TW": "預置 實心圓",
"ja": "プリセット 固形円"
"en": "Solid-circle",
"zh": "实心圆",
"zh_TW": "實心圓",
"ja": "固形円"
},
"entry": "./styles/Preset_solidcircle/Style.qml"
},
@ -109,10 +109,10 @@
"location": "/advp-style-preset/ordinal_scale_ui_bottom",
"catalog": "top.mashiros.advp-style",
"title": {
"en": "Preset Ordinal Scale UI bottom",
"zh": "预置 序列之争底部UI",
"zh_TW": "預置 序列之爭底部UI",
"ja": "プリセット オーディナル・スケール- UI 下部"
"en": "Ordinal Scale UI bottom",
"zh": "序列之争底部UI",
"zh_TW": "序列之爭底部UI",
"ja": "オーディナル・スケール- UI 下部"
},
"entry": "./styles/Preset_Ordinal_Scale_UI_bottom/Style.qml"
},
@ -120,10 +120,10 @@
"location": "/preset/advp-style-preset/line",
"catalog": "preset/widget",
"title": {
"en": "ADV Preset Line",
"zh": "ADV预置 线",
"zh_TW": "ADV預置 線",
"ja": "ADVプリセット 線"
"en": "Audio Visualization: Line",
"zh": "音频可视化: 线",
"zh_TW": "音頻可視化: 線",
"ja": "音声視覚化: 線"
},
"preview": "Presets/Line/preview.png",
"entry": "Presets/Line/preset.json"
@ -132,10 +132,10 @@
"location": "/preset/advp-style-preset/gradient_line",
"catalog": "preset/widget",
"title": {
"en": "ADV Preset Gradient Line",
"zh": "ADV预置 渐变线",
"zh_TW": "ADV預置 漸變線",
"ja": "ADVプリセット グラデーションライン"
"en": "Audio Visualization: Gradient Line",
"zh": "音频可视化: 渐变线",
"zh_TW": "音頻可視化: 漸變線",
"ja": "音声視覚化: グラデーションライン"
},
"preview": "Presets/Gradient_Line/preview.png",
"entry": "Presets/Gradient_Line/preset.json"
@ -144,10 +144,10 @@
"location": "/preset/advp-style-preset/waves",
"catalog": "preset/widget",
"title": {
"en": "ADV Preset Waves",
"zh": "ADV预置 波浪",
"zh_TW": "ADV預置 波浪",
"ja": "ADVプリセット 波浪"
"en": "Audio Visualization: Waves",
"zh": "音频可视化: 波浪",
"zh_TW": "音頻可視化: 波浪",
"ja": "音声視覚化: 波浪"
},
"preview": "Presets/Waves/preview.png",
"entry": "Presets/Waves/preset.json"
@ -156,10 +156,10 @@
"location": "/preset/advp-style-preset/circle",
"catalog": "preset/widget",
"title": {
"en": "ADV Preset Circle",
"zh": "ADV预置 圆",
"zh_TW": "ADV預置 圓",
"ja": "ADVプリセット 円"
"en": "Audio Visualization: Circle",
"zh": "音频可视化: 圆",
"zh_TW": "音頻可視化: 圓",
"ja": "音声視覚化: 円"
},
"preview": "Presets/Circle/preview.png",
"entry": "Presets/Circle/preset.json"
@ -168,10 +168,10 @@
"location": "/preset/advp-style-preset/solidcircle",
"catalog": "preset/widget",
"title": {
"en": "ADV Preset Solid-circle",
"zh": "ADV预置 实心圆",
"zh_TW": "ADV預置 實心圓",
"ja": "ADVプリセット 固形円"
"en": "Audio Visualization: Solid-circle",
"zh": "音频可视化: 实心圆",
"zh_TW": "音頻可視化: 實心圓",
"ja": "音声視覚化: 固形円"
},
"preview": "Presets/Solidcircle/preview.png",
"entry": "Presets/Solidcircle/preset.json"
@ -180,10 +180,10 @@
"location": "/preset/advp-style-preset/ordinal_scale_ui_bottom",
"catalog": "preset/widget",
"title": {
"en": "ADV Preset Ordinal Scale UI bottom",
"zh": "ADV预置 序列之争底部UI",
"zh_TW": "ADV預置 序列之爭底部UI",
"ja": "ADVプリセット オーディナル・スケール- UI 下部"
"en": "Audio Visualization: Ordinal Scale UI bottom",
"zh": "音频可视化: 序列之争底部UI",
"zh_TW": "音頻可視化: 序列之爭底部UI",
"ja": "音声視覚化: オーディナル・スケール- UI 下部"
},
"preview": "Presets/Ordinal_Scale_UI_bottom/preview.png",
"entry": "Presets/Ordinal_Scale_UI_bottom/preset.json"

1
qml/Main.qml

@ -40,7 +40,6 @@ T.Widget {
if (!widget.settings[widget.settings.current_style]) {
widget.settings[widget.settings.current_style] = defaultValues;
}else if(widget.settings[widget.settings.current_style]["Version"] !== defaultValues["Version"]) {
delete widget.settings[widget.settings.current_style]["__cfg_height"];
delete widget.settings[widget.settings.current_style]["Version"];
widget.settings[widget.settings.current_style] = Object.assign(defaultValues, widget.settings[widget.settings.current_style]);
}

31
qml/StylePreferences.qml

@ -14,17 +14,10 @@ NVG.Window {
title: qsTr("ADV-Plugin: Settings")
visible: true
minimumWidth: 480
minimumHeight: 580
minimumHeight: 600
width: minimumWidth
height: minimumHeight
Behavior on minimumHeight {
PropertyAnimation {
duration: 500
easing.type: Easing.InOutBack
}
}
property var old_style_cfg
property int last_style_index
@ -34,7 +27,6 @@ NVG.Window {
header: TitleBar {
text: qsTr("Settings")
standardButtons: Dialog.Save | Dialog.Reset
onAccepted: {
@ -72,8 +64,6 @@ NVG.Window {
id: rootPreference
Layout.fillWidth: true
label: qsTr("Configuration")
onPreferenceEdited: {
if (widget.settings.current_style !== Common.stylesURL[styleList.value]) {
widget.settings[widget.settings.current_style] = old_style_cfg;
@ -92,8 +82,11 @@ NVG.Window {
defaultValue: 0
model: Common.styles
}
P.Separator {}
Heading {
id: heading
text: Common.styles[styleList.value] + " " + qsTr("Configuration")
}
P.PreferenceLoader {
id: stylePreferenceLoader
@ -102,21 +95,9 @@ NVG.Window {
onLoaded: {
let cfg = save();
load(widget.settings[widget.settings.current_style]);
window.minimumHeight = cfg["__cfg_height"];
}
onContentItemChanged: {
if(contentItem) {
let index = Common.stylesURL.indexOf(widget.settings.current_style);
if (index === -1)
index = 0;
contentItem.label = Common.styles[index];
}
}
}
P.Separator {}
Component.onCompleted: {
last_style_index = Common.stylesURL.indexOf(widget.settings.current_style);
if (last_style_index === -1) {

17
qml/api/AdvpPreference.qml

@ -2,11 +2,8 @@ import QtQuick 2.12
import QtQuick.Controls 2.12
import NERvGear.Preferences 1.0 as P
P.DialogPreference {
icon.name: "solid:\uf085"
live: true
P.PreferenceGroup {
property string version: ""
property int cfg_height: 580
P.TextFieldPreference {
name: "Version"
@ -14,17 +11,7 @@ P.DialogPreference {
enabled: false
defaultValue: version
}
P.SpinPreference {
name: "__cfg_height"
enabled: false
visible: false
editable: false
from: cfg_height
to: cfg_height
defaultValue: cfg_height
}
ItemDelegate {
text: qsTr("Version")
visible: version

4
readme.md

@ -11,7 +11,7 @@
## 特色
* 整合客户端与服务器端的功能,使用更简单
* 预设4种频谱显示形式,其中每种都可以进一步自定义设置其样式
* 预设6种频谱显示形式,其中每种都可以进一步自定义设置其样式
* 提供了Style的开发接口,供开发者添加更多的可视化样式
* 导入第三方Style类似其他插件,预计支持steam创意工坊下载
* 服务端崩溃后自启动
@ -20,7 +20,7 @@
安装并启用插件后,默认加载第一种预设Style样式。右键挂件可调出菜单,在挂件菜单的挂件名选单中点击Settings选项,呼出Style设置窗口。点击其中的Styles选项可切换不同的Style风格,若此Style提供可配置项,则在Styles选项下方会出现配置界面的入口。
<div align="center"><img src="https://s3.bmp.ovh/imgs/2022/04/15/b62270e9dd574622.png" style="zoom:80%;" /></div>
<div align="center"><img src="https://s3.bmp.ovh/imgs/2022/04/29/c666df5a88a7ab9a.png" style="zoom:80%;" /></div>
# 进阶设置

1
styles/Preset_Ordinal_Scale_UI_bottom/Style.qml

@ -135,7 +135,6 @@ AdvpStyleTemplate {
preference: AdvpPreference {
version: defaultValues["Version"]
cfg_height: 680
P.ColorPreference {
name: "Bass Color"

1
styles/Preset_circle/Style.qml

@ -125,7 +125,6 @@ AdvpStyleTemplate {
preference: AdvpPreference {
version: defaultValues["Version"]
cfg_height: 740
P.ColorPreference {
name: "Main Color"

61
styles/Preset_gradient_line/Style.qml

@ -30,15 +30,13 @@ AdvpStyleTemplate {
readonly property int dataLength: 64/uDataLen
readonly property int channel: configs["Channel"]
readonly property bool centerRotateFlag: configs["Rotate Settings"]["Center Enable"]
readonly property real centerRotateAngle: configs["Rotate Settings"]["Center Angle"]
readonly property real centerRotateAngle: configs["Rotate Settings"]["Center Angle"]*Math.PI/180
readonly property bool lineRotateFlag: configs["Rotate Settings"]["Line Enable"]
readonly property real lineRotateAngle: configs["Rotate Settings"]["Line Angle"]
readonly property real lineRotateAngle: 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"]
property real degUnit: Math.PI / 180
property real halfWidth: width/2
property real halfHeight: height/2
@ -46,7 +44,7 @@ AdvpStyleTemplate {
readonly property int r_stop: dataLength+dataLength*(channel!==0)
readonly property int total: r_stop-l_start
readonly property real _y_dy: centerRotateFlag*Math.tan(centerRotateAngle*degUnit)*halfWidth
readonly property real _y_dy: centerRotateFlag*Math.tan(centerRotateAngle)*halfWidth
readonly property real _ux: width/(r_stop-l_start)
readonly property real _dx: Math.round(_ux/2)
@ -97,26 +95,40 @@ AdvpStyleTemplate {
context.clearRect(0, 0, width+32, height+32);
let _y = halfHeight-_y_dy;
if(lineRotateFlag || centerRotateFlag) {
context.transform(1, centerRotateFlag*centerRotateAngle * degUnit, -lineRotateFlag*lineRotateAngle * degUnit, 1, lineRotateFlag*Math.sin(1.05*lineRotateAngle*degUnit)*_y, 0);
}
if (centerLineFlag) {
context.fillRect(0, _y, width, 2);
}
//
let _y;
let _dy;
for (let i=l_start; i<r_stop; i++) {
_y = halfHeight*(1-(linePosition!==2)*audioData[i])-_y_dy;
_dy = (halfHeight + (!linePosition)*halfHeight)*audioData[i];
context.fillRect(_ux * (i-l_start), _y, _dx, _dy);
}
if (centerRotateFlag || lineRotateFlag)
//
if(lineRotateFlag || centerRotateFlag) {
context.transform(1, Math.sin(centerRotateFlag*centerRotateAngle), -Math.sin(lineRotateFlag*lineRotateAngle), 1, Math.sin(lineRotateFlag*lineRotateAngle)*(halfHeight-_y_dy), 0);
for (let i=l_start; i<r_stop; i++) {
_y = halfHeight*(1-(linePosition!==2)*audioData[i])-_y_dy;
_dy = (halfHeight + (!linePosition)*halfHeight)*audioData[i];
context.fillRect(_ux * (i-l_start), _y, _dx, _dy);
}
if (centerLineFlag) {
context.fillRect(0, halfHeight-_y_dy, width, 2);
}
context.resetTransform();
} else if (linePosition) {
let _flag = 1-2*(linePosition===1);
_y = halfHeight + halfHeight*(3-2*linePosition)*Boolean(linePosition);
for (let i=l_start; i<r_stop; i++) {
_dy = height*audioData[i]*_flag;
context.fillRect(_ux * (i-l_start), _y, _dx, _dy);
}
if (centerLineFlag) {
context.fillRect(0, _y-(2-linePosition)*2, width, 2);
}
} else {
for (let i=l_start; i<r_stop; i++) {
_y = halfHeight*(1-(linePosition!==2)*audioData[i])-_y_dy;
_dy = (halfHeight + (!linePosition)*halfHeight)*audioData[i];
context.fillRect(_ux * (i-l_start), _y, _dx, _dy);
}
if (centerLineFlag) {
context.fillRect(0, halfHeight-_y_dy, width, 2);
}
}
context.fill();
requestPaint();
@ -132,7 +144,7 @@ AdvpStyleTemplate {
}
defaultValues: {
"Version": "1.1.0",
"Version": "1.2.0",
"Gradient Direction": 0,
"Start Position Color": "#f44336",
"Middle Position Color": "#4caf50",
@ -156,7 +168,6 @@ AdvpStyleTemplate {
preference: AdvpPreference {
version: defaultValues["Version"]
cfg_height: 670
P.SelectPreference {
name: "Gradient Direction"

68
styles/Preset_line/Style.qml

@ -15,22 +15,20 @@ AdvpStyleTemplate {
readonly property int dataLength: 64/uDataLen
readonly property int channel: configs["Channel"]
readonly property bool centerRotateFlag: configs["Rotate Settings"]["Center Enable"]
readonly property real centerRotateAngle: configs["Rotate Settings"]["Center Angle"]
readonly property real centerRotateAngle: configs["Rotate Settings"]["Center Angle"]*Math.PI/180
readonly property bool lineRotateFlag: configs["Rotate Settings"]["Line Enable"]
readonly property real lineRotateAngle: configs["Rotate Settings"]["Line Angle"]
readonly property real lineRotateAngle: 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"]
property real degUnit: Math.PI / 180
property real halfWidth: width/2
property real halfHeight: 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 _y_dy: centerRotateFlag*Math.tan(centerRotateAngle*degUnit)*halfWidth
readonly property real _y_dy: centerRotateFlag*Math.tan(centerRotateAngle)*halfWidth
readonly property real _ux: width/(r_stop-l_start)
readonly property real _dx: Math.round(_ux/2)
@ -72,27 +70,46 @@ AdvpStyleTemplate {
context.clearRect(0, 0, width+32, height+32);
let _y = halfHeight-_y_dy;
if(lineRotateFlag || centerRotateFlag) {
context.transform(1, centerRotateFlag*centerRotateAngle * degUnit, -lineRotateFlag*lineRotateAngle * degUnit, 1, lineRotateFlag*Math.sin(1.05*lineRotateAngle*degUnit)*_y, 0);
}
if (centerLineFlag) {
context.fillStyle = center_color;
context.fillRect(0, _y, width, 2);
}
context.fillStyle = line_color;
//
let _y;
let _dy;
for (let i=l_start; i<r_stop; i++) {
_y = halfHeight*(1-(linePosition!==2)*audioData[i])-_y_dy;
_dy = (halfHeight + (!linePosition)*halfHeight)*audioData[i];
context.fillRect(_ux * (i-l_start), _y, _dx, _dy);
}
if (centerRotateFlag || lineRotateFlag)
//
if(lineRotateFlag || centerRotateFlag) {
context.transform(1, Math.sin(centerRotateFlag*centerRotateAngle), -Math.sin(lineRotateFlag*lineRotateAngle), 1, Math.sin(lineRotateFlag*lineRotateAngle)*(halfHeight-_y_dy), 0);
context.fillStyle = line_color;
for (let i=l_start; i<r_stop; i++) {
_y = halfHeight*(1-(linePosition!==2)*audioData[i])-_y_dy;
_dy = (halfHeight + (!linePosition)*halfHeight)*audioData[i];
context.fillRect(_ux * (i-l_start), _y, _dx, _dy);
}
if (centerLineFlag) {
context.fillStyle = center_color;
context.fillRect(0, halfHeight-_y_dy, width, 2);
}
context.resetTransform();
} else if (linePosition) {
let _flag = 1-2*(linePosition===1);
_y = halfHeight + halfHeight*(3-2*linePosition)*Boolean(linePosition);
context.fillStyle = line_color;
for (let i=l_start; i<r_stop; i++) {
_dy = height*audioData[i]*_flag;
context.fillRect(_ux * (i-l_start), _y, _dx, _dy);
}
if (centerLineFlag) {
context.fillStyle = center_color;
context.fillRect(0, _y-(2-linePosition)*2, width, 2);
}
} else {
context.fillStyle = line_color;
for (let i=l_start; i<r_stop; i++) {
_y = halfHeight*(1-(linePosition!==2)*audioData[i])-_y_dy;
_dy = (halfHeight + (!linePosition)*halfHeight)*audioData[i];
context.fillRect(_ux * (i-l_start), _y, _dx, _dy);
}
if (centerLineFlag) {
context.fillStyle = center_color;
context.fillRect(0, halfHeight-_y_dy, width, 2);
}
}
context.fill();
requestPaint();
@ -106,7 +123,7 @@ AdvpStyleTemplate {
}
defaultValues: {
"Version": "1.1.0",
"Version": "1.2.0",
"Center Line": true,
"Center Color": "#ff4500",
"Line Color": "#ff4500",
@ -128,7 +145,6 @@ AdvpStyleTemplate {
preference: AdvpPreference {
version: defaultValues["Version"]
cfg_height: 580
P.SwitchPreference {
id: _cfg_preset_line_Center_Line

1
styles/Preset_solidcircle/Style.qml

@ -141,7 +141,6 @@ AdvpStyleTemplate {
preference: AdvpPreference {
version: defaultValues["Version"]
cfg_height: 740
P.ColorPreference {
name: "Main Color"

1
styles/Preset_waves/Style.qml

@ -98,7 +98,6 @@ AdvpStyleTemplate {
preference: AdvpPreference {
version: defaultValues["Version"]
cfg_height: 500
P.SliderPreference {
name: "Line Width"

Loading…
Cancel
Save