mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Improve binding properties
Each property now correspond to exactly one aspect of the UI allowing us to remove the logic and use the class as a view.
This commit is contained in:
@@ -220,7 +220,7 @@
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="381562804"/>
|
||||
</object>
|
||||
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
|
||||
<string key="NSScreenRect">{{0, 0}, {2560, 1578}}</string>
|
||||
<string key="NSMinSize">{213, 129}</string>
|
||||
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
|
||||
<bool key="NSWindowIsRestorable">YES</bool>
|
||||
@@ -295,47 +295,43 @@
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBBindingConnection" key="connection">
|
||||
<string key="label">isIndeterminate: isInstalling</string>
|
||||
<string key="label">isIndeterminate: isIndeterminate</string>
|
||||
<reference key="source" ref="233311379"/>
|
||||
<reference key="destination" ref="469019052"/>
|
||||
<object class="NSNibBindingConnector" key="connector">
|
||||
<reference key="NSSource" ref="233311379"/>
|
||||
<reference key="NSDestination" ref="469019052"/>
|
||||
<string key="NSLabel">isIndeterminate: isInstalling</string>
|
||||
<string key="NSLabel">isIndeterminate: isIndeterminate</string>
|
||||
<string key="NSBinding">isIndeterminate</string>
|
||||
<string key="NSKeyPath">isInstalling</string>
|
||||
<string key="NSKeyPath">isIndeterminate</string>
|
||||
<reference key="NSPreviousConnector" ref="221091218"/>
|
||||
<int key="NSNibBindingConnectorVersion">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<int key="connectionID">41</int>
|
||||
<int key="connectionID">45</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBBindingConnection" key="connection">
|
||||
<string key="label">enabled: isInstalling</string>
|
||||
<string key="label">enabled: canCancel</string>
|
||||
<reference key="source" ref="196209169"/>
|
||||
<reference key="destination" ref="469019052"/>
|
||||
<object class="NSNibBindingConnector" key="connector">
|
||||
<reference key="NSSource" ref="196209169"/>
|
||||
<reference key="NSDestination" ref="469019052"/>
|
||||
<string key="NSLabel">enabled: isInstalling</string>
|
||||
<string key="NSLabel">enabled: canCancel</string>
|
||||
<string key="NSBinding">enabled</string>
|
||||
<string key="NSKeyPath">isInstalling</string>
|
||||
<object class="NSDictionary" key="NSOptions">
|
||||
<string key="NS.key.0">NSValueTransformerName</string>
|
||||
<string key="NS.object.0">NSNegateBoolean</string>
|
||||
</object>
|
||||
<string key="NSKeyPath">canCancel</string>
|
||||
<int key="NSNibBindingConnectorVersion">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<int key="connectionID">42</int>
|
||||
<int key="connectionID">46</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBBindingConnection" key="connection">
|
||||
<string key="label">enabled: canInstall</string>
|
||||
<reference key="source" ref="865616887"/>
|
||||
<reference key="destination" ref="469019052"/>
|
||||
<object class="NSNibBindingConnector" key="connector" id="316075721">
|
||||
<object class="NSNibBindingConnector" key="connector">
|
||||
<reference key="NSSource" ref="865616887"/>
|
||||
<reference key="NSDestination" ref="469019052"/>
|
||||
<string key="NSLabel">enabled: canInstall</string>
|
||||
@@ -346,42 +342,6 @@
|
||||
</object>
|
||||
<int key="connectionID">25</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBBindingConnection" key="connection">
|
||||
<string key="label">enabled2: isInstalling</string>
|
||||
<reference key="source" ref="865616887"/>
|
||||
<reference key="destination" ref="469019052"/>
|
||||
<object class="NSNibBindingConnector" key="connector">
|
||||
<reference key="NSSource" ref="865616887"/>
|
||||
<reference key="NSDestination" ref="469019052"/>
|
||||
<string key="NSLabel">enabled2: isInstalling</string>
|
||||
<string key="NSBinding">enabled2</string>
|
||||
<string key="NSKeyPath">isInstalling</string>
|
||||
<object class="NSDictionary" key="NSOptions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>NSMultipleValuesPlaceholder</string>
|
||||
<string>NSNoSelectionPlaceholder</string>
|
||||
<string>NSNotApplicablePlaceholder</string>
|
||||
<string>NSNullPlaceholder</string>
|
||||
<string>NSValueTransformerName</string>
|
||||
</object>
|
||||
<object class="NSArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<integer value="-1"/>
|
||||
<integer value="-1"/>
|
||||
<integer value="-1"/>
|
||||
<integer value="-1"/>
|
||||
<string>NSNegateBoolean</string>
|
||||
</object>
|
||||
</object>
|
||||
<reference key="NSPreviousConnector" ref="316075721"/>
|
||||
<int key="NSNibBindingConnectorVersion">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<int key="connectionID">43</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBBindingConnection" key="connection">
|
||||
<string key="label">value: activityText</string>
|
||||
@@ -600,7 +560,7 @@
|
||||
<reference key="dict.values" ref="0"/>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">43</int>
|
||||
<int key="maxID">46</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
|
||||
@@ -6,10 +6,13 @@
|
||||
|
||||
@property (nonatomic, retain) NSString* activityText; // Text binding: “Downlading ‘TextMate_r1589.tbz’…”
|
||||
@property (nonatomic, retain) NSString* statusText; // Text binding: “Less than one minute”
|
||||
@property (nonatomic, readonly) BOOL isWorking; // Progress bar binding (animate)
|
||||
|
||||
@property (nonatomic, assign) BOOL isWorking; // Progress bar binding (animate)
|
||||
@property (nonatomic, assign) BOOL isIndeterminate; // Progress bar binding (is indeterminate)
|
||||
@property (nonatomic, assign) CGFloat progress; // Progress bar binding (value)
|
||||
@property (nonatomic, assign) BOOL canInstall; // Install Button binding
|
||||
@property (nonatomic, assign) BOOL isInstalling; // Install/Cancel Button bindings + Progress bar (is indeterminate)
|
||||
|
||||
@property (nonatomic, assign) BOOL canInstall; // Install button binding (enabled)
|
||||
@property (nonatomic, assign) BOOL canCancel; // Cancel button binding (enabled)
|
||||
|
||||
- (id)initWithURL:(NSString*)aURL displayString:(NSString*)aDisplayString keyChain:(key_chain_t const&)aKeyChain;
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ typedef std::shared_ptr<shared_state_t> shared_state_ptr;
|
||||
|
||||
@property (nonatomic, retain) NSDate* downloadStartDate;
|
||||
@property (nonatomic, retain) NSTimer* progressTimer;
|
||||
@property (nonatomic, assign) BOOL isDownloading;
|
||||
@property (nonatomic, assign) BOOL showUpdateBadge;
|
||||
@property (retain) NSString* url;
|
||||
@property (retain) NSString* archive;
|
||||
@@ -42,17 +41,24 @@ typedef std::shared_ptr<shared_state_t> shared_state_ptr;
|
||||
if(self = [super initWithWindowNibName:@"DownloadProgress"])
|
||||
{
|
||||
sharedState.reset(new shared_state_t);
|
||||
self.downloadStartDate = [NSDate date];
|
||||
secondsLeft = CGFLOAT_MAX;
|
||||
secondsLeft = CGFLOAT_MAX;
|
||||
|
||||
self.activityText = aDisplayString;
|
||||
self.progress = 0;
|
||||
self.statusText = @"";
|
||||
self.isDownloading = YES;
|
||||
self.progressTimer = [NSTimer scheduledTimerWithTimeInterval:0.04 target:self selector:@selector(updateProgress:) userInfo:nil repeats:YES];
|
||||
self.downloadStartDate = [NSDate date];
|
||||
self.progressTimer = [NSTimer scheduledTimerWithTimeInterval:0.04 target:self selector:@selector(updateProgress:) userInfo:nil repeats:YES];
|
||||
|
||||
self.activityText = aDisplayString;
|
||||
self.statusText = @"";
|
||||
|
||||
self.isIndeterminate = NO;
|
||||
self.progress = 0;
|
||||
self.isWorking = YES;
|
||||
|
||||
self.canInstall = NO;
|
||||
self.canCancel = YES;
|
||||
|
||||
self.url = aURL;
|
||||
keyChain = aKeyChain;
|
||||
|
||||
[self performSelectorInBackground:@selector(performBackgroundDownload:) withObject:self];
|
||||
}
|
||||
return self;
|
||||
@@ -114,7 +120,7 @@ typedef std::shared_ptr<shared_state_t> shared_state_ptr;
|
||||
self.progressTimer = nil;
|
||||
self.progress = 1;
|
||||
self.statusText = @"";
|
||||
self.isDownloading = NO;
|
||||
self.isWorking = NO;
|
||||
|
||||
if(sharedState->stop)
|
||||
return;
|
||||
@@ -152,13 +158,6 @@ typedef std::shared_ptr<shared_state_t> shared_state_ptr;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
+ (NSSet*)keyPathsForValuesAffectingIsWorking { return [NSSet setWithObjects:@"isDownloading", @"isInstalling", nil]; }
|
||||
|
||||
- (BOOL)isWorking
|
||||
{
|
||||
return self.isDownloading || self.isInstalling;
|
||||
}
|
||||
|
||||
- (void)windowDidLoad
|
||||
{
|
||||
self.window.hidesOnDeactivate = YES;
|
||||
@@ -200,8 +199,10 @@ typedef std::shared_ptr<shared_state_t> shared_state_ptr;
|
||||
{
|
||||
D(DBF_SoftwareUpdate_Download, bug("\n"););
|
||||
|
||||
self.activityText = [NSString stringWithFormat:@"Installing %@…", self.versionOfDownload ?: @"app"];
|
||||
self.isInstalling = YES;
|
||||
self.activityText = [NSString stringWithFormat:@"Installing %@…", self.versionOfDownload ?: @"app"];
|
||||
self.isIndeterminate = YES;
|
||||
self.isWorking = YES;
|
||||
self.canInstall = NO;
|
||||
|
||||
std::string err = sw_update::install_update(to_s(self.archive));
|
||||
if(err == NULL_STR)
|
||||
@@ -218,6 +219,7 @@ typedef std::shared_ptr<shared_state_t> shared_state_ptr;
|
||||
else
|
||||
{
|
||||
self.activityText = [NSString stringWithCxxString:err];
|
||||
self.isWorking = NO;
|
||||
OakRunIOAlertPanel("%s", err.c_str());
|
||||
}
|
||||
}
|
||||
@@ -233,7 +235,6 @@ typedef std::shared_ptr<shared_state_t> shared_state_ptr;
|
||||
D(DBF_SoftwareUpdate_Download, bug("\n"););
|
||||
[self.progressTimer invalidate];
|
||||
self.progressTimer = nil;
|
||||
self.isDownloading = NO;
|
||||
self.showUpdateBadge = NO;
|
||||
|
||||
sharedState->stop = true;
|
||||
|
||||
Reference in New Issue
Block a user