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
39236c19
Commit
39236c19
authored
1 year ago
by
Kaj Koivunen
Browse files
Options
Downloads
Patches
Plain Diff
recent projektit
parent
c6847bad
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/Project.kt
+44
-2
44 additions, 2 deletions
src/main/kotlin/Project.kt
src/main/kotlin/SplashScreen.kt
+9
-53
9 additions, 53 deletions
src/main/kotlin/SplashScreen.kt
with
53 additions
and
55 deletions
src/main/kotlin/Project.kt
+
44
−
2
View file @
39236c19
...
@@ -65,7 +65,7 @@ class Project {
...
@@ -65,7 +65,7 @@ class Project {
* Loads project from specified file
* Loads project from specified file
* @param file file to load
* @param file file to load
*/
*/
private
fun
loadFile
(
file
:
File
)
{
fun
loadFile
(
file
:
File
)
{
if
(!
file
.
exists
())
return
if
(!
file
.
exists
())
return
new
()
new
()
file
.
bufferedReader
().
use
{
reader
->
file
.
bufferedReader
().
use
{
reader
->
...
@@ -84,7 +84,7 @@ class Project {
...
@@ -84,7 +84,7 @@ class Project {
* Saves project to a specified file
* Saves project to a specified file
* @param file file to save to
* @param file file to save to
*/
*/
private
fun
saveFile
(
file
:
File
)
{
fun
saveFile
(
file
:
File
)
{
file
.
printWriter
().
use
{
writer
->
file
.
printWriter
().
use
{
writer
->
var
pageNumber
=
1
var
pageNumber
=
1
for
(
page
in
pages
)
{
for
(
page
in
pages
)
{
...
@@ -92,6 +92,7 @@ class Project {
...
@@ -92,6 +92,7 @@ class Project {
page
.
save
(
writer
)
page
.
save
(
writer
)
}
}
}
}
addRecent
(
"name"
,
file
)
}
}
/**
/**
...
@@ -107,6 +108,47 @@ class Project {
...
@@ -107,6 +108,47 @@ class Project {
for
(
page
in
pages
)
page
.
translatePage
()
for
(
page
in
pages
)
page
.
translatePage
()
}
}
companion
object
{
/** List of recently opened projects */
val
recent
:
MutableList
<
Pair
<
String
,
File
>>
=
mutableListOf
()
/** File to store recent projects in */
private
val
recentFile
=
File
(
"recent.rvs"
)
init
{
if
(
recentFile
.
exists
())
{
recentFile
.
bufferedReader
().
use
{
reader
->
var
line
:
String
?
while
(
reader
.
readLine
().
also
{
line
=
it
}
!=
null
)
{
val
s
=
line
!!
.
split
(
2
.
toChar
())
recent
.
add
(
s
.
getOrElse
(
0
)
{
""
}
to
File
(
s
.
getOrElse
(
1
)
{
""
}))
}
}
}
else
{
print
(
"Creating recent file: $recentFile"
)
recentFile
.
printWriter
().
use
{
writer
->
writer
.
println
()
}
}
}
/**
* Adds a file to recent list, if it isn't there yet
* @param name Name of display to user
* @param file Path to file
*/
fun
addRecent
(
name
:
String
,
file
:
File
)
{
for
(
recent
in
recent
)
{
if
(
recent
.
second
==
file
)
return
}
recent
.
add
(
name
to
file
)
recentFile
.
printWriter
().
use
{
writer
->
for
(
recent
in
recent
)
{
writer
.
println
(
"${recent.first}${2.toChar()}${recent.second}"
)
}
}
}
}
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
src/main/kotlin/SplashScreen.kt
+
9
−
53
View file @
39236c19
...
@@ -14,61 +14,17 @@ class SplashScreen(project: Project) : View("Ronove") {
...
@@ -14,61 +14,17 @@ class SplashScreen(project: Project) : View("Ronove") {
override
val
root
=
borderpane
{
override
val
root
=
borderpane
{
center
=
form
{
center
=
form
{
fieldset
{
fieldset
{
field
{
for
(
recent
in
Project
.
recent
)
{
hyperlink
(
"Dummy 1"
)
{
field
{
action
{
hyperlink
(
recent
.
first
)
{
project
.
pages
=
mutableListOf
(
action
{
Page
(
listOf
(
project
.
loadFile
(
recent
.
second
)
Line
(
"なんでタバコすってんだ?"
,
"Why are you smoking?"
,
"Why do you smoke?"
),
(
app
as
Ronove
).
table
.
refresh
()
Line
(
"んー"
,
"Hmm."
,
"Hmm..."
),
close
()
Line
(
"フー"
,
"whoosh"
,
"Haa..."
,
"SFX: Exhaling"
),
}
Line
(
"カツコつけてんの"
,
"I'm trying to be cool."
,
}
"I'm just trying to look cool"
),
Line
(
"かっこいー"
,
"That's so cool."
,
"Coooool!"
)
)),
Page
(
listOf
(
Line
(
"Sivu 2"
,
"Page 2"
,
"Page 2"
),
Line
(
"a"
,
"b"
,
"c"
),
Line
(
"a"
,
"b"
,
"c"
),
Line
(
"a"
,
"b"
,
"c"
)
)),
Page
(
listOf
(
Line
(
"Sivu 3"
,
"Page 3"
,
"Page 3"
),
Line
(
"a"
,
"b"
,
"c"
),
Line
(
"a"
,
"b"
,
"c"
),
Line
(
"a"
,
"b"
,
"c"
),
Line
(
"a"
,
"b"
,
"c"
),
Line
(
"a"
,
"b"
,
"c"
)
)),
Page
(
listOf
(
Line
(
"Sivu 4"
,
"Page 4"
,
"Page 4"
),
Line
(
"a"
,
"b"
,
"c"
),
Line
(
"a"
,
"b"
,
"c"
),
Line
(
"a"
,
"b"
,
"c"
)
)),
Page
(
listOf
(
Line
(
"Sivu 5"
,
"Page 5"
,
"Page 5"
),
Line
(
"a"
,
"b"
,
"c"
),
Line
(
"a"
,
"b"
,
"c"
)
))
)
close
()
(
app
as
Ronove
).
table
.
refresh
()
}
}
}
}
progressbar
(
0.2
)
}
field
{
hyperlink
(
"Dummy 2"
)
progressbar
(
0.3
)
}
field
{
hyperlink
(
"Dummy 3"
)
progressbar
(
0.5
)
}
field
{
hyperlink
(
"Dummy 4"
)
progressbar
(
0.9
)
}
field
{
hyperlink
(
"Dummy 5"
)
progressbar
(
0.9
)
}
field
{
field
{
button
(
"New project"
)
{
action
{
button
(
"New project"
)
{
action
{
project
.
new
()
project
.
new
()
...
...
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