00001 //<<<<<< INCLUDES >>>>>> 00002 00003 #include "Iguana/Studio/interface/IgNTupleAppSetup.h" 00004 #include "Iguana/Studio/interface/IgNTupleAppExtension.h" 00005 #include "Iguana/Studio/interface/IgStudioDriver.h" 00006 #include "Iguana/Studio/interface/IgQtAppStatusBarService.h" 00007 #include "Iguana/Framework/interface/IgState.h" 00008 #include "Iguana/Framework/interface/IgExtensionDB.h" 00009 #include <qapplication.h> 00010 00011 //<<<<<< PRIVATE DEFINES >>>>>> 00012 //<<<<<< PRIVATE CONSTANTS >>>>>> 00013 //<<<<<< PRIVATE TYPES >>>>>> 00014 //<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>> 00015 //<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>> 00016 //<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> 00017 00018 IG_DEFINE_STATE_ELEMENT (IgNTupleAppSetup, "Services/Studio/Session Types/Vis Example--NTuple browser; NTuple browser"); 00019 00020 //<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>> 00021 //<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>> 00022 //<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>> 00023 00024 IgNTupleAppSetup::IgNTupleAppSetup (IgState *state) 00025 : m_state (state), 00026 m_studio (0) 00027 { ASSERT (m_state); m_state->put (s_key, this); } 00028 00029 00030 IgNTupleAppSetup::~IgNTupleAppSetup (void) 00031 {ASSERT (m_state); m_state->detach (s_key);} 00032 00033 bool 00034 IgNTupleAppSetup::setup (IgStudioDriver *into) 00035 { 00036 ASSERT (m_state); 00037 ASSERT (into); 00038 ASSERT (!m_studio); 00039 00040 m_studio = into; 00041 00042 static const char name [] = "Services/Generic/NTuple"; 00043 IgNTupleAppExtension * app = 0; 00044 IgExtension * newext = 0; 00045 00046 try 00047 { 00048 // Try to instantiate it 00049 QApplication::setOverrideCursor (Qt::waitCursor); 00050 IgQtAppStatusBarService::get (m_state) 00051 ->setMessage ("Building NTuple browser app..."); 00052 00053 newext = IgExtensionDB::get ()->create (name, m_state); 00054 00055 // Make sure we got what we expect 00056 ASSERT (newext); 00057 ASSERT (dynamic_cast<IgNTupleAppExtension *> (newext)); 00058 app = static_cast<IgNTupleAppExtension *> (newext); 00059 00060 // Try to set it up 00061 app->setup (this); 00062 00063 IgQtAppStatusBarService::get (m_state) 00064 ->setMessage ("NTuple browser is loaded."); 00065 00066 QApplication::restoreOverrideCursor (); 00067 } 00068 // FIXME: too broad... 00069 catch (...) 00070 { 00071 QApplication::restoreOverrideCursor (); 00072 return EXIT_FAILURE; 00073 } 00074 00075 return true; 00076 } 00077 00078 IgState * 00079 IgNTupleAppSetup::state (void) const 00080 { return m_state; } 00081 00082 IgStudioDriver * 00083 IgNTupleAppSetup::studio (void) const 00084 { return m_studio; }