![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2011 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: DtMovieUrlLabel.h,v $ $Revision: 1.22 $ $State: Exp $ 00007 *******************************************************************************/ 00008 00012 00013 #pragma once 00014 00015 #include <vrvCoreQt/vrvCoreQt.h> 00016 00017 #include <vrvCoreQt/DtUrlLabel.h> 00018 #include <boost/unordered_map.hpp> 00019 00020 class QMovie; 00021 00022 namespace makVrv 00023 { 00027 class DT_DLL_VRVCOREQT DtMovieUrlLabel : public DtUrlLabel 00028 { 00029 Q_OBJECT 00030 00031 public: 00033 DtMovieUrlLabel( QWidget* parent=0, Qt::WindowFlags f=0 ); 00034 00036 virtual ~DtMovieUrlLabel(); 00037 00041 virtual void setMovie(QMovie* movie); 00042 00045 virtual void addUrl( const QString& url, int startFrame, int endFrame ); 00046 00049 virtual void setUrl( const QString& url); 00050 00053 virtual QString url() const; 00054 00056 virtual QString url(int frame) const; 00057 00059 virtual void removeUrl( const QString& url ); 00060 00065 virtual void setInfiniteLoop( bool b ); 00066 00067 protected slots: 00070 void onMovieFinished(); 00071 00073 void updateTooltip(int frame); 00074 00075 protected: 00076 // Utility structure to hold start and end frame as one item 00077 // (for use in a map) 00078 struct FrameRange 00079 { 00080 int startFrame; 00081 int endFrame; 00082 }; 00083 00084 // Map type for maintaining url to animation frames relationships 00085 typedef boost::unordered_map<std::string, FrameRange> UrlFramesMap; 00086 00087 // Pointer to the movie set by the user. Deleted when class is 00088 // destructed 00089 QMovie* myMovie; 00090 00091 // Map of Url to frame number relationships 00092 UrlFramesMap myUrlFramesMap; 00093 00094 // Indicate whether this class should force animation looping 00095 bool myInfiniteLoop; 00096 }; 00097 }