add option to delete frontend tracks

This commit is contained in:
Downforce Agent 2024-07-21 15:50:09 -05:00
parent 07e98b12df
commit 47159b6efb
2 changed files with 54 additions and 10 deletions

View File

@ -3,7 +3,7 @@
<grid id="27dc6" binding="frameContainer" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="27dc6" binding="frameContainer" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/> <margin top="10" left="10" bottom="10" right="10"/>
<constraints> <constraints>
<xy x="20" y="20" width="756" height="460"/> <xy x="20" y="20" width="771" height="460"/>
</constraints> </constraints>
<properties> <properties>
<background color="-15128227"/> <background color="-15128227"/>
@ -291,7 +291,7 @@
<color color="-1"/> <color color="-1"/>
</border> </border>
<children> <children>
<grid id="6168c" layout-manager="GridLayoutManager" row-count="7" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="6168c" layout-manager="GridLayoutManager" row-count="7" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/> <margin top="0" left="0" bottom="0" right="0"/>
<constraints> <constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@ -313,7 +313,7 @@
</component> </component>
<component id="74c7a" class="javax.swing.JLabel"> <component id="74c7a" class="javax.swing.JLabel">
<constraints> <constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> <grid row="4" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties> <properties>
<font name="Exo 2"/> <font name="Exo 2"/>
@ -323,7 +323,7 @@
</component> </component>
<component id="1fda4" class="javax.swing.JLabel" binding="dSTitle"> <component id="1fda4" class="javax.swing.JLabel" binding="dSTitle">
<constraints> <constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> <grid row="1" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties> <properties>
<font name="Exo 2" style="2"/> <font name="Exo 2" style="2"/>
@ -333,7 +333,7 @@
</component> </component>
<component id="99b42" class="javax.swing.JLabel" binding="dMTitle"> <component id="99b42" class="javax.swing.JLabel" binding="dMTitle">
<constraints> <constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> <grid row="5" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties> <properties>
<font name="Exo 2" style="2"/> <font name="Exo 2" style="2"/>
@ -343,7 +343,7 @@
</component> </component>
<component id="c11e8" class="javax.swing.JLabel" binding="dSSize"> <component id="c11e8" class="javax.swing.JLabel" binding="dSSize">
<constraints> <constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> <grid row="2" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties> <properties>
<font name="Exo 2" style="2"/> <font name="Exo 2" style="2"/>
@ -353,7 +353,7 @@
</component> </component>
<component id="8480f" class="javax.swing.JLabel" binding="dMSize"> <component id="8480f" class="javax.swing.JLabel" binding="dMSize">
<constraints> <constraints>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> <grid row="6" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties> <properties>
<font name="Exo 2" style="2"/> <font name="Exo 2" style="2"/>
@ -363,9 +363,35 @@
</component> </component>
<vspacer id="73ce0"> <vspacer id="73ce0">
<constraints> <constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="3" indent="0" use-parent-layout="false"/> <grid row="3" column="0" row-span="1" col-span="3" vsize-policy="6" hsize-policy="1" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
</vspacer> </vspacer>
<component id="6ab1b" class="javax.swing.JButton" binding="spDeleteBtn">
<constraints>
<grid row="0" column="1" row-span="1" col-span="2" vsize-policy="1" hsize-policy="1" anchor="5" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-2271221"/>
<borderPainted value="false"/>
<focusPainted value="false"/>
<foreground color="-1"/>
<text value="Remove"/>
<visible value="false"/>
</properties>
</component>
<component id="9d8a0" class="javax.swing.JButton" binding="mpDeleteBtn">
<constraints>
<grid row="4" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="1" anchor="5" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-2271221"/>
<borderPainted value="false"/>
<focusPainted value="false"/>
<foreground color="-1"/>
<text value="Remove"/>
<visible value="false"/>
</properties>
</component>
</children> </children>
</grid> </grid>
</children> </children>

View File

@ -71,7 +71,9 @@ public class Suggs implements ActionListener, ListSelectionListener {
private JLabel dSSize; private JLabel dSSize;
private JLabel dMSize; private JLabel dMSize;
private JCheckBox checkAdditive; private JCheckBox checkAdditive;
private Scooter progressDialog; private JButton spDeleteBtn;
private JButton mpDeleteBtn;
private Scooter progressDialog;
JFrame parent; JFrame parent;
int curIndex = -1; int curIndex = -1;
@ -130,6 +132,8 @@ public class Suggs implements ActionListener, ListSelectionListener {
fArtist.addActionListener(this); // also update field when new item selected fArtist.addActionListener(this); // also update field when new item selected
frontendMainChooseBtn.addActionListener(this); // file picker for singleplayer campaign grid music frontendMainChooseBtn.addActionListener(this); // file picker for singleplayer campaign grid music
frontendDemoChooseBtn.addActionListener(this); // file picker for multiplayer lobby music frontendDemoChooseBtn.addActionListener(this); // file picker for multiplayer lobby music
spDeleteBtn.addActionListener(this);
mpDeleteBtn.addActionListener(this);
dSongList.addListSelectionListener(this); dSongList.addListSelectionListener(this);
frame.addWindowListener(new WindowAdapter() { frame.addWindowListener(new WindowAdapter() {
@ -201,7 +205,19 @@ public class Suggs implements ActionListener, ListSelectionListener {
save(); save();
} }
} }
} } else
if (actionEvent.getSource() == spDeleteBtn) {
dSTitle.setText("no track");
dSSize.setText("no size");
sptrack = null;
spDeleteBtn.setVisible(false);
} else
if (actionEvent.getSource() == mpDeleteBtn) {
dMTitle.setText("no track");
dMSize.setText("no size");
mptrack = null;
mpDeleteBtn.setVisible(false);
}
} }
@Override @Override
@ -320,6 +336,7 @@ public class Suggs implements ActionListener, ListSelectionListener {
if (selectedFile.length() > 1048575) { if (selectedFile.length() > 1048575) {
dSSize.setText((selectedFile.length() / 1048576) + " MB"); dSSize.setText((selectedFile.length() / 1048576) + " MB");
} }
spDeleteBtn.setVisible(true);
} }
} }
@ -331,6 +348,7 @@ public class Suggs implements ActionListener, ListSelectionListener {
mptrack = selectedFile; mptrack = selectedFile;
dMTitle.setText(selectedFile.getName()); dMTitle.setText(selectedFile.getName());
dMSize.setText((selectedFile.length() / 1000) + "kb"); dMSize.setText((selectedFile.length() / 1000) + "kb");
mpDeleteBtn.setVisible(true);
} }
} }