00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef Impala_Application_IDash_ScreenPlay_h
00014 #define Impala_Application_IDash_ScreenPlay_h
00015
00016 #include "Core/VideoSet/SegmentationDocument.h"
00017 #include "OglGui/CheckBox.h"
00018 #include "NfiSixViewControl.h"
00019 #include "ScreenBase.h"
00020
00021 #ifdef OGL_USING_QT
00022 using namespace OglGui;
00023 #endif
00024
00025 namespace Impala {
00026 namespace Application {
00027 namespace IDash {
00028
00029 class ScreenPlay : public ScreenBase,
00030 public OglGui::CheckBoxListener
00031 {
00032 public:
00033 typedef Core::VideoSet::SegmentationDocument SegmentationDocument;
00034 typedef Core::VideoSet::VideoSet VideoSet;
00035
00036 ScreenPlay(int w, int h, SegmentationDocument* segDoc) :
00037 ScreenBase(w, h)
00038 {
00039 InitScreen(w,h,segDoc);
00040 }
00041
00042 ScreenPlay(OglGui::Window *parent, int w, int h,
00043 SegmentationDocument* segDoc) :
00044 ScreenBase(parent, w, h)
00045 {
00046 InitScreen(w,h,segDoc);
00047 }
00048
00049 ScreenPlay(OglGui::Window *parent, SegmentationDocument* segDoc) :
00050 ScreenBase(parent)
00051 {
00052 InitScreen(parent->W(), parent->H(), segDoc);
00053 }
00054
00055 virtual void HandleActivate()
00056 {
00057 ILOG_INFO("HandleActivate");
00058 int curFile = mSegDoc->CurFileId();
00059 int curShot = mSegDoc->CurShot();
00060 PlayFile(curFile);
00061 }
00062
00063 virtual void
00064 PlayFile(int videoID)
00065 {
00066 ILOG_DEBUG("PlayFileEvent: video ID = " << videoID);
00067 if (videoID != mVideoId)
00068 {
00069 mVideoId = videoID;
00070 VideoSet* vidSet = mSegDoc->GetSegmentation()->GetVideoSet();
00071 String videoName = FileNameTail(vidSet->GetFile(videoID));
00072
00073 mNfiSixView->SetVideo(vidSet,videoID);
00074
00075 std::ostringstream o;
00076 o << "Video: " << videoID << " [" << videoName << "]";
00077 if (!mNfiSixView->OpenVideo())
00078 {
00079 o << " can not be played in 6 parts";
00080 mVideoId = -1;
00081 }
00082 mVideoLabel->SetText(o.str());
00083 }
00084 if (mVideoId != -1)
00085 {
00086 mNfiSixView->Rewind();
00087 mNfiSixView->Play();
00088 }
00089 }
00090
00091
00092 virtual void
00093 CheckBoxEvent(OglGui::CheckBox *src, bool checked, void* userData)
00094 {
00095 if (userData == (void*) CHECK_LOOPVIDEO)
00096 mNfiSixView->SetLoopVideo(checked);
00097 }
00098
00099 private:
00100 void
00101 InitScreen(int w, int h, SegmentationDocument* segDoc)
00102 {
00103 ILOG_DEBUG("constructing screen Play");
00104 mSegDoc = segDoc;
00105 mVideoId = -1;
00106
00107 mVideoLabel = new StaticText(this,0,h-80,w,80,"No video loaded");
00108 SetAsBox(mVideoLabel,false);
00109 mVideoLabel->ConnectTo(this, L2L|R2R|T2T|B2T);
00110
00111 Window *footer = new Window(this,0,0,w,80);
00112 new Strut(footer,4000,1);
00113 new Strut(footer,40,1);
00114 mNfiSixViewControl = new NfiSixViewControl(footer,600,60,0);
00115 new Strut(footer, 100, 20);
00116
00117
00118 CheckBox* cBox =
00119 new CheckBox(footer,180,60,"Loop Video",false,BEV_ETCHED);
00120 cBox->SetCheckBoxListener(this, CHECK_LOOPVIDEO);
00121
00122 footer->RepositionViewports();
00123 footer->ScaleChildren();
00124 footer->ConnectTo(this,L2L|R2R|T2B|B2B);
00125 SetAsBox(footer,false);
00126
00127
00128 mNfiSixView = new NfiSixView(this,0,80,w,h-160);
00129 mNfiSixView->SetLoopVideo(false);
00130 mNfiSixView->ConnectTo(this);
00131 SetAsBox(mNfiSixView,false);
00132
00133 mNfiSixViewControl->SetNfiSixView(mNfiSixView);
00134
00135
00136 SetAllowChildScaling(false);
00137 }
00138
00139 SegmentationDocument* mSegDoc;
00140 NfiSixView* mNfiSixView;
00141 NfiSixViewControl* mNfiSixViewControl;
00142 StaticText* mVideoLabel;
00143
00144
00145 int mVideoId;
00146
00147 const static int CHECK_LOOPVIDEO = 1;
00148
00149 ILOG_VAR_DEC;
00150 };
00151
00152 ILOG_VAR_INIT(ScreenPlay, Application.IDash);
00153
00154 }
00155 }
00156 }
00157
00158 #endif