Skip to content

Commit

Permalink
Add logic to indicate log is updated
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesTKhan committed Apr 13, 2022
1 parent b9df576 commit b59a92e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions editor/src/main/com/mbrlabs/mundus/editor/ui/UI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,8 @@ object UI : Stage(ScreenViewport()) {
dialog.show(this)
}

override fun act() {
super.act()
docker.update();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,8 @@ class DockBar(private val splitPane: MundusSplitPane) : VisTable(), TabbedPaneLi
// user can't do that
}

fun update() {
tabbedPane.updateTabTitle(logBar)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ class LogBar : Tab(false, false), LogEvent.LogEventListener {
private val maxLogSize = 75
private val dateFormat = SimpleDateFormat("HH:mm:ss")

// True when new entries are in the log and log is not the active tab
var newEntries = false

init {
Mundus.registerEventListener(this)
initUi()
Expand Down Expand Up @@ -79,7 +82,15 @@ class LogBar : Tab(false, false), LogEvent.LogEventListener {
})
}

override fun onShow() {
super.onShow()
newEntries = false
}

override fun getTabTitle(): String {
if (newEntries)
return "Log*"

return "Log"
}

Expand All @@ -96,6 +107,9 @@ class LogBar : Tab(false, false), LogEvent.LogEventListener {
* removes old entries.
*/
private fun addLogMessage(message : String) {
if (!isActiveTab)
newEntries = true

val timeStamp = dateFormat.format(Date())

val logString = buildString {
Expand Down

0 comments on commit b59a92e

Please sign in to comment.