Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor BisqApp - move icon load into ImageUtil #3382

Merged
merged 1 commit into from
Oct 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions desktop/src/main/java/bisq/desktop/app/BisqApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -253,18 +253,7 @@ private void setupStage(Scene scene) {
stage.setScene(scene);
stage.setMinWidth(MIN_WINDOW_WIDTH);
stage.setMinHeight(MIN_WINDOW_HEIGHT);

// 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/[email protected]" : "/images/window_icon.png";
else if (Utilities.isWindows())
iconPath = "/images/task_bar_icon_windows.png";
else
iconPath = "/images/task_bar_icon_linux.png";

stage.getIcons().add(new Image(getClass().getResourceAsStream(iconPath)));
stage.getIcons().add(ImageUtil.getApplicationIconImage());

// make the UI visible
stage.show();
Expand Down
14 changes: 14 additions & 0 deletions desktop/src/main/java/bisq/desktop/util/ImageUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

import bisq.core.locale.Country;

import bisq.common.util.Utilities;

import javafx.scene.image.Image;
import javafx.scene.image.ImageView;

Expand All @@ -40,6 +42,18 @@ public static ImageView getImageViewById(String id) {
return imageView;
}

public static Image getApplicationIconImage () {
String iconPath;
if (Utilities.isOSX())
iconPath = ImageUtil.isRetina() ? "/images/[email protected]" : "/images/window_icon.png";
else if (Utilities.isWindows())
iconPath = "/images/task_bar_icon_windows.png";
else
iconPath = "/images/task_bar_icon_linux.png";

return getImageByUrl(iconPath);
}

private static Image getImageByUrl(String url) {
return new Image(ImageUtil.class.getResourceAsStream(url));
}
Expand Down