aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableContent.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-09-26 16:36:32 +0000
committerBibiko <bibiko@eva.mpg.de>2009-09-26 16:36:32 +0000
commit572b761e971c732585ef5f0fcf852e1842d44e31 (patch)
treefd6f5f408bb462dfac264988d45db635c60a1ec5 /Source/TableContent.m
parent0dbc2fe46d3f496b2e6e7be784352767572b6df1 (diff)
downloadsequelpro-572b761e971c732585ef5f0fcf852e1842d44e31.tar.gz
sequelpro-572b761e971c732585ef5f0fcf852e1842d44e31.tar.bz2
sequelpro-572b761e971c732585ef5f0fcf852e1842d44e31.zip
• changed the progress wheel updating behaviour while loading table data slightly to increase the loading speed; this is up to now a compromise between speed and user information, the progress wheel will be updated every ~15%
Diffstat (limited to 'Source/TableContent.m')
-rw-r--r--Source/TableContent.m23
1 files changed, 15 insertions, 8 deletions
diff --git a/Source/TableContent.m b/Source/TableContent.m
index 806e1f47..19cb1dcf 100644
--- a/Source/TableContent.m
+++ b/Source/TableContent.m
@@ -1204,10 +1204,17 @@
NSArray *tempRow;
NSMutableArray *newRow;
NSMutableArray *columnBlobStatuses = [[NSMutableArray alloc] init];
- int i;
- int lastProgressValue = 0;
+ NSUInteger i;
+
+ // Update the progress wheel every ~15%
+ NSUInteger loadingIndicatorDelta = 15;
+
+ NSUInteger lastProgressValue = loadingIndicatorDelta;
+ float relativeTargetRowCount = 100.0/targetRowCount;
+
long rowsProcessed = 0;
long columnsCount = [dataColumns count];
+
NSAutoreleasePool *dataLoadingPool;
NSProgressIndicator *dataLoadingIndicator = [tableDocumentInstance valueForKey:@"queryProgressBar"];
id prefsNullValue = [[prefs objectForKey:@"NullValue"] retain];
@@ -1222,7 +1229,7 @@
// Remove all items from the table and reset the progress indicator
[tableValues removeAllObjects];
if (targetRowCount) [dataLoadingIndicator setIndeterminate:NO];
- [dataLoadingIndicator setDoubleValue:0];
+ [dataLoadingIndicator setDoubleValue:(int)loadingIndicatorDelta/2];
[dataLoadingIndicator display];
// Set up an autorelease pool for row processing
@@ -1253,14 +1260,14 @@
// Update the progress bar as necessary, minimising updates
rowsProcessed++;
- if (rowsProcessed == targetRowCount) {
- [dataLoadingIndicator setIndeterminate:YES];
- } else if (rowsProcessed < targetRowCount) {
- [dataLoadingIndicator setDoubleValue:(rowsProcessed*100/targetRowCount)];
+ if (rowsProcessed < targetRowCount) {
+ [dataLoadingIndicator setDoubleValue:(rowsProcessed*relativeTargetRowCount)];
if ((int)[dataLoadingIndicator doubleValue] > lastProgressValue) {
[dataLoadingIndicator display];
- lastProgressValue = (int)[dataLoadingIndicator doubleValue];
+ lastProgressValue = (int)[dataLoadingIndicator doubleValue] + loadingIndicatorDelta;
}
+ } else if (rowsProcessed == targetRowCount) {
+ [dataLoadingIndicator setIndeterminate:YES];
}
// Drain and reset the autorelease pool every ~1024 rows