Skip to content

Commit

Permalink
code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmm committed Nov 26, 2024
1 parent d96a847 commit 3756941
Show file tree
Hide file tree
Showing 16 changed files with 65 additions and 65 deletions.
4 changes: 2 additions & 2 deletions src/contents/ui/Autogain.qml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import "Common.js" as Common
import EEtagsPluginName
import QtQuick
import QtQuick.Controls as Controls
import QtQuick.Layouts
import ee.database as DB
import ee.tags.plugin.name as TagsPluginName
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard

Expand Down Expand Up @@ -287,7 +287,7 @@ Kirigami.ScrollablePage {

footer: RowLayout {
Controls.Label {
text: i18n("Using %1", EEtagsPluginPackage.ebur128)
text: i18n("Using %1", TagsPluginName.EEtagsPluginPackage.ebur128)
horizontalAlignment: Qt.AlignLeft
verticalAlignment: Qt.AlignVCenter
Layout.fillWidth: false
Expand Down
4 changes: 2 additions & 2 deletions src/contents/ui/BassEnhancer.qml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import "Common.js" as Common
import EEtagsPluginName
import QtQuick
import QtQuick.Controls as Controls
import QtQuick.Layouts
import ee.database as DB
import ee.tags.plugin.name as TagsPluginName
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard

Expand Down Expand Up @@ -190,7 +190,7 @@ Kirigami.ScrollablePage {

footer: RowLayout {
Controls.Label {
text: i18n("Using %1", EEtagsPluginPackage.calf)
text: i18n("Using %1", TagsPluginName.EEtagsPluginPackage.calf)
horizontalAlignment: Qt.AlignLeft
verticalAlignment: Qt.AlignVCenter
Layout.fillWidth: false
Expand Down
4 changes: 2 additions & 2 deletions src/contents/ui/Compressor.qml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import "Common.js" as Common
import EEtagsPluginName
import QtQuick
import QtQuick.Controls as Controls
import QtQuick.Layouts
import ee.database as DB
import ee.pipewire as PW
import ee.tags.plugin.name as TagsPluginName
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard

Expand Down Expand Up @@ -815,7 +815,7 @@ Kirigami.ScrollablePage {

footer: RowLayout {
Controls.Label {
text: i18n("Using %1", EEtagsPluginPackage.lsp)
text: i18n("Using %1", TagsPluginName.EEtagsPluginPackage.lsp)
horizontalAlignment: Qt.AlignLeft
verticalAlignment: Qt.AlignVCenter
Layout.fillWidth: false
Expand Down
4 changes: 2 additions & 2 deletions src/contents/ui/Crystalizer.qml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import "Common.js" as Common
import EEtagsPluginName
import QtQuick
import QtQuick.Controls as Controls
import QtQuick.Layouts
import ee.database as DB
import ee.tags.plugin.name as TagsPluginName
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard

Expand Down Expand Up @@ -71,7 +71,7 @@ Kirigami.ScrollablePage {

footer: RowLayout {
Controls.Label {
text: i18n("Using %1", EEtagsPluginPackage.zita)
text: i18n("Using %1", TagsPluginName.EEtagsPluginPackage.zita)
horizontalAlignment: Qt.AlignLeft
verticalAlignment: Qt.AlignVCenter
Layout.fillWidth: false
Expand Down
4 changes: 2 additions & 2 deletions src/contents/ui/Exciter.qml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import "Common.js" as Common
import EEtagsPluginName
import QtQuick
import QtQuick.Controls as Controls
import QtQuick.Layouts
import ee.database as DB
import ee.tags.plugin.name as TagsPluginName
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard

Expand Down Expand Up @@ -190,7 +190,7 @@ Kirigami.ScrollablePage {

footer: RowLayout {
Controls.Label {
text: i18n("Using %1", EEtagsPluginPackage.calf)
text: i18n("Using %1", TagsPluginName.EEtagsPluginPackage.calf)
horizontalAlignment: Qt.AlignLeft
verticalAlignment: Qt.AlignVCenter
Layout.fillWidth: false
Expand Down
4 changes: 2 additions & 2 deletions src/contents/ui/Filter.qml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import "Common.js" as Common
import EEtagsPluginName
import QtQuick
import QtQuick.Controls as Controls
import QtQuick.Layouts
import ee.database as DB
import ee.tags.plugin.name as TagsPluginName
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard

Expand Down Expand Up @@ -197,7 +197,7 @@ Kirigami.ScrollablePage {

footer: RowLayout {
Controls.Label {
text: i18n("Using %1", EEtagsPluginPackage.lsp)
text: i18n("Using %1", TagsPluginName.EEtagsPluginPackage.lsp)
horizontalAlignment: Qt.AlignLeft
verticalAlignment: Qt.AlignVCenter
Layout.fillWidth: false
Expand Down
4 changes: 2 additions & 2 deletions src/contents/ui/Gate.qml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import "Common.js" as Common
import EEtagsPluginName
import QtQuick
import QtQuick.Controls as Controls
import QtQuick.Layouts
import ee.database as DB
import ee.pipewire as PW
import ee.tags.plugin.name as TagsPluginName
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard

Expand Down Expand Up @@ -911,7 +911,7 @@ Kirigami.ScrollablePage {

footer: RowLayout {
Controls.Label {
text: i18n("Using %1", EEtagsPluginPackage.lsp)
text: i18n("Using %1", TagsPluginName.EEtagsPluginPackage.lsp)
horizontalAlignment: Qt.AlignLeft
verticalAlignment: Qt.AlignVCenter
Layout.fillWidth: false
Expand Down
4 changes: 2 additions & 2 deletions src/contents/ui/Limiter.qml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import "Common.js" as Common
import EEtagsPluginName
import QtQuick
import QtQuick.Controls as Controls
import QtQuick.Layouts
import ee.database as DB
import ee.pipewire as PW
import ee.tags.plugin.name as TagsPluginName
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard

Expand Down Expand Up @@ -493,7 +493,7 @@ Kirigami.ScrollablePage {

footer: RowLayout {
Controls.Label {
text: i18n("Using %1", EEtagsPluginPackage.lsp)
text: i18n("Using %1", TagsPluginName.EEtagsPluginPackage.lsp)
horizontalAlignment: Qt.AlignLeft
verticalAlignment: Qt.AlignVCenter
Layout.fillWidth: false
Expand Down
4 changes: 2 additions & 2 deletions src/contents/ui/Maximizer.qml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import "Common.js" as Common
import EEtagsPluginName
import QtQuick
import QtQuick.Controls as Controls
import QtQuick.Layouts
import ee.database as DB
import ee.tags.plugin.name as TagsPluginName
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard

Expand Down Expand Up @@ -102,7 +102,7 @@ Kirigami.ScrollablePage {

footer: RowLayout {
Controls.Label {
text: i18n("Using %1", EEtagsPluginPackage.zam)
text: i18n("Using %1", TagsPluginName.EEtagsPluginPackage.zam)
horizontalAlignment: Qt.AlignLeft
verticalAlignment: Qt.AlignVCenter
Layout.fillWidth: false
Expand Down
12 changes: 6 additions & 6 deletions src/contents/ui/MenuAddPlugins.qml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import "Common.js" as Common
import EEtagsPluginName
import QtCore
import QtQuick
import QtQuick.Controls as Controls
import QtQuick.Dialogs
import QtQuick.Layouts
import ee.tags.plugin.name as TagsPluginName
import org.kde.kirigami as Kirigami

Kirigami.OverlaySheet {
Expand Down Expand Up @@ -32,7 +32,7 @@ Kirigami.OverlaySheet {
clip: true
delegate: listDelegate
reuseItems: true
model: SortedPluginsNameModel
model: TagsPluginName.SortedPluginsNameModel

Kirigami.PlaceholderMessage {
anchors.centerIn: parent
Expand Down Expand Up @@ -100,8 +100,8 @@ Kirigami.OverlaySheet {
the second to last position. The reason is that we still want to preserve the
"limiter protection" in case the last plugins are a limiter followed by a meter.
*/
const limiters_and_meters = [BasePluginName.limiter, BasePluginName.maximizer, BasePluginName.level_meter];
const limiters = [BasePluginName.limiter, BasePluginName.maximizer];
const limiters_and_meters = [TagsPluginName.BasePluginName.limiter, TagsPluginName.BasePluginName.maximizer, TagsPluginName.BasePluginName.level_meter];
const limiters = [TagsPluginName.BasePluginName.limiter, TagsPluginName.BasePluginName.maximizer];
if (plugins.length === 0) {
plugins.push(new_name);
} else if (limiters_and_meters.some((v) => {
Expand All @@ -112,7 +112,7 @@ Kirigami.OverlaySheet {
return plugins[plugins.length - 1].startsWith(v);
})) {
plugins.splice(-1, 0, new_name);
} else if (plugins[plugins.length - 1].startsWith(BasePluginName.level_meter)) {
} else if (plugins[plugins.length - 1].startsWith(TagsPluginName.BasePluginName.level_meter)) {
if (plugins.length >= 2) {
if (limiters.some((v) => {
return plugins[plugins.length - 2].startsWith(v);
Expand Down Expand Up @@ -144,7 +144,7 @@ Kirigami.OverlaySheet {
Layout.fillWidth: true
placeholderText: i18n("Search")
onAccepted: {
SortedPluginsNameModel.filterRegularExpression = RegExp(search.text, "i");
TagsPluginName.SortedPluginsNameModel.filterRegularExpression = RegExp(search.text, "i");
}
}

Expand Down
32 changes: 16 additions & 16 deletions src/contents/ui/PageStreamsEffects.qml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import "Common.js" as Common
import EEtagsPluginName
import QtCharts
import QtQuick
import QtQuick.Controls as Controls
import QtQuick.Layouts
import ee.database as DB
import ee.pipewire as PW
import ee.tags.plugin.name as TagsPluginName
import org.kde.kirigami as Kirigami

Kirigami.Page {
Expand Down Expand Up @@ -49,7 +49,7 @@ Kirigami.Page {

clip: true
reuseItems: true
model: pageType === 0 ? ModelOutputStreams : ModelInputStreams
model: pageType === 0 ? PW.ModelOutputStreams : PW.ModelInputStreams

Kirigami.PlaceholderMessage {
anchors.centerIn: parent
Expand All @@ -74,14 +74,14 @@ Kirigami.Page {

GridLayout {
function populatePluginsListModel(plugins) {
let baseNames = PluginsNameModel.getBaseNames();
let baseNames = TagsPluginName.PluginsNameModel.getBaseNames();
for (let n = 0; n < plugins.length; n++) {
for (let k = 0; k < baseNames.length; k++) {
if (plugins[n].startsWith(baseNames[k])) {
pluginsListModel.append({
"name": plugins[n],
"baseName": baseNames[k],
"translatedName": PluginsNameModel.translate(baseNames[k]),
"translatedName": TagsPluginName.PluginsNameModel.translate(baseNames[k]),
"bypass": false
});
break;
Expand All @@ -92,87 +92,87 @@ Kirigami.Page {

function createPluginStack(name, baseName, pluginDB) {
switch (baseName) {
case BasePluginName.autogain:
case TagsPluginName.BasePluginName.autogain:
while (pluginsStack.depth > 1)pluginsStack.pop()
pluginsStack.push("qrc:ui/Autogain.qml", {
"name": name,
"pluginDB": pluginDB,
"pipelineInstance": pipelineInstance
});
break;
case BasePluginName.bassEnhancer:
case TagsPluginName.BasePluginName.bassEnhancer:
while (pluginsStack.depth > 1)pluginsStack.pop()
pluginsStack.push("qrc:ui/BassEnhancer.qml", {
"name": name,
"pluginDB": pluginDB,
"pipelineInstance": pipelineInstance
});
break;
case BasePluginName.compressor:
case TagsPluginName.BasePluginName.compressor:
while (pluginsStack.depth > 1)pluginsStack.pop()
pluginsStack.push("qrc:ui/Compressor.qml", {
"name": name,
"pluginDB": pluginDB,
"pipelineInstance": pipelineInstance
});
break;
case BasePluginName.crystalizer:
case TagsPluginName.BasePluginName.crystalizer:
while (pluginsStack.depth > 1)pluginsStack.pop()
pluginsStack.push("qrc:ui/Crystalizer.qml", {
"name": name,
"pluginDB": pluginDB,
"pipelineInstance": pipelineInstance
});
break;
case BasePluginName.exciter:
case TagsPluginName.BasePluginName.exciter:
while (pluginsStack.depth > 1)pluginsStack.pop()
pluginsStack.push("qrc:ui/Exciter.qml", {
"name": name,
"pluginDB": pluginDB,
"pipelineInstance": pipelineInstance
});
break;
case BasePluginName.filter:
case TagsPluginName.BasePluginName.filter:
while (pluginsStack.depth > 1)pluginsStack.pop()
pluginsStack.push("qrc:ui/Filter.qml", {
"name": name,
"pluginDB": pluginDB,
"pipelineInstance": pipelineInstance
});
break;
case BasePluginName.gate:
case TagsPluginName.BasePluginName.gate:
while (pluginsStack.depth > 1)pluginsStack.pop()
pluginsStack.push("qrc:ui/Gate.qml", {
"name": name,
"pluginDB": pluginDB,
"pipelineInstance": pipelineInstance
});
break;
case BasePluginName.limiter:
case TagsPluginName.BasePluginName.limiter:
while (pluginsStack.depth > 1)pluginsStack.pop()
pluginsStack.push("qrc:ui/Limiter.qml", {
"name": name,
"pluginDB": pluginDB,
"pipelineInstance": pipelineInstance
});
break;
case BasePluginName.maximizer:
case TagsPluginName.BasePluginName.maximizer:
while (pluginsStack.depth > 1)pluginsStack.pop()
pluginsStack.push("qrc:ui/Maximizer.qml", {
"name": name,
"pluginDB": pluginDB,
"pipelineInstance": pipelineInstance
});
break;
case BasePluginName.speex:
case TagsPluginName.BasePluginName.speex:
while (pluginsStack.depth > 1)pluginsStack.pop()
pluginsStack.push("qrc:ui/Speex.qml", {
"name": name,
"pluginDB": pluginDB,
"pipelineInstance": pipelineInstance
});
break;
case BasePluginName.stereoTools:
case TagsPluginName.BasePluginName.stereoTools:
while (pluginsStack.depth > 1)pluginsStack.pop()
pluginsStack.push("qrc:ui/StereoTools.qml", {
"name": name,
Expand All @@ -196,7 +196,7 @@ Kirigami.Page {
pluginsListView.currentIndex = streamDB.plugins.findIndex((v) => {
return v == streamDB.visiblePlugin;
});
let baseNames = PluginsNameModel.getBaseNames();
let baseNames = TagsPluginName.PluginsNameModel.getBaseNames();
for (let k = 0; k < baseNames.length; k++) {
if (streamDB.visiblePlugin.startsWith(baseNames[k])) {
createPluginStack(streamDB.visiblePlugin, baseNames[k], pluginsDB[streamDB.visiblePlugin]);
Expand Down
Loading

0 comments on commit 3756941

Please sign in to comment.