Mercurial > hg > audiodb
changeset 688:8bc10774e56b
Disabled query button if no query file selected.
author | mas01mj |
---|---|
date | Fri, 12 Mar 2010 11:54:02 +0000 |
parents | e2f4924130ef |
children | 015e361e5baa |
files | examples/iAudioDB/AppController.h examples/iAudioDB/AppController.m examples/iAudioDB/English.lproj/MainMenu.xib |
diffstat | 3 files changed, 41 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/examples/iAudioDB/AppController.h Thu Mar 11 17:19:15 2010 +0000 +++ b/examples/iAudioDB/AppController.h Fri Mar 12 11:54:02 2010 +0000 @@ -31,6 +31,7 @@ IBOutlet NSTextField* queryLengthVectors; IBOutlet NSTextField* queryLengthSeconds; IBOutlet NSTextField* queryPath; + IBOutlet NSButton* queryButton; // Main window buttons/fields.
--- a/examples/iAudioDB/AppController.m Thu Mar 11 17:19:15 2010 +0000 +++ b/examples/iAudioDB/AppController.m Fri Mar 12 11:54:02 2010 +0000 @@ -139,6 +139,19 @@ [dbState release]; } + if(selectedKey) + { + NSLog(@"Released selected key: %@", selectedKey); + [selectedKey release]; + selectedKey = Nil; + NSLog(@"Is now %@", selectedKey); + } + + if(selectedKey) + { + NSLog(@"Still evals"); + } + // Reset query flags [queryPath setStringValue: @"No file selected"]; [queryLengthSeconds setDoubleValue:0]; @@ -221,8 +234,8 @@ { NSLog(@"No db"); [performQueryButton setEnabled:NO]; - [playBothButton setEnabled:FALSE]; - [playResultButton setEnabled:FALSE]; + [playBothButton setEnabled:NO]; + [playResultButton setEnabled:NO]; } } @@ -249,7 +262,7 @@ NSArray *filesToOpen = [panel filenames]; NSString* extractor = [dbState objectForKey:@"extractor"]; - NSString* extractorPath = [NSString stringWithFormat:@"/Users/mikej/Development/audioDB/examples/iAudioDB/rdf/%@.n3", extractor]; + NSString* extractorPath = [NSString stringWithFormat:@"/Applications/iAudioDB.app/rdf/%@.n3", extractor]; // TODO Shift this process into a separate function. // Create the customized extractor config @@ -511,6 +524,7 @@ */ -(IBAction)chooseQuery:(id)sender { + [queryButton setEnabled:(selectedKey ? YES : NO)]; [NSApp beginSheet:querySheet modalForWindow:mainWindow modalDelegate:self didEndSelector:NULL contextInfo:nil]; session = [NSApp beginModalSessionForWindow:querySheet]; [NSApp runModalSession:session]; @@ -542,6 +556,7 @@ [queryKey setStringValue:selectedKey]; [queryPath setStringValue:selectedKey]; selectedFilename = [[panel filename] retain]; + [queryButton setEnabled:YES]; [self resetLengths:self]; } @@ -573,6 +588,8 @@ double secs = [queryLengthSeconds doubleValue]; if(secs > 0) { + // (samples - windowSize) / hopSize + [queryLengthVectors setDoubleValue:ceil(((secs*44100)-winSize)/hopSize)]; } }
--- a/examples/iAudioDB/English.lproj/MainMenu.xib Thu Mar 11 17:19:15 2010 +0000 +++ b/examples/iAudioDB/English.lproj/MainMenu.xib Fri Mar 12 11:54:02 2010 +0000 @@ -8,11 +8,11 @@ <string key="IBDocument.HIToolboxVersion">353.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="565"/> <integer value="524"/> - <integer value="57"/> <integer value="793"/> <integer value="779"/> + <integer value="57"/> + <integer value="565"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -1423,6 +1423,7 @@ <string key="NSWindowTitle">Query</string> <string key="NSWindowClass">NSPanel</string> <nil key="NSViewClass"/> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <object class="NSView" key="NSWindowView" id="543728174"> <reference key="NSNextResponder"/> <int key="NSvFlags">256</int> @@ -2144,6 +2145,14 @@ </object> <int key="connectionID">845</int> </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">queryButton</string> + <reference key="source" ref="232596070"/> + <reference key="destination" ref="836048334"/> + </object> + <int key="connectionID">846</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -3326,7 +3335,6 @@ <string>789.IBPluginDependency</string> <string>790.IBPluginDependency</string> <string>792.IBEditorWindowLastContentRect</string> - <string>792.IBPluginDependency</string> <string>792.IBWindowTemplateEditedContentRect</string> <string>792.NSWindowTemplate.visibleAtLaunch</string> <string>793.IBPluginDependency</string> @@ -3419,8 +3427,8 @@ <reference ref="9"/> <string>{74, 862}</string> <string>{{6, 978}, {478, 20}}</string> - <string>{{26, 350}, {606, 477}}</string> - <string>{{26, 350}, {606, 477}}</string> + <string>{{26, 79}, {606, 477}}</string> + <string>{{26, 79}, {606, 477}}</string> <reference ref="9"/> <string>{{33, 99}, {480, 360}}</string> <string>{3.40282e+38, 3.40282e+38}</string> @@ -3446,8 +3454,8 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> - <string>{{169, 544}, {305, 281}}</string> - <string>{{169, 544}, {305, 281}}</string> + <string>{{169, 281}, {305, 281}}</string> + <string>{{169, 281}, {305, 281}}</string> <boolean value="NO" id="6"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{83, 102}, {201, 183}}</string> @@ -3520,9 +3528,8 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{333, 87}, {293, 251}}</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{333, 87}, {293, 251}}</string> + <string>{{392, 71}, {293, 251}}</string> + <string>{{392, 71}, {293, 251}}</string> <reference ref="6"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -3583,7 +3590,7 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">845</int> + <int key="maxID">846</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -3648,6 +3655,7 @@ <string>performQueryButton</string> <string>playBothButton</string> <string>playResultButton</string> + <string>queryButton</string> <string>queryKey</string> <string>queryLengthSeconds</string> <string>queryLengthVectors</string> @@ -3673,6 +3681,7 @@ <string>NSButton</string> <string>NSButton</string> <string>NSButton</string> + <string>NSButton</string> <string>NSTextField</string> <string>NSTextField</string> <string>NSTextField</string>