00001 #include <QtGui/QtGui> 00002 00003 #include "Component/ModelManager.H" 00004 #include "Component/ModelComponent.H" 00005 #include "Media/FrameSeries.H" 00006 #include "Image/Image.H" 00007 #include "Image/PixelsTypes.H" 00008 #include "Robots/SeaBeeIII/GUI/MainWindow.qt.H" 00009 #include <Ice/Ice.h> 00010 #include <Ice/Service.h> 00011 00012 class SeaBee3GUIService : public Ice::Service { 00013 protected: 00014 virtual bool start(int, char* argv[]); 00015 virtual bool stop() { 00016 if (itsMgr) 00017 delete itsMgr; 00018 return true; 00019 } 00020 00021 private: 00022 Ice::ObjectAdapterPtr itsAdapter; 00023 ModelManager *itsMgr; 00024 }; 00025 00026 bool SeaBee3GUIService::start(int argc, char* argv[]) 00027 { 00028 QApplication app(argc, argv); 00029 00030 itsMgr = new ModelManager("SeaBeeIIIGUIManager"); 00031 00032 char adapterStr[255]; 00033 LINFO("Creating Adapter"); 00034 sprintf(adapterStr, "default -p %i", 12345); 00035 itsAdapter = communicator()->createObjectAdapterWithEndpoints("RobotBrainPort", 00036 adapterStr); 00037 00038 nub::ref<MainWindow> mainWindow(new MainWindow(*itsMgr)); 00039 itsMgr->addSubComponent(mainWindow); 00040 00041 LINFO("Starting Up GUI Comm"); 00042 mainWindow->initIce(communicator(), itsAdapter); 00043 00044 itsMgr->parseCommandLine(argc, argv, "", 0, 0); 00045 00046 itsAdapter->activate(); 00047 00048 itsMgr->start(); 00049 00050 mainWindow->setGeometry(100,100,900,800); 00051 mainWindow->show(); 00052 00053 return app.exec(); 00054 } 00055 00056 // ###################################################################### 00057 int main(int argc, char** argv) { 00058 00059 SeaBee3GUIService svc; 00060 return svc.main(argc, argv); 00061 } 00062