Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
Syer10 committed Sep 2, 2024
1 parent d783ba4 commit a5d7f27
Show file tree
Hide file tree
Showing 22 changed files with 52 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ class LauncherViewModel {
null,
arrayOf(
"Cancel",
"Continue"
"Continue",
),
1
1,
)
when (option) {
0 -> {
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/suwayomi/tachidesk/launcher/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ suspend fun main(args: Array<String>) {
arrayOf(
"Copy",
"Reset",
"Close"
"Close",
),
1
1,
)
when (option) {
0 -> {
Expand Down Expand Up @@ -168,6 +168,6 @@ fun setupTheme(vm: LauncherViewModel) {
vm.theme.value = Base64.getEncoder().encodeToString(it.toByteArray())
}
}
}
},
)
}
8 changes: 4 additions & 4 deletions src/main/kotlin/suwayomi/tachidesk/launcher/SwingDsl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ inline fun jframe(
title: String? = null,
graphicsConfiguration: GraphicsConfiguration? = null,
isVisible: Boolean = true,
builder: JFrame.() -> Unit
builder: JFrame.() -> Unit,
): JFrame {
return JFrame(title, graphicsConfiguration).apply {
builder()
Expand All @@ -71,7 +71,7 @@ inline fun jframe(
inline fun jpanel(
layoutManager: LayoutManager = FlowLayout(),
isDoubleBuffered: Boolean = true,
builder: JPanel.() -> Unit
builder: JPanel.() -> Unit,
): JPanel {
return JPanel(layoutManager, isDoubleBuffered).apply {
builder()
Expand All @@ -83,7 +83,7 @@ inline fun jpanel(
inline fun jTabbedPane(
tabPlacement: Int = JTabbedPane.TOP,
tabLayoutPolicy: Int = JTabbedPane.WRAP_TAB_LAYOUT,
builder: JTabbedPane.() -> Unit
builder: JTabbedPane.() -> Unit,
): JTabbedPane {
return JTabbedPane(tabPlacement, tabLayoutPolicy).apply {
builder()
Expand Down Expand Up @@ -152,7 +152,7 @@ inline fun jPasswordField(text: String? = null, columns: Int = 0, document: Docu
inline fun <E> jComboBox(
items: Array<E>? = null,
model: ComboBoxModel<E>? = null,
builder: JComboBox<E>.() -> Unit
builder: JComboBox<E>.() -> Unit,
): JComboBox<E> {
require(items != null || model != null) { "Both items and model were null" }
return JComboBox(model ?: DefaultComboBoxModel(items)).apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import kotlin.io.path.writeText

class ConfigManager(
private val tachideskServer: Path,
rootDir: String
rootDir: String,
) {
private val userConfigFile = getServerConf(rootDir)

Expand Down Expand Up @@ -107,7 +107,7 @@ class ConfigManager(

fun resetConfig(
tachideskServer: Path,
rootDir: String
rootDir: String,
) {
val userConfigFile = getServerConf(rootDir)
userConfigFile.createParentDirectories().writeText(getDefaultConfig(tachideskServer))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import kotlin.reflect.KProperty

class ServerConfig(
private val scope: CoroutineScope,
private val configManager: ConfigManager
private val configManager: ConfigManager,
) {

inner class OverrideConfigValue<T : Any>(private val configAdapter: ConfigAdapter<T>) : ReadOnlyProperty<ServerConfig, MutableStateFlow<T>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ object StringOrNullAdapter : Adapter<String?> {

class SerializableAdapter<E>(
private val serialize: (E) -> String,
private val deserialize: (String) -> E
private val deserialize: (String) -> E,
) : Adapter<E> {
override fun get(settings: ObservableSettings, key: String, default: E) =
settings.getStringOrNull(key)?.let { deserialize(it) } ?: default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ open class LauncherPreference<T>(
private val key: String,
private val default: T,
private val settings: ObservableSettings,
private val adapter: Adapter<T>
private val adapter: Adapter<T>,
) {

fun get(): T {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@ import java.util.prefs.Preferences

class LauncherSettings {
private val settings = PreferencesSettings(
Preferences.userRoot().node("suwayomi/launcher")
Preferences.userRoot().node("suwayomi/launcher"),
)

enum class WebUIFlavor {
WebUI,
VUI,
Custom
Custom,
}

enum class WebUIInterface {
Browser,
Electron
Electron,
}

enum class WebUIChannel {
Stable,
Preview,
Bundled
Bundled,
}

// Directories
Expand All @@ -40,7 +40,7 @@ class LauncherSettings {
"root",
null,
settings,
StringOrNullAdapter
StringOrNullAdapter,
)
}

Expand All @@ -50,7 +50,7 @@ class LauncherSettings {
"theme",
null,
settings,
StringOrNullAdapter
StringOrNullAdapter,
)
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/suwayomi/tachidesk/launcher/ui/Backup.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ import kotlin.io.path.isWritable

fun Backup(vm: LauncherViewModel, scope: CoroutineScope) = jpanel(
MigLayout(
LC().alignX("center").alignY("center")
)
LC().alignX("center").alignY("center"),
),
) {
jTextArea("Backups path") {
isEditable = false
Expand All @@ -56,7 +56,7 @@ fun Backup(vm: LauncherViewModel, scope: CoroutineScope) = jpanel(
.combine(
keyListener()
.filterIsInstance<KeyListenerEvent.Released>()
.filter { it.event?.keyCode == KeyEvent.VK_ENTER }
.filter { it.event?.keyCode == KeyEvent.VK_ENTER },
) { _, _ -> }
.map {
text?.trim()
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/suwayomi/tachidesk/launcher/ui/BasicAuth.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import suwayomi.tachidesk.launcher.keyListener

fun BasicAuth(vm: LauncherViewModel, scope: CoroutineScope) = jpanel(
MigLayout(
LC().alignX("center").alignY("center")
)
LC().alignX("center").alignY("center"),
),
) {
jCheckBox("Basic Authentication", selected = vm.basicAuthEnabled.value) {
// todo toolTipText = ""
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/suwayomi/tachidesk/launcher/ui/Cloudflare.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import javax.swing.SpinnerNumberModel

fun Cloudflare(vm: LauncherViewModel, scope: CoroutineScope) = jpanel(
MigLayout(
LC().alignX("center").alignY("center")
)
LC().alignX("center").alignY("center"),
),
) {
jCheckBox("Use FlareSolverr", selected = vm.flareSolverrEnabled.value) {
toolTipText = "Use FlareSolverr instance to bypass Cloudflare." // todo improve
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/suwayomi/tachidesk/launcher/ui/Downloader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ import kotlin.io.path.isWritable

fun Downloader(vm: LauncherViewModel, scope: CoroutineScope) = jpanel(
MigLayout(
LC().alignX("center").alignY("center")
)
LC().alignX("center").alignY("center"),
),
) {
jCheckBox("Download as CBZ", selected = vm.downloadAsCbz.value) {
toolTipText = "Download chapters as CBZ files." // todo improve
Expand All @@ -66,7 +66,7 @@ fun Downloader(vm: LauncherViewModel, scope: CoroutineScope) = jpanel(
.combine(
keyListener()
.filterIsInstance<KeyListenerEvent.Released>()
.filter { it.event?.keyCode == KeyEvent.VK_ENTER }
.filter { it.event?.keyCode == KeyEvent.VK_ENTER },
) { _, _ -> }
.map {
text?.trim()
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/suwayomi/tachidesk/launcher/ui/Extension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ private val repoMatchRegex =

fun Extension(vm: LauncherViewModel, scope: CoroutineScope) = jpanel(
MigLayout(
LC().alignX("center").alignY("center")
)
LC().alignX("center").alignY("center"),
),
) {
jTextArea("Extension repos") {
isEditable = false
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/suwayomi/tachidesk/launcher/ui/LocalSource.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import kotlin.io.path.isWritable

fun LocalSource(vm: LauncherViewModel, scope: CoroutineScope) = jpanel(
MigLayout(
LC().alignX("center").alignY("center")
)
LC().alignX("center").alignY("center"),
),
) {
jTextArea("Local Source path") {
isEditable = false
Expand All @@ -53,7 +53,7 @@ fun LocalSource(vm: LauncherViewModel, scope: CoroutineScope) = jpanel(
.combine(
keyListener()
.filterIsInstance<KeyListenerEvent.Released>()
.filter { it.event?.keyCode == KeyEvent.VK_ENTER }
.filter { it.event?.keyCode == KeyEvent.VK_ENTER },
) { _, _ -> }
.map {
text?.trim()
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/suwayomi/tachidesk/launcher/ui/Misc.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import suwayomi.tachidesk.launcher.jpanel

fun Misc(vm: LauncherViewModel, scope: CoroutineScope) = jpanel(
MigLayout(
LC().alignX("center").alignY("center")
)
LC().alignX("center").alignY("center"),
),
) {
jCheckBox("Debug logging", selected = vm.debug.value) {
toolTipText = "Use this to toggle extra logging to the console window to help debug issues." // todo improve
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/suwayomi/tachidesk/launcher/ui/Requests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import javax.swing.SpinnerNumberModel

fun Requests(vm: LauncherViewModel, scope: CoroutineScope) = jpanel(
MigLayout(
LC().alignX("center").alignY("center")
)
LC().alignX("center").alignY("center"),
),
) {
jTextArea("Max Parallel Source Requests") {
isEditable = false
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/suwayomi/tachidesk/launcher/ui/RootDir.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import kotlin.io.path.isWritable

fun RootDir(vm: LauncherViewModel, scope: CoroutineScope) = jpanel(
MigLayout(
LC().alignX("center").alignY("center")
)
LC().alignX("center").alignY("center"),
),
) {
jTextArea("Root path") {
isEditable = false
Expand All @@ -53,7 +53,7 @@ fun RootDir(vm: LauncherViewModel, scope: CoroutineScope) = jpanel(
.combine(
keyListener()
.filterIsInstance<KeyListenerEvent.Released>()
.filter { it.event?.keyCode == KeyEvent.VK_ENTER }
.filter { it.event?.keyCode == KeyEvent.VK_ENTER },
) { _, _ -> }
.map {
text?.trim()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import javax.swing.SpinnerNumberModel

fun ServerIpAndPortBindings(vm: LauncherViewModel, scope: CoroutineScope) = jpanel(
MigLayout(
LC().alignX("center").alignY("center")
)
LC().alignX("center").alignY("center"),
),
) {
/*
TODO
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/suwayomi/tachidesk/launcher/ui/SocksProxy.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import javax.swing.SpinnerNumberModel

fun Socks5(vm: LauncherViewModel, scope: CoroutineScope) = jpanel(
MigLayout(
LC().alignX("center").alignY("center")
)
LC().alignX("center").alignY("center"),
),
) {
jCheckBox("Socks Proxy", selected = vm.socksProxyEnabled.value) {
// todo toolTipText = ""
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/suwayomi/tachidesk/launcher/ui/Updater.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import javax.swing.SpinnerNumberModel

fun Updater(vm: LauncherViewModel, scope: CoroutineScope) = jpanel(
MigLayout(
LC().alignX("center").alignY("center")
)
LC().alignX("center").alignY("center"),
),
) {
jCheckBox("Exclude unread chapters", selected = vm.excludeUnreadChapters.value) {
// todo toolTipText = ""
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/suwayomi/tachidesk/launcher/ui/WebUI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ import javax.swing.UIManager

fun WebUI(vm: LauncherViewModel, scope: CoroutineScope) = jpanel(
MigLayout(
LC().alignX("center").alignY("center")
)
LC().alignX("center").alignY("center"),
),
) {
jCheckBox("WebUI", selected = vm.webUIEnabled.value) {
// todo toolTipText = ""
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/suwayomi/tachidesk/launcher/util/PortUsage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import java.util.concurrent.TimeUnit

suspend fun checkIfPortInUse(
ip: String,
port: Int
port: Int,
): Boolean {
val appIP = if (ip == "0.0.0.0") "127.0.0.1" else ip

Expand All @@ -32,7 +32,7 @@ suspend fun checkIfPortInUse(
Request.Builder()
.get()
.url("http://$appIP:$port/api/v1/settings/about/")
.build()
.build(),
).execute().body.string()
}
return true
Expand Down

0 comments on commit a5d7f27

Please sign in to comment.