feat: cleaned up Speed widget by refactoring download/upload to input/output to make better logic for both modules: Disk and Network which have different meanings for these values.

This commit is contained in:
Serhiy Mytrovtsiy
2024-10-26 16:11:39 +02:00
parent 68c45ab604
commit 905ce8fa3d
6 changed files with 156 additions and 132 deletions

View File

@@ -94,10 +94,19 @@
<key>Icon</key>
<string>chars</string>
<key>Symbols</key>
<array>
<dict>
<key>Output</key>
<string>W</string>
<key>Input</key>
<string>R</string>
</array>
</dict>
<key>Words</key>
<dict>
<key>Output</key>
<string>Write</string>
<key>Input</key>
<string>Read</string>
</dict>
<key>Order</key>
<integer>5</integer>
</dict>

View File

@@ -296,7 +296,7 @@ public class Disk: Module {
self.menuBar.widgets.filter{ $0.isActive }.forEach { (w: SWidget) in
switch w.item {
case let widget as SpeedWidget:
widget.setValue(upload: d.activity.write, download: d.activity.read)
widget.setValue(input: d.activity.read, output: d.activity.write)
case let widget as NetworkChart:
widget.setValue(upload: Double(d.activity.write), download: Double(d.activity.read))
if self.capacityReader?.interval != 1 {

View File

@@ -22,10 +22,19 @@
<key>Default</key>
<true/>
<key>Symbols</key>
<array>
<dict>
<key>Output</key>
<string>U</string>
<key>Input</key>
<string>D</string>
</array>
</dict>
<key>Words</key>
<dict>
<key>Output</key>
<string>Upload</string>
<key>Input</key>
<string>Download</string>
</dict>
<key>Order</key>
<integer>1</integer>
</dict>

View File

@@ -234,7 +234,7 @@ public class Network: Module {
self.menuBar.widgets.filter{ $0.isActive }.forEach { (w: SWidget) in
switch w.item {
case let widget as SpeedWidget: widget.setValue(upload: upload, download: download)
case let widget as SpeedWidget: widget.setValue(input: download, output: upload)
case let widget as NetworkChart: widget.setValue(upload: Double(upload), download: Double(download))
case let widget as TextWidget:
var text = self.textValue