Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

mainIDashX.cpp

Go to the documentation of this file.
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 //using namespace OglGui; 
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         // attach engine to screens:
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     // RvB: Only function of DossierListener still used
00057     // This class listens to ScreenDossier
00058     // Should be refactored: Name to general
00059     virtual void
00060     PlayFileEvent(int videoID)
00061     {
00062         // we should switch to the PLAY tab:
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         // define ONE appControlDoc for the entire application, to handle
00086         // global keys and manage the dossier state. Some other screens
00087         // rely on this appcontrol for state change info and events.
00088         mAppControlDoc =
00089             new AppControlDoc(TAB_DOSSIER, mEngine->SegmentationDocument());
00090         // attach this appcontrol to the AppController:
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         // Next line to react on HandleActivate
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         // Next line to react on HandleActivate
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         // RvB: Added as maybe in future needs to react to HandleActivate
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         // Next line to react on HandleActivate
00116         Visualization::AppController::Instance().AddControl(mScrnTimeLineVideo);
00117 
00118         // RvB: Note: Other screens do not use or depend on mAppControlDoc yet.
00119         mScrnBrowser->SetAppControlDoc(mAppControlDoc, TAB_BROWSE);
00120         mScrnDossier->SetAppControlDoc(mAppControlDoc, TAB_DOSSIER);
00121 
00122         // RvB: Only one still dependent on DossierListener original model
00123         // added to react in this file to the PlayFileEvent of scrnDossier.
00124         mScrnDossier->AddDossierListener(this);
00125 
00126         // RvB: mScrnTabs->ScaleChildren() did not scale the Tabs
00127         mScrnTabs->GetTabs()->ScaleTabBar(true);
00128         mScrnTabs->GotoTab(TAB_BROWSE);
00129     }
00130 
00131     //AppControlDossier       *mAppControlDossier;
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 }; //class IDash
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     // configuration:
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 } // namespace IDash
00199 } // namespace Application
00200 } // namespace Impala
00201 
00202 int
00203 main(int argc, char* argv[])
00204 {
00205     return Impala::Application::IDash::mainIDash(argc, argv);
00206 }
00207 

Generated on Fri Mar 19 09:30:26 2010 for ImpalaSrc by  doxygen 1.5.1