![]() |
![]() |
#include <VisGeant4/VisG4Core/interface/VisG4UIManager.h>
Public Member Functions | |
virtual void | start (void) |
VisG4UIManager (IgState *state) | |
Private Member Functions | |
void | cmdLoop (void) |
IG_DECLARE_STATE_ELEMENT (VisG4UIManager) | |
void | onQuit (void) |
Private Attributes | |
pthread_t | m_cmdline |
VisG4UIShell * | m_shell |
IgState * | m_state |
G4UIterminal * | m_terminal |
G4UImanager * | m_ui |
Friends | |
void * | VisG4UIManagerCmdLoop (void *) |
Definition at line 26 of file VisG4UIManager.h.
VisG4UIManager::VisG4UIManager | ( | IgState * | state | ) |
Definition at line 24 of file VisG4UIManager.cc.
References ASSERT, m_state, and IgState::put().
00025 : m_state (state), 00026 m_ui (G4UImanager::GetUIpointer ()), 00027 m_shell (new VisG4UIShell ("Idle> ", 10)), 00028 m_terminal (new G4UIterminal (m_shell)), 00029 m_cmdline (0) 00030 { ASSERT (m_state); m_state->put (s_key, this); }
Definition at line 68 of file VisG4UIManager.cc.
References ASSERT, and m_terminal.
00069 { 00070 // Execute custom startup script. 00071 // m_ui->ApplyCommand ("/control/execute startup.mac"); 00072 00073 // Run the command line until exit. 00074 ASSERT (m_terminal); 00075 m_terminal->SessionStart (); 00076 00077 // Signal and wait for the GUI to exit. We do not really have to 00078 // synchronise. Right now (Qt 2.2.4) calling quit() is harmless 00079 // even if we do it too late (whether already exiting, or exited). 00080 // Qt processes quitting mostly unlocked so locking does us no 00081 // extra good, but we do that anyway for an extra measure of 00082 // safety. The wake-up from unlock is also harmless if the GUI 00083 // has already quit. 00084 qApp->lock (); 00085 qApp->quit (); 00086 qApp->unlock (); 00087 }
VisG4UIManager::IG_DECLARE_STATE_ELEMENT | ( | VisG4UIManager | ) | [private] |
Definition at line 50 of file VisG4UIManager.cc.
References m_cmdline, m_shell, m_terminal, and VisG4UIShell::Quit().
Referenced by start().
00051 { 00052 // GUI has exited. Tell command line to exit the next time it 00053 // reads input (or right now if it is currently reading input). 00054 // This operation is safe even if the command line has already 00055 // exited -- the shell is still around and simply remembers that 00056 // it needs to quit the next time around. 00057 m_shell->Quit (); 00058 00059 pthread_join (m_cmdline, 0); 00060 m_cmdline = 0; 00061 00062 delete m_terminal; 00063 m_terminal = 0; 00064 m_shell = 0; 00065 }
Definition at line 36 of file VisG4UIManager.cc.
References ASSERT, lat::CreateCallback(), DBSPlugin::get(), m_cmdline, m_state, onQuit(), pthread_create, and VisG4UIManagerCmdLoop.
Referenced by VisG4ExampleSetup::setup().
00037 { 00038 // Start the command line in another thread 00039 ASSERT (! m_cmdline); 00040 pthread_create (&m_cmdline, 0, VisG4UIManagerCmdLoop, this); 00041 00042 // Install an application loop post-action to synchronise 00043 // the exit with the command line. 00044 ASSERT (IgQtAppLoopService::get (m_state)); 00045 IgQtAppLoopService::get (m_state)->post 00046 (lat::CreateCallback (this, &VisG4UIManager::onQuit)); 00047 }
Definition at line 32 of file VisG4UIManager.cc.
Referenced by start().
00033 { ((VisG4UIManager *) context)->cmdLoop (); return 0; }
pthread_t VisG4UIManager::m_cmdline [private] |
VisG4UIShell* VisG4UIManager::m_shell [private] |
IgState* VisG4UIManager::m_state [private] |
G4UIterminal* VisG4UIManager::m_terminal [private] |
G4UImanager* VisG4UIManager::m_ui [private] |
Definition at line 40 of file VisG4UIManager.h.