00001 #define AS_TODS_BROWSER
00002
00003 #include "OglGui/OglLib.cpp"
00004 #include "Basis/ILog.h"
00005 #include "Application/idash/ScreenTabs.h"
00006 #include "Application/idash/ScreenBrowserX.h"
00007 #include "Application/idash/ScreenPlayX.h"
00008 #include "Application/idash/ScreenTimeLineVideo.h"
00009 #include "Application/idash/ScreenDossier.h"
00010 #include "Application/idash/TrecEngine.h"
00011
00012
00013
00014
00015 namespace Impala {
00016 namespace Application {
00017 namespace IDash {
00018
00019 class IDash : public ScreenBase,
00020 public DossierListener
00021 {
00022 public:
00023 typedef Visualization::AppController AppController;
00024
00025 IDash(int w, int h) :
00026 ScreenBase(w,h)
00027 {
00028 Impala::CmdOptions& options = Impala::CmdOptions::GetInstance();
00029
00030 ILOG_STARTACTION("loading engine", ILOG_LEVEL_INFO);
00031 mEngine = new TrecEngine();
00032
00033
00034 ScreenBase::SetEngine(mEngine);
00035 ILOG_ENDACTION("loading engine");
00036
00037 mStartWithMovies = options.GetBool("startWithMovies");
00038
00039 ILOG_STARTACTION("building GUI", ILOG_LEVEL_INFO);
00040 BuildGUI(w,h);
00041 ILOG_ENDACTION("building GUI");
00042 }
00043
00044 void Go()
00045 {
00046 if (mStartWithMovies)
00047 {
00048 ILOG_INFO("Dispatching initial query...");
00049 mScrnBrowser->DoInitialQuery();
00050 }
00051
00052 ILOG_INFO("Starting main loop...");
00053 AppController::Instance().MainLoop();
00054 }
00055
00056
00057
00058
00059 virtual void
00060 PlayFileEvent(int videoID)
00061 {
00062
00063 mEngine->SegmentationDocument()->CursorToFile(videoID);
00064 mScrnTabs->GotoTab(TAB_PLAY6);
00065 }
00066
00067 virtual void
00068 KeyEvent(OglGui::Window *src, int c, int state)
00069 {
00070 switch (c) {
00071 case oglFUNC(1): mScrnTabs->GotoTab(TAB_BROWSE); break;
00072 case oglFUNC(2): mScrnTabs->GotoTab(TAB_PLAY6); break;
00073 case oglFUNC(3): mScrnTabs->GotoTab(TAB_DOSSIER); break;
00074 case oglFUNC(4): mScrnTabs->GotoTab(TAB_TLINEVIDEO); break;
00075 case 'Q': exit(0);
00076 }
00077 }
00078
00079 private:
00080 void BuildGUI(int w, int h)
00081 {
00082 mScrnTabs = new ScreenTabs(this,0,0,w,h);
00083 mScrnTabs->ConnectTo(this);
00084
00085
00086
00087
00088 mAppControlDoc =
00089 new AppControlDoc(TAB_DOSSIER, mEngine->SegmentationDocument());
00090
00091 Visualization::AppController::Instance().AddControl(mAppControlDoc);
00092
00093 OglGui::Window* tab;
00094
00095 tab = mScrnTabs->MakeTab("F1: Browse", TAB_BROWSE);
00096 mScrnBrowser = new ScreenBrowser(tab,TAB_BROWSE);
00097
00098 Visualization::AppController::Instance().AddControl(mScrnBrowser);
00099
00100 tab = mScrnTabs->MakeTab("F2: Video 6 Parts",TAB_PLAY6);
00101 mScrnPlay = new ScreenPlay(tab,mEngine->SegmentationDocument());
00102 mScrnPlay->SetControlId(TAB_PLAY6);
00103
00104 Visualization::AppController::Instance().AddControl(mScrnPlay);
00105
00106 tab = mScrnTabs->MakeTab("F3: Dossier",TAB_DOSSIER);
00107 mScrnDossier = new ScreenDossier(tab);
00108 mScrnDossier->SetControlId(TAB_DOSSIER);
00109
00110 Visualization::AppController::Instance().AddControl(mScrnDossier);
00111
00112 tab = mScrnTabs->MakeTab("F4: VideoTimeLine",TAB_TLINEVIDEO);
00113 mScrnTimeLineVideo = new ScreenTimeLineVideo(tab,TAB_TLINEVIDEO);
00114 mScrnTimeLineVideo->SetSegmentationDoc(mEngine->SegmentationDocument());
00115
00116 Visualization::AppController::Instance().AddControl(mScrnTimeLineVideo);
00117
00118
00119 mScrnBrowser->SetAppControlDoc(mAppControlDoc, TAB_BROWSE);
00120 mScrnDossier->SetAppControlDoc(mAppControlDoc, TAB_DOSSIER);
00121
00122
00123
00124 mScrnDossier->AddDossierListener(this);
00125
00126
00127 mScrnTabs->GetTabs()->ScaleTabBar(true);
00128 mScrnTabs->GotoTab(TAB_BROWSE);
00129 }
00130
00131
00132
00133 TrecEngine* mEngine;
00134
00135 ScreenTabs* mScrnTabs;
00136 ScreenBrowser* mScrnBrowser;
00137 ScreenPlay* mScrnPlay;
00138 ScreenDossier* mScrnDossier;
00139 ScreenTimeLineVideo* mScrnTimeLineVideo;
00140
00141 bool mStartWithMovies;
00142
00143 ILOG_VAR_DECL;
00144
00145 public:
00146 const static int TAB_TABS = 0;
00147 const static int TAB_BROWSE = 1;
00148 const static int TAB_PLAY6 = 2;
00149 const static int TAB_DOSSIER = 3;
00150 const static int TAB_TLINEVIDEO = 4;
00151
00152 };
00153
00154 ILOG_VAR_INIT(IDash, Impala.Application.IDash);
00155
00156
00157 int mainIDash(int argc, char* argv[])
00158 {
00159 OglInit(&argc, &argv[0]);
00160
00161
00162 Impala::CmdOptions& options = Impala::CmdOptions::GetInstance();
00163 options.Initialise(true, false, true);
00164 options.SetDefault("wndWidth", "1270");
00165 options.SetDefault("wndHeight", "975");
00166
00167 options.AddOption(0, "noArchive", "", "0");
00168 options.AddOption(0, "imFileArchive", "", "0");
00169 options.AddOption(0, "imServer", "name", "");
00170
00171 options.AddOption(0, "maxImagesOnRow", "", "99");
00172
00173 options.AddOption(0, "actionloglevel", "0=all .. 10=nothing", "2");
00174 options.AddOption(0, "loglevel", "0=all .. 10=nothing", "2");
00175 options.AddOption(0, "logfile", "filename", "trecsearch.log");
00176 options.AddOption(0, "logtofile", "0 = no, 1 = yes", "1");
00177
00178 options.AddOption(0, "mdBrowserUseKeyframes", "0=no, thumbnails, 1=yes, only center, 2=yes, always", "0");
00179 options.AddOption(0, "mdBrowserAspectRatio", "0=automatic, else value", "0");
00180 options.AddOption(0, "mdBrowserHighResDistance", "nr of shots from center, 0=only center", "0");
00181
00182 options.AddOption(0, "startWithMovies", "", "1");
00183 if (! options.ParseArgs(argc, argv, "", 0))
00184 return 1;
00185
00186 ILOG_VAR(Impala.Application.IDash.mainIDashX);
00187
00188 ILOG_SYSTEM("LOADING......");
00189 int w = options.GetInt("wndWidth");
00190 int h = options.GetInt("wndHeight");
00191 Impala::Application::IDash::IDash *d =
00192 new Impala::Application::IDash::IDash(w,h);
00193 ILOG_SYSTEM("STARTING -----------------------------");
00194 d->Go();
00195 return 0;
00196 }
00197
00198 }
00199 }
00200 }
00201
00202 int
00203 main(int argc, char* argv[])
00204 {
00205 return Impala::Application::IDash::mainIDash(argc, argv);
00206 }
00207