Skip to content

Commit

Permalink
fix. disable install button when showing all games.
Browse files Browse the repository at this point in the history
  • Loading branch information
adelolmo committed Jan 24, 2018
1 parent 617d0fa commit e4de5b9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 24 deletions.
21 changes: 3 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,37 +40,22 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.1</version>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
<version>2.6</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>retrofit</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>converter-gson</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.4</version>
<version>1.5</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void setLibraryDirectory(String libraryDirectory) {
protected Task<List<GameView>> createTask() {
return new Task<List<GameView>>() {
@Override
protected List<GameView> call() throws Exception {
protected List<GameView> call() {
final List<GameView> list = new ArrayList<>();

if (libraryDir != null && new File(libraryDir).exists()) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/ado/psplib/install/InstallGameService.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.List;

import static java.lang.String.format;
Expand Down Expand Up @@ -69,7 +70,7 @@ protected GameView call() throws Exception {
);
try {
final int statusCode = extractProcess.waitFor();
final String input = IOUtils.toString(extractProcess.getInputStream());
final String input = IOUtils.toString(extractProcess.getInputStream(), StandardCharsets.UTF_8);
if (statusCode > 0 || input.startsWith("Usage")) {
LOGGER.error("Unable to extract CSO file into ISO. Cause: " + input);
throw new IOException(format("Unable to extract CSO file %s into ISO.", csoFile.getAbsolutePath()));
Expand Down
12 changes: 8 additions & 4 deletions src/main/java/org/ado/psplib/view/AppPresenter.java
Original file line number Diff line number Diff line change
Expand Up @@ -342,11 +342,15 @@ public void myGames() {
}

public void allGames() {
installButton.setText("Install");
installButton.setDisable(true);
uninstallButton.setDisable(true);
gamePane.setVisible(false);
statusLabel.setText("");
gameViewObservableList.setAll(fullGameList);
gamesListView.setOnMouseClicked(event -> {
final ObservableList<GameView> selectedItems = gamesListView.getSelectionModel().getSelectedItems();
gamePane.setVisible(false);
if (!selectedItems.isEmpty()) {
gamePane.setVisible(true);

Expand All @@ -356,9 +360,6 @@ public void allGames() {
genreLabel.setText(String.join(", ", (CharSequence[]) gameView.game().genres()));
scoreLabel.setText(String.valueOf(gameView.game().score()) + "/100");
loadGameImage(gameView.game().cover());

} else {
gamePane.setVisible(false);
}
});
}
Expand Down Expand Up @@ -395,7 +396,10 @@ private EventHandler<MouseEvent> onClickMyGames() {
if (isInstalled) {
uninstallButton.setDisable(false);
} else {
installButton.setText(format("Install (%d)", selectedItems.size()));
installButton.setText("Install");
if (selectedItems.size() > 1) {
installButton.setText(format("Install (%d)", selectedItems.size()));
}
installButton.setDisable(false);
}
} else {
Expand Down

0 comments on commit e4de5b9

Please sign in to comment.