Skip to content
Snippets Groups Projects
Commit 1c9815f9 authored by Kaj Koivunen's avatar Kaj Koivunen :coffee:
Browse files

eri ikkunoita eteenpäin

parent 7a2fe946
No related branches found
No related tags found
No related merge requests found
package guru.kake.ronove
import javafx.collections.FXCollections
import javafx.scene.image.Image
import javafx.stage.Modality
import javafx.stage.StageStyle
import tornadofx.*
import kotlin.system.exitProcess
class MainView : View("Ronove") {
override val root = borderpane {
top = menubar {
menu("File") {
item("Open").action {
chooseDirectory("Choose folder")
}
menu("Open recent") {
}
item("Save")
item("Close")
item("Exit").action {
exitProcess(0)
}
}
menu("Edit") {
item("Machine translation settings") {
action {
SettingsView().openModal()
}
}
}
menu("Help") {
item("Documentation")
item("About")
}
}
center<TranslationPageView>()
bottom = hbox {
label("MTL: Deepl | ")
label("API quota ")
progressbar(TranslationBackend.quotaProperty)
label(" 48 / 500,000 | ")
val providers = FXCollections.observableArrayList("DeepL","Google Translate")
combobox(values = providers)
}
right = drawer(multiselect = true) {
maxWidth = 100.0
item<ImageTab> {
maxWidth = 100.0
}
item<ReaderTab>()
item<DictionaryTab>()
item<TranslatorTest>()
}
}
init {
primaryStage.icons.add(Image("/ronove128.png"))
SplashScreen().openModal(stageStyle = StageStyle.UTILITY, block = true, modality = Modality.APPLICATION_MODAL, owner = primaryStage)
}
}
...@@ -13,6 +13,13 @@ class SettingsView : View("Settings") { ...@@ -13,6 +13,13 @@ class SettingsView : View("Settings") {
val toggleGroup = ToggleGroup() val toggleGroup = ToggleGroup()
private var backends: MutableList<MTLSettingsMenu<TranslationService>> = mutableListOf() private var backends: MutableList<MTLSettingsMenu<TranslationService>> = mutableListOf()
override val root = form { override val root = form {
label {
text = "Be aware that use of translation APIs may incur costs in accordance to their usage terms. Check with " +
"the translation service provider for their rates. While Ronove will attempt to minimize API calls " +
"where appropriate, be aware that for some providers even testing the API key may be a billed operation."
isWrapText = true
prefWidth = 300.0
}
fun MTLSettingsMenu<*>.add() { fun MTLSettingsMenu<*>.add() {
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
...@@ -21,7 +28,7 @@ class SettingsView : View("Settings") { ...@@ -21,7 +28,7 @@ class SettingsView : View("Settings") {
} }
MTLSettingsMenu(this@SettingsView, "DeepL") { DeepLTranslator(it) }.add() MTLSettingsMenu(this@SettingsView, "DeepL") { DeepLTranslator(it) }.add()
MTLSettingsMenu(this@SettingsView, "Google Translate") { GoogleTranslator(it) }.add() MTLSettingsMenu(this@SettingsView, "Google Translate API v2") { GoogleTranslator(it) }.add()
hbox { hbox {
applyButton = button("Apply") { applyButton = button("Apply") {
...@@ -74,7 +81,6 @@ private class MTLSettingsMenu<T: TranslationService>(private val parent: Setting ...@@ -74,7 +81,6 @@ private class MTLSettingsMenu<T: TranslationService>(private val parent: Setting
} }
saveButton = button("Save & test") { saveButton = button("Save & test") {
action { saveButtonAction() } action { saveButtonAction() }
} }
statusLabel = label() statusLabel = label()
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment