00001
00002
00003 #include "Iguana/Studio/interface/IgQtAppDebugService.h"
00004 #include "Iguana/Studio/interface/IgQtAppDebug.h"
00005 #include "Iguana/Studio/interface/IgQtAppMenuService.h"
00006 #include <classlib/utils/DebugAids.h>
00007 #include <qmenubar.h>
00008 #include <qpopupmenu.h>
00009
00010
00011
00012
00013
00014
00015
00016
00017 IG_DEFINE_STATE_ELEMENT (IgQtAppDebugService, "Services/Qt/App Debug");
00018
00019
00020
00021
00022
00023 IgQtAppDebugService::IgQtAppDebugService (IgState *state,
00024 QWidget *mainWindow)
00025 : m_state (state),
00026 m_mainWindow (mainWindow),
00027 m_info (new IgQtAppDebug (state, mainWindow))
00028 {
00029 ASSERT (state);
00030 ASSERT (mainWindow);
00031 state->put (s_key, this);
00032
00033 ASSERT (IgQtAppMenuService::get (state));
00034 QMenuBar *menu = IgQtAppMenuService::get (state)->menuBar ();
00035 QPopupMenu *debug = new QPopupMenu (mainWindow);
00036
00037 debug->setCaption ("Debug");
00038 debug->insertTearOffHandle ();
00039 debug->insertItem
00040 ("Show &Resources", m_info, SLOT(resources()), 0,
00041 MENU_ID_DEBUG_RESOURCES, IgQtAppMenuService::index
00042 (debug, MENU_ID_DEBUG_RESOURCES));
00043 debug->insertItem
00044 ("Show &Libraries", m_info, SLOT(libraries()), 0,
00045 MENU_ID_DEBUG_LIBRARIES, IgQtAppMenuService::index
00046 (debug, MENU_ID_DEBUG_LIBRARIES));
00047 debug->insertItem
00048 ("Show &Plugins", m_info, SLOT(plugins()), 0,
00049 MENU_ID_DEBUG_PLUGINS, IgQtAppMenuService::index
00050 (debug, MENU_ID_DEBUG_PLUGINS));
00051 debug->insertItem
00052 ("&Show State Tree", m_info, SLOT(dumpState()), 0,
00053 MENU_ID_DEBUG_DUMPSTATE, IgQtAppMenuService::index
00054 (debug, MENU_ID_DEBUG_DUMPSTATE));
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 debug->insertItem
00068 ("&Debug Me Now", m_info, SLOT(debugme()), 0,
00069 MENU_ID_DEBUG_DEBUGME, IgQtAppMenuService::index
00070 (debug, MENU_ID_DEBUG_DEBUGME));
00071
00072 debug->insertSeparator (IgQtAppMenuService::index
00073 (debug, MENU_ID_DEBUG_PROFILER_SEP));
00074
00075 debug->insertItem
00076 ("Show &Profiler", m_info, SLOT(showProfiler()), 0,
00077 MENU_ID_DEBUG_PROFILER, IgQtAppMenuService::index
00078 (debug, MENU_ID_DEBUG_PROFILER));
00079
00080 menu->insertItem ("&Debug", debug, MENU_ID_DEBUG,
00081 IgQtAppMenuService::index (menu, MENU_ID_DEBUG));
00082 }
00083
00084 IgQtAppDebugService::~IgQtAppDebugService (void)
00085 {
00086 ASSERT (m_state);
00087 ASSERT (m_mainWindow);
00088 m_state->detach (s_key);
00089 }