-
Notifications
You must be signed in to change notification settings - Fork 220
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
feat: Added menu item icon to show whether updates are available #519
Open
paul-court
wants to merge
12
commits into
gluonhq:master
Choose a base branch
from
paul-court:issue-489
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9e02f6b
fix: Wraps alert display in Platform.runlater()
a2a94e7
fix: Adds an icon that reflects the available update status to the he…
9ce3afb
Improves UX with better menu item text
c7fe0da
Merge branch 'master' into issue-489
2b94b2f
Removing hi-res icons as they mess up the menu on Mac
4d14d8a
Removes unused icon.
paul-court ee65d35
Sets the OK image and message by default and only updates the menu it…
paul-court d3202ec
Removes unused import.
paul-court 1fa4a33
Merge branch 'master' into issue-489
paul-court aed8b86
Replaces stack trace outputs with log messages.
paul-court 91c5919
Alternate menu item label when there are no updates.
paul-court 4e86eb4
Merge branch 'master' into issue-489
paul-court File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ | |
import com.oracle.javafx.scenebuilder.app.i18n.I18N; | ||
import com.oracle.javafx.scenebuilder.app.preferences.PreferencesController; | ||
import com.oracle.javafx.scenebuilder.app.preferences.PreferencesRecordGlobal; | ||
import com.oracle.javafx.scenebuilder.app.util.AppSettings; | ||
import com.oracle.javafx.scenebuilder.kit.editor.EditorController; | ||
import com.oracle.javafx.scenebuilder.kit.editor.EditorController.ControlAction; | ||
import com.oracle.javafx.scenebuilder.kit.editor.EditorController.EditAction; | ||
|
@@ -66,6 +67,7 @@ | |
import java.util.TreeMap; | ||
import java.util.TreeSet; | ||
|
||
import javafx.application.Platform; | ||
import javafx.beans.value.ChangeListener; | ||
import javafx.collections.ObservableList; | ||
import javafx.event.ActionEvent; | ||
|
@@ -81,6 +83,8 @@ | |
import javafx.scene.control.RadioMenuItem; | ||
import javafx.scene.control.SeparatorMenuItem; | ||
import javafx.scene.effect.Effect; | ||
import javafx.scene.image.Image; | ||
import javafx.scene.image.ImageView; | ||
import javafx.scene.input.KeyCharacterCombination; | ||
import javafx.scene.input.KeyCode; | ||
import javafx.scene.input.KeyCodeCombination; | ||
|
@@ -1171,6 +1175,23 @@ public String getTitle() { | |
insertMenu.setOnMenuValidation(onCustomPartOfInsertMenuValidationHandler); | ||
|
||
windowMenu.setOnMenuValidation(onWindowMenuValidationHandler); | ||
|
||
// Modify the Check Updates menu item if there is an update available. | ||
// Icons by Font Awesome (https://fontawesome.com/license/free) under CC BY 4.0 License | ||
AppSettings.getLatestVersion(latestVersion -> { | ||
if (AppSettings.isUpdateAvailable()) { | ||
Image icon = new Image(MenuBarController.class | ||
.getResource("download_icon.png") | ||
.toExternalForm()); | ||
ImageView iconView = new ImageView(icon); | ||
|
||
Platform.runLater(() -> { | ||
checkUpdatesMenuItem.setGraphic(iconView); | ||
checkUpdatesMenuItem.disableProperty().setValue(false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
checkUpdatesMenuItem.setText(I18N.getString("menu.title.check.updates.available")); | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
private void addSwatchGraphic(RadioMenuItem swatchMenuItem) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+6.3 KB
app/src/main/resources/com/oracle/javafx/scenebuilder/app/menubar/check_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.47 KB
...src/main/resources/com/oracle/javafx/scenebuilder/app/menubar/download_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to make this change at all? If the update is not available, the item is disabled, so not clickable. I think the existing behaviour is fine here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The checks are performed every time you open the menu. Even with disabling the menu item in the FXML file, if we leave this hard coded to a
true
response, it will re-enable the item when you open the menu.