@@ -2,6 +2,7 @@ package mediathek.mac
2
2
3
3
import com.formdev.flatlaf.FlatClientProperties
4
4
import com.formdev.flatlaf.util.SystemInfo
5
+ import mediathek.config.Konstanten
5
6
import mediathek.gui.actions.ShowAboutAction
6
7
import mediathek.gui.messages.DownloadFinishedEvent
7
8
import mediathek.gui.messages.DownloadStartEvent
@@ -13,6 +14,7 @@ import mediathek.tool.MessageBus
13
14
import mediathek.tool.notification.INotificationCenter
14
15
import mediathek.tool.notification.MacNotificationCenter
15
16
import mediathek.tool.threads.IndicatorThread
17
+ import mediathek.tool.timer.TimerPool
16
18
import net.engio.mbassy.listener.Handler
17
19
import org.apache.logging.log4j.LogManager
18
20
import org.apache.logging.log4j.Logger
@@ -23,13 +25,50 @@ import java.awt.Taskbar
23
25
import java.awt.desktop.QuitEvent
24
26
import java.awt.desktop.QuitResponse
25
27
import java.io.IOException
28
+ import java.util.*
29
+ import java.util.concurrent.TimeUnit
30
+ import javax.swing.JOptionPane
26
31
import javax.swing.JPanel
27
32
import javax.swing.JToolBar
33
+ import javax.swing.SwingUtilities
28
34
import kotlin.io.path.absolutePathString
29
35
30
- class MediathekGuiMac : MediathekGui () {
36
+ class MediathekGuiMac : MediathekGui {
31
37
private val powerManager = OsxPowerManager ()
32
38
39
+ constructor () : super () {
40
+ TimerPool .timerPool.schedule({checkForCorrectArchitecture()}, 15 , TimeUnit .SECONDS )
41
+ }
42
+
43
+ /* *
44
+ * Check if MV is running "old" intel application on a new Mac with ARM cpu.
45
+ * Issue warning if true as we have a faster alternative.
46
+ */
47
+ private fun checkForCorrectArchitecture () {
48
+ logger.trace(" Checking for correct JVM architecture on macOS..." )
49
+ val osName = System .getProperty(" os.name" ).lowercase(Locale .getDefault())
50
+ val osArch = System .getProperty(" os.arch" ).lowercase(Locale .getDefault()) // native arch
51
+ val jvmBinaryArch = System .getProperty(" os.arch" ).lowercase(Locale .getDefault())
52
+
53
+ val isAppleSilicon = osName.contains(" mac" ) && osArch.contains(" aarch64" )
54
+ val isJVMIntel = jvmBinaryArch == " x86_64" || jvmBinaryArch == " amd64"
55
+
56
+ if (isAppleSilicon && isJVMIntel) {
57
+ logger.warn(" ⚠️ Running an Intel JVM on Apple Silicon. Consider using a native ARM64 JVM for better performance." )
58
+ SwingUtilities .invokeLater {
59
+ val msg = " <html>Ihr Mac hat eine moderne Apple Silicon CPU.<br/>" +
60
+ " Sie nutzen jedoch eine MediathekView Version für Intel Prozessoren.<br/><br/>" +
61
+ " Um die Geschwindigkeit des Programms erheblich zu verbessern laden Sie bitte<br/>" +
62
+ " die passende <b>MediathekView für Apple Silicon</b> herunter.</html>"
63
+ JOptionPane .showMessageDialog(this ,msg, Konstanten .PROGRAMMNAME , JOptionPane .WARNING_MESSAGE )
64
+ }
65
+ }
66
+ }
67
+
68
+ override fun resetTabPlacement () {
69
+ // do not reset tab placement as it is not necessary...
70
+ }
71
+
33
72
override fun addQuitMenuItem () {
34
73
// using native handler instead
35
74
}
0 commit comments