diff --git a/src/QtMacVideoWindow.h b/src/QtMacVideoWindow.h index 471ac5ee4..643fa480b 100644 --- a/src/QtMacVideoWindow.h +++ b/src/QtMacVideoWindow.h @@ -103,6 +103,7 @@ class VideoWindow : public GcWindow // passed from MainWindow QDir home; MainWindow *main; + bool hasMovie; // the active movie NativeQTMovieRef movie; diff --git a/src/QtMacVideoWindow.mm b/src/QtMacVideoWindow.mm index 7eb485d59..9a301c0b2 100644 --- a/src/QtMacVideoWindow.mm +++ b/src/QtMacVideoWindow.mm @@ -25,7 +25,7 @@ #include VideoWindow::VideoWindow(MainWindow *parent, const QDir &home) : -GcWindow(parent), home(home), main(parent) +GcWindow(parent), home(home), main(parent), hasMovie(false) { setControls(NULL); @@ -60,22 +60,32 @@ void VideoWindow::resizeEvent(QResizeEvent * ) void VideoWindow::startPlayback() { - if (!movie) return; // no movie selected + if (!hasMovie) return; // no movie selected + + [movie gotoBeginning]; + [movie play]; } void VideoWindow::stopPlayback() { - if (!movie) return; // no movie selected + if (!hasMovie) return; // no movie selected + + [movie stop]; + [movie gotoBeginning]; } void VideoWindow::pausePlayback() { - if (!movie) return; // no movie selected + if (!hasMovie) return; // no movie selected + + [movie stop]; } void VideoWindow::resumePlayback() { - if (!movie) return; // no movie selected + if (!hasMovie) return; // no movie selected + + [movie play]; } static inline NSString *darwinQStringToNSString (const QString &aString) @@ -86,21 +96,10 @@ static inline NSString *darwinQStringToNSString (const QString &aString) void VideoWindow::mediaSelected(QString filename) { -qDebug()<<"media selected:"<setMovie(movie); + + hasMovie = true; } } -MediaHelper::MediaHelper() -{ -} +MediaHelper::MediaHelper() { } -MediaHelper::~MediaHelper() -{ -} +MediaHelper::~MediaHelper() { } // convert an NSString to a QString static QString qt_mac_NSStringToQString(const NSString *nsstr) @@ -184,12 +180,7 @@ QtMacMovieView::QtMacMovieView (QWidget *parent) : QMacCocoaViewContainer (0, pa // allocate the player player = [[QTMovieView alloc] initWithFrame:frame]; [player setPreservesAspectRatio:YES]; - -#if 0 - NSSegmentedButtonTarget *bt = [[NSSegmentedButtonTarget alloc] initWithObject1:this]; - [mNativeRef setTarget:bt]; - [mNativeRef setAction:@selector(segControlClicked:)]; -#endif + [player setControllerVisible:NO]; setCocoaView (player); } @@ -197,8 +188,5 @@ QtMacMovieView::QtMacMovieView (QWidget *parent) : QMacCocoaViewContainer (0, pa void QtMacMovieView::setMovie(NativeQTMovieRef movie) { -qDebug()<<"setting the movie to qtmovieview..."; [player setMovie:movie]; -qDebug()<<"playing the movie?"; - [[player movie] play]; }