@@ -21,45 +21,43 @@ class ViewControllerRemoteInfo: NSViewController, SetDismisser, Abort, Setcolor
2121 @IBOutlet var abortbutton : NSButton !
2222 @IBOutlet var count : NSTextField !
2323
24- private var remoteinfotask : RemoteinfoEstimation ?
24+ private var remoteestimatedlist : RemoteinfoEstimation ?
2525 weak var remoteinfotaskDelegate : SetRemoteInfo ?
2626 var loaded : Bool = false
2727 var diddissappear : Bool = false
2828
2929 @IBAction func execute( _: NSButton ) {
30- if let backup = self . dobackups ( ) {
31- if backup. count > 0 {
32- self . remoteinfotask? . setbackuplist ( list: backup)
33- weak var openDelegate : OpenQuickBackup ?
34- if ( self . presentingViewController as? ViewControllerMain ) != nil {
35- openDelegate = ViewControllerReference . shared. getvcref ( viewcontroller: . vctabmain) as? ViewControllerMain
36- } else if ( self . presentingViewController as? ViewControllerSchedule ) != nil {
37- openDelegate = ViewControllerReference . shared. getvcref ( viewcontroller: . vctabschedule) as? ViewControllerSchedule
38- } else if ( self . presentingViewController as? ViewControllerNewConfigurations ) != nil {
39- openDelegate = ViewControllerReference . shared. getvcref ( viewcontroller: . vcnewconfigurations) as? ViewControllerNewConfigurations
40- } else if ( self . presentingViewController as? ViewControllerRestore ) != nil {
41- openDelegate = ViewControllerReference . shared. getvcref ( viewcontroller: . vcrestore) as? ViewControllerRestore
42- } else if ( self . presentingViewController as? ViewControllerLoggData ) != nil {
43- openDelegate = ViewControllerReference . shared. getvcref ( viewcontroller: . vcloggdata) as? ViewControllerLoggData
44- } else if ( self . presentingViewController as? ViewControllerSnapshots ) != nil {
45- openDelegate = ViewControllerReference . shared. getvcref ( viewcontroller: . vcsnapshot) as? ViewControllerSnapshots
46- }
47- openDelegate? . openquickbackup ( )
30+ if ( self . remoteestimatedlist? . estimatedlistandconfigs? . estimatedlist? . count ?? 0 ) > 0 {
31+ weak var openDelegate : OpenQuickBackup ?
32+ if ( self . presentingViewController as? ViewControllerMain ) != nil {
33+ openDelegate = ViewControllerReference . shared. getvcref ( viewcontroller: . vctabmain) as? ViewControllerMain
34+ } else if ( self . presentingViewController as? ViewControllerSchedule ) != nil {
35+ openDelegate = ViewControllerReference . shared. getvcref ( viewcontroller: . vctabschedule) as? ViewControllerSchedule
36+ } else if ( self . presentingViewController as? ViewControllerNewConfigurations ) != nil {
37+ openDelegate = ViewControllerReference . shared. getvcref ( viewcontroller: . vcnewconfigurations) as? ViewControllerNewConfigurations
38+ } else if ( self . presentingViewController as? ViewControllerRestore ) != nil {
39+ openDelegate = ViewControllerReference . shared. getvcref ( viewcontroller: . vcrestore) as? ViewControllerRestore
40+ } else if ( self . presentingViewController as? ViewControllerLoggData ) != nil {
41+ openDelegate = ViewControllerReference . shared. getvcref ( viewcontroller: . vcloggdata) as? ViewControllerLoggData
42+ } else if ( self . presentingViewController as? ViewControllerSnapshots ) != nil {
43+ openDelegate = ViewControllerReference . shared. getvcref ( viewcontroller: . vcsnapshot) as? ViewControllerSnapshots
4844 }
45+ // openDelegate?.openquickbackup()
4946 }
50- self . remoteinfotask = nil
47+ self . remoteestimatedlist? . abort ( )
48+ self . remoteestimatedlist? . stackoftasktobeestimated = nil
49+ self . remoteestimatedlist = nil
50+ self . remoteinfotaskDelegate? . setremoteinfo ( remoteinfotask: nil )
5151 self . closeview ( )
5252 }
5353
5454 // Either abort or close
5555 @IBAction func abort( _: NSButton ) {
56- // if self.remoteinfotask?.stackoftasktobeestimated?.count ?? 0 > 0 {
57- self . remoteinfotask? . abort ( )
58- self . remoteinfotask? . stackoftasktobeestimated = nil
59- self . remoteinfotask = nil
56+ self . remoteestimatedlist? . abort ( )
57+ self . remoteestimatedlist? . stackoftasktobeestimated = nil
58+ self . remoteestimatedlist = nil
6059 self . abort ( )
6160 self . remoteinfotaskDelegate? . setremoteinfo ( remoteinfotask: nil )
62- // }
6361 self . closeview ( )
6462 }
6563
@@ -88,12 +86,12 @@ class ViewControllerRemoteInfo: NSViewController, SetDismisser, Abort, Setcolor
8886 ViewControllerReference . shared. setvcref ( viewcontroller: . vcremoteinfo, nsviewcontroller: self )
8987 self . remoteinfotaskDelegate = ViewControllerReference . shared. getvcref ( viewcontroller: . vctabmain) as? ViewControllerMain
9088 if let remoteinfotask = self . remoteinfotaskDelegate? . getremoteinfo ( ) {
91- self . remoteinfotask = remoteinfotask
89+ self . remoteestimatedlist = remoteinfotask
9290 self . loaded = true
9391 self . progress. isHidden = true
9492 } else {
95- self . remoteinfotask = RemoteinfoEstimation ( viewcontroller: self , processtermination: self . processtermination)
96- self . remoteinfotaskDelegate? . setremoteinfo ( remoteinfotask: self . remoteinfotask )
93+ self . remoteestimatedlist = RemoteinfoEstimation ( viewcontroller: self , processtermination: self . processtermination)
94+ self . remoteinfotaskDelegate? . setremoteinfo ( remoteinfotask: self . remoteestimatedlist )
9795 }
9896 }
9997
@@ -119,21 +117,21 @@ class ViewControllerRemoteInfo: NSViewController, SetDismisser, Abort, Setcolor
119117 super. viewDidDisappear ( )
120118 self . diddissappear = true
121119 // Release the estimating object
122- self . remoteinfotask ? . abort ( )
123- self . remoteinfotask = nil
120+ self . remoteestimatedlist ? . abort ( )
121+ self . remoteestimatedlist = nil
124122 }
125123
126124 private func number( ) -> String {
127125 if self . loaded {
128126 return NSLocalizedString ( " Loaded cached data... " , comment: " Remote info " )
129127 } else {
130- let max = self . remoteinfotask ? . maxCount ( ) ?? 0
128+ let max = self . remoteestimatedlist ? . maxCount ( ) ?? 0
131129 return NSLocalizedString ( " Number of tasks to estimate: " , comment: " Remote info " ) + " " + String( describing: max)
132130 }
133131 }
134132
135133 private func dobackups( ) -> [ NSMutableDictionary ] ? {
136- let backup = self . remoteinfotask ? . records? . filter { $0. value ( forKey: DictionaryStrings . select. rawValue) as? Int == 1 }
134+ let backup = self . remoteestimatedlist ? . records? . filter { $0. value ( forKey: DictionaryStrings . select. rawValue) as? Int == 1 }
137135 return backup
138136 }
139137
@@ -150,7 +148,7 @@ class ViewControllerRemoteInfo: NSViewController, SetDismisser, Abort, Setcolor
150148 }
151149
152150 private func initiateProgressbar( ) {
153- self . progress. maxValue = Double ( self . remoteinfotask ? . maxCount ( ) ?? 0 )
151+ self . progress. maxValue = Double ( self . remoteestimatedlist ? . maxCount ( ) ?? 0 )
154152 self . progress. minValue = 0
155153 self . progress. doubleValue = 0
156154 self . progress. startAnimation ( self )
@@ -163,15 +161,15 @@ class ViewControllerRemoteInfo: NSViewController, SetDismisser, Abort, Setcolor
163161
164162extension ViewControllerRemoteInfo : NSTableViewDataSource {
165163 func numberOfRows( in _: NSTableView ) -> Int {
166- return self . remoteinfotask ? . records? . count ?? 0
164+ return self . remoteestimatedlist ? . records? . count ?? 0
167165 }
168166}
169167
170168extension ViewControllerRemoteInfo : NSTableViewDelegate , Attributedestring {
171169 func tableView( _: NSTableView , objectValueFor tableColumn: NSTableColumn ? , row: Int ) -> Any ? {
172- guard self . remoteinfotask ? . records != nil else { return nil }
173- guard row < ( self . remoteinfotask !. records? . count) ! else { return nil }
174- let object : NSDictionary = ( self . remoteinfotask ? . records ? [ row] ) !
170+ guard self . remoteestimatedlist ? . records != nil else { return nil }
171+ guard row < ( self . remoteestimatedlist !. records? . count) ! else { return nil }
172+ let object : NSDictionary = ( self . remoteestimatedlist ? . records ? [ row] ) !
175173 switch tableColumn!. identifier. rawValue {
176174 case DictionaryStrings . transferredNumber. rawValue:
177175 let celltext = object [ tableColumn!. identifier] as? String
@@ -194,11 +192,11 @@ extension ViewControllerRemoteInfo: NSTableViewDelegate, Attributedestring {
194192
195193 // Toggling selection
196194 func tableView( _: NSTableView , setObjectValue _: Any ? , for tableColumn: NSTableColumn ? , row: Int ) {
197- guard self . remoteinfotask ? . records != nil else { return }
195+ guard self . remoteestimatedlist ? . records != nil else { return }
198196 if tableColumn!. identifier. rawValue == DictionaryStrings . select. rawValue {
199- var select : Int = self . remoteinfotask ? . records![ row] . value ( forKey: DictionaryStrings . select. rawValue) as? Int ?? 0
197+ var select : Int = self . remoteestimatedlist ? . records![ row] . value ( forKey: DictionaryStrings . select. rawValue) as? Int ?? 0
200198 if select == 0 { select = 1 } else if select == 1 { select = 0 }
201- self . remoteinfotask ? . records![ row] . setValue ( select, forKey: DictionaryStrings . select. rawValue)
199+ self . remoteestimatedlist ? . records![ row] . setValue ( select, forKey: DictionaryStrings . select. rawValue)
202200 }
203201 self . enableexecutebutton ( )
204202 }
@@ -209,7 +207,7 @@ extension ViewControllerRemoteInfo {
209207 globalMainQueue. async { ( ) -> Void in
210208 self . mainTableView. reloadData ( )
211209 }
212- let progress = Double ( self . remoteinfotask ? . maxCount ( ) ?? 0 ) - Double( self . remoteinfotask ? . inprogressCount ( ) ?? 0 )
210+ let progress = Double ( self . remoteestimatedlist ? . maxCount ( ) ?? 0 ) - Double( self . remoteestimatedlist ? . inprogressCount ( ) ?? 0 )
213211 self . updateProgressbar ( progress)
214212 }
215213}
0 commit comments