mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 15:10:44 +01:00
Add addSceneKeyEventHandler and checkForCorrectOSArchitecture methods
This commit is contained in:
parent
b87d4cc540
commit
8a266b16bb
1 changed files with 55 additions and 46 deletions
|
@ -200,6 +200,39 @@ public class BisqApp extends Application {
|
|||
event.consume();
|
||||
stop();
|
||||
});
|
||||
addSceneKeyEventHandler();
|
||||
|
||||
// configure the primary stage
|
||||
primaryStage.setTitle(bisqEnvironment.getRequiredProperty(AppOptionKeys.APP_NAME_KEY));
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.setMinWidth(1020);
|
||||
primaryStage.setMinHeight(620);
|
||||
|
||||
// on windows the title icon is also used as task bar icon in a larger size
|
||||
// on Linux no title icon is supported but also a large task bar icon is derived from that title icon
|
||||
String iconPath;
|
||||
if (Utilities.isOSX())
|
||||
iconPath = ImageUtil.isRetina() ? "/images/window_icon@2x.png" : "/images/window_icon.png";
|
||||
else if (Utilities.isWindows())
|
||||
iconPath = "/images/task_bar_icon_windows.png";
|
||||
else
|
||||
iconPath = "/images/task_bar_icon_linux.png";
|
||||
|
||||
primaryStage.getIcons().add(new Image(getClass().getResourceAsStream(iconPath)));
|
||||
|
||||
// make the UI visible
|
||||
primaryStage.show();
|
||||
|
||||
checkForCorrectOSArchitecture();
|
||||
UserThread.runPeriodically(() -> Profiler.printSystemLoad(log), LOG_MEMORY_PERIOD_MIN, TimeUnit.MINUTES);
|
||||
} catch (Throwable throwable) {
|
||||
log.error("Error during app init", throwable);
|
||||
showErrorPopup(throwable, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void addSceneKeyEventHandler() {
|
||||
scene.addEventHandler(KeyEvent.KEY_RELEASED, keyEvent -> {
|
||||
Utilities.isAltOrCtrlPressed(KeyCode.W, keyEvent);
|
||||
if (Utilities.isCtrlPressed(KeyCode.W, keyEvent) ||
|
||||
|
@ -236,43 +269,6 @@ public class BisqApp extends Application {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
// configure the primary stage
|
||||
primaryStage.setTitle(bisqEnvironment.getRequiredProperty(AppOptionKeys.APP_NAME_KEY));
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.setMinWidth(1020);
|
||||
primaryStage.setMinHeight(620);
|
||||
|
||||
// on windows the title icon is also used as task bar icon in a larger size
|
||||
// on Linux no title icon is supported but also a large task bar icon is derived from that title icon
|
||||
String iconPath;
|
||||
if (Utilities.isOSX())
|
||||
iconPath = ImageUtil.isRetina() ? "/images/window_icon@2x.png" : "/images/window_icon.png";
|
||||
else if (Utilities.isWindows())
|
||||
iconPath = "/images/task_bar_icon_windows.png";
|
||||
else
|
||||
iconPath = "/images/task_bar_icon_linux.png";
|
||||
|
||||
primaryStage.getIcons().add(new Image(getClass().getResourceAsStream(iconPath)));
|
||||
|
||||
// make the UI visible
|
||||
primaryStage.show();
|
||||
|
||||
if (!Utilities.isCorrectOSArchitecture()) {
|
||||
String osArchitecture = Utilities.getOSArchitecture();
|
||||
// We don't force a shutdown as the osArchitecture might in strange cases return a wrong value.
|
||||
// Needs at least more testing on different machines...
|
||||
new Popup<>().warning(Res.get("popup.warning.wrongVersion",
|
||||
osArchitecture,
|
||||
Utilities.getJVMArchitecture(),
|
||||
osArchitecture))
|
||||
.show();
|
||||
}
|
||||
UserThread.runPeriodically(() -> Profiler.printSystemLoad(log), LOG_MEMORY_PERIOD_MIN, TimeUnit.MINUTES);
|
||||
} catch (Throwable throwable) {
|
||||
log.error("Error during app init", throwable);
|
||||
showErrorPopup(throwable, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void showSendAlertMessagePopup() {
|
||||
|
@ -377,6 +373,19 @@ public class BisqApp extends Application {
|
|||
stage.show();
|
||||
}
|
||||
|
||||
private void checkForCorrectOSArchitecture() {
|
||||
if (!Utilities.isCorrectOSArchitecture()) {
|
||||
String osArchitecture = Utilities.getOSArchitecture();
|
||||
// We don't force a shutdown as the osArchitecture might in strange cases return a wrong value.
|
||||
// Needs at least more testing on different machines...
|
||||
new Popup<>().warning(Res.get("popup.warning.wrongVersion",
|
||||
osArchitecture,
|
||||
Utilities.getJVMArchitecture(),
|
||||
osArchitecture))
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("CodeBlock2Expr")
|
||||
@Override
|
||||
public void stop() {
|
||||
|
|
Loading…
Add table
Reference in a new issue