emit an event when the UI loads

pull/4/head
Zlatin Balevsky 2019-06-09 15:44:06 +01:00
parent b88334f19a
commit f39d7f4fa8
4 changed files with 13 additions and 0 deletions

View File

@ -154,6 +154,7 @@ public class Core {
eventBus.register(FileDownloadedEvent.class, fileManager)
eventBus.register(FileUnsharedEvent.class, fileManager)
eventBus.register(SearchEvent.class, fileManager)
eventBus.register(UILoadedEvent.class, fileManager)
log.info "initializing persistence service"
persisterService = new PersisterService(new File(home, "files.json"), eventBus, 5000, fileManager)

View File

@ -0,0 +1,4 @@
package com.muwire.core
class UILoadedEvent extends Event {
}

View File

@ -4,6 +4,7 @@ import com.muwire.core.EventBus
import com.muwire.core.InfoHash
import com.muwire.core.MuWireSettings
import com.muwire.core.SharedFile
import com.muwire.core.UILoadedEvent
import com.muwire.core.search.ResultsEvent
import com.muwire.core.search.SearchEvent
import com.muwire.core.search.SearchIndex
@ -134,4 +135,8 @@ class FileManager {
}
rv
}
void onUILoadedEvent(UILoadedEvent e) {
// TODO: resume downloads
}
}

View File

@ -7,6 +7,7 @@ import org.codehaus.griffon.runtime.core.AbstractLifecycleHandler
import com.muwire.core.Core
import com.muwire.core.MuWireSettings
import com.muwire.core.UILoadedEvent
import com.muwire.core.files.FileSharedEvent
import javax.annotation.Nonnull
@ -117,6 +118,8 @@ class Ready extends AbstractLifecycleHandler {
core.eventBus.publish(new FileSharedEvent(file : new File(it)))
}
}
core.eventBus.publish(new UILoadedEvent())
}
private static String selectHome() {