Skip to content

Commit

Permalink
feat: 新增jre/vm信息显示, 置顶APP
Browse files Browse the repository at this point in the history
  • Loading branch information
Leon406 committed Sep 5, 2021
1 parent 4b4b6f9 commit 0fc4ff0
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 34 deletions.
6 changes: 6 additions & 0 deletions src/main/kotlin/me/leon/ext/Prefs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ import java.util.prefs.Preferences

object Prefs {
private const val IGNORE_UPDATE = "isIgnoreUpdate"
private const val ALWAYS_ON_TOP = "alwaysOnTop"
private val preference = Preferences.userNodeForPackage(Prefs::class.java)
var isIgnoreUpdate
get() = preference.getBoolean(IGNORE_UPDATE, false)
set(value) {
preference.putBoolean(IGNORE_UPDATE, value)
}
var alwaysOnTop
get() = preference.getBoolean(ALWAYS_ON_TOP, true)
set(value) {
preference.putBoolean(ALWAYS_ON_TOP, value)
}
}
18 changes: 10 additions & 8 deletions src/main/kotlin/me/leon/view/AboutView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ class AboutView : View("关于") {
spacing = DEFAULT_SPACING
paddingAll = DEFAULT_SPACING
imageview(Image("/tb.png"))
text("版本 v$VERSION") { font = Font.font(18.0) }
text("构建时间 ${times()}")
text("版本: v$VERSION") { font = Font.font(18.0) }
text("BUILD: ${times()}")
text("JRE: ${System.getProperty("java.runtime.version")}")
text("VM: ${System.getProperty("java.vm.name")}")
hyperlink("吾爱破解地址") { action { PJ52_URL.openInBrowser() } }
hyperlink("github开源地址") {
font = Font.font(18.0)
Expand All @@ -36,11 +38,11 @@ class AboutView : View("关于") {
private fun checkUpdate(isAuto: Boolean = true) {
if (!isAuto) return
runAsync { CHECK_UPDATE_URL.readFromNet(CHECK_UPDATE_URL2) } ui
{
latestVersion.text =
if (it.isEmpty()) "未知错误"
else if (VERSION != it) "发现新版本 v$it".also { find<UpdateFragment>().openModal() }
else "已是最新版本"
}
{
latestVersion.text =
if (it.isEmpty()) "未知错误"
else if (VERSION != it) "发现新版本 v$it".also { find<UpdateFragment>().openModal() }
else "已是最新版本"
}
}
}
2 changes: 2 additions & 0 deletions src/main/kotlin/me/leon/view/Home.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.leon.view

import javafx.stage.StageStyle
import java.security.Security
import me.leon.APP_NAME
import me.leon.VERSION
Expand All @@ -19,6 +20,7 @@ class Home : View("$APP_NAME v.$VERSION") {
tab<SignatureView>()
tab<QrcodeView>()
tab<AboutView>()
primaryStage.isAlwaysOnTop = true
}

companion object {
Expand Down
42 changes: 16 additions & 26 deletions src/main/kotlin/me/leon/view/QrcodeView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,8 @@ import javafx.scene.layout.HBox
import javafx.scene.paint.Paint
import javafx.stage.Stage
import javafx.stage.StageStyle
import me.leon.ext.*
import kotlin.math.abs
import me.leon.ext.DEFAULT_SPACING_20X
import me.leon.ext.DEFAULT_SPACING_2X
import me.leon.ext.DEFAULT_SPACING_3X
import me.leon.ext.DEFAULT_SPACING_4X
import me.leon.ext.clipboardImage
import me.leon.ext.clipboardText
import me.leon.ext.copy
import me.leon.ext.createQR
import me.leon.ext.fileChooser
import me.leon.ext.qrReader
import me.leon.ext.showToast
import me.leon.ext.toBufferImage
import me.leon.ext.toFxImg
import tornadofx.*

class QrcodeView : View("Qrcode") {
Expand Down Expand Up @@ -90,19 +78,6 @@ class QrcodeView : View("Qrcode") {
}
}
}
hbox {
spacing = DEFAULT_SPACING_2X
label("生成:")
button("生成二维码") {
action {
if (tf.text.isNotEmpty()) {
iv.image = createQR(tf.text)
}
}
shortcut(KeyCombination.valueOf("F9"))
tooltip("快捷键F9")
}
}

hbox {
spacing = DEFAULT_SPACING_3X
Expand All @@ -118,7 +93,22 @@ class QrcodeView : View("Qrcode") {
textarea {
promptText = "请输入文本或者使用截屏识别/识别二维码"
isWrapText = true
prefHeight = DEFAULT_SPACING_10X
}

hbox {
spacing = DEFAULT_SPACING_2X
label("生成:")
button("生成二维码") {
action {
if (tf.text.isNotEmpty()) {
iv.image = createQR(tf.text)
}
}
shortcut(KeyCombination.valueOf("F9"))
tooltip("快捷键F9")
}
}
hbox {
label("二维码图片:")
button(graphic = imageview(Image("/copy.png"))) {
Expand Down

0 comments on commit 0fc4ff0

Please sign in to comment.