-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #131 from deltacv/dev
v4.0.1
- Loading branch information
Showing
14 changed files
with
334 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/gui/dialog/CrashReportOutput.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package com.github.serivesmejia.eocvsim.gui.dialog | ||
|
||
import com.formdev.flatlaf.intellijthemes.FlatArcDarkIJTheme | ||
import com.github.serivesmejia.eocvsim.gui.EOCVSimIconLibrary | ||
import com.github.serivesmejia.eocvsim.gui.dialog.component.OutputPanel | ||
import com.github.serivesmejia.eocvsim.gui.dialog.component.OutputPanel.DefaultBottomButtonsPanel | ||
import java.awt.Dimension | ||
import java.awt.Font | ||
import javax.swing.BoxLayout | ||
import javax.swing.JDialog | ||
import javax.swing.JFrame | ||
import javax.swing.JLabel | ||
import javax.swing.SwingUtilities | ||
import javax.swing.WindowConstants | ||
import kotlin.system.exitProcess | ||
|
||
class CrashReportOutput( | ||
parent: JFrame?, | ||
crashReport: String | ||
){ | ||
val output by lazy { | ||
JDialog(parent) | ||
} | ||
|
||
private val reportPanel by lazy { | ||
OutputPanel(DefaultBottomButtonsPanel { exitProcess(0) }) | ||
} | ||
|
||
init { | ||
output.isModal = true | ||
output.title = "Crash Report" | ||
output.layout = BoxLayout(output.contentPane, BoxLayout.Y_AXIS) | ||
output.isAlwaysOnTop = true | ||
|
||
reportPanel.outputArea.text = crashReport | ||
SwingUtilities.invokeLater { | ||
reportPanel.resetScroll() | ||
} | ||
|
||
output.add(JLabel("An unexpected fatal error occurred, please report this to the developers.").apply { | ||
font = font.deriveFont(Font.BOLD, 18f) | ||
alignmentX = JLabel.CENTER_ALIGNMENT | ||
}) | ||
output.add(reportPanel) | ||
|
||
output.defaultCloseOperation = WindowConstants.DISPOSE_ON_CLOSE | ||
|
||
output.size = Dimension(800, 400) | ||
|
||
output.iconImages = listOf( | ||
EOCVSimIconLibrary.icoEOCVSim128.image, | ||
EOCVSimIconLibrary.icoEOCVSim64.image, | ||
EOCVSimIconLibrary.icoEOCVSim32.image, | ||
EOCVSimIconLibrary.icoEOCVSim16.image | ||
) | ||
|
||
output.setLocationRelativeTo(null) | ||
output.isVisible = true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...ain/java/com/github/serivesmejia/eocvsim/util/exception/handling/CrashReportOutputMain.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.github.serivesmejia.eocvsim.util.exception.handling | ||
|
||
import com.formdev.flatlaf.intellijthemes.FlatArcDarkIJTheme | ||
import com.github.serivesmejia.eocvsim.Build | ||
import com.github.serivesmejia.eocvsim.gui.DialogFactory | ||
import com.github.serivesmejia.eocvsim.util.SysUtil | ||
import kotlinx.coroutines.Runnable | ||
import picocli.CommandLine | ||
import java.io.File | ||
import javax.swing.SwingUtilities | ||
|
||
object CrashReportOutputMain { | ||
@CommandLine.Command(name = "report", mixinStandardHelpOptions = true, version = [Build.versionString]) | ||
private class CrashReportOutputCommandInterface : Runnable { | ||
@CommandLine.Option(names = ["-p", "--path"], description = ["Specifies the path where the crash report was saved"]) | ||
@JvmField var crashReportPath: String? = null | ||
|
||
override fun run() { | ||
SwingUtilities.invokeLater(FlatArcDarkIJTheme::setup) | ||
DialogFactory.createCrashReport(null, SysUtil.loadFileStr(File(crashReportPath ?: ""))) | ||
} | ||
} | ||
|
||
@JvmStatic | ||
fun main(args: Array<String>) { | ||
CommandLine(CrashReportOutputCommandInterface()).execute(*args) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.