Skip to content

Commit

Permalink
Last minute fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kikugie committed Aug 24, 2024
1 parent 7361e5a commit 3ce5158
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import java.nio.file.Path
import kotlin.io.path.invariantSeparatorsPathString

object Downloader {
private const val FAILURE = "soundboard.download.failure"
private const val SUCCESS = "soundboard.download.success"
private const val FAILURE = "soundboard.downloader.failure"
private const val SUCCESS = "soundboard.downloader.success"
private val downloads: MutableMap<Path, Pair<URI, Job>> = mutableMapOf()

fun isDownloading(path: Path) = path in downloads
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class DownloadScreen : BaseOwoScreen<StackLayout>() {
const val URL = "soundboard.downloader.url"
const val FOOTER = "soundboard.downloader.footer"

const val FILE_TOOLTIP = "soundboard.downloader.tooltip.path"
const val URL_TOOLTIP = "soundboard.downloader.tooltip.url"

const val DOWNLOAD = "soundboard.downloader.tooltip.download"
const val OVERWRITE_PATH = "soundboard.downloader.tooltip.overwrite_path"
const val DOWNLOADING_PATH = "soundboard.downloader.tooltip.downloading_path"
Expand All @@ -60,7 +63,9 @@ class DownloadScreen : BaseOwoScreen<StackLayout>() {
root = component + setup()
root.childById<FlowLayout>("container")!!.apply {
gap = 2
this += label(FILE_PATH.translation())
this += label(FILE_PATH.translation()) {
tooltipText = FILE_TOOLTIP.translation()
}
this += coloredTextBox {
id = "path"
maxLength = Short.MAX_VALUE.toInt()
Expand Down Expand Up @@ -96,7 +101,9 @@ class DownloadScreen : BaseOwoScreen<StackLayout>() {
}

this += fixedSpacer(4)
this += label(URL.translation())
this += label(URL.translation()) {
tooltipText = URL_TOOLTIP.translation()
}
this += horizontalFlow {
gap = 2
verticalAlignment = VerticalAlignment.CENTER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ package dev.kikugie.soundboard.gui.widget
import com.mojang.blaze3d.systems.RenderSystem
import dev.kikugie.kowoui.access.renderer
import dev.kikugie.kowoui.access.sizing
import dev.kikugie.kowoui.access.tooltipText
import dev.kikugie.kowoui.button
import dev.kikugie.kowoui.experimental.plusAssign
import dev.kikugie.kowoui.translation
import dev.kikugie.soundboard.gui.screen.DownloadScreen
import dev.kikugie.soundboard.gui.screen.SoundBrowser
import dev.kikugie.soundboard.util.currentScreen
Expand All @@ -23,7 +25,7 @@ class SidebarWidget(private val current: Screen) : FlowLayout(fixed(16), content

init {
gap(2)
this += tab<SoundBrowser>("sound-browser", 0)
this += tab<SoundBrowser>("browser", 0)
this += tab<DownloadScreen>("downloader", 1)
}

Expand All @@ -32,6 +34,7 @@ class SidebarWidget(private val current: Screen) : FlowLayout(fixed(16), content
sizing = fixed(16)
renderer = texture(WIDGETS, index * 16, 0, 256, 256)
active = current !is T
tooltipText = "soundboard.$name".translation()
onPress { RenderSystem.recordRenderCall { currentScreen = T::class.createInstance() } }
}
}
22 changes: 11 additions & 11 deletions src/main/resources/assets/soundboard/lang/en_us.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ soundboard:
config: Open Soundboard config
play: Play favourite sound (use with number keys)
browser:
.: Sound browser
tooltip:
unavailable: Proximity chat muted or disconnected
directory: Shift-click to open in your file manager
Expand All @@ -26,11 +27,9 @@ soundboard:
favourite: Add to favourites
unfavourite: Remove from favourites
downloader:
path: |-
Save location starting at '.minecraft/config/soundboard/'.
Files are saved as .wav - you don't need to type the extension.
url: |-
Source URL - check supported sources on the cobalt website.
.: Audio downloader
path: Save location
url: Source URL
footer:
- text:
color: gold
Expand All @@ -48,13 +47,14 @@ soundboard:
You're responsible for what you download, so be mindful when using the service.
color: dark_gray
bold: false
failure:
- text: Failed to save %s. Check the game log
color: red
success:
- text: Downloaded %s
color: green
failure: §4[Soundboard] Failed to save %s. Check the game log for more details
success: §a[Soundboard] Downloaded %s
tooltip:
path: |-
Save location starting at '.minecraft/config/soundboard/'.
Files are saved as .wav - you don't need to type the extension.
url: |-
Video or audio link - check supported sources on the cobalt website.
overwrite_path: File already exists and will be overwritten
downloading_path: File is already being downloaded and will be overwritten
invalid_path: Provided path is invalid
Expand Down

0 comments on commit 3ce5158

Please sign in to comment.