Do not popup the update prompt, add a button on the bottom bar instead. GitHub issue #157

dbus-notify
Zlatin Balevsky 2022-06-24 17:05:53 +01:00
parent 7f26a02339
commit f6d824339e
No known key found for this signature in database
GPG Key ID: A72832072D525E41
4 changed files with 28 additions and 19 deletions

View File

@ -1062,6 +1062,17 @@ class MainFrameController {
mvcGroup.createMVCGroup("chat-favorites", params)
}
@ControllerAction
void showUpdate() {
if (application.mvcGroupManager.findGroup("update") == null) {
Map<String, Object> args = new HashMap<>()
args['core'] = core
args['available'] = model.updateAvailableEvent
args['downloaded'] = model.updateDownloadedEvent
mvcGroup.createMVCGroup("update", "update", args).destroy()
}
}
void saveMuWireSettings() {
core.saveMuSettings()
}

View File

@ -772,6 +772,7 @@ TOOLTIP_TOTAL_UP_SPEED=Total upload speed
TOOLTIP_UNREAD_MESSAEGS=Unread messages
TOOLTIP_CONNECTIONS=Connections to other MuWire nodes
TOOLTIP_SEARCH_BOX=Search for keywords, search phrase or regular expression
TOOLTIP_UPDATE=Update MuWire
### Tooltips for browse files tab
TOOLTIP_COPY_SENDER_FULL_ID=Copy the full ID of the sender to clipboard

View File

@ -10,6 +10,7 @@ import com.muwire.core.trust.TrustServiceLoadedEvent
import com.muwire.gui.profile.PersonaOrProfile
import com.muwire.gui.profile.ThumbnailIcon
import com.muwire.gui.profile.TrustPOP
import griffon.core.controller.ControllerAction
import javax.swing.DefaultListModel
import javax.swing.Icon
@ -206,6 +207,9 @@ class MainFrameModel {
@Observable int downSpeed
@Observable int upSpeed
@Observable UpdateDownloadedEvent updateDownloadedEvent
@Observable UpdateAvailableEvent updateAvailableEvent
private final Set<InfoHash> downloadInfoHashes = new ConcurrentHashSet<>()
@ -411,16 +415,18 @@ class MainFrameModel {
void onUpdateDownloadedEvent(UpdateDownloadedEvent e) {
runInsideUIAsync {
if (application.mvcGroupManager.findGroup("update") == null) {
Map<String, Object> args = new HashMap<>()
args['core'] = core
args['available'] = null
args['downloaded'] = e
mvcGroup.createMVCGroup("update", "update", args).destroy()
}
updateDownloadedEvent = e
updateAvailableEvent = null
}
}
void onUpdateAvailableEvent(UpdateAvailableEvent e) {
runInsideUIAsync {
updateDownloadedEvent = null
updateAvailableEvent = e
}
}
void onUIResultEvent(UIResultEvent e) {
MVCGroup resultsGroup = results.get(e.uuid)
resultsGroup?.model.handleResult(e)
@ -798,18 +804,6 @@ class MainFrameModel {
}
}
void onUpdateAvailableEvent(UpdateAvailableEvent e) {
runInsideUIAsync {
if (application.mvcGroupManager.findGroup("update") == null) {
Map<String, Object> args = new HashMap<>()
args['core'] = core
args['available'] = e
args['downloaded'] = null
mvcGroup.createMVCGroup("update", "update", args).destroy()
}
}
}
void onRouterDisconnectedEvent(RouterDisconnectedEvent e) {
if (core.getShutdown().get())
return

View File

@ -735,6 +735,9 @@ class MainFrameView {
panel (border: etchedBorder(), constraints : BorderLayout.SOUTH) {
borderLayout()
panel (constraints : BorderLayout.WEST) {
button(text: trans("UPDATE"), toolTipText: trans("TOOLTIP_UPDATE"),
enabled: bind {model.updateAvailableEvent != null || model.updateDownloadedEvent != null},
showUpdateAction)
button(text: "", icon: imageIcon('/edit_profile.png'), toolTipText: trans("TOOLTIP_PROFILE_EDITOR"),
editProfileAction)
}