You can now press enter in the "Game..." text field to start a search.

This commit is contained in:
Jeddunk 2020-08-30 16:15:46 +02:00
parent 8c23ae27e8
commit 7d9514abae
2 changed files with 18 additions and 10 deletions

View File

@ -21,6 +21,7 @@ import javafx.concurrent.Service;
import javafx.concurrent.Task; import javafx.concurrent.Task;
import javafx.event.Event; import javafx.event.Event;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.input.KeyCode; import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent; import javafx.scene.input.KeyEvent;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
@ -40,17 +41,15 @@ import util.SteamAppsListCache;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URL;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.nio.file.StandardCopyOption; import java.nio.file.StandardCopyOption;
import java.util.List; import java.util.*;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.stream.Stream; import java.util.stream.Stream;
public class Controller { public class Controller implements Initializable {
private static final String REGEX = "(?<steamApiDll>steam_api(?:64)?.dll)$"; private static final String REGEX = "(?<steamApiDll>steam_api(?:64)?.dll)$";
public Label creamApiDllApplied; public Label creamApiDllApplied;
@ -111,8 +110,15 @@ public class Controller {
} }
@FXML @FXML
public void initialize() { @Override
public void initialize(URL location, ResourceBundle resources) {
appId_textfield.textProperty().addListener(appIdChangesGameName()); appId_textfield.textProperty().addListener(appIdChangesGameName());
game_name_textfield.setOnKeyReleased(event -> {
KeyCode code = event.getCode();
if (code.equals(KeyCode.ENTER)) {
getAppId();
}
});
language_combobox.setItems(FXCollections.observableArrayList(config.getLanguages())); language_combobox.setItems(FXCollections.observableArrayList(config.getLanguages()));
language_combobox.setTooltip(new Tooltip()); language_combobox.setTooltip(new Tooltip());
language_combobox.setEditable(false); language_combobox.setEditable(false);
@ -286,7 +292,6 @@ public class Controller {
} }
public void getAppId() { public void getAppId() {
//final App game = cache.findGame(game_name_textfield.getText());
final List<App> games = cache.findListOfGames(game_name_textfield.getText()); final List<App> games = cache.findListOfGames(game_name_textfield.getText());
if (games.isEmpty()) { if (games.isEmpty()) {
appId_textfield.setText("-1"); appId_textfield.setText("-1");
@ -306,7 +311,6 @@ public class Controller {
Stage stage = new Stage(); Stage stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL); stage.initModality(Modality.APPLICATION_MODAL);
stage.setResizable(false); stage.setResizable(false);
//stage.initStyle(StageStyle.UNDECORATED);
stage.setTitle("Choose game..."); stage.setTitle("Choose game...");
stage.setScene(new Scene(root1)); stage.setScene(new Scene(root1));
stage.show(); stage.show();

View File

@ -14,6 +14,7 @@
*/ */
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.control.cell.TreeItemPropertyValueFactory; import javafx.scene.control.cell.TreeItemPropertyValueFactory;
import javafx.scene.input.MouseButton; import javafx.scene.input.MouseButton;
@ -21,9 +22,11 @@ import javafx.scene.input.MouseEvent;
import javafx.stage.Stage; import javafx.stage.Stage;
import pojo.App; import pojo.App;
import java.net.URL;
import java.util.List; import java.util.List;
import java.util.ResourceBundle;
public class SearchResultWindowController { public class SearchResultWindowController implements Initializable {
@FXML @FXML
public Button okButton; public Button okButton;
@ -45,7 +48,8 @@ public class SearchResultWindowController {
} }
@FXML @FXML
public void initialize() { @Override
public void initialize(URL location, ResourceBundle resources) {
} }
public void initMe(List<App> games) { public void initMe(List<App> games) {