* 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:
@@ -149,6 +149,8 @@ static property_info sPropertyInfo[] = {
|
|||||||
|
|
||||||
static const char* kRatingAttrName = "Media:Rating";
|
static const char* kRatingAttrName = "Media:Rating";
|
||||||
|
|
||||||
|
static const char* kDisabledSeekMessage = "Drop files to play";
|
||||||
|
|
||||||
|
|
||||||
//#define printf(a...)
|
//#define printf(a...)
|
||||||
|
|
||||||
@@ -249,6 +251,7 @@ MainWin::MainWin(bool isFirstWindow, BMessage* message)
|
|||||||
fControlsHeight = (int)fControls->Frame().Height() + 1;
|
fControlsHeight = (int)fControls->Frame().Height() + 1;
|
||||||
fControlsWidth = (int)fControls->Frame().Width() + 1;
|
fControlsWidth = (int)fControls->Frame().Width() + 1;
|
||||||
fControls->SetResizingMode(B_FOLLOW_BOTTOM | B_FOLLOW_LEFT_RIGHT);
|
fControls->SetResizingMode(B_FOLLOW_BOTTOM | B_FOLLOW_LEFT_RIGHT);
|
||||||
|
fControls->SetDisabledString(kDisabledSeekMessage);
|
||||||
|
|
||||||
fPlaylist->AddListener(fPlaylistObserver);
|
fPlaylist->AddListener(fPlaylistObserver);
|
||||||
fController->SetVideoView(fVideoView);
|
fController->SetVideoView(fVideoView);
|
||||||
@@ -607,8 +610,7 @@ MainWin::MessageReceived(BMessage* msg)
|
|||||||
BAlert* alert = new BAlert("Nothing to Play", "None of the files "
|
BAlert* alert = new BAlert("Nothing to Play", "None of the files "
|
||||||
"you wanted to play appear to be media files.", "OK");
|
"you wanted to play appear to be media files.", "OK");
|
||||||
alert->Go();
|
alert->Go();
|
||||||
|
fControls->SetDisabledString(kDisabledSeekMessage);
|
||||||
_ShowIfNeeded();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1253,10 +1255,9 @@ MainWin::_RefsReceived(BMessage* message)
|
|||||||
// so that undo/redo is used for modifying the playlist
|
// so that undo/redo is used for modifying the playlist
|
||||||
fPlaylistWindow->PostMessage(message);
|
fPlaylistWindow->PostMessage(message);
|
||||||
|
|
||||||
if (message->FindRect("window frame", &fNoVideoFrame) != B_OK) {
|
if (message->FindRect("window frame", &fNoVideoFrame) != B_OK)
|
||||||
fNoVideoFrame = BRect();
|
fNoVideoFrame = BRect();
|
||||||
_ShowIfNeeded();
|
_ShowIfNeeded();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1293,6 +1294,7 @@ MainWin::_PlaylistItemOpened(const PlaylistItemRef& item, status_t result)
|
|||||||
message << "Error: " << strerror(result);
|
message << "Error: " << strerror(result);
|
||||||
}
|
}
|
||||||
(new BAlert("error", message.String(), "OK"))->Go();
|
(new BAlert("error", message.String(), "OK"))->Go();
|
||||||
|
fControls->SetDisabledString(kDisabledSeekMessage);
|
||||||
} else {
|
} else {
|
||||||
// Just go to the next file and don't bother user (yet)
|
// Just go to the next file and don't bother user (yet)
|
||||||
fPlaylist->SetCurrentItemIndex(fPlaylist->CurrentItemIndex() + 1);
|
fPlaylist->SetCurrentItemIndex(fPlaylist->CurrentItemIndex() + 1);
|
||||||
@@ -1347,11 +1349,6 @@ MainWin::_SetupWindow()
|
|||||||
}
|
}
|
||||||
_UpdateControlsEnabledStatus();
|
_UpdateControlsEnabledStatus();
|
||||||
|
|
||||||
if (!fHasVideo && fNoVideoFrame.IsValid()) {
|
|
||||||
MoveTo(fNoVideoFrame.LeftTop());
|
|
||||||
ResizeTo(fNoVideoFrame.Width(), fNoVideoFrame.Height());
|
|
||||||
}
|
|
||||||
fNoVideoFrame = BRect();
|
|
||||||
_ShowIfNeeded();
|
_ShowIfNeeded();
|
||||||
|
|
||||||
// Adopt the size and window layout if necessary
|
// Adopt the size and window layout if necessary
|
||||||
@@ -2251,6 +2248,12 @@ MainWin::_ShowIfNeeded()
|
|||||||
if (find_thread(NULL) != Thread())
|
if (find_thread(NULL) != Thread())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!fHasVideo && fNoVideoFrame.IsValid()) {
|
||||||
|
MoveTo(fNoVideoFrame.LeftTop());
|
||||||
|
ResizeTo(fNoVideoFrame.Width(), fNoVideoFrame.Height());
|
||||||
|
}
|
||||||
|
fNoVideoFrame = BRect();
|
||||||
|
|
||||||
if (IsHidden()) {
|
if (IsHidden()) {
|
||||||
Show();
|
Show();
|
||||||
UpdateIfNeeded();
|
UpdateIfNeeded();
|
||||||
|
|||||||
@@ -14,9 +14,7 @@
|
|||||||
#include <Shape.h>
|
#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,
|
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),
|
B_TRIANGLE_THUMB),
|
||||||
fTracking(false),
|
fTracking(false),
|
||||||
fLastTrackTime(0),
|
fLastTrackTime(0),
|
||||||
fDisabledString(kDisabledSeekMessage),
|
fDisabledString(""),
|
||||||
fScale(0.0f)
|
fScale(0.0f)
|
||||||
{
|
{
|
||||||
BFont font(be_plain_font);
|
BFont font(be_plain_font);
|
||||||
@@ -177,7 +175,7 @@ void
|
|||||||
SeekSlider::SetDisabledString(const char* string)
|
SeekSlider::SetDisabledString(const char* string)
|
||||||
{
|
{
|
||||||
if (string == NULL)
|
if (string == NULL)
|
||||||
string = kDisabledSeekMessage;
|
string = "";
|
||||||
|
|
||||||
if (fDisabledString == string)
|
if (fDisabledString == string)
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user