chore: clean up annotations and imports
This commit is contained in:
parent
e61df73dd3
commit
9fd5d870cf
|
@ -9,7 +9,8 @@ import io.gitlab.jfronny.inceptum.launcher.system.launch.*;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.system.setup.Steps;
|
import io.gitlab.jfronny.inceptum.launcher.system.setup.Steps;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public class LaunchCommand extends BaseInstanceCommand {
|
public class LaunchCommand extends BaseInstanceCommand {
|
||||||
|
|
|
@ -12,7 +12,6 @@ import org.gnome.gtk.*
|
||||||
import java.util.function.Consumer
|
import java.util.function.Consumer
|
||||||
|
|
||||||
object GtkEnvBackend : EnvBackend {
|
object GtkEnvBackend : EnvBackend {
|
||||||
@JvmField
|
|
||||||
var dialogParent: Window? = null
|
var dialogParent: Window? = null
|
||||||
|
|
||||||
override fun showError(message: String, title: String) {
|
override fun showError(message: String, title: String) {
|
||||||
|
@ -66,7 +65,6 @@ object GtkEnvBackend : EnvBackend {
|
||||||
cancel: Runnable?
|
cancel: Runnable?
|
||||||
) = schedule { simpleDialog(dialogParent, markup, title, ok, cancel) }
|
) = schedule { simpleDialog(dialogParent, markup, title, ok, cancel) }
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun simpleDialog(
|
fun simpleDialog(
|
||||||
parent: Window?,
|
parent: Window?,
|
||||||
markup: String,
|
markup: String,
|
||||||
|
|
|
@ -30,7 +30,6 @@ object GtkMain {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun showGui(args: Array<String>): Int = setupApplication(args) {
|
fun showGui(args: Array<String>): Int = setupApplication(args) {
|
||||||
//TODO update check
|
//TODO update check
|
||||||
AccountManager.loadAccounts()
|
AccountManager.loadAccounts()
|
||||||
|
@ -45,7 +44,6 @@ object GtkMain {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun setupApplication(args: Array<String>, onActivate: Application.() -> Unit): Int {
|
fun setupApplication(args: Array<String>, onActivate: Application.() -> Unit): Int {
|
||||||
val app = Application(ID, ApplicationFlags.FLAGS_NONE)
|
val app = Application(ID, ApplicationFlags.FLAGS_NONE)
|
||||||
app.onActivate {
|
app.onActivate {
|
||||||
|
|
|
@ -30,14 +30,10 @@ import java.io.IOException
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
|
|
||||||
object GtkMenubar {
|
object GtkMenubar {
|
||||||
@JvmField
|
|
||||||
var newMenu: MenuBuilder? = null
|
var newMenu: MenuBuilder? = null
|
||||||
@JvmField
|
|
||||||
var accountsMenu: MenuBuilder? = null
|
var accountsMenu: MenuBuilder? = null
|
||||||
@JvmField
|
|
||||||
var launchMenu: MenuBuilder? = null
|
var launchMenu: MenuBuilder? = null
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun create(app: Application) {
|
fun create(app: Application) {
|
||||||
val menu = MenuBuilder(app)
|
val menu = MenuBuilder(app)
|
||||||
val file = menu.submenu("file")
|
val file = menu.submenu("file")
|
||||||
|
@ -77,7 +73,6 @@ object GtkMenubar {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun generateNewMenu(app: Application) {
|
fun generateNewMenu(app: Application) {
|
||||||
newMenu!!.clear()
|
newMenu!!.clear()
|
||||||
newMenu!!.button("new") { NewInstanceWindow(app).visible = true }
|
newMenu!!.button("new") { NewInstanceWindow(app).visible = true }
|
||||||
|
@ -145,7 +140,6 @@ object GtkMenubar {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun generateLaunchMenu(app: Application) {
|
fun generateLaunchMenu(app: Application) {
|
||||||
launchMenu!!.clear()
|
launchMenu!!.clear()
|
||||||
try {
|
try {
|
||||||
|
@ -159,7 +153,6 @@ object GtkMenubar {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun launch(instance: Instance, launchType: LaunchType) {
|
fun launch(instance: Instance, launchType: LaunchType) {
|
||||||
if (instance.isSetupLocked) {
|
if (instance.isSetupLocked) {
|
||||||
LauncherEnv.showError(I18n["instance.launch.locked.setup"], I18n["instance.launch.locked"])
|
LauncherEnv.showError(I18n["instance.launch.locked.setup"], I18n["instance.launch.locked"])
|
||||||
|
@ -200,7 +193,6 @@ object GtkMenubar {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
fun generateAccountsMenu(app: Application) {
|
fun generateAccountsMenu(app: Application) {
|
||||||
accountsMenu!!.clear()
|
accountsMenu!!.clear()
|
||||||
accountsMenu!!.button("new") { MicrosoftLoginDialog(GtkEnvBackend.dialogParent).visible = true }
|
accountsMenu!!.button("new") { MicrosoftLoginDialog(GtkEnvBackend.dialogParent).visible = true }
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package io.gitlab.jfronny.inceptum.gtk.control
|
package io.gitlab.jfronny.inceptum.gtk.control
|
||||||
|
|
||||||
import io.gitlab.jfronny.inceptum.gtk.util.kText
|
|
||||||
import org.gnome.gtk.Entry
|
import org.gnome.gtk.Entry
|
||||||
import java.util.function.Consumer
|
import java.util.function.Consumer
|
||||||
|
|
||||||
|
@ -8,7 +7,7 @@ class KEntry(value: String? = ""): Entry() {
|
||||||
private val onChange = ArrayList<Consumer<String>>()
|
private val onChange = ArrayList<Consumer<String>>()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
kText = value ?: ""
|
text = value ?: ""
|
||||||
onChanged { onChange.forEach { it.accept(text) } }
|
onChanged { onChange.forEach { it.accept(text) } }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package io.gitlab.jfronny.inceptum.gtk.control.settings
|
package io.gitlab.jfronny.inceptum.gtk.control.settings
|
||||||
|
|
||||||
import io.gitlab.jfronny.inceptum.common.Utils
|
|
||||||
import io.gitlab.jfronny.inceptum.gtk.util.I18n
|
import io.gitlab.jfronny.inceptum.gtk.util.I18n
|
||||||
import io.gitlab.jfronny.inceptum.gtk.util.Log
|
|
||||||
import org.gnome.adw.HeaderBar
|
import org.gnome.adw.HeaderBar
|
||||||
import org.gnome.adw.ViewStack
|
import org.gnome.adw.ViewStack
|
||||||
import org.gnome.adw.ViewSwitcherBar
|
import org.gnome.adw.ViewSwitcherBar
|
||||||
|
|
|
@ -26,7 +26,6 @@ class MenuBuilder private constructor(map: ActionMap, menu: Menu, prefix: String
|
||||||
groupName
|
groupName
|
||||||
)
|
)
|
||||||
|
|
||||||
@JvmOverloads
|
|
||||||
constructor(app: Application, menu: Menu = getRootMenu(app), prefix: String = "") : this(app, menu, prefix, "app.")
|
constructor(app: Application, menu: Menu = getRootMenu(app), prefix: String = "") : this(app, menu, prefix, "app.")
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|
|
@ -2,7 +2,10 @@ package io.gitlab.jfronny.inceptum.gtk.util
|
||||||
|
|
||||||
import io.gitlab.jfronny.inceptum.gtk.control.ILabel
|
import io.gitlab.jfronny.inceptum.gtk.control.ILabel
|
||||||
import org.gnome.adw.ActionRow
|
import org.gnome.adw.ActionRow
|
||||||
import org.gnome.gtk.*
|
import org.gnome.gtk.EntryBuffer
|
||||||
|
import org.gnome.gtk.Label
|
||||||
|
import org.gnome.gtk.MessageDialog
|
||||||
|
import org.gnome.gtk.Widget
|
||||||
|
|
||||||
var Widget.margin: Int
|
var Widget.margin: Int
|
||||||
set(value) {
|
set(value) {
|
||||||
|
|
|
@ -23,7 +23,6 @@ class AboutWindow : AboutDialog() {
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
|
||||||
fun createAndShow() {
|
fun createAndShow() {
|
||||||
AboutWindow().visible = true
|
AboutWindow().visible = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,13 +80,11 @@ class ProcessStateWatcherDialog(
|
||||||
}.start()
|
}.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmRecord
|
|
||||||
data class State(val msg: String, val progress: Float) {
|
data class State(val msg: String, val progress: Float) {
|
||||||
constructor(source: ProcessState) : this(source.currentStep, source.progress)
|
constructor(source: ProcessState) : this(source.currentStep, source.progress)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
|
||||||
fun show(
|
fun show(
|
||||||
parent: Window?,
|
parent: Window?,
|
||||||
title: String,
|
title: String,
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package io.gitlab.jfronny.inceptum.gtk.window.dialog
|
package io.gitlab.jfronny.inceptum.gtk.window.dialog
|
||||||
|
|
||||||
import io.gitlab.jfronny.inceptum.gtk.util.kText
|
|
||||||
import org.gnome.gtk.*
|
import org.gnome.gtk.*
|
||||||
|
|
||||||
class StringInputDialog(parent: Window?, flags: DialogFlags, type: MessageType, buttons: ButtonsType, message: String, value: String) : MessageDialog(parent, flags, type, buttons, message) {
|
class StringInputDialog(parent: Window?, flags: DialogFlags, type: MessageType, buttons: ButtonsType, message: String, value: String) : MessageDialog(parent, flags, type, buttons, message) {
|
||||||
|
@ -8,7 +7,7 @@ class StringInputDialog(parent: Window?, flags: DialogFlags, type: MessageType,
|
||||||
|
|
||||||
init {
|
init {
|
||||||
(messageArea as Box).append(entry)
|
(messageArea as Box).append(entry)
|
||||||
entry.kText = value
|
entry.text = value
|
||||||
}
|
}
|
||||||
|
|
||||||
val input: String get() = entry.text
|
val input: String get() = entry.text
|
||||||
|
|
|
@ -147,7 +147,7 @@ class GeneralTab(window: InstanceSettingsWindow) : SectionedSettingsTab<Instance
|
||||||
dialog.onResponse { responseId: Int ->
|
dialog.onResponse { responseId: Int ->
|
||||||
if (responseId == ResponseType.ACCEPT.value) {
|
if (responseId == ResponseType.ACCEPT.value) {
|
||||||
val file = dialog.file!!.path
|
val file = dialog.file!!.path
|
||||||
if (file != null) entry.kText = file
|
if (file != null) entry.text = file
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dialog.show()
|
dialog.show()
|
||||||
|
|
|
@ -4,7 +4,6 @@ import io.gitlab.jfronny.gson.compile.util.GList;
|
||||||
import io.gitlab.jfronny.gson.stream.JsonReader;
|
import io.gitlab.jfronny.gson.stream.JsonReader;
|
||||||
import io.gitlab.jfronny.inceptum.common.Net;
|
import io.gitlab.jfronny.inceptum.common.Net;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.modrinth.*;
|
import io.gitlab.jfronny.inceptum.launcher.model.modrinth.*;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
|
|
|
@ -3,7 +3,6 @@ package io.gitlab.jfronny.inceptum.launcher.model.inceptum;
|
||||||
import io.gitlab.jfronny.commons.HashUtils;
|
import io.gitlab.jfronny.commons.HashUtils;
|
||||||
import io.gitlab.jfronny.commons.data.MutCollection;
|
import io.gitlab.jfronny.commons.data.MutCollection;
|
||||||
import io.gitlab.jfronny.commons.data.delegate.DelegateMap;
|
import io.gitlab.jfronny.commons.data.delegate.DelegateMap;
|
||||||
import io.gitlab.jfronny.commons.serialize.gson.api.v1.Ignore;
|
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GPrefer;
|
import io.gitlab.jfronny.gson.compile.annotations.GPrefer;
|
||||||
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
import io.gitlab.jfronny.gson.compile.annotations.GSerializable;
|
||||||
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
import io.gitlab.jfronny.inceptum.common.GsonPreset;
|
||||||
|
@ -12,7 +11,6 @@ import io.gitlab.jfronny.inceptum.launcher.api.CurseforgeApi;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.api.ModrinthApi;
|
import io.gitlab.jfronny.inceptum.launcher.api.ModrinthApi;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.gson.ModMetaSourcesAdapter;
|
import io.gitlab.jfronny.inceptum.launcher.gson.ModMetaSourcesAdapter;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.model.curseforge.response.FingerprintMatchesResponse;
|
import io.gitlab.jfronny.inceptum.launcher.model.curseforge.response.FingerprintMatchesResponse;
|
||||||
import io.gitlab.jfronny.inceptum.launcher.system.instance.Mod;
|
|
||||||
import io.gitlab.jfronny.inceptum.launcher.system.source.*;
|
import io.gitlab.jfronny.inceptum.launcher.system.source.*;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
Loading…
Reference in New Issue