Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Ronove
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kaj Koivunen
Ronove
Commits
1c9815f9
Commit
1c9815f9
authored
2 years ago
by
Kaj Koivunen
Browse files
Options
Downloads
Patches
Plain Diff
eri ikkunoita eteenpäin
parent
7a2fe946
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/kotlin/MainView.kt
+66
-0
66 additions, 0 deletions
src/main/kotlin/MainView.kt
src/main/kotlin/SettingsView.kt
+8
-2
8 additions, 2 deletions
src/main/kotlin/SettingsView.kt
with
74 additions
and
2 deletions
src/main/kotlin/MainView.kt
0 → 100644
+
66
−
0
View file @
1c9815f9
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
)
}
}
This diff is collapsed.
Click to expand it.
src/main/kotlin/SettingsView.kt
+
8
−
2
View file @
1c9815f9
...
@@ -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
()
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment