Author: stippi Date: 2010-09-21 18:04:24 +0200 (Tue, 21 Sep 2010) New Revision: 38764 Changeset: http://dev.haiku-os.org/changeset/38764 Modified: haiku/trunk/src/apps/mediaplayer/MainWin.cpp haiku/trunk/src/apps/mediaplayer/interface/SeekSlider.cpp Log: * Show the window when opening files, since that shows the nice "opening file bla" message and makes starting MediaPlayer feel even more snappy. * Show the window at the no-video location when opening files. * Move the "Drop files to play" message handling into MainWin and make sure it shows after failed attempts to open a file when the playlist is still empty. Modified: haiku/trunk/src/apps/mediaplayer/MainWin.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/MainWin.cpp 2010-09-21 16:01:56 UTC (rev 38763) +++ haiku/trunk/src/apps/mediaplayer/MainWin.cpp 2010-09-21 16:04:24 UTC (rev 38764) @@ -149,7 +149,9 @@ static const char* kRatingAttrName = "Media:Rating"; +static const char* kDisabledSeekMessage = "Drop files to play"; + //#define printf(a...) @@ -249,6 +251,7 @@ fControlsHeight = (int)fControls->Frame().Height() + 1; fControlsWidth = (int)fControls->Frame().Width() + 1; fControls->SetResizingMode(B_FOLLOW_BOTTOM | B_FOLLOW_LEFT_RIGHT); + fControls->SetDisabledString(kDisabledSeekMessage); fPlaylist->AddListener(fPlaylistObserver); fController->SetVideoView(fVideoView); @@ -607,8 +610,7 @@ BAlert* alert = new BAlert("Nothing to Play", "None of the files " "you wanted to play appear to be media files.", "OK"); alert->Go(); - - _ShowIfNeeded(); + fControls->SetDisabledString(kDisabledSeekMessage); break; } @@ -1253,10 +1255,9 @@ // so that undo/redo is used for modifying the playlist fPlaylistWindow->PostMessage(message); - if (message->FindRect("window frame", &fNoVideoFrame) != B_OK) { + if (message->FindRect("window frame", &fNoVideoFrame) != B_OK) fNoVideoFrame = BRect(); - _ShowIfNeeded(); - } + _ShowIfNeeded(); } @@ -1293,6 +1294,7 @@ message << "Error: " << strerror(result); } (new BAlert("error", message.String(), "OK"))->Go(); + fControls->SetDisabledString(kDisabledSeekMessage); } else { // Just go to the next file and don't bother user (yet) fPlaylist->SetCurrentItemIndex(fPlaylist->CurrentItemIndex() + 1); @@ -1347,11 +1349,6 @@ } _UpdateControlsEnabledStatus(); - if (!fHasVideo && fNoVideoFrame.IsValid()) { - MoveTo(fNoVideoFrame.LeftTop()); - ResizeTo(fNoVideoFrame.Width(), fNoVideoFrame.Height()); - } - fNoVideoFrame = BRect(); _ShowIfNeeded(); // Adopt the size and window layout if necessary @@ -2251,6 +2248,12 @@ if (find_thread(NULL) != Thread()) return; + if (!fHasVideo && fNoVideoFrame.IsValid()) { + MoveTo(fNoVideoFrame.LeftTop()); + ResizeTo(fNoVideoFrame.Width(), fNoVideoFrame.Height()); + } + fNoVideoFrame = BRect(); + if (IsHidden()) { Show(); UpdateIfNeeded(); Modified: haiku/trunk/src/apps/mediaplayer/interface/SeekSlider.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/interface/SeekSlider.cpp 2010-09-21 16:01:56 UTC (rev 38763) +++ haiku/trunk/src/apps/mediaplayer/interface/SeekSlider.cpp 2010-09-21 16:04:24 UTC (rev 38764) @@ -14,11 +14,9 @@ #include <Shape.h> -const rgb_color kThumbRed = (rgb_color){ 255, 52, 52, 255 }; +static const rgb_color kThumbRed = (rgb_color){ 255, 52, 52, 255 }; -const char* kDisabledSeekMessage = "Drop files to play"; - SeekSlider::SeekSlider(const char* name, BMessage* message, int32 minValue, int32 maxValue) : @@ -26,7 +24,7 @@ B_TRIANGLE_THUMB), fTracking(false), fLastTrackTime(0), - fDisabledString(kDisabledSeekMessage), + fDisabledString(""), fScale(0.0f) { BFont font(be_plain_font); @@ -177,7 +175,7 @@ SeekSlider::SetDisabledString(const char* string) { if (string == NULL) - string = kDisabledSeekMessage; + string = ""; if (fDisabledString == string) return;