Revision: 23943
          http://sourceforge.net/p/bibdesk/svn/23943
Author:   hofman
Date:     2019-07-05 09:36:36 +0000 (Fri, 05 Jul 2019)
Log Message:
-----------
Pass adding and moving of item download progress through update method to 
simplify API

Modified Paths:
--------------
    trunk/bibdesk/BDSKEditor.m
    trunk/bibdesk/BibItem.h
    trunk/bibdesk/BibItem.m

Modified: trunk/bibdesk/BDSKEditor.m
===================================================================
--- trunk/bibdesk/BDSKEditor.m  2019-07-05 06:30:46 UTC (rev 23942)
+++ trunk/bibdesk/BDSKEditor.m  2019-07-05 09:36:36 UTC (rev 23943)
@@ -1821,6 +1821,10 @@
     if (index != NSNotFound) {
         [fileView updateProgressIndicator:progress forURL:url atIndex:index];
     } else {
+        if ([statusBar progressIndicatorStyle] != 
BDSKProgressIndicatorSpinningStyle) {
+            [statusBar 
setProgressIndicatorStyle:BDSKProgressIndicatorSpinningStyle];
+            [statusBar startAnimation:nil];
+        }
         if (progress < 0.0) {
             [[statusBar progressIndicator] setIndeterminate:YES];
         } else {
@@ -1830,15 +1834,6 @@
     }
 }
 
-- (void)item:(BibItem *)item addProgressForURL:(NSURL *)url 
atIndex:(NSUInteger)index {
-    if (index != NSNotFound) {
-        [fileView addProgressIndicatorForURL:url atIndex:index];
-    } else {
-        [statusBar 
setProgressIndicatorStyle:BDSKProgressIndicatorSpinningStyle];
-        [statusBar startAnimation:nil];
-    }
-}
-
 - (void)item:(BibItem *)item removeProgressForURL:(NSURL *)url 
atIndex:(NSUInteger)index {
     if (index != NSNotFound) {
         [fileView removeProgressIndicatorForURL:url atIndex:index];
@@ -1848,12 +1843,6 @@
     }
 }
 
-- (void)item:(BibItem *)item moveProgressForURL:(NSURL *)url 
toIndex:(NSUInteger)index {
-    if (index != NSNotFound) {
-        // move progress indicator in file view
-    }
-}
-
 #pragma mark KVO
 
 - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object 
change:(NSDictionary *)change context:(void *)context {

Modified: trunk/bibdesk/BibItem.h
===================================================================
--- trunk/bibdesk/BibItem.h     2019-07-05 06:30:46 UTC (rev 23942)
+++ trunk/bibdesk/BibItem.h     2019-07-05 09:36:36 UTC (rev 23943)
@@ -866,8 +866,6 @@
 @protocol BDSKItemProgressDelegate <NSObject>
 
 - (void)item:(BibItem *)item updateProgress:(CGFloat)progress forURL:(NSURL 
*)url atIndex:(NSUInteger)index;
-- (void)item:(BibItem *)item addProgressForURL:(NSURL *)url 
atIndex:(NSUInteger)index;
 - (void)item:(BibItem *)item removeProgressForURL:(NSURL *)url 
atIndex:(NSUInteger)index;
-- (void)item:(BibItem *)item moveProgressForURL:(NSURL *)url 
toIndex:(NSUInteger)index;
 
 @end

Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m     2019-07-05 06:30:46 UTC (rev 23942)
+++ trunk/bibdesk/BibItem.m     2019-07-05 09:36:36 UTC (rev 23943)
@@ -3197,7 +3197,6 @@
         for (BDSKItemDownload *download in downloads) {
             NSUInteger idx = [download index];
             NSURL *url = [download URL];
-            [progressDelegate item:self addProgressForURL:url atIndex:idx];
             [progressDelegate item:self updateProgress:[download progress] 
forURL:url atIndex:idx];
         }
     }
@@ -3251,7 +3250,6 @@
         [downloads addObject:download];
         [download start];
         [download release];
-        [progressDelegate item:self addProgressForURL:url atIndex:NSNotFound];
     }
 }
 
@@ -3265,7 +3263,6 @@
         [download setDelegate:self];
         [download start];
         [download release];
-        [progressDelegate item:self addProgressForURL:[linkedFile URL] 
atIndex:idx];
     }
 }
 
@@ -4140,7 +4137,7 @@
         NSUInteger realIdx = [files indexOfObject:linkedFile];
         if (realIdx != NSNotFound && realIdx != idx) {
             [download setIndex:realIdx];
-            [progressDelegate item:self moveProgressForURL:[download URL] 
toIndex:realIdx];
+            [progressDelegate item:self updateProgress:[download progress] 
forURL:[download URL] atIndex:realIdx];
         }
     }
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to