void CMoodMgr::displayMenu(menuType m) { actionType action = menu.display(m); while(action != ACTION_EXIT) { switch(action) { case ACTION_NEW_SECURE: displayMessage("CREATE SECURE SONG"); createSong(SONG_SECURE); break; case ACTION_NEW_PROMO: displayMessage("CREATE PROMO SONG"); createSong(SONG_PROMO); break; case ACTION_EDIT_SONG: displayMessage("EDIT SONG"); editSong(); break; case ACTION_DELETE_SONG: displayMessage("DELETE SONG"); deleteSong(); break; case ACTION_READ_FILE: displayMessage("READ FILE"); input(); break; case ACTION_WRITE_FILE: displayMessage("WRITE FILE"); output(); break; case ACTION_LIST_ALL: displayMessage("LIST ALL SONGS"); list(); break; case ACTION_LIST_SECURE: displayMessage("LIST SECURE SONGS"); listSecure(); break; case ACTION_LIST_PROMO: displayMessage("LIST PROMO SONGS"); listPromo(); break; case ACTION_SORT_ARTIST: displayMessage("SORT BY ARTIST NAME"); sortArtist(); break; case ACTION_SORT_SONGNAME: displayMessage("SORT BY SONG NAME"); sortSongName(); break; case ACTION_SORT_DURATION: displayMessage("SORT BY DURATION"); sortDuration(); break; case ACTION_MODIFY_POPULARITY: displayMessage("MODIFY SONG POPULARITY"); editPopularity(); break; case ACTION_SORT_SONGS_POPULARITY: displayMessage("SORT SONGS BY POPULARITY"); sortSongPopularity(); break; case ACTION_SORT_ARTISTS_POPULARITY: displayMessage("SORT ARTISTS BY POPULARITY"); sortArtistPopularity(); break; case ACTION_MENU_TOP: m = MENU_TOP; break; case ACTION_MENU_NEW: m = MENU_NEW; break; case ACTION_MENU_EDIT: m = MENU_EDIT; break; case ACTION_MENU_FILE: m = MENU_FILE; break; case ACTION_MENU_LIST: m = MENU_LIST; break; case ACTION_MENU_SORT: m = MENU_SORT; break; case ACTION_MENU_POPULARITY: m = MENU_POPULARITY; break; default: break; } action = menu.display(m); } }
void CMoodMgr::editPopularity() { cout << "\nYou will now be transfered to the edit menu\n" << "to edit the appropriate song's popularity.\n"; editSong(); }
/************************************************************* * Function: main () * Created: January 27th, 2012 * Last Revised: February 2nd, 2012 * Description: This function controls the program * Input parameters: None * Returns: None * Preconditions: the program needs to be run * Postconditions: the program has been run *************************************************************/ int main (void) { // variables char programTitle[] = "Digital Music Manager"; Node *pSongs = NULL; int prog_state = 0, sub_state = 0, option = 0; Bool success = false; FILE *ioFile = NULL; while (prog_state >= 0) { //// LOADING //// if (prog_state == 0) { // open the music file ioFile = fopen ("music.dmm", "r+"); prog_state = 1; } //// MAIN MENU //// else if (prog_state == 1) { // display menu and get selected option option = display_menu (2, 2, ':', 1, 9, ";", programTitle, "Main Menu", "Display Songs;Rate Songs;Sort Songs;Add Song;Edit Song;Delete Song;Load Songs;Store Songs;Exit Digital Music Manager"); // Display Songs if (option == 1) { displaySongs (pSongs); } // Rate Songs else if (option == 2) { editSong (1, &pSongs); } // Sort Songs else if (option == 3) { sortSongs (&pSongs, display_menu (2, 2, ':', 1, 3, ";", programTitle, "Choose an Insert Order...", "Insert by Song Title;Insert by Genre;Insert by Rating")); } // Add Song else if (option == 4) { success = addSong (&pSongs); if (!success) { printf ("Failed to create song!\n"); } else { sortSongs (&pSongs, display_menu (2, 2, ':', 1, 3, ";", programTitle, "Choose an Insert Order...", "Insert by Song Title;Insert by Genre;Insert by Rating")); } } // Edit Song else if (option == 5) { editSong (0, &pSongs); } // Delete Song else if (option == 6) { deleteSong (&pSongs); } // Load Songs else if (option == 7) { loadSongs (&pSongs, ioFile); } // Store Songs else if (option == 8) { storeSongs (pSongs, ioFile); } // Exit program else if (option == 9) { fclose (ioFile); prog_state = -1; } } } return 0; }