Changeset 25410

Show
Ignore:
Timestamp:
05/10/08 06:12:23 (6 days ago)
Author:
stippi
Message:
Fix a few minor coding style violations.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • haiku/trunk/src/apps/cdplayer/CDPlayer.cpp

    r23935 r25410  
    7070 
    7171 
    72 CDPlayer::CDPlayer(BRect frame, const char *name, uint32 resizeMask, uint32 flags) 
     72CDPlayer::CDPlayer(BRect frame, const char *name, uint32 resizeMask, 
     73                uint32 flags) 
    7374        : BView(frame, name, resizeMask, flags | B_FRAME_EVENTS), 
    7475        fCDQuery("freedb.freedb.org") 
    7576{ 
    76         SetViewColor(216,216,216); 
     77        SetViewColor(216, 216, 216); 
    7778 
    7879        fVolume = 255; 
     
    8182 
    8283        if (fCDDrive.CountDrives() < 1) { 
    83                 BAlert *alert = new BAlert("CDPlayer", "It appears that there are no CD drives
    84                                                                        " on your computer or there is no system software
    85                                                                        " to support one. Sorry.", "OK"); 
     84                BAlert *alert = new BAlert("CDPlayer", "It appears that there are no CD
     85                        " drives on your computer or there is no system software to
     86                        "support one. Sorry.", "OK"); 
    8687                alert->Go(); 
    8788                be_app->PostMessage(B_QUIT_REQUESTED); 
     
    125126 
    126127        float labelWidth, labelHeight; 
    127         fCDTitle = new BStringView(r, "CDTitle", "CD drive is empty", B_FOLLOW_LEFT_RIGHT); 
     128        fCDTitle = new BStringView(r, "CDTitle", "CD drive is empty", 
     129                B_FOLLOW_LEFT_RIGHT); 
    128130        fCDTitle->GetPreferredSize(&labelWidth, &labelHeight); 
    129131        fCDTitle->ResizeTo(r.Width(), labelHeight); 
     
    138140        r.OffsetBy(0, r.Height() + 5); 
    139141        r.right = r.left + (r.Width() / 2); 
    140         fTrackTime = new BStringView(r, "TrackTime", "Track: --:-- / --:--", B_FOLLOW_LEFT_RIGHT); 
     142        fTrackTime = new BStringView(r, "TrackTime", "Track: --:-- / --:--", 
     143                B_FOLLOW_LEFT_RIGHT); 
    141144        box->AddChild(fTrackTime); 
    142145 
    143146        r.OffsetTo(box->Bounds().right / 2, r.top); 
    144         fDiscTime = new BStringView(r, "DiscTime", "Disc: --:-- / --:--", B_FOLLOW_RIGHT); 
     147        fDiscTime = new BStringView(r, "DiscTime", "Disc: --:-- / --:--", 
     148                B_FOLLOW_RIGHT); 
    145149        fDiscTime->ResizeToPreferred(); 
    146150        fDiscTime->ResizeBy(10, 0); 
     
    155159        fStop->ResizeToPreferred(); 
    156160        fStop->MoveTo(10, box->Frame().bottom + 15); 
    157         fStop->SetDisabled(BTranslationUtils::GetBitmap(B_PNG_FORMAT, "stop_disabled")); 
     161        fStop->SetDisabled(BTranslationUtils::GetBitmap(B_PNG_FORMAT, 
     162                "stop_disabled")); 
    158163        AddChild(fStop); 
    159164        float stopTop = fStop->Frame().top; 
     
    255260                case M_STOP: 
    256261                        if (fWindowState == kPaused) { 
    257                                 fPlay->SetBitmaps(0, BTranslationUtils::GetBitmap(B_PNG_FORMAT, "play_up"), 
     262                                fPlay->SetBitmaps(0, BTranslationUtils::GetBitmap(B_PNG_FORMAT, 
     263                                        "play_up"), 
    258264                                        BTranslationUtils::GetBitmap(B_PNG_FORMAT, "play_down")); 
    259265                                fPlay->SetState(1); 
     
    269275                                fWindowState = kPaused; 
    270276                                fCDDrive.Pause(); 
    271                                 fPlay->SetBitmaps(0, BTranslationUtils::GetBitmap(B_PNG_FORMAT, "paused_up"), 
     277                                fPlay->SetBitmaps(0, BTranslationUtils::GetBitmap(B_PNG_FORMAT, 
     278                                        "paused_up"), 
    272279                                        BTranslationUtils::GetBitmap(B_PNG_FORMAT, "play_down")); 
    273280                        } else if (fWindowState == kPaused) { 
    274281                                fWindowState = kPlaying; 
    275282                                fCDDrive.Resume(); 
    276                                 fPlay->SetBitmaps(0, BTranslationUtils::GetBitmap(B_PNG_FORMAT, "play_up"), 
     283                                fPlay->SetBitmaps(0, BTranslationUtils::GetBitmap(B_PNG_FORMAT, 
     284                                        "play_up"), 
    277285                                        BTranslationUtils::GetBitmap(B_PNG_FORMAT, "play_down")); 
    278286                        } else { 
     
    448456                        fWindowState = kNoCD; 
    449457 
    450                         // Because we are changing play states, we will need to update the GUI 
     458                        // Because we are changing play states, we will need to update 
     459                        // the GUI 
    451460                        fCDData.SetDiscID(-1); 
    452461                        SetLabel(fCDTitle, "CD drive is empty"); 
     
    471480                        internalTrackChange = true; 
    472481 
    473                         // This means that the drive finished playing the song, so get the next one 
    474                         // from the list and play it 
     482                        // This means that the drive finished playing the song, so get 
     483                        // the next one from the list and play it 
    475484                        int16 next = fPlayList.GetNextTrack(); 
    476485                        if (next > 0) 
     
    486495                fPlay->SetState(0); 
    487496 
    488         // If we got this far, then there must be a CD in the drive. The next order on the agenda 
    489         // is to find out which CD it is 
     497        // If we got this far, then there must be a CD in the drive. The next order 
     498        // on the agenda is to find out which CD it is 
    490499        int32 discId = fCDDrive.GetDiscID(); 
    491500        bool updateTrackGui = false; 
     
    499508 
    500509                if (fCDQuery.Ready()) { 
    501                         // Note that we only update the CD title for now. We still need a track number 
    502                         // in order to update the display for the selected track 
     510                        // Note that we only update the CD title for now. We still need a 
     511                        // track number in order to update the display for the selected track 
    503512                        if (fCDQuery.GetData(&fCDData, 1000000)) { 
    504513                                BString display(fCDData.Artist()); 
     
    522531 
    523532                        if (!internalTrackChange) { 
    524                                 // The main thing is that we need to make sure that the playlist and the drive's track 
    525                                 // stay in sync. The CD's track may have been changed by an outside source, so if 
     533                                // The main thing is that we need to make sure that the 
     534                                // playlist and the drive's track stay in sync. The CD's 
     535                                // track may have been changed by an outside source, so if 
    526536                                // the drive is playing, check for playlist sync. 
    527537                                fPlayList.SetTrackCount(driveCount); 
     
    534544                        // This happens only when CDs are changed 
    535545                        if (driveCount < 0) { 
    536                                 // There is no CD in the drive. The playlist needs to have its track 
    537                                 // count set to 0 and it also needs to be rewound. 
     546                                // There is no CD in the drive. The playlist needs to have its 
     547                                // track count set to 0 and it also needs to be rewound. 
    538548                                fPlayList.SetStartingTrack(1); 
    539549                                fPlayList.SetTrackCount(0); 
     
    541551                                playlistCount = 0; 
    542552                        } else { 
    543                                 // Two possible cases here: playlist is empty or playlist has a different 
    544                                 // number of tracks. In either case, the playlist needs to be reinitialized 
    545                                 // to the current track data 
     553                                // Two possible cases here: playlist is empty or playlist has a 
     554                                // different number of tracks. In either case, the playlist 
     555                                // needs to be reinitialized to the current track data 
    546556                                fPlayList.SetStartingTrack(1); 
    547557                                fPlayList.SetTrackCount(driveCount); 
     
    565575                                whichTrack++; 
    566576 
    567                         currentTrackName << "Track " << whichTrack << ": " << fCDData.TrackAt(whichTrack - 1); 
     577                        currentTrackName << "Track " << whichTrack << ": " 
     578                                << fCDData.TrackAt(whichTrack - 1); 
    568579 
    569580                        SetLabel(fCurrentTrack, currentTrackName.String()); 
     
    582593        if (fCDDrive.GetTime(trackTime, discTime)) { 
    583594                fCDDrive.GetTimeForDisc(discTotal); 
    584                 sprintf(timeString, "Disc: %ld:%.2ld / %ld:%.2ld", discTime.GetMinutes(), 
    585                         discTime.GetSeconds(), discTotal.GetMinutes(), discTotal.GetSeconds()); 
     595                sprintf(timeString, "Disc: %ld:%.2ld / %ld:%.2ld", 
     596                        discTime.GetMinutes(), discTime.GetSeconds(), 
     597                        discTotal.GetMinutes(), discTotal.GetSeconds()); 
    586598                SetLabel(fDiscTime, timeString); 
    587599 
    588600                fCDDrive.GetTimeForTrack(playlistTrack, trackTotal); 
    589                 sprintf(timeString, "Track: %ld:%.2ld / %ld:%.2ld", trackTime.GetMinutes(), 
    590                         trackTime.GetSeconds(), trackTotal.GetMinutes(), trackTotal.GetSeconds()); 
     601                sprintf(timeString, "Track: %ld:%.2ld / %ld:%.2ld", 
     602                        trackTime.GetMinutes(), trackTime.GetSeconds(), 
     603                        trackTotal.GetMinutes(), trackTotal.GetSeconds()); 
    591604                SetLabel(fTrackTime, timeString); 
    592605        } else { 
     
    601614 
    602615CDPlayerWindow::CDPlayerWindow() 
    603         : BWindow(BRect (100, 100, 405, 280), "CDPlayer", B_TITLED_WINDOW, B_NOT_RESIZABLE | 
    604                 B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS) 
     616        : BWindow(BRect (100, 100, 405, 280), "CDPlayer", B_TITLED_WINDOW, 
     617                B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS) 
    605618{ 
    606619}