CatNiP prefinal
Sähköinen nuottikirja, HY-TKTKL-OHTUPROJ KESÄ11
ScorePopoverController Class Reference

Controller for popover that shows all the scores for the chosen compositionData object. More...

#import <ScorePopoverController.h>

Collaboration diagram for ScorePopoverController:

List of all members.

Public Member Functions

(void) - addToPlaylist:
 Opens playlist popover to select playlist in which the score associated with given button will be added.
(void) - cancelDownload:
 Cancel's download of pdf associated with this button.
(UIView *) - createAccessoryViewForIndexPath:
 creates accessory view depending on current LIBRARYTYPE
(ScoreListButton *) - createAddToPlaylistButtonForScore:
 Create add to playlist button which sends actions to addToPlaylist:
(ScoreListButton *) - createCancelButtonForScore:
 Create cancel button which sends actions to cancelDownload:
(ScoreListButton *) - createDetailButtonForScore:
 Create detail button which sends actions to showDetailsForScore:
(ScoreListButton *) - createDownloadButtonForScore:
 Create download button which sends actions to downloadScore:
(void) - dealloc [implementation]
(void) - didReceiveMemoryWarning [implementation]
(UIView *) - downloadableAccessoryViewForIndexPath:
 Creates accessoryview for IMSLP score which can be downloaded.
(UIView *) - downloadedAccessoryViewForIndexPath:
 Creates accessoryview for IMSLP score which is already downloaded.
(UIView *) - downloadingAccessoryViewForIndexPath:
 Creates accessoryview for IMSLP score which is downloading at the moment.
(void) - downloadScore:
 Starts downloading score's pdf associated with button and changes button's cell's accessoryview.
(UIView *) - IMSLPAccessoryViewForIndexPath:
 Creates accessoryview for IMSLP scorecell in indexPath.
(id) - initWithStyle:masterController:compositionData:editable:
 Basic init for ScorePopoverController, sets masterController = controller.
(UIView *) - LocalAccessoryViewForIndexPath:
 Creates accessoryview for local score.
(NSInteger) - numberOfSectionsInTableView:
 UITableViewDataSource protocol function's implementation.
(BOOL) - shouldAutorotateToInterfaceOrientation: [implementation]
(void) - showDetailsForScore:
 Shows details popover about the score associated with given button.
(BOOL) - tableView:canEditRowAtIndexPath:
 UITableViewDataSource protocol function's implementation.
(UITableViewCell *) - tableView:cellForRowAtIndexPath:
 UITableViewDataSource protocol function's implementation.
(void) - tableView:commitEditingStyle:forRowAtIndexPath:
 UITableViewDataSource protocol function's implementation.
(void) - tableView:didSelectRowAtIndexPath:
 UITableViewDelegate protocol function's implementation.
(UITableViewCellEditingStyle) - tableView:editingStyleForRowAtIndexPath:
 UITableViewDelegate protocol function's implementation.
(CGFloat) - tableView:heightForHeaderInSection:
 UITableViewDelegate protocol function's implementation.
(CGFloat) - tableView:heightForRowAtIndexPath:
 UITableViewDelegate protocol function's implementation.
(NSInteger) - tableView:numberOfRowsInSection: [implementation]
 UITableViewDataSource protocol function's implementation.
(UIView *) - tableView:viewForHeaderInSection:
 tableViewDelegate protocol function's implementation.
(void) - updateProgressView:
 Updates UIProgressview associated with this NSTimer.
(void) - viewDidAppear: [implementation]
(void) - viewDidDisappear: [implementation]
(void) - viewDidLoad [implementation]
(void) - viewDidUnload [implementation]
(void) - viewWillAppear: [implementation]
(void) - viewWillDisappear: [implementation]

Protected Attributes

CatNiPViewControllermaster

Properties

NSString * composer
NSString * composition
CompositionDatacompositionData
BOOL editable
IBOutlet CatNiPViewControllermaster

Detailed Description

Controller for popover that shows all the scores for the chosen compositionData object.

Depending on the current LIBRARYTYPE and spesific score's download status alter's cells accessoryView's to represent relevant buttons.

API up to date 28.6.2011

Definition at line 17 of file ScorePopoverController.h.


Member Function Documentation

- (void) addToPlaylist: (id)  button

Opens playlist popover to select playlist in which the score associated with given button will be added.

Parameters:
addToPlaylistsender of the action. Only ScoreListButtons allowed.

Definition at line 616 of file ScorePopoverController.m.

- (void) cancelDownload: (id)  button

Cancel's download of pdf associated with this button.

Accessoryview of this cell is updated after cancel.

Parameters:
cancelDownloadsender of the action. Only ScoreListButtons allowed.

Definition at line 638 of file ScorePopoverController.m.

References IMSLPQueryHelper::abortRead:.

Here is the call graph for this function:

- (UIView *) createAccessoryViewForIndexPath: (NSIndexPath *)  indexPath

creates accessory view depending on current LIBRARYTYPE

Calls IMSLPAccessoryViewForIndexPath: or LocalAccessoryViewForIndexPath:

Parameters:
IcreateAccessoryViewForIndexPathindexpath for cell
Returns:
accessoryview for cell as UIView

Definition at line 359 of file ScorePopoverController.m.

References IMSLP, IMSLPAccessoryViewForIndexPath:, LIBRARYTYPE, LOCAL, and LocalAccessoryViewForIndexPath:.

Here is the call graph for this function:

Here is the caller graph for this function:

- (ScoreListButton *) createAddToPlaylistButtonForScore: (ScoreData *)  score

Create add to playlist button which sends actions to addToPlaylist:

Definition at line 541 of file ScorePopoverController.m.

Here is the caller graph for this function:

- (ScoreListButton *) createCancelButtonForScore: (ScoreData *)  score

Create cancel button which sends actions to cancelDownload:

Definition at line 553 of file ScorePopoverController.m.

Here is the caller graph for this function:

- (ScoreListButton *) createDetailButtonForScore: (ScoreData *)  score

Create detail button which sends actions to showDetailsForScore:

Definition at line 517 of file ScorePopoverController.m.

Here is the caller graph for this function:

- (ScoreListButton *) createDownloadButtonForScore: (ScoreData *)  score

Create download button which sends actions to downloadScore:

Definition at line 529 of file ScorePopoverController.m.

Here is the caller graph for this function:

- (void) dealloc [implementation]

Definition at line 43 of file ScorePopoverController.m.

References composer, composition, and compositionData.

- (void) didReceiveMemoryWarning [implementation]

Definition at line 51 of file ScorePopoverController.m.

- (UIView *) downloadableAccessoryViewForIndexPath: (NSIndexPath *)  indexPath

Creates accessoryview for IMSLP score which can be downloaded.

Accessoryview has download button and detail button.

Parameters:
downloadableAccessoryViewForIndexPathindexpath for cell
Returns:
accessoryview for cell as UIView

Definition at line 434 of file ScorePopoverController.m.

References createDetailButtonForScore:, and createDownloadButtonForScore:.

Here is the call graph for this function:

Here is the caller graph for this function:

- (UIView *) downloadedAccessoryViewForIndexPath: (NSIndexPath *)  indexPath

Creates accessoryview for IMSLP score which is already downloaded.

Accessoryview has 'check-mark' instead of download button and detail button.

Parameters:
downloadedAccessoryViewForIndexPathindexpath for cell
Returns:
accessoryview for cell as UIView

Definition at line 496 of file ScorePopoverController.m.

References createDetailButtonForScore:.

Here is the call graph for this function:

Here is the caller graph for this function:

- (UIView *) downloadingAccessoryViewForIndexPath: (NSIndexPath *)  indexPath

Creates accessoryview for IMSLP score which is downloading at the moment.

Accessoryview has progressbar, cancel button and detail button.

Parameters:
downloadingAccessoryViewForIndexPathindexpath for cell
Returns:
accessoryview for cell as UIView

Definition at line 460 of file ScorePopoverController.m.

References createCancelButtonForScore:, and createDetailButtonForScore:.

Here is the call graph for this function:

Here is the caller graph for this function:

- (void) downloadScore: (id)  button

Starts downloading score's pdf associated with button and changes button's cell's accessoryview.

Parameters:
downloadScoresender of the action. Only ScoreListButtons allowed.

Definition at line 568 of file ScorePopoverController.m.

References IMSLPAccessoryViewForIndexPath:, and IMSLPQueryHelper::readIMSLPFile:ofComposition:reportTo:withMethod:.

Here is the call graph for this function:

- (UIView *) IMSLPAccessoryViewForIndexPath: (NSIndexPath *)  indexPath

Creates accessoryview for IMSLP scorecell in indexPath.

Accessoryview created is based on score associated with cell and score's pdf. If pdf is already downloading downloadingAccessoryViewForIndexPath: is called. If it's already stored locally downloadedAccessoryViewForIndexPath: is called. If it's not either downloadableAccessoryViewForIndexPath: is called.

Parameters:
IMSLPAccessoryViewForIndexPathindexpath for cell
Returns:
accessoryview for cell as UIView

Definition at line 382 of file ScorePopoverController.m.

References LocalDelegateDataSource::allLocalScores, downloadableAccessoryViewForIndexPath:, downloadedAccessoryViewForIndexPath:, downloadingAccessoryViewForIndexPath:, CatNiPViewController::localDelegateAndDataSource, master, and ScoreData::pdf.

Here is the call graph for this function:

Here is the caller graph for this function:

- (id) initWithStyle: (UITableViewStyle)  style
masterController: (CatNiPViewController *)  controller
compositionData: (CompositionData *)  compData
editable: (BOOL)  ed 

Basic init for ScorePopoverController, sets masterController = controller.

Parameters:
initWithStyle,:check framework's API for UITableViewStyles
masterControllermaster viewController in which this popover is represented.
IMSLPCompositionDataIMSLPCompositionData object of given composition
Returns:
id

Definition at line 29 of file ScorePopoverController.m.

References CompositionData::composerName, and CompositionData::compositionName.

- (UIView *) LocalAccessoryViewForIndexPath: (NSIndexPath *)  indexPath

Creates accessoryview for local score.

Accessoryview has addToPlaylist button and detail button.

Parameters:
LocalAccessoryViewForIndexPathindexpath for cell
Returns:
accessoryview for cell as UIView

Definition at line 410 of file ScorePopoverController.m.

References createAddToPlaylistButtonForScore:, and createDetailButtonForScore:.

Here is the call graph for this function:

Here is the caller graph for this function:

- (NSInteger) numberOfSectionsInTableView: (UITableView *)  tableView

UITableViewDataSource protocol function's implementation.

Returns 1

Parameters:
numberOfSectionsInTableViewself.tableView
Returns:
returns 1.

Definition at line 124 of file ScorePopoverController.m.

- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)  interfaceOrientation [implementation]

Definition at line 104 of file ScorePopoverController.m.

- (void) showDetailsForScore: (id)  button

Shows details popover about the score associated with given button.

Parameters:
showDetailsForScoresender of the action. Only ScoreListButtons allowed.

Definition at line 597 of file ScorePopoverController.m.

- (BOOL) tableView: (UITableView *)  tableView
canEditRowAtIndexPath: (NSIndexPath *)  indexPath 

UITableViewDataSource protocol function's implementation.

Parameters:
tableViewself.tableView
canEditRowAtIndexPathindexPath for cell
Returns:
self.editable

Definition at line 177 of file ScorePopoverController.m.

- (UITableViewCell *) tableView: (UITableView *)  tableView
cellForRowAtIndexPath: (NSIndexPath *)  indexPath 

UITableViewDataSource protocol function's implementation.

Parameters:
tableViewself.tableView
cellForRowAtIndexPathindexPath for cell to be created
Returns:
created cell for given arguments

Definition at line 147 of file ScorePopoverController.m.

References createAccessoryViewForIndexPath:, master, and CatNiPViewController::tableView:createCellWithIdentifier:.

Here is the call graph for this function:

- (void) tableView: (UITableView *)  tableView
commitEditingStyle: (UITableViewCellEditingStyle)  editingStyle
forRowAtIndexPath: (NSIndexPath *)  indexPath 

UITableViewDataSource protocol function's implementation.

Assumes that all editing is deleting score represented in forRowAtIndexPath. Removes all local references to that score and finally deletes the pdf-file associated with the score.

Parameters:
tableViewself.tableView
commitEditingStyleUITableViewCellEditingStyle
forRowAtIndexPathindexPath for cell

Definition at line 192 of file ScorePopoverController.m.

References compositionData, CatNiPViewController::currentPlaylist, CatNiPViewController::currentScore, master, ScoreData::pdf, LocalDataHandler::removeAndDeleteLocalScoreData:fromScoreArray:andDictionary:andPlaylistArray:, and Playlist::scorelist.

Here is the call graph for this function:

- (void) tableView: (UITableView *)  tableView
didSelectRowAtIndexPath: (NSIndexPath *)  indexPath 

UITableViewDelegate protocol function's implementation.

Shows pdf associated with score. If LIBRARYTYPE is IMSLP then downloads it first if it's not already downloaded or currently downloading in which cases does nothing.

Parameters:
tableViewself.tableView
didSelectRowAtIndexPathindexPath for selected cell

Definition at line 311 of file ScorePopoverController.m.

References LocalDelegateDataSource::allLocalScores, downloadingAccessoryViewForIndexPath:, IMSLP, LIBRARYTYPE, LOCAL, CatNiPViewController::localDelegateAndDataSource, master, ScoreData::pdf, and IMSLPQueryHelper::readIMSLPFile:ofComposition:reportTo:withMethod:.

Here is the call graph for this function:

- (UITableViewCellEditingStyle) tableView: (UITableView *)  tableView
editingStyleForRowAtIndexPath: (NSIndexPath *)  indexPath 

UITableViewDelegate protocol function's implementation.

Parameters:
tableViewtableView of the cell
editingStyleForRowAtIndexPathindexPath of the cell
Returns:
if self.editable == YES return UITableViewCellEditingStyleDelete else returns UITableViewCellEditingStyleNone

Definition at line 346 of file ScorePopoverController.m.

References editable.

- (CGFloat) tableView: (UITableView *)  tableView
heightForHeaderInSection: (NSInteger)  section 

UITableViewDelegate protocol function's implementation.

Calculate header's height based on it's content's length. Calculation formula is: ((int)(l / 45) +1) * 25 + 50 where l is |composer| + |composition| + 3.

Parameters:
tableViewself.tableView
heightForHeaderInSectiononly one section (0) in this table.
Returns:
height of header as CGFloat.

Definition at line 280 of file ScorePopoverController.m.

- (CGFloat) tableView: (UITableView *)  tableView
heightForRowAtIndexPath: (NSIndexPath *)  indexPath 

UITableViewDelegate protocol function's implementation.

Calculate table row's height dynamically based on string's length.

Parameters:
tableViewself.tableView
heightRowAtIndexPathindexPath of the cell which height is being calculated
Returns:
height of row as CGFloat.

Definition at line 294 of file ScorePopoverController.m.

- (NSInteger) tableView: (UITableView *)  tableView
numberOfRowsInSection: (NSInteger)  section 
[implementation]

UITableViewDataSource protocol function's implementation.

Parameters:
tableViewself.tableView
numberOfRowsInSectionOnly one section (0) in self.tableView
Returns:
amount of scores in selected library for given composition

Definition at line 136 of file ScorePopoverController.m.

- (UIView *) tableView: (UITableView *)  tableView
viewForHeaderInSection: (NSInteger)  section 

tableViewDelegate protocol function's implementation.

Creates an UILabel for self.tableView header (it has only one section) and sets its textLabel.text = "Scores for: composition". Header backgroundcolor has alpha component set to 0.4 so that text behind it can be seen.

Parameters:
tableViewself.tableView
sectiononly one section (0) in this table at the moment.
Returns:
view for header in section

Definition at line 242 of file ScorePopoverController.m.

- (void) updateProgressView: (NSTimer *)  nt

Updates UIProgressview associated with this NSTimer.

Timer's userinfo (NSArray) has progressview (index:0) and pdf(index:1) of the file for which IMSLPQueryHelper's downloadProgressFor: function is called.

Parameters:
updateProgressViewNSTimer object which makes the calls to this function.

Definition at line 671 of file ScorePopoverController.m.

References IMSLPQueryHelper::downloadProgressFor:.

Here is the call graph for this function:

- (void) viewDidAppear: (BOOL)  animated [implementation]

Definition at line 89 of file ScorePopoverController.m.

- (void) viewDidDisappear: (BOOL)  animated [implementation]

Definition at line 99 of file ScorePopoverController.m.

- (void) viewDidLoad [implementation]

Definition at line 61 of file ScorePopoverController.m.

- (void) viewDidUnload [implementation]

Definition at line 77 of file ScorePopoverController.m.

- (void) viewWillAppear: (BOOL)  animated [implementation]

Definition at line 84 of file ScorePopoverController.m.

- (void) viewWillDisappear: (BOOL)  animated [implementation]

Definition at line 94 of file ScorePopoverController.m.


Member Data Documentation

- (CatNiPViewController*) master [protected]

Definition at line 23 of file ScorePopoverController.h.


Property Documentation

- (NSString *) composer [read, write, retain]

Definition at line 20 of file ScorePopoverController.h.

- (NSString *) composition [read, write, retain]

Definition at line 21 of file ScorePopoverController.h.

- (CompositionData *) compositionData [read, write, retain]

Definition at line 24 of file ScorePopoverController.h.

- (BOOL) editable [read, write, assign]

Definition at line 22 of file ScorePopoverController.h.

- (IBOutlet CatNiPViewController*) master [read, write, retain]

Definition at line 27 of file ScorePopoverController.h.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Enumerations Enumerator Properties Defines