[Jahshaka-cvs] jah/jahwidgets/src/qt3/widgets player.cpp, 1.21, 1.22 player.h, 1.15, 1.16
Status: Beta
Brought to you by:
jahshaka
From: Charles Y. <lil...@us...> - 2006-07-19 12:35:10
|
Update of /cvsroot/jahshaka/jah/jahwidgets/src/qt3/widgets In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv29709/qt3/widgets Modified Files: player.cpp player.h Log Message: + Tooltips in player and reel Index: player.cpp =================================================================== RCS file: /cvsroot/jahshaka/jah/jahwidgets/src/qt3/widgets/player.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- player.cpp 18 Jul 2006 15:37:13 -0000 1.21 +++ player.cpp 19 Jul 2006 12:35:07 -0000 1.22 @@ -11,6 +11,7 @@ #include <qmessagebox.h> #include <qcursor.h> #include <qdragobject.h> +#include <qtooltip.h> #include <qmime.h> #include <qsizepolicy.h> @@ -88,6 +89,37 @@ return false; } +class PlayerTip : public QToolTip +{ + public: + PlayerTip( Player *parent ) + : QToolTip( parent ) + , player_( parent ) + { + } + + virtual ~PlayerTip( ) { } + + protected: + void maybeTip( const QPoint &point ) + { + MediaPtr media = player_->find( point.x( ), point.y( ) ); + if ( media && media->get_asset( ) ) + { + QRect r( media->gx( ), media->gy( ), media->gw( ), media->gh( ) ); + if ( !r.isValid( ) ) return; + current_ = QString( media->uri( ).c_str( ) ); + if ( current_.findRev( '/' ) != -1 ) + current_ = current_.mid( current_.findRev( '/' ) + 1 ); + tip( r, QString( current_ ) ); + } + } + + private: + Player *player_; + QString current_; +}; + Player::Player( QWidget *parent, const QString &name ) : QGLWidget( parent, name ) , speed_( 1 ) @@ -112,11 +144,14 @@ connect( timer_, SIGNAL( timeout( ) ), this, SLOT( timeOutSlot( ) ) ); set_channels( 1.0f, 1.0f, 1.0f, 1.0f ); + + tip_ = new PlayerTip( this ); } Player::~Player( ) { delete timer_; + delete tip_; } bool Player::play( MediaPtr media, int speed ) Index: player.h =================================================================== RCS file: /cvsroot/jahshaka/jah/jahwidgets/src/qt3/widgets/player.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- player.h 18 Jul 2006 15:37:13 -0000 1.15 +++ player.h 19 Jul 2006 12:35:07 -0000 1.16 @@ -47,6 +47,8 @@ olib::openpluginlib::v_vec4f channel_selector_prop_; }; +class PlayerTip; + // The 'player' class - it provides the basic mechanism for rendering any number // of media sources. Only one source is active at a time, but many can be // registered and still images can be rendered from each of the inactive ones. @@ -158,8 +160,8 @@ bool ask_audio_; bool mute_; float channel_selector_[ 4 ]; - shader_state shaders_[ SHADER_COUNT ]; + PlayerTip *tip_; }; } } |