Display max 24 chars of profile remark.

This commit is contained in:
Qiu Yuzhou
2019-10-12 16:51:01 +08:00
parent f7e5bc54d4
commit e3795096ea
3 changed files with 3 additions and 3 deletions

View File

@ -491,7 +491,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
if mgr.activeProfileId == p.uuid { if mgr.activeProfileId == p.uuid {
var profileName :String var profileName :String
if !p.remark.isEmpty { if !p.remark.isEmpty {
profileName = p.remark profileName = String(p.remark.prefix(24))
} else { } else {
profileName = p.serverHost profileName = p.serverHost
} }

View File

@ -250,7 +250,7 @@ class PreferencesWindowController: NSWindowController
let profile = profileMgr.profiles[index] let profile = profileMgr.profiles[index]
let isActive = (profileMgr.activeProfileId == profile.uuid) let isActive = (profileMgr.activeProfileId == profile.uuid)
if !profile.remark.isEmpty { if !profile.remark.isEmpty {
return (profile.remark, isActive) return (String(profile.remark.prefix(24)), isActive)
} else { } else {
return (profile.serverHost, isActive) return (profile.serverHost, isActive)
} }

View File

@ -328,7 +328,7 @@ class ServerProfile: NSObject, NSCopying {
if remark.isEmpty { if remark.isEmpty {
return "\(serverHost):\(serverPort)" return "\(serverHost):\(serverPort)"
} else { } else {
return "\(remark) (\(serverHost):\(serverPort))" return "\(String(remark.prefix(24))) (\(serverHost):\(serverPort))"
} }
} }