* 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. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38764 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
ad471f9969
commit
fd5c34224c
@ -149,6 +149,8 @@ static property_info sPropertyInfo[] = {
|
||||
|
||||
static const char* kRatingAttrName = "Media:Rating";
|
||||
|
||||
static const char* kDisabledSeekMessage = "Drop files to play";
|
||||
|
||||
|
||||
//#define printf(a...)
|
||||
|
||||
@ -249,6 +251,7 @@ MainWin::MainWin(bool isFirstWindow, BMessage* message)
|
||||
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 @@ MainWin::MessageReceived(BMessage* msg)
|
||||
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 @@ MainWin::_RefsReceived(BMessage* message)
|
||||
// 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 @@ MainWin::_PlaylistItemOpened(const PlaylistItemRef& item, status_t result)
|
||||
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 @@ MainWin::_SetupWindow()
|
||||
}
|
||||
_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 @@ MainWin::_ShowIfNeeded()
|
||||
if (find_thread(NULL) != Thread())
|
||||
return;
|
||||
|
||||
if (!fHasVideo && fNoVideoFrame.IsValid()) {
|
||||
MoveTo(fNoVideoFrame.LeftTop());
|
||||
ResizeTo(fNoVideoFrame.Width(), fNoVideoFrame.Height());
|
||||
}
|
||||
fNoVideoFrame = BRect();
|
||||
|
||||
if (IsHidden()) {
|
||||
Show();
|
||||
UpdateIfNeeded();
|
||||
|
@ -14,9 +14,7 @@
|
||||
#include <Shape.h>
|
||||
|
||||
|
||||
const rgb_color kThumbRed = (rgb_color){ 255, 52, 52, 255 };
|
||||
|
||||
const char* kDisabledSeekMessage = "Drop files to play";
|
||||
static const rgb_color kThumbRed = (rgb_color){ 255, 52, 52, 255 };
|
||||
|
||||
|
||||
SeekSlider::SeekSlider(const char* name, BMessage* message, int32 minValue,
|
||||
@ -26,7 +24,7 @@ SeekSlider::SeekSlider(const char* name, BMessage* message, int32 minValue,
|
||||
B_TRIANGLE_THUMB),
|
||||
fTracking(false),
|
||||
fLastTrackTime(0),
|
||||
fDisabledString(kDisabledSeekMessage),
|
||||
fDisabledString(""),
|
||||
fScale(0.0f)
|
||||
{
|
||||
BFont font(be_plain_font);
|
||||
@ -177,7 +175,7 @@ void
|
||||
SeekSlider::SetDisabledString(const char* string)
|
||||
{
|
||||
if (string == NULL)
|
||||
string = kDisabledSeekMessage;
|
||||
string = "";
|
||||
|
||||
if (fDisabledString == string)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user