Clear warnings
This commit is contained in:
@@ -121,4 +121,5 @@ task makePackGZ(dependsOn: jar) doLast {
|
|||||||
}
|
}
|
||||||
|
|
||||||
build.dependsOn makeExecutable
|
build.dependsOn makeExecutable
|
||||||
build.dependsOn makePackGZ
|
//build.dependsOn makePackGZ
|
||||||
|
//Kotlin classes will be ignored by Pack200 due to class unrecognized attribute
|
||||||
@@ -30,7 +30,7 @@ import javafx.scene.layout.StackPane
|
|||||||
import javafx.scene.layout.VBox
|
import javafx.scene.layout.VBox
|
||||||
import java.util.concurrent.Callable
|
import java.util.concurrent.Callable
|
||||||
|
|
||||||
class AccountItem(i: Int, width: Double, height: Double, group: ToggleGroup) : StackPane() {
|
class AccountItem(i: Int, group: ToggleGroup) : StackPane() {
|
||||||
@FXML lateinit var icon: Pane
|
@FXML lateinit var icon: Pane
|
||||||
@FXML lateinit var content: VBox
|
@FXML lateinit var content: VBox
|
||||||
@FXML lateinit var header: StackPane
|
@FXML lateinit var header: StackPane
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ class AccountsPage() : StackPane(), DecoratorPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun buildNode(i: Int, account: Account, group: ToggleGroup): Node {
|
private fun buildNode(i: Int, account: Account, group: ToggleGroup): Node {
|
||||||
return AccountItem(i, Math.random() * 100 + 100, Math.random() * 100 + 100, group).apply {
|
return AccountItem(i, group).apply {
|
||||||
chkSelected.properties["account"] = account
|
chkSelected.properties["account"] = account
|
||||||
chkSelected.isSelected = Settings.selectedAccount == account
|
chkSelected.isSelected = Settings.selectedAccount == account
|
||||||
lblUser.text = account.username
|
lblUser.text = account.username
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ class LeftPaneController(val leftPane: VBox) {
|
|||||||
|
|
||||||
fun onProfileChanged(event: ProfileChangedEvent) {
|
fun onProfileChanged(event: ProfileChangedEvent) {
|
||||||
val profile = event.value
|
val profile = event.value
|
||||||
profile.selectedVersionProperty.addListener { observable ->
|
profile.selectedVersionProperty.addListener { _ ->
|
||||||
versionChanged(profile.selectedVersion)
|
versionChanged(profile.selectedVersion)
|
||||||
}
|
}
|
||||||
profile.selectedVersionProperty.fireValueChangedEvent()
|
profile.selectedVersionProperty.fireValueChangedEvent()
|
||||||
@@ -122,14 +122,15 @@ class LeftPaneController(val leftPane: VBox) {
|
|||||||
ripplerContainer.selected = true
|
ripplerContainer.selected = true
|
||||||
profile.selectedVersion = version.id
|
profile.selectedVersion = version.id
|
||||||
}
|
}
|
||||||
ripplerContainer.userData = version.id to item
|
ripplerContainer.properties["version"] = version.id to item
|
||||||
versionsPane.children += ripplerContainer
|
versionsPane.children += ripplerContainer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
fun versionChanged(selectedVersion: String) {
|
fun versionChanged(selectedVersion: String) {
|
||||||
versionsPane.children
|
versionsPane.children
|
||||||
.filter { it is RipplerContainer && it.userData is Pair<*, *> }
|
.filter { it is RipplerContainer && it.properties["version"] is Pair<*, *> }
|
||||||
.forEach { (it as RipplerContainer).selected = (it.userData as Pair<String, VersionListItem>).first == selectedVersion }
|
.forEach { (it as RipplerContainer).selected = (it.properties["version"] as Pair<String, VersionListItem>).first == selectedVersion }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,14 +29,16 @@ import java.util.concurrent.Callable
|
|||||||
class ModController {
|
class ModController {
|
||||||
@FXML lateinit var scrollPane: ScrollPane
|
@FXML lateinit var scrollPane: ScrollPane
|
||||||
@FXML lateinit var rootPane: VBox
|
@FXML lateinit var rootPane: VBox
|
||||||
lateinit var modManager: ModManager
|
private lateinit var modManager: ModManager
|
||||||
lateinit var versionId: String
|
private lateinit var versionId: String
|
||||||
|
|
||||||
fun initialize() {
|
fun initialize() {
|
||||||
scrollPane.smoothScrolling()
|
scrollPane.smoothScrolling()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun loadMods() {
|
fun loadMods(modManager: ModManager, versionId: String) {
|
||||||
|
this.modManager = modManager
|
||||||
|
this.versionId = versionId
|
||||||
Task.of(Callable {
|
Task.of(Callable {
|
||||||
modManager.refreshMods(versionId)
|
modManager.refreshMods(versionId)
|
||||||
}).subscribe(Scheduler.JAVAFX) {
|
}).subscribe(Scheduler.JAVAFX) {
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ open class RipplerContainer(@NamedArg("container") container: Node): StackPane()
|
|||||||
return@Callable background
|
return@Callable background
|
||||||
}
|
}
|
||||||
}, backgroundProperty()))
|
}, backgroundProperty()))
|
||||||
ripplerFillProperty.addListener { o, oldVal, newVal -> this.buttonRippler.ripplerFill = newVal }
|
ripplerFillProperty.addListener { _, _, newVal -> this.buttonRippler.ripplerFill = newVal }
|
||||||
if (background == null || this.isJavaDefaultBackground(background)) {
|
if (background == null || this.isJavaDefaultBackground(background)) {
|
||||||
background = Background(BackgroundFill(Color.TRANSPARENT, this.defaultRadii, null))
|
background = Background(BackgroundFill(Color.TRANSPARENT, this.defaultRadii, null))
|
||||||
}
|
}
|
||||||
@@ -149,11 +149,7 @@ open class RipplerContainer(@NamedArg("container") container: Node): StackPane()
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected fun updateChildren() {
|
protected fun updateChildren() {
|
||||||
children.add(container)
|
children.addAll(buttonContainer, container)
|
||||||
|
|
||||||
if (this.buttonContainer != null) {
|
|
||||||
this.children.add(0, this.buttonContainer)
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i in 1..this.children.size - 1) {
|
for (i in 1..this.children.size - 1) {
|
||||||
this.children[i].isPickOnBounds = false
|
this.children[i].isPickOnBounds = false
|
||||||
@@ -161,34 +157,6 @@ open class RipplerContainer(@NamedArg("container") container: Node): StackPane()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun layoutChildren(x: Double, y: Double, w: Double, h: Double) {
|
|
||||||
if (this.invalid) {
|
|
||||||
if (ripplerFill == null) {
|
|
||||||
for (i in this.children.size - 1 downTo 1) {
|
|
||||||
if (this.children[i] is Shape) {
|
|
||||||
this.buttonRippler.ripplerFill = (this.children[i] as Shape).fill
|
|
||||||
(this.children[i] as Shape).fillProperty().addListener { o, oldVal, newVal -> this.buttonRippler.ripplerFill = newVal }
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.children[i] is Label) {
|
|
||||||
this.buttonRippler.ripplerFill = (this.children[i] as Label).textFill
|
|
||||||
(this.children[i] as Label).textFillProperty().addListener { o, oldVal, newVal -> this.buttonRippler.ripplerFill = newVal }
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.buttonRippler.ripplerFill = ripplerFill
|
|
||||||
}
|
|
||||||
|
|
||||||
this.invalid = false
|
|
||||||
}
|
|
||||||
|
|
||||||
val shift = 1.0
|
|
||||||
this.buttonContainer.resizeRelocate(layoutBounds.minX - shift, layoutBounds.minY - shift, width + 2.0 * shift, height + 2.0 * shift)
|
|
||||||
//this.layoutLabelInArea(x, y, w, h)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun isJavaDefaultBackground(background: Background): Boolean {
|
private fun isJavaDefaultBackground(background: Background): Boolean {
|
||||||
try {
|
try {
|
||||||
val firstFill = (background.fills[0] as BackgroundFill).fill.toString()
|
val firstFill = (background.fills[0] as BackgroundFill).fill.toString()
|
||||||
|
|||||||
@@ -46,9 +46,7 @@ class VersionPage : StackPane(), DecoratorPage {
|
|||||||
fun load(id: String, profile: Profile) {
|
fun load(id: String, profile: Profile) {
|
||||||
titleProperty.set("Version settings - " + id)
|
titleProperty.set("Version settings - " + id)
|
||||||
|
|
||||||
versionSettingsController.loadVersionSetting(id, profile.getVersionSetting(id))
|
versionSettingsController.loadVersionSetting(profile.getVersionSetting(id))
|
||||||
modController.modManager = profile.modManager
|
modController.loadMods(profile.modManager, id)
|
||||||
modController.versionId = id
|
|
||||||
modController.loadMods()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,7 +71,7 @@ class VersionSettingsController {
|
|||||||
txtMetaspace.textProperty().addListener(validation(txtMetaspace))
|
txtMetaspace.textProperty().addListener(validation(txtMetaspace))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun loadVersionSetting(id: String, version: VersionSetting) {
|
fun loadVersionSetting(version: VersionSetting) {
|
||||||
rootPane.children -= advancedSettingsPane
|
rootPane.children -= advancedSettingsPane
|
||||||
|
|
||||||
lastVersionSetting?.apply {
|
lastVersionSetting?.apply {
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ interface AbstractWizardDisplayer : WizardDisplayer {
|
|||||||
navigateTo(StackPane().apply { children += vbox }, Navigation.NavigationDirection.FINISH)
|
navigateTo(StackPane().apply { children += vbox }, Navigation.NavigationDirection.FINISH)
|
||||||
|
|
||||||
task.executor().let { executor ->
|
task.executor().let { executor ->
|
||||||
|
@Suppress("NAME_SHADOWING")
|
||||||
executor.taskListener = object : TaskListener {
|
executor.taskListener = object : TaskListener {
|
||||||
override fun onReady(task: Task) {
|
override fun onReady(task: Task) {
|
||||||
Platform.runLater { tasksBar.progressProperty().set(finishedTasks * 1.0 / executor.totTask.get()) }
|
Platform.runLater { tasksBar.progressProperty().set(finishedTasks * 1.0 / executor.totTask.get()) }
|
||||||
|
|||||||
@@ -24,13 +24,10 @@ import java.util.zip.ZipEntry
|
|||||||
import java.util.zip.ZipFile
|
import java.util.zip.ZipFile
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
private fun lessThan32(b: ByteArray, x: Int): Int {
|
private fun lessThan32(b: ByteArray, startIndex: Int): Int {
|
||||||
var x = x
|
for (i in startIndex until b.size)
|
||||||
while (x < b.size) {
|
if (b[i] < 32)
|
||||||
if (b[x] < 32)
|
return i
|
||||||
return x
|
|
||||||
x++
|
|
||||||
}
|
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ class ModInfo (
|
|||||||
val file = if (modFile.extension == DISABLED_EXTENSION)
|
val file = if (modFile.extension == DISABLED_EXTENSION)
|
||||||
modFile.absoluteFile.parentFile.resolve(modFile.nameWithoutExtension)
|
modFile.absoluteFile.parentFile.resolve(modFile.nameWithoutExtension)
|
||||||
else modFile
|
else modFile
|
||||||
var description = "Unrecognized mod file"
|
val description: String
|
||||||
if (file.extension == "zip" || file.extension == "jar")
|
if (file.extension == "zip" || file.extension == "jar")
|
||||||
try {
|
try {
|
||||||
return ForgeModMetadata.fromFile(modFile)
|
return ForgeModMetadata.fromFile(modFile)
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ abstract class Task {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun executor() = TaskExecutor().submit(this)
|
fun executor() = TaskExecutor().submit(this)
|
||||||
|
fun executor(taskListener: TaskListener) = TaskExecutor().submit(this).apply { this.taskListener = taskListener }
|
||||||
|
|
||||||
fun subscribe(subscriber: Task) = executor().apply {
|
fun subscribe(subscriber: Task) = executor().apply {
|
||||||
submit(subscriber).start()
|
submit(subscriber).start()
|
||||||
|
|||||||
Reference in New Issue
Block a user