From 3b5e8f80a471ff88cd39e8c295276beb7c3412ec Mon Sep 17 00:00:00 2001 From: Matthew Judy Date: Mon, 22 Sep 2003 06:19:52 +0000 Subject: [PATCH] Incremental checkin. Updating the StatusWindow and WtatusWindowController objects. Adding functionality, and removing duplicated API. Also adding the new Shuffle and Repeat graphics. --- MainController.m | 57 ++++---- MenuController.m | 2 +- PreferencesController.h | 2 +- Repeat.tiff | Bin 0 -> 62768 bytes Shuffle.tiff | Bin 0 -> 62800 bytes StatusWindow.h | 38 +++--- StatusWindow.m | 282 ++++++++++++++++++++++----------------- StatusWindowController.h | 43 +++--- StatusWindowController.m | 36 +++-- 9 files changed, 248 insertions(+), 212 deletions(-) create mode 100755 Repeat.tiff create mode 100755 Shuffle.tiff diff --git a/MainController.m b/MainController.m index 7a0c29a..517c892 100755 --- a/MainController.m +++ b/MainController.m @@ -439,16 +439,16 @@ static MainController *sharedController; - (void)showCurrentTrackInfo { - NSString *title = [currentRemote currentSongTitle]; - + ITMTRemotePlayerSource source = [currentRemote currentSource]; + NSString *title = [currentRemote currentSongTitle]; + NSString *album = nil; + NSString *artist = nil; + NSString *time = nil; + int trackNumber = 0; + int trackTotal = 0; + int rating = -1; + if ( title ) { - NSString *album = nil; - NSString *artist = nil; - NSString *time = nil; - int trackNumber = 0; - int trackTotal = 0; - int rating = 0; - ITMTRemotePlayerSource source = [currentRemote currentSource]; if ( [df boolForKey:@"showAlbum"] ) { album = [currentRemote currentSongAlbum]; @@ -470,26 +470,19 @@ static MainController *sharedController; if ( [df boolForKey:@"showRating"] ) { rating = ( [currentRemote currentSongRating] * 5 ); } - - [statusWindowController showSongWindowWithTitle:title - album:album - artist:artist - time:time - trackNumber:trackNumber - trackTotal:trackTotal - rating:rating - source:source]; + } else { title = NSLocalizedString(@"noSongPlaying", @"No song is playing."); - [statusWindowController showSongWindowWithTitle:title - album:nil - artist:nil - time:nil - trackNumber:0 - trackTotal:0 - rating:0 - source:[currentRemote currentSource]]; } + + [statusWindowController showSongInfoWindowWithSource:source + title:title + album:album + artist:artist + time:time + trackNumber:trackNumber + trackTotal:trackTotal + rating:rating]; } - (void)showUpcomingSongs @@ -509,10 +502,10 @@ static MainController *sharedController; } } - [statusWindowController showUpcomingSongsWithTitles:songList]; + [statusWindowController showUpcomingSongsWindowWithTitles:songList]; } else { - [statusWindowController showUpcomingSongsWithTitles:[NSArray arrayWithObject:NSLocalizedString(@"noUpcomingSongs", @"No upcoming songs.")]]; + [statusWindowController showUpcomingSongsWindowWithTitles:[NSArray arrayWithObject:NSLocalizedString(@"noUpcomingSongs", @"No upcoming songs.")]]; } } @@ -564,7 +557,7 @@ static MainController *sharedController; [currentRemote setCurrentSongRating:rating]; //Show rating status window - [statusWindowController showRatingWindowWithLevel:rating]; + [statusWindowController showRatingWindowWithRating:rating]; } - (void)decrementRating @@ -577,7 +570,7 @@ static MainController *sharedController; [currentRemote setCurrentSongRating:rating]; //Show rating status window - [statusWindowController showRatingWindowWithLevel:rating]; + [statusWindowController showRatingWindowWithRating:rating]; } - (void)toggleLoop @@ -598,7 +591,7 @@ static MainController *sharedController; [currentRemote setRepeatMode:repeatMode]; //Show loop status window - [statusWindowController showLoopWindowWithMode:repeatMode]; + [statusWindowController showRepeatWindowWithMode:repeatMode]; } - (void)toggleShuffle @@ -606,7 +599,7 @@ static MainController *sharedController; bool newShuffleEnabled = ![currentRemote shuffleEnabled]; [currentRemote setShuffleEnabled:newShuffleEnabled]; //Show shuffle status window - [statusWindowController showLoopWindowWithMode:newShuffleEnabled]; + [statusWindowController showRepeatWindowWithMode:newShuffleEnabled]; } /*************************************************************************/ diff --git a/MenuController.m b/MenuController.m index cfd2909..7a2db4b 100755 --- a/MenuController.m +++ b/MenuController.m @@ -230,7 +230,7 @@ } if ([defaults boolForKey:@"showTrackRating"]) { - NSString *string; + NSString *string = nil; switch ((int)([currentRemote currentSongRating] * 5)) { case 0: string = [NSString stringWithUTF8String:"☆☆☆☆☆"]; diff --git a/PreferencesController.h b/PreferencesController.h index b8f0b7a..bd77dbb 100755 --- a/PreferencesController.h +++ b/PreferencesController.h @@ -25,7 +25,7 @@ IBOutlet NSPanel *keyComboPanel; IBOutlet NSButton *launchAtLoginCheckbox; IBOutlet NSButton *launchPlayerAtLaunchCheckbox; - IBOutlet MyTableView *menuTableView; + IBOutlet CustomMenuTableView *menuTableView; IBOutlet NSButton *nameCheckbox; IBOutlet NSButton *nextTrackButton; IBOutlet NSButton *playPauseButton; diff --git a/Repeat.tiff b/Repeat.tiff new file mode 100755 index 0000000000000000000000000000000000000000..0c8f842b186891f2c58391cd78a9a1f438991fc2 GIT binary patch literal 62768 zcmeHQdvH|OeZDIJM&e<>0b(1RivkuH_MsJ6LY4p_A&`-T4B}w|wpY7X(xTPg_3o7s zp3KDdA5N!JcRI0|!D%OkN!!fCPTc&}S331%Iw^j2nx?L)GpXa+_?6mZz+ep6>i6B< zySlpC_pYRsbdKiRz4zSn{JqZaJnpK!UAjw>q`A^k=__d#u5185O7*WGu5G6468#$K zY~{AnSUeKj=ESZ`aJ|?lr{@1`OJniOu`G7YGM5`^{%MizHfeUWO4}0K?eXi|Y%5IV zuQiolC7~ASYbd3{=8j+AZQDDNzU1fZ!jg4JbMKR_yk0#dNw;X<^&9nmcH@uM7}uBA zqCC5Ji?pAvJ!G_8U|M<_9vftNGd2my^t3A}D^!ax^8dml_+R^2GwBNhgSGjdd zdHq%o%eN1CLiQeiKvTjIS&4WXDw_6I@bOR`o(w3OM;;mo1S54r4V8L^I$Sf_St;vD zwEl+5L+zcirmBH{zb3mKwGOwvx_X1$6ZQ-!$JKDZT;VVUK$XVrZIZ;u$tXI{H?u7jz&94S!Pq#X#HB=4``h9g9J-$t@Znwv-_-bqHRaL$k zyJz!8x80}sYLuEYpYFRSlYPHe$KkRw`HDC`evj!sXn(xQe3Jh*J%rH1{Fs#s47>{TN5PNqk; zSoXyEH9r^D9Nw_v(bTY!r>s7rq4-{Fb%+}91W_eY#!{4*r7YO5DFcn+u;;``(H`ES zVaRASElC;aJI6xM^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(C2=@ z2XIcr`5AqE`i&e*XqRZCCPU9q?U+Ej$@b7+p-ho?lrgSzdH7p8TuYhCyyKZvo^Qmu zwxCfQQhA2LZ|<^=dyrxunmr z6`+2RUoyb;M$%y}P)s_8<|GW{9c7C$Mqi}@;FwG~%*t*ey|E5MIo>_VxEJ+P{>USa z-;DszgKPx2Pq+qH39!$!iR4!?>lm6hCKSYOqEym}wBdM3yE~a6Z;184T7cu$Dqsb` zc`V0=`2hLFF{4;*BAS*qAUznCr{|pqSL{W;MfS`b&fS`b&fS`b&fS`b&fS`b&fS`b&fS`b&fS`b& sfS`b&fS`b&fS`b&z*M3@>1kVZcZ@$KP{Ggpa1{> literal 0 HcmV?d00001 diff --git a/Shuffle.tiff b/Shuffle.tiff new file mode 100755 index 0000000000000000000000000000000000000000..14f784c59e913f92ee175769f0dd9205d62cd93f GIT binary patch literal 62800 zcmeHQeQ;YF;-? zD?iEldY0_S_Pv>({O*1Co_Fs#=bn4+$9w7Q)UMGqZLYRN`<*rmS0;czX7R_5Ym@G} zL|h}EsoZ3ar6aScGkB2F`f}5fSUO8w61yhNOJ$yaUSzsln;m_mX|d^w`1R$c zr8@enbo8q=JVm=0R4Po4`1M-T&e8lOKVuUXuST95{-}f3%l}-{E{fdkmCrr7^p97> zueX36c@X_qe)djHt6ZeT{sIIcLrNM1Kur1L!Mnnw|Bda4!YL4 zD>rT^Z`|l4ed}Ro(AwwqMLeOf#S?ZlRkZG`;O)Z=xHII5I4y^VeEx95;igJapaIuR zwpCh0mdIdJ<=)ONOC%8R4SFLMM^$~5!&*~woux129P%6rga$3uRkf8M8FKeE>}+d~ z5k#!1av%~3HrQ;34jrmGR8tiQ_1mh~ty^caJ8TYz6*;WoBmRiR#&_0tj=|799Fl-UFWH*cX;|7)s^KI*=}dBvorM*!65O-p&>riVrfJ|XJuk2MlFa+NIcKhy#W)EA3M3GQ) zavPR}uy)c^fn}8ni^uN@xV`@Vri$I&?bdp+MzpMLM{D=ZU7IXHpEn$_bnU)=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@%trH zLO^LMNx5;)XeH1HY>q+MMKGd>1AQs_p@VRrEHc}Ellj$EZk6tGh{D1N`%+LS; literal 0 HcmV?d00001 diff --git a/StatusWindow.h b/StatusWindow.h index b72ca71..6e72123 100755 --- a/StatusWindow.h +++ b/StatusWindow.h @@ -16,28 +16,30 @@ #import -#define SW_PAD 24.0 -#define SW_SPACE 24.0 -#define SW_MINW 211.0 -#define SW_BORDER 32.0 +#define SW_PAD 24.0 +#define SW_SPACE 24.0 +#define SW_MINW 211.0 +#define SW_BORDER 32.0 +#define SW_METER_PAD 4.0 -typedef enum { - StatusWindowTextMode, - StatusWindowVolumeMode -} StatusWindowMode; @interface StatusWindow : ITTransientStatusWindow { - NSImage *image; - NSString *text; - NSImageView *imageView; - ITTextField *textField; - NSMatrix *volMatrix; - StatusWindowMode windowMode; - float volumeLevel; + NSImage *_image; + BOOL _locked; } - (void)setImage:(NSImage *)newImage; -- (void)setText:(NSString *)newText; -- (void)setVolume:(float)level; - +- (void)setLocked:(BOOL)flag; + +- (void)buildTextWindowWithString:(NSString *)text; +- (void)buildMeterWindowWithCharacter:(NSString *)character + count:(int)count + active:(int)active; +- (void)buildDialogWindowWithMessage:(NSString *)message + defaultButton:(NSString *)title + alternateButton:(NSString *)title + target:(id)target + defaultAction:(SEL)okAction + alternateAction:(SEL)alternateAction; + @end diff --git a/StatusWindow.m b/StatusWindow.m index 4bf245b..28fca4f 100755 --- a/StatusWindow.m +++ b/StatusWindow.m @@ -8,175 +8,211 @@ #import "StatusWindow.h" - @interface StatusWindow (Private) -- (void)buildStatusWindow; +- (NSRect)setupWindowWithDataSize:(NSSize)dataSize; @end - @implementation StatusWindow +/*************************************************************************/ +#pragma mark - +#pragma mark INITIALIZATION / DEALLOCATION METHODS +/*************************************************************************/ + - (id)initWithContentView:(NSView *)contentView exitMode:(ITTransientStatusWindowExitMode)exitMode backgroundType:(ITTransientStatusWindowBackgroundType)backgroundType { if ( ( self = [super initWithContentView:contentView exitMode:exitMode - backgroundType:backgroundType]) ) { + backgroundType:backgroundType] ) ) { // Set default values. - windowMode = StatusWindowTextMode; - image = [NSImage imageNamed:@"NSApplicationIcon"]; - text = @"No string set yet."; - volumeLevel = 0.0; - - [self buildStatusWindow]; + _image = [[NSImage imageNamed:@"NSApplicationIcon"] retain]; + _groupNoun = [@"Playlist" retain]; + _locked = NO; } return self; } -- (void)buildStatusWindow +- (void)dealloc { - NSRect imageRect; - NSRect dataRect; - float imageWidth = 0.0; - float imageHeight = 0.0; - float dataWidth = 0.0; - float dataHeight = 0.0; - float contentHeight = 0.0; - float windowWidth = 0.0; - float windowHeight = 0.0; - NSArray *lines = [text componentsSeparatedByString:@"\n"]; - id oneLine = nil; - NSEnumerator *lineEnum = [lines objectEnumerator]; - NSFont *font = [NSFont fontWithName:@"Lucida Grande Bold" size:18]; - NSDictionary *attr = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName]; - - // Get image width and height. - imageWidth = [image size].width; - imageHeight = [image size].height; - - if ( windowMode == StatusWindowTextMode ) { - // Iterate over each line to get text width and height - while ( (oneLine = [lineEnum nextObject]) ) { - // Get the width of one line, adding 8.0 because Apple sucks donkey rectum. - float oneLineWidth = ( [oneLine sizeWithAttributes:attr].width + 8.0 ); - // Add the height of this line to the total text height - dataHeight += [oneLine sizeWithAttributes:attr].height; - // If this line wider than the last one, set it as the text width. - dataWidth = ( ( dataWidth > oneLineWidth ) ? dataWidth : oneLineWidth ); - } - - // Add 4.0 to the final dataHeight to accomodate the shadow. - dataHeight += 4.0; - } else { - dataHeight = 24.0; - dataWidth = 200.0; - } + [_image release]; + [_groupNoun release]; + [super dealloc]; +} + + +/*************************************************************************/ +#pragma mark - +#pragma mark ACCESSOR METHODS +/*************************************************************************/ + +- (void)setImage:(NSImage *)newImage +{ + [_image autorelease]; + _image = [newImage copy]; +} + +- (void)setGroupNoun:(NSString *)newNoun; +{ + [_groupNoun autorelease]; + _groupNoun = [newNoun copy]; +} + +- (void)setLocked:(BOOL)flag +{ + _locked = flag; +} + + +/*************************************************************************/ +#pragma mark - +#pragma mark INSTANCE METHODS +/*************************************************************************/ + +- (NSRect)setupWindowWithDataSize:(NSSize)dataSize +{ + NSRect imageRect; + float imageWidth = 0.0; + float imageHeight = 0.0; + float dataWidth = dataSize.width; + float dataHeight = dataSize.height; + float contentHeight = 0.0; + float windowWidth = 0.0; + float windowHeight = 0.0; + NSImageView *imageView; + +// Get image width and height. + imageWidth = [_image size].width; + imageHeight = [_image size].height; - // Set the content height to the greater of the text and image heights. +// Set the content height to the greater of the text and image heights. contentHeight = ( ( imageHeight > dataHeight ) ? imageHeight : dataHeight ); - - // Setup the Window, and remove all its contentview's subviews. + +// Setup the Window, and remove all its contentview's subviews. windowWidth = ( SW_PAD + imageWidth + SW_SPACE + dataWidth + SW_PAD ); windowHeight = ( SW_PAD + contentHeight + SW_PAD ); [self setFrame:NSMakeRect(SW_BORDER, SW_BORDER, windowWidth, windowHeight) display:YES]; [[[self contentView] subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)]; - - // Setup, position, fill, and add the image view to the content view. + +// Setup, position, fill, and add the image view to the content view. imageRect = NSMakeRect( SW_PAD, (SW_PAD + ((contentHeight - imageHeight) / 2)), imageWidth, imageHeight ); imageView = [[[NSImageView alloc] initWithFrame:imageRect] autorelease]; - [imageView setImage:image]; + [imageView setImage:_image]; [[self contentView] addSubview:imageView]; - dataRect = NSMakeRect( (SW_PAD + imageWidth + SW_SPACE), - (SW_PAD + ((contentHeight - dataHeight) / 2)), - dataWidth, - dataHeight); + return NSMakeRect( (SW_PAD + imageWidth + SW_SPACE), + (SW_PAD + ((contentHeight - dataHeight) / 2)), + dataWidth, + dataHeight); +} - if ( windowMode == StatusWindowTextMode ) { +- (void)buildTextWindowWithString:(NSString *)text +{ + float dataWidth = 0.0; + float dataHeight = 0.0; + NSRect dataRect; + NSArray *lines = [text componentsSeparatedByString:@"\n"]; + id oneLine = nil; + NSEnumerator *lineEnum = [lines objectEnumerator]; + NSFont *font = [NSFont fontWithName:@"Lucida Grande Bold" size:18]; + NSDictionary *attr = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName]; + ITTextField *textField; - // Setup, position, fill, and add the text view to the content view. - textField = [[[ITTextField alloc] initWithFrame:dataRect] autorelease]; - [textField setEditable:NO]; - [textField setSelectable:NO]; - [textField setBordered:NO]; - [textField setDrawsBackground:NO]; - [textField setFont:[NSFont fontWithName:@"Lucida Grande Bold" size:18]]; - [textField setTextColor:[NSColor whiteColor]]; - [textField setCastsShadow:YES]; - [textField setStringValue:text]; - [[self contentView] addSubview:textField]; +// Iterate over each line to get text width and height + while ( (oneLine = [lineEnum nextObject]) ) { +// Get the width of one line, adding 8.0 because Apple sucks donkey rectum. + float oneLineWidth = ( [oneLine sizeWithAttributes:attr].width + 8.0 ); +// Add the height of this line to the total text height + dataHeight += [oneLine sizeWithAttributes:attr].height; +// If this line wider than the last one, set it as the text width. + dataWidth = ( ( dataWidth > oneLineWidth ) ? dataWidth : oneLineWidth ); + } - } else if ( windowMode == StatusWindowVolumeMode ) { - - NSEnumerator *cellEnum; - id aCell; - int lights = ( ceil(volumeLevel * 100) / 10 ); - int lightCount = 0; - - volMatrix = [[[NSMatrix alloc] initWithFrame:dataRect - mode:NSHighlightModeMatrix - cellClass:NSClassFromString(@"ITTextFieldCell") - numberOfRows:1 - numberOfColumns:10] autorelease]; - - [volMatrix setCellSize:NSMakeSize(20, 24)]; - [volMatrix setIntercellSpacing:NSMakeSize(0, 0)]; +// Add 4.0 to the final dataHeight to accomodate the shadow. + dataHeight += 4.0; + + dataRect = [self setupWindowWithDataSize:NSMakeSize(dataWidth, dataHeight)]; + +// Create, position, setup, fill, and add the text view to the content view. + textField = [[[ITTextField alloc] initWithFrame:dataRect] autorelease]; + [textField setEditable:NO]; + [textField setSelectable:NO]; + [textField setBordered:NO]; + [textField setDrawsBackground:NO]; + [textField setFont:font]; + [textField setTextColor:[NSColor whiteColor]]; + [textField setCastsShadow:YES]; + [textField setStringValue:text]; + [[self contentView] addSubview:textField]; + +// Display the window. + [[self contentView] setNeedsDisplay:YES]; +} - cellEnum = [[volMatrix cells] objectEnumerator]; +- (void)buildMeterWindowWithCharacter:(NSString *)character + count:(int)count + active:(int)active +{ + NSFont *font = [NSFont fontWithName:@"Lucida Grande Bold" size:18]; + NSDictionary *attr = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName]; + NSSize charSize = [character sizeWithAttributes:attr]; + float cellHeight = ( charSize.height + 4.0 ); // Add 4.0 for shadow + float cellWidth = ( (charSize.width) + SW_METER_PAD ); // Add 8.0 for Apple suck + float dataWidth = ( cellWidth * count ); + NSRect dataRect = [self setupWindowWithDataSize:NSMakeSize(dataWidth, cellHeight)]; + NSEnumerator *cellEnum = nil; + id aCell = nil; + int activeCount = 0; + NSMatrix *volMatrix = [[[NSMatrix alloc] initWithFrame:dataRect + mode:NSHighlightModeMatrix + cellClass:NSClassFromString(@"ITTextFieldCell") + numberOfRows:1 + numberOfColumns:count] autorelease]; + + [volMatrix setCellSize:NSMakeSize(cellWidth, cellHeight)]; + [volMatrix setIntercellSpacing:NSMakeSize(0, 0)]; + + cellEnum = [[volMatrix cells] objectEnumerator]; + + while ( (aCell = [cellEnum nextObject]) ) { + [aCell setEditable:NO]; + [aCell setSelectable:NO]; + [aCell setBordered:NO]; + [aCell setDrawsBackground:NO]; + [aCell setAlignment:NSCenterTextAlignment]; + [aCell setFont:font]; + [aCell setStringValue:character]; + + activeCount ++; - while ( (aCell = [cellEnum nextObject]) ) { - [aCell setEditable:NO]; - [aCell setSelectable:NO]; - [aCell setBordered:NO]; - [aCell setDrawsBackground:NO]; - [aCell setFont:[NSFont fontWithName:@"Lucida Grande Bold" size:18]]; - [aCell setStringValue:[NSString stringWithUTF8String:"▊"]]; - - lightCount ++; - - // NSLog(@"%f, %i, %i", volumeLevel, lights, lightCount); - - if ( lights >= lightCount ) { - [aCell setCastsShadow:YES]; - [aCell setTextColor:[NSColor whiteColor]]; - } else { - [aCell setCastsShadow:NO]; - [aCell setTextColor:[NSColor darkGrayColor]]; - } - + if ( active >= activeCount ) { + [aCell setCastsShadow:YES]; + [aCell setTextColor:[NSColor whiteColor]]; + } else { + [aCell setCastsShadow:NO]; + [aCell setTextColor:[NSColor darkGrayColor]]; } - [[self contentView] addSubview:volMatrix]; } + [[self contentView] addSubview:volMatrix]; [[self contentView] setNeedsDisplay:YES]; } -- (void)setImage:(NSImage *)newImage +- (void)buildDialogWindowWithMessage:(NSString *)message + defaultButton:(NSString *)defaultTitle + alternateButton:(NSString *)alternateTitle + target:(id)target + defaultAction:(SEL)okAction + alternateAction:(SEL)alternateAction { - [image autorelease]; - image = [newImage copy]; - [self buildStatusWindow]; -} -- (void)setText:(NSString *)newText -{ - [text autorelease]; - text = [newText copy]; - windowMode = StatusWindowTextMode; - [self buildStatusWindow]; } -- (void)setVolume:(float)level -{ - volumeLevel = level; - windowMode = StatusWindowVolumeMode; - [self buildStatusWindow]; -} @end diff --git a/StatusWindowController.h b/StatusWindowController.h index 913432b..2cf440b 100755 --- a/StatusWindowController.h +++ b/StatusWindowController.h @@ -20,36 +20,33 @@ typedef enum { - MTStatusWindowLoopModeLoopNone, - MTStatusWindowLoopModeLoopOne, - MTStatusWindowLoopModeLoopAll -} MTStatusWindowLoopMode; - -typedef enum { - MTStatusWindowShuffleModeOn, - MTStatusWindowShuffleModeOff -} MTStatusWindowShuffleMode; + StatusWindowRepeatNone, + StatusWindowRepeatGroup, + StatusWindowRepeatSong +} StatusWindowRepeatMode; @interface StatusWindowController : NSObject { - StatusWindow *_window; + StatusWindow *_window; NSUserDefaults *df; } -- (void)showSongWindowWithTitle: (NSString *)title - album: (NSString *)album - artist: (NSString *)artist - time: (NSString *)time // FLOW: Should probably be NSDate or something. - trackNumber: (int)trackNumber - trackTotal: (int)trackTotal - rating: (int)rating - source:(ITMTRemotePlayerSource)source; - -- (void)showUpcomingSongsWithTitles:(NSArray *)titleStrings; +- (void)showUpcomingSongsWindowWithTitles:(NSArray *)titleStrings; - (void)showVolumeWindowWithLevel:(float)level; -- (void)showRatingWindowWithLevel:(int)level; -- (void)showShuffleWindowWithMode:(MTStatusWindowShuffleMode)mode; -- (void)showLoopWindowWithMode:(MTStatusWindowLoopMode)mode; +- (void)showRatingWindowWithRating:(int)rating; +- (void)showShuffleWindow:(BOOL)shuffle; +- (void)showRepeatWindowWithMode:(StatusWindowRepeatMode)mode; +- (void)showSetupQueryWindow; + +- (void)showSongInfoWindowWithSource:(ITMTRemotePlayerSource)source + title: (NSString *)title + album: (NSString *)album + artist: (NSString *)artist + time: (NSString *)time + trackNumber: (int)trackNumber + trackTotal: (int)trackTotal + rating: (int)rating; + @end diff --git a/StatusWindowController.m b/StatusWindowController.m index 43fdd46..49cbf89 100755 --- a/StatusWindowController.m +++ b/StatusWindowController.m @@ -85,21 +85,21 @@ [super dealloc]; } -- (void)showSongWindowWithTitle: (NSString *)title - album: (NSString *)album - artist: (NSString *)artist - time: (NSString *)time // FLOW: Should probably be NSDate or something. - trackNumber: (int)trackNumber - trackTotal: (int)trackTotal - rating: (int)rating - source:(ITMTRemotePlayerSource)source +- (void)showSongInfoWindowWithSource:(ITMTRemotePlayerSource)source + title: (NSString *)title + album: (NSString *)album + artist: (NSString *)artist + time: (NSString *)time // FLOW: Should probably be NSDate or something. + trackNumber: (int)trackNumber + trackTotal: (int)trackTotal + rating: (int)rating { [_window setImage:[NSImage imageNamed:@"Library"]]; - [_window setText:title]; + [_window buildTextWindowWithString:title]; [_window appear:self]; } -- (void)showUpcomingSongsWithTitles:(NSArray *)titleStrings +- (void)showUpcomingSongsWindowWithTitles:(NSArray *)titleStrings { } @@ -107,23 +107,31 @@ - (void)showVolumeWindowWithLevel:(float)level { [_window setImage:[NSImage imageNamed:@"Volume"]]; - [_window setVolume:level]; + [_window buildMeterWindowWithCharacter:[NSString stringWithUTF8String:"▊"] + count:10 + active:( ceil(level * 100) / 10 )]; [_window appear:self]; } -- (void)showRatingWindowWithLevel:(int)level +- (void)showRatingWindowWithRating:(int)rating { } -- (void)showShuffleWindowWithMode:(MTStatusWindowShuffleMode)mode +- (void)showShuffleWindow:(BOOL)shuffle { } -- (void)showLoopWindowWithMode:(MTStatusWindowLoopMode)mode +- (void)showRepeatWindowWithMode:(StatusWindowRepeatMode)mode { } +- (void)showSetupQueryWindow +{ + +} + + @end \ No newline at end of file -- 2.20.1