Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/syd711/vpin-studio
Browse files Browse the repository at this point in the history
  • Loading branch information
leprinco committed Dec 21, 2024
2 parents 0a17b6e + 68172f9 commit e445982
Show file tree
Hide file tree
Showing 20 changed files with 203 additions and 66 deletions.
8 changes: 7 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
## Release Notes 3.11.1

## Bugfixes
- **Tables / PUP Packs**: Fixed wrong order of PUP pack detection when an alias was used.

- **Tables / PUP Packs**: Fixed alias lookups.
- **Tables / ALT Sound**: Added "name" field, fixed alias lookups, fixed "Open Folder" button for alias names.
- **Tables / ALT Color**: Added "name" field and fixed alias lookups, fixed "Open Folder" button for alias names.
- **Tables / VPS Updates**: Fixed filtering issues.
- **Tables / Media Recorder**: Added missing sorting for the "Last Update" column.
- **Backglasses / Sub-folders**: Extract DMD image when backglass is in a sub-folder of tables

## Release Notes 3.11.0

Expand Down
2 changes: 1 addition & 1 deletion resources/vpsdb.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ public interface UIDefaults {

int THUMBNAIL_SIZE = 240;
int SCROLL_OFFSET = 120;

int MAX_REFRESH_COUNT = 3;
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ public AltColor getAltColor(@NonNull Game game) {
String tableName = game.getTableName();

File altColorFolder = null;
if (!StringUtils.isEmpty(rom)) {
if (!StringUtils.isEmpty(game.getRomAlias())) {
altColorFolder = new File(game.getEmulator().getAltColorFolder(), game.getRomAlias());
}
else if (!StringUtils.isEmpty(rom)) {
altColorFolder = new File(game.getEmulator().getAltColorFolder(), rom);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,11 @@ public void setNotes(String notes) {
public boolean isVpxGame() {
return this.emulator.isVpxEmulator();
}

public boolean isFpGame() {
return this.emulator.isFpEmulator();
}

public boolean isFxGame() {
return this.emulator.isFxEmulator();
}
Expand Down Expand Up @@ -301,7 +303,7 @@ public void setFoundTableExit(boolean foundTableExit) {

@JsonIgnore
public File getWheelImage() {
return wheelImageFile;
return wheelImageFile;
}

public void setWheelImage(File wheelFile) {
Expand Down Expand Up @@ -671,6 +673,9 @@ public boolean isAltSoundAvailable() {
@Nullable
@JsonIgnore
public File getAltSoundFolder() {
if (!StringUtils.isEmpty(this.getRomAlias()) && emulator != null) {
return new File(emulator.getAltSoundFolder(), this.getRomAlias());
}
if (!StringUtils.isEmpty(this.getRom()) && emulator != null) {
return new File(emulator.getAltSoundFolder(), this.getRom());
}
Expand All @@ -690,7 +695,10 @@ public File getCfgFile() {
@Nullable
@JsonIgnore
public File getAltColorFolder() {
if (!StringUtils.isEmpty(this.getRom())) {
if (!StringUtils.isEmpty(this.getRomAlias()) && emulator != null) {
return new File(new File(emulator.getMameFolder(), "altcolor"), this.getRomAlias());
}
if (!StringUtils.isEmpty(this.getRom()) && emulator != null) {
return new File(new File(emulator.getMameFolder(), "altcolor"), this.getRom());
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public List<Score> getScores(@NonNull Game game, @NonNull Date createdAt, @NonNu
int i = 1;
for (HighScore score : scores) {
result.add(new Score(createdAt, game.getId(), score.player, null, score.score, score.scoreValue, i));
i++;
}
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ public Comparator<GameRepresentationModel> buildComparator(TableView<GameReprese

if (column.equals(recorderController.columnDisplayName)) {
comp = Comparator.comparing(o -> o.getGame().getGameDisplayName());
}
}
else if (column.equals(recorderController.columnDateModified)) {
comp = Comparator.comparing(o -> o.getGame().getDateUpdated());
}
else {
VPinScreen screen = recorderController.screenFromColumn(column);
if (screen != null) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import de.mephisto.vpin.restclient.PreferenceNames;
import de.mephisto.vpin.restclient.frontend.FrontendType;
import de.mephisto.vpin.restclient.games.*;
import de.mephisto.vpin.restclient.preferences.UISettings;
import de.mephisto.vpin.ui.tables.dialogs.TableDataController;
import de.mephisto.vpin.ui.tables.models.TableStatus;
import de.mephisto.vpin.ui.tables.panels.BaseFilterController;
Expand Down Expand Up @@ -104,13 +105,15 @@ public class TableFilterController extends BaseFilterController<GameRepresentati
private ComboBox<NoteType> notesCombo;

private FilterSettings filterSettings;
private UISettings uiSettings;

private TableOverviewPredicateFactory predicateFactory = new TableOverviewPredicateFactory();


public void applyFilters() {
// as we do not call filterGames() anymore, manually call saveFilterSettings to persist the reset
client.getPreferenceService().setJsonPreference(filterSettings);
uiSettings = client.getPreferenceService().getJsonPreference(PreferenceNames.UI_SETTINGS, UISettings.class);
super.applyFilters();
}

Expand All @@ -127,7 +130,7 @@ protected GameEmulatorRepresentation getEmulatorSelection() {
@Override
public Predicate<GameRepresentationModel> buildPredicate(String searchTerm, PlaylistRepresentation playlist) {
GameEmulatorRepresentation emulatorSelection = getEmulatorSelection();
return predicateFactory.buildPredicate(searchTerm, playlist, emulatorSelection, filterSettings);
return predicateFactory.buildPredicate(searchTerm, playlist, emulatorSelection, filterSettings, uiSettings);
}

protected void resetFilters() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import de.mephisto.vpin.commons.utils.WidgetFactory;
import de.mephisto.vpin.connectors.vps.VPS;
import de.mephisto.vpin.connectors.vps.model.VPSChanges;
import de.mephisto.vpin.connectors.vps.model.VpsDiffTypes;
import de.mephisto.vpin.restclient.PreferenceNames;
import de.mephisto.vpin.restclient.altsound.AltSound;
Expand Down Expand Up @@ -488,7 +489,12 @@ public void onVps() {
@FXML
public void onVpsReset() {
List<GameRepresentation> selectedItems = getSelections();
TableActions.onVpsReset(selectedItems);
onVpsReset(selectedItems);
}

public static void onVpsReset(List<GameRepresentation> selectedItems) {
List<GameRepresentation> collect = selectedItems.stream().filter(g -> !g.getVpsUpdates().isEmpty()).collect(Collectors.toList());
ProgressDialog.createProgressDialog(new VPSResetProgressModel(collect));
}

@FXML
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package de.mephisto.vpin.ui.tables;

import de.mephisto.vpin.connectors.vps.model.VPSChange;
import de.mephisto.vpin.restclient.games.FilterSettings;
import de.mephisto.vpin.restclient.games.GameEmulatorRepresentation;
import de.mephisto.vpin.restclient.games.GameRepresentation;
import de.mephisto.vpin.restclient.games.NoteType;
import de.mephisto.vpin.restclient.games.PlaylistRepresentation;
import de.mephisto.vpin.restclient.preferences.UISettings;
import de.mephisto.vpin.ui.tables.vps.VpsTableColumn;
import org.apache.commons.lang3.StringUtils;

import java.util.function.Predicate;
Expand All @@ -13,7 +16,7 @@ public class TableOverviewPredicateFactory {
/**
* We need a new Predicate each time else TableView does not detect the changes
*/
public Predicate<GameRepresentationModel> buildPredicate(String searchTerm, PlaylistRepresentation playlist, GameEmulatorRepresentation emulator, FilterSettings filterSettings) {
public Predicate<GameRepresentationModel> buildPredicate(String searchTerm, PlaylistRepresentation playlist, GameEmulatorRepresentation emulator, FilterSettings filterSettings, UISettings uiSettings) {
return new Predicate<GameRepresentationModel>() {
@Override
public boolean test(GameRepresentationModel model) {
Expand Down Expand Up @@ -55,9 +58,19 @@ public boolean test(GameRepresentationModel model) {
return false;
}

if (filterSettings.isVpsUpdates() && (game.getVpsUpdates() == null || game.getVpsUpdates().isEmpty())) {
if (filterSettings.isVpsUpdates() && (StringUtils.isEmpty(game.getExtTableId()) || game.getVpsUpdates() == null || game.getVpsUpdates().isEmpty())) {
return false;
}

if (filterSettings.isVpsUpdates() && game.getVpsUpdates() != null) {
for (VPSChange change : game.getVpsUpdates().getChanges()) {
if (!VpsTableColumn.isFiltered(uiSettings, change)) {
continue;
}
return false;
}
}

if (filterSettings.isVersionUpdates() && !game.isUpdateAvailable()) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public class TablesSidebarAltColorController implements Initializable {
@FXML
private Label typeLabel;

@FXML
private Label nameLabel;

@FXML
private Label filesLabel;

Expand Down Expand Up @@ -147,6 +150,7 @@ public void refreshView(Optional<GameRepresentation> g) {

lastModifiedLabel.setText("-");
backupsLabel.setText("-");
nameLabel.setText("-");
typeLabel.setText("-");
filesLabel.setText("-");

Expand All @@ -166,6 +170,8 @@ public void refreshView(Optional<GameRepresentation> g) {
altColor = Studio.client.getAltColorService().getAltColor(game.getId());
lastModifiedLabel.setText(SimpleDateFormat.getDateTimeInstance().format(altColor.getModificationDate()));
typeLabel.setText(altColor.getAltColorType().name());
nameLabel.setText(altColor.getName());
altColor = Studio.client.getAltColorService().getAltColor(game.getId());
backupsLabel.setText(String.valueOf(altColor.getBackedUpFiles()));

List<String> files = altColor.getFiles();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public class TablesSidebarAltSoundController implements Initializable {
@FXML
private Button uploadBtn;

@FXML
private Label nameLabel;

@FXML
private Label entriesLabel;

Expand Down Expand Up @@ -184,6 +187,7 @@ public void refreshView(Optional<GameRepresentation> g) {
uploadBtn.setDisable(true);
deleteBtn.setDisable(true);

nameLabel.setText("-");
entriesLabel.setText("-");
bundleSizeLabel.setText("-");
filesLabel.setText("-");
Expand All @@ -209,6 +213,7 @@ public void refreshView(Optional<GameRepresentation> g) {
restoreBtn.setDisable(!altSoundAvailable);

if (altSoundAvailable) {
nameLabel.setText(altSound.getName());
entriesLabel.setText(String.valueOf(altSound.getEntries().size()));
filesLabel.setText(String.valueOf(altSound.getFiles()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ private void onAltSound() {
GameEmulatorRepresentation emulatorRepresentation = client.getFrontendService().getGameEmulator(this.game.get().getEmulatorId());
File altSoundFolder = new File(emulatorRepresentation.getAltSoundDirectory(), game.get().getRom());
if (!altSoundFolder.exists() && !StringUtils.isEmpty(game.get().getRomAlias())) {
altSoundFolder = new File(altSoundFolder, game.get().getRomAlias());
altSoundFolder = new File(emulatorRepresentation.getAltSoundDirectory(), game.get().getRomAlias());
}
SystemUtil.openFolder(altSoundFolder, new File(emulatorRepresentation.getAltSoundDirectory()));
}
Expand All @@ -296,7 +296,7 @@ private void onAltColor() {
GameEmulatorRepresentation emulatorRepresentation = client.getFrontendService().getGameEmulator(this.game.get().getEmulatorId());
File folder = new File(emulatorRepresentation.getAltColorDirectory(), game.get().getRom());
if (!folder.exists() && !StringUtils.isEmpty(game.get().getRomAlias())) {
folder = new File(folder, game.get().getRomAlias());
folder = new File(emulatorRepresentation.getAltColorDirectory(), game.get().getRomAlias());
}
SystemUtil.openFolder(folder, new File(emulatorRepresentation.getAltColorDirectory()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ public void refreshView(Optional<GameRepresentation> g) {
}

for (PlaylistRepresentation playlist : playlists) {

boolean linkedToEmu = playlist.getEmulatorId() == null || playlist.getEmulatorId() == game.getEmulatorId();

HBox root = new HBox();
Expand All @@ -214,7 +213,8 @@ public void refreshView(Optional<GameRepresentation> g) {
CheckBox gameCheckbox = new CheckBox();
gameCheckbox.setUserData(playlist);
gameCheckbox.setSelected(playlist.containsGame(game.getId()));
gameCheckbox.setDisable(playlist.isSqlPlayList() || !linkedToEmu);
boolean disabled = playlist.isSqlPlayList() || !linkedToEmu;
gameCheckbox.setDisable(disabled);
gameCheckbox.setStyle("-fx-font-size: 14px;-fx-text-fill: white;");

boolean wasPlayed = playlist.wasPlayed(game.getId());
Expand Down Expand Up @@ -311,7 +311,8 @@ public void changed(ObservableValue<? extends Boolean> observableValue, Boolean
}
});

Label name = new Label(playlist.getName());
String playlistTitle = playlist.getName();
Label name = new Label(playlistTitle);
name.setStyle("-fx-font-size: 14px;-fx-text-fill: white;-fx-padding: 0 0 0 6;");
name.setPrefWidth(370);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ private void onTableOpen() {
private void onVpsReset() {
if (!this.game.isEmpty()) {
GameRepresentation gameRepresentation = this.game.get();
TableActions.onVpsReset(Arrays.asList(gameRepresentation));
TableOverviewController.onVpsReset(Arrays.asList(gameRepresentation));
}
}

Expand Down
Loading

0 comments on commit e445982

Please sign in to comment.