Skip to content

Commit fd6f38d

Browse files
committed
Support hiding parts of the UI
feat: Support hiding parts of the UI to increase visible area Change default theme to FlatLaf macOS Dark Make log detail dialog non-modal fix: Fix filter tag background visibility in some themes
1 parent 0033ae8 commit fd6f38d

File tree

28 files changed

+341
-156
lines changed

28 files changed

+341
-156
lines changed

app/src/main/kotlin/me/gegenbauer/catspy/Application.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import me.gegenbauer.catspy.concurrency.AppScope
1010
import me.gegenbauer.catspy.concurrency.GIO
1111
import me.gegenbauer.catspy.concurrency.UI
1212
import me.gegenbauer.catspy.conf.DebugConfiguration
13-
import me.gegenbauer.catspy.conf.GlobalConfSync
1413
import me.gegenbauer.catspy.configuration.GlobalStrings
1514
import me.gegenbauer.catspy.configuration.SettingsManager
1615
import me.gegenbauer.catspy.context.ServiceManager
@@ -50,7 +49,6 @@ object Application : WindowAdapter() {
5049
GLog.i(TAG, "[main] start")
5150
Preferences.loadFromDisk()
5251
SettingsManager.init()
53-
GlobalConfSync.init()
5452
DebugConfiguration.apply()
5553
GLog.i(TAG, "[currentPlatform] $currentPlatform")
5654
registerGlobalService()

app/src/main/kotlin/me/gegenbauer/catspy/conf/GlobalConfSync.kt

Lines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package me.gegenbauer.catspy.conf
2+
3+
import me.gegenbauer.catspy.cache.CacheLog
4+
import me.gegenbauer.catspy.configuration.GlobalStrings
5+
import me.gegenbauer.catspy.configuration.WriteSyncValueProperty
6+
import me.gegenbauer.catspy.configuration.currentSettings
7+
import me.gegenbauer.catspy.databinding.BindingLog
8+
import me.gegenbauer.catspy.databinding.bind.ObservableValueProperty
9+
import me.gegenbauer.catspy.ddmlib.log.DdmLog
10+
import me.gegenbauer.catspy.glog.GLog
11+
import me.gegenbauer.catspy.log.Log
12+
import me.gegenbauer.catspy.log.filter.StorableValueProperty
13+
import me.gegenbauer.catspy.task.TaskLog
14+
15+
object MainConfSync {
16+
val globalDebug: ObservableValueProperty<Boolean> = WriteSyncValueProperty(
17+
listOf(
18+
currentSettings.debugSettings::globalDebug,
19+
GLog::debug
20+
),
21+
currentSettings.debugSettings.globalDebug
22+
)
23+
val dataBindingDebug: ObservableValueProperty<Boolean> = WriteSyncValueProperty(
24+
listOf(
25+
currentSettings.debugSettings::dataBindingDebug,
26+
BindingLog::debug
27+
),
28+
currentSettings.debugSettings.dataBindingDebug
29+
)
30+
val taskDebug: ObservableValueProperty<Boolean> = WriteSyncValueProperty(
31+
listOf(
32+
currentSettings.debugSettings::taskDebug,
33+
TaskLog::debug
34+
),
35+
currentSettings.debugSettings.taskDebug
36+
)
37+
val ddmDebug: ObservableValueProperty<Boolean> = WriteSyncValueProperty(
38+
listOf(
39+
currentSettings.debugSettings::ddmDebug,
40+
DdmLog::debug
41+
),
42+
currentSettings.debugSettings.ddmDebug
43+
)
44+
val cacheDebug: ObservableValueProperty<Boolean> = WriteSyncValueProperty(
45+
listOf(
46+
currentSettings.debugSettings::cacheDebug,
47+
CacheLog::debug
48+
),
49+
currentSettings.debugSettings.cacheDebug
50+
)
51+
val logDebug: ObservableValueProperty<Boolean> = WriteSyncValueProperty(
52+
listOf(
53+
currentSettings.debugSettings::logDebug,
54+
Log::debug
55+
),
56+
currentSettings.debugSettings.logDebug
57+
)
58+
59+
val showStatusBar: ObservableValueProperty<Boolean> = StorableValueProperty(
60+
GlobalStrings.FUNC_SHOW_STATUS_BAR,
61+
true
62+
)
63+
}

app/src/main/kotlin/me/gegenbauer/catspy/ui/MainFrame.kt

Lines changed: 47 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ package me.gegenbauer.catspy.ui
22

33
import kotlinx.coroutines.*
44
import me.gegenbauer.catspy.concurrency.*
5-
import me.gegenbauer.catspy.conf.GlobalConfSync
5+
import me.gegenbauer.catspy.conf.MainConfSync
6+
import me.gegenbauer.catspy.configuration.GlobalStrings
67
import me.gegenbauer.catspy.configuration.SettingsManager
78
import me.gegenbauer.catspy.configuration.currentSettings
89
import me.gegenbauer.catspy.context.Context
@@ -16,6 +17,7 @@ import me.gegenbauer.catspy.glog.GLog
1617
import me.gegenbauer.catspy.iconset.appIcons
1718
import me.gegenbauer.catspy.java.ext.EMPTY_STRING
1819
import me.gegenbauer.catspy.java.ext.KotlinReflectionPreTrigger
20+
import me.gegenbauer.catspy.log.LogConfSync
1921
import me.gegenbauer.catspy.network.update.ReleaseEvent
2022
import me.gegenbauer.catspy.platform.currentPlatform
2123
import me.gegenbauer.catspy.strings.STRINGS
@@ -25,15 +27,17 @@ import me.gegenbauer.catspy.ui.dialog.GThemeSettingsDialog.Companion.GROUP_INDEX
2527
import me.gegenbauer.catspy.ui.dialog.UpdateDialog
2628
import me.gegenbauer.catspy.ui.menu.HelpMenu
2729
import me.gegenbauer.catspy.ui.menu.SettingsMenu
30+
import me.gegenbauer.catspy.ui.menu.ViewMenu
2831
import me.gegenbauer.catspy.ui.panel.MemoryStatusBar
2932
import me.gegenbauer.catspy.ui.panel.TabManagerPane
33+
import me.gegenbauer.catspy.utils.ui.Key
3034
import me.gegenbauer.catspy.utils.ui.dismissOnClickOutsideWindows
35+
import me.gegenbauer.catspy.utils.ui.installKeyStroke
3136
import me.gegenbauer.catspy.utils.ui.registerDismissOnClickOutsideListener
3237
import me.gegenbauer.catspy.view.panel.StatusPanel
3338
import me.gegenbauer.catspy.view.tab.OnTabChangeListener
3439
import me.gegenbauer.catspy.view.tab.TabManager
3540
import java.awt.BorderLayout
36-
import java.awt.Frame
3741
import java.awt.event.WindowAdapter
3842
import java.awt.event.WindowEvent
3943
import java.io.File
@@ -51,9 +55,11 @@ class MainFrame(
5155
//region menu
5256
private val helpMenu = HelpMenu()
5357
private val settingsMenu = SettingsMenu()
58+
private val viewMenu = ViewMenu()
5459
private val menuBar = JMenuBar().apply {
5560
add(this@MainFrame.settingsMenu)
5661
add(this@MainFrame.helpMenu)
62+
add(this@MainFrame.viewMenu)
5763
}
5864
//endregion
5965

@@ -92,12 +98,18 @@ class MainFrame(
9298
}
9399

94100
private fun bindGlobalProperties() {
95-
selectedProperty(settingsMenu.globalDebug) bindDual GlobalConfSync.globalDebug
96-
selectedProperty(settingsMenu.bindingDebug) bindDual GlobalConfSync.dataBindingDebug
97-
selectedProperty(settingsMenu.taskDebug) bindDual GlobalConfSync.taskDebug
98-
selectedProperty(settingsMenu.ddmDebug) bindDual GlobalConfSync.ddmDebug
99-
selectedProperty(settingsMenu.cacheDebug) bindDual GlobalConfSync.cacheDebug
100-
selectedProperty(settingsMenu.logDebug) bindDual GlobalConfSync.logDebug
101+
selectedProperty(settingsMenu.globalDebug) bindDual MainConfSync.globalDebug
102+
selectedProperty(settingsMenu.bindingDebug) bindDual MainConfSync.dataBindingDebug
103+
selectedProperty(settingsMenu.taskDebug) bindDual MainConfSync.taskDebug
104+
selectedProperty(settingsMenu.ddmDebug) bindDual MainConfSync.ddmDebug
105+
selectedProperty(settingsMenu.cacheDebug) bindDual MainConfSync.cacheDebug
106+
selectedProperty(settingsMenu.logDebug) bindDual MainConfSync.logDebug
107+
// view
108+
selectedProperty(viewMenu.showLogToolbar) bindDual LogConfSync.showLogToolbar
109+
selectedProperty(viewMenu.showFilterPanel) bindDual LogConfSync.showFilterPanel
110+
selectedProperty(viewMenu.showLogPanelToolbar) bindDual LogConfSync.showLogPanelToolbar
111+
selectedProperty(viewMenu.showLogTableColumnNames) bindDual LogConfSync.showLogTableColumnNames
112+
selectedProperty(viewMenu.showStatusBar) bindDual MainConfSync.showStatusBar
101113
}
102114

103115
private fun configureAdbPath() {
@@ -126,15 +138,11 @@ class MainFrame(
126138
unfocusedTabs.forEach { (it as? OnTabChangeListener)?.onTabFocusChanged(false) }
127139
}
128140
}
129-
addWindowFocusListener(object : WindowAdapter() {
130-
override fun windowLostFocus(e: WindowEvent) {
131-
getWindows().filter { it.type == Type.POPUP }.forEach { it.dispose() }
132-
}
133-
})
134141
observeEventFlow()
135142
observeGlobalMessage()
136143
observeGlobalEvent()
137-
registerDismissOnClickOutsideListener { it.javaClass.simpleName in dismissOnClickOutsideWindows }
144+
observeStatusbarVisibility()
145+
registerGlobalKeyEvents()
138146
}
139147

140148
private fun preTriggerKotlinReflection() {
@@ -279,10 +287,34 @@ class MainFrame(
279287
}
280288
}
281289

290+
private fun observeStatusbarVisibility() {
291+
MainConfSync.showStatusBar.addObserver {
292+
globalStatus.isVisible = it == true
293+
}
294+
}
295+
296+
private fun registerGlobalKeyEvents() {
297+
installKeyStroke(Key.C_1, GlobalStrings.FUNC_SHOW_LOG_TOOLBAR) {
298+
LogConfSync.showLogToolbar.updateValue(!(LogConfSync.showLogToolbar.value ?: true))
299+
}
300+
installKeyStroke(Key.C_2, GlobalStrings.FUNC_SHOW_FILTER_PANEL) {
301+
LogConfSync.showFilterPanel.updateValue(!(LogConfSync.showFilterPanel.value ?: true))
302+
}
303+
installKeyStroke(Key.C_3, GlobalStrings.FUNC_SHOW_LOG_PANEL_TOOLBAR) {
304+
LogConfSync.showLogPanelToolbar.updateValue(!(LogConfSync.showLogPanelToolbar.value ?: true))
305+
}
306+
installKeyStroke(Key.C_4, GlobalStrings.FUNC_SHOW_LOG_TABLE_COLUMN_NAMES) {
307+
LogConfSync.showLogTableColumnNames.updateValue(!(LogConfSync.showLogTableColumnNames.value ?: true))
308+
}
309+
installKeyStroke(Key.C_5, GlobalStrings.FUNC_SHOW_STATUS_BAR) {
310+
MainConfSync.showStatusBar.updateValue(!(MainConfSync.showStatusBar.value ?: true))
311+
}
312+
}
313+
282314
private fun configureWindow() {
283315
iconImages = appIcons
284316

285-
currentSettings.windowSettings.loadWindowSettings(this, Frame.MAXIMIZED_BOTH)
317+
currentSettings.windowSettings.loadWindowSettings(this, MAXIMIZED_BOTH)
286318
}
287319

288320
override fun destroy() {
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package me.gegenbauer.catspy.ui.menu
2+
3+
import me.gegenbauer.catspy.context.Context
4+
import me.gegenbauer.catspy.context.Contexts
5+
import me.gegenbauer.catspy.strings.STRINGS
6+
import me.gegenbauer.catspy.utils.ui.applyTooltip
7+
import me.gegenbauer.catspy.view.menu.GMenu
8+
import java.awt.event.KeyEvent
9+
import javax.swing.JCheckBoxMenuItem
10+
11+
class ViewMenu(override val contexts: Contexts = Contexts.default) : GMenu(), Context {
12+
val showLogToolbar = JCheckBoxMenuItem(STRINGS.ui.showLogToolbar).applyTooltip(STRINGS.toolTip.showLogToolbar)
13+
val showFilterPanel = JCheckBoxMenuItem(STRINGS.ui.showFilterPanel).applyTooltip(STRINGS.toolTip.showFilterPanel)
14+
val showStatusBar = JCheckBoxMenuItem(STRINGS.ui.showStatusBar).applyTooltip(STRINGS.toolTip.showStatusBar)
15+
val showLogTableColumnNames = JCheckBoxMenuItem(STRINGS.ui.showLogTableColumnNames).applyTooltip(STRINGS.toolTip.showLogTableColumnNames)
16+
val showLogPanelToolbar = JCheckBoxMenuItem(STRINGS.ui.showLogPanelToolbar).applyTooltip(STRINGS.toolTip.showLogPanelToolbar)
17+
18+
init {
19+
text = STRINGS.ui.menuView
20+
mnemonic = KeyEvent.VK_V
21+
22+
add(showLogToolbar)
23+
add(showFilterPanel)
24+
add(showLogPanelToolbar)
25+
add(showLogTableColumnNames)
26+
add(showStatusBar)
27+
}
28+
}

app/src/main/resources/me/gegenbauer/catspy/FlatDarkLaf.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ Action.toggleButton.selectedBackground = #4e5157
3636
Action.toggleButton.selectedForeground = #c6c8ce
3737

3838
#---- Chip ----
39-
Chip.background = #565656
40-
Chip.hoverBackground = #5E5E5E
39+
Chip.bg = #565656
40+
Chip.hoverBg = #5E5E5E
4141
Chip.borderColor = #676767

app/src/main/resources/me/gegenbauer/catspy/FlatLightLaf.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ Action.toggleButton.selectedBackground = #dfe1e5
3636
Action.toggleButton.selectedForeground = #777b88
3737

3838
#---- Chip ----
39-
Chip.background = #0000000F
40-
Chip.hoverBackground = #0000001F
39+
Chip.bg = #0000000F
40+
Chip.hoverBg = #0000001F
4141
Chip.borderColor = #1F1F1F26

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ kotlin.code.style=official
44
# Application Global Properties
55
app.name=CatSpy
66
app.id=me.gegenbauer.catspy
7-
app.version.name=1.1.12
8-
app.version.code=1001012
7+
app.version.name=1.1.13
8+
app.version.code=1001013
99
app.author=gegenbauer
1010
app.repo=catspy
1111
app.repo.link=https://github.com/Gegenbauer/CatSpy

resources/strings/default.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,12 @@
100100
"searchTargetLabel": "Searching View: filtered log, full log",
101101
"selectLogBuffer": "Select log buffers, such as main, system, radio, events, etc. The default is all buffers.",
102102
"selectTabBtn": "Select function tab",
103+
"showFilterPanel": "Update visibility of Filter Panel, press CTRL + NUM2 for quick access",
103104
"showFullLog": "whether to show full log panel or not",
105+
"showLogPanelToolbar": "Update visibility of Log Panel Toolbar, press CTRL + NUM3 for quick access",
106+
"showLogTableColumnNames": "Update visibility of Column Header, press CTRL + NUM4 for quick access",
107+
"showLogToolbar": "Update visibility of Log Toolbar, press CTRL + NUM1 for quick access",
108+
"showStatusBar": "Update visibility of Status Bar, press CTRL + NUM5 for quick access",
104109
"splitChar": "Character used to split strings",
105110
"startBtn": "CTRL+P: Start adb logcat and receive logs",
106111
"stopBtn": "CTRL+K: Stop adb logcat",
@@ -269,6 +274,7 @@
269274
"menuSettings": "Settings",
270275
"menuShowLogInFiles": "Show Log in Files",
271276
"menuTheme": "Theme",
277+
"menuView": "View",
272278
"mergeNearByPartsFromIndexLabel": "From:",
273279
"mergeNearByPartsToIndexLabel": "To:",
274280
"mergeUntilCharStartIndexLabel": "Start Index:",
@@ -328,7 +334,12 @@
328334
"settingsCopyToClipboardSuccess": "Settings has been copied to clipboard",
329335
"showEntireLine": "Show Entire Line",
330336
"showFileInFileManager": "Show in Files",
337+
"showFilterPanel": "Show Filter Panel",
331338
"showFullLogBtn": "show full log",
339+
"showLogPanelToolbar": "Show Log Panel Toolbar",
340+
"showLogTableColumnNames": "Show Log Table Column Names",
341+
"showLogToolbar": "Show Log Toolbar",
342+
"showStatusBar": "Show Status Bar",
332343
"size": "Size",
333344
"splitCharLabel": "Split Character:",
334345
"start": "Start",

resources/strings/src/main/resources/strings/en.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,12 @@
100100
"searchTargetLabel": "Searching View: filtered log, full log",
101101
"selectLogBuffer": "Select log buffers, such as main, system, radio, events, etc. The default is all buffers.",
102102
"selectTabBtn": "Select function tab",
103+
"showFilterPanel": "Update visibility of Filter Panel, press CTRL + NUM2 for quick access",
103104
"showFullLog": "whether to show full log panel or not",
105+
"showLogPanelToolbar": "Update visibility of Log Panel Toolbar, press CTRL + NUM3 for quick access",
106+
"showLogTableColumnNames": "Update visibility of Column Header, press CTRL + NUM4 for quick access",
107+
"showLogToolbar": "Update visibility of Log Toolbar, press CTRL + NUM1 for quick access",
108+
"showStatusBar": "Update visibility of Status Bar, press CTRL + NUM5 for quick access",
104109
"splitChar": "Character used to split strings",
105110
"startBtn": "CTRL+P: Start adb logcat and receive logs",
106111
"stopBtn": "CTRL+K: Stop adb logcat",
@@ -267,6 +272,7 @@
267272
"menuSettings": "Settings",
268273
"menuShowLogInFiles": "Show Log in Files",
269274
"menuTheme": "Theme",
275+
"menuView": "View",
270276
"mergeNearByPartsFromIndexLabel": "From:",
271277
"mergeNearByPartsToIndexLabel": "To:",
272278
"mergeUntilCharStartIndexLabel": "Start Index:",
@@ -325,7 +331,12 @@
325331
"settingsCopyToClipboardSuccess": "Settings has been copied to clipboard",
326332
"showEntireLine": "Show Entire Line",
327333
"showFileInFileManager": "Show in Files",
334+
"showFilterPanel": "Show Filter Panel",
328335
"showFullLogBtn": "show full log",
336+
"showLogPanelToolbar": "Show Log Panel Toolbar",
337+
"showLogTableColumnNames": "Show Log Table Column Names",
338+
"showLogToolbar": "Show Log Toolbar",
339+
"showStatusBar": "Show Status Bar",
329340
"size": "Size",
330341
"splitCharLabel": "Split Character:",
331342
"start": "Start",

0 commit comments

Comments
 (0)