Skip to content

Commit

Permalink
Fix download list address and parsing.
Browse files Browse the repository at this point in the history
Fix problem with closing infoPanel instead of taskProgressPanel.
Disable add button if no version available (fix #2).
  • Loading branch information
James Foster committed Jun 25, 2020
1 parent 7143e80 commit ea544e8
Show file tree
Hide file tree
Showing 14 changed files with 68 additions and 79 deletions.
6 changes: 4 additions & 2 deletions GemStone.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -809,13 +809,14 @@
CODE_SIGN_IDENTITY = "Developer ID Application";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1.4.7;
CURRENT_PROJECT_VERSION = 1.4.6;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 72G58AHU7P;
ENABLE_HARDENED_RUNTIME = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "GemStone/GemStone-Prefix.pch";
INFOPLIST_FILE = "GemStone/GemStone-Info.plist";
MARKETING_VERSION = 1.4.6;
PRODUCT_BUNDLE_IDENTIFIER = com.GemTalk.GemStone;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
Expand All @@ -833,12 +834,13 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1.4.7;
CURRENT_PROJECT_VERSION = 1.4.6;
DEVELOPMENT_TEAM = 72G58AHU7P;
ENABLE_HARDENED_RUNTIME = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "GemStone/GemStone-Prefix.pch";
INFOPLIST_FILE = "GemStone/GemStone-Info.plist";
MARKETING_VERSION = 1.4.6;
PRODUCT_BUNDLE_IDENTIFIER = com.GemTalk.GemStone;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
Expand Down
35 changes: 21 additions & 14 deletions GemStone/AppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ @interface AppController()
// Versions Tab
@property (weak) IBOutlet NSTextField *lastUpdateDateField;
// Databases Tab
@property (weak) IBOutlet NSButton *addDatabaseButton;
@property (weak) IBOutlet NSButton *deleteDatabaseButton;
@property (weak) IBOutlet NSArrayController *databaseListController;
@property (weak) IBOutlet NSTableView *databaseTableView;
@property IBOutlet NSTextView *infoPanelTextView;
@property (weak) IBOutlet NSArrayController *logFileListController;
@property (weak) IBOutlet NSButton *removeButton;
@property (weak) IBOutlet NSArrayController *versionListController;
Expand All @@ -67,6 +68,7 @@ @interface AppController()
@property (weak) IBOutlet NSButton *upgradeSeasideCheckbox;

@property (weak) IBOutlet NSPanel *infoPanel;
@property IBOutlet NSTextView *infoPanelTextView;
@property (weak) IBOutlet NSPanel *taskProgressPanel;
@property IBOutlet NSTextView *taskProgressText;
@property (weak) IBOutlet NSProgressIndicator *taskProgressIndicator;
Expand Down Expand Up @@ -154,7 +156,7 @@ - (IBAction)cancelTask:(id)sender {
[self.operations cancelAllOperations];
[self taskFinishedAfterDelay];
} else { // Presumably this means that the title was changed to "Close"
[self taskFinished];
[self closeTaskProgressPanel];
}
}

Expand Down Expand Up @@ -187,11 +189,17 @@ - (IBAction)clickedDataFile:(id)sender {
- (IBAction)closeInfoPanel:(id)sender {
[self.taskProgressText setString:[NSMutableString new]];
dispatch_async(dispatch_get_main_queue(), ^{
[self.infoPanel orderOut:nil];
[[NSApp mainWindow] endSheet:self.infoPanel];
[[NSApp mainWindow] endSheet:self.infoPanel returnCode:0];
});
}

- (void)closeTaskProgressPanel {
[self.taskProgressText setString:[NSMutableString new]];
dispatch_async(dispatch_get_main_queue(), ^{
[[NSApp mainWindow] endSheet:self.taskProgressPanel returnCode:0];
});
}

- (void)criticalAlert:(NSString *)textString details:(NSString *)detailsString {
NSArray *args = [NSArray arrayWithObjects:textString, detailsString, nil];
[self performSelectorOnMainThread:@selector(criticalAlertA:) withObject:args waitUntilDone:NO];
Expand Down Expand Up @@ -480,14 +488,17 @@ - (void)removeVersionDone {
}

- (void)refreshInstalledVersionsList {
Boolean hasAnyInstalledVersions = false;
[self.versionPopupController removeObjects:[self.versionPopupController arrangedObjects]];
for (Version *version in [self.versionListController arrangedObjects]) {
[version updateIsInstalled];
if ([version isInstalled]) {
[self.versionPopupController addObject:[version name]];
hasAnyInstalledVersions = true;
}
}
[self.lastUpdateDateField setObjectValue:[self.mySetup versionsDownloadDate]];
[self.addDatabaseButton setEnabled:hasAnyInstalledVersions];
}

- (void)refreshUpgradeVersionsList {
Expand Down Expand Up @@ -583,7 +594,7 @@ - (IBAction)showHelperToolInfo:(id)sender {
"";
[self.infoPanelTextView setString:string];
[[NSApp mainWindow]beginSheet:self.infoPanel completionHandler:^(NSModalResponse returnCode) {
return;
[self.infoPanel orderOut:self];
}];
}

Expand Down Expand Up @@ -616,10 +627,6 @@ - (void)taskErrorA:(NSString *)aString {
[self taskFinishedAfterDelay];
}

- (void)taskFinished {
[self closeInfoPanel:self];
}

- (void)taskFinishedAfterDelay {
[self performSelectorOnMainThread:@selector(taskFinishedAfterDelayA)
withObject:nil
Expand All @@ -636,24 +643,24 @@ - (void)taskFinishedAfterDelayA {

- (void)taskFinishedAfterDelayB {
if ([[self.mySetup taskCloseWhenDoneCode] boolValue]) {
[self taskFinished];
[self closeTaskProgressPanel];
}
}

- (void)taskProgress:(NSString *)aString {
Boolean isVisible = [self.taskProgressPanel isVisible];
NSUInteger length = [aString length];
Boolean hasLength = 0 < length;
if (isVisible && hasLength) {
if (hasLength) {
[self performSelectorOnMainThread:@selector(taskProgressA:)
withObject:aString
waitUntilDone:YES];
} else {
NSLog(@"taskProgress: - %i %lu '%@'", isVisible, (unsigned long)length, aString);
NSLog(@"taskProgress: \"\"");
}
}

- (void)taskProgressA:(NSString *)aString {
if (![self.taskProgressPanel isVisible]) return;
NSArray *array = [aString componentsSeparatedByString:@"\r"];
NSRange range = {self.taskProgressText.string.length, 0};
[self.taskProgressText insertText:[array objectAtIndex:0] replacementRange:range];
Expand Down Expand Up @@ -692,7 +699,7 @@ - (void)taskStartA:(NSString *)aString {
if (![self.taskProgressPanel isVisible]) {
[[NSApp mainWindow] beginSheet:self.taskProgressPanel
completionHandler:^(NSModalResponse returnCode) {
return;
[self.taskProgressPanel orderOut:self];
}];
[self.taskProgressIndicator setIndeterminate:YES];
[self.taskProgressIndicator startAnimation:self];
Expand Down
Loading

0 comments on commit ea544e8

Please sign in to comment.