void QtApplication::quitApplication() { signalExit(); QApplication::quit(); splash_ = nullptr; bQuit_ = true; }
void CGalcon::connectSendersToTakers() { connect(m_gui, SIGNAL(SendView(Message::CMessageAddViewPtr)), m_game, SLOT(AddView(Message::CMessageAddViewPtr))); connect(m_game, SIGNAL(SendStartGame(uint,uint)), m_gui, SLOT(TakeFieldSize(uint,uint))); connect(m_game, SIGNAL(SendError(Message::CMessageInformationPtr)), m_gui, SLOT(TakeInInformation(Message::CMessageInformationPtr))); connect(m_game, SIGNAL(SendFinishGame(Message::CMessageFinishGamePtr)), m_gui, SLOT(TakeFinishGame(Message::CMessageFinishGamePtr))); connect(m_game, SIGNAL(signalTimer()), m_game, SLOT(slotTimer())); connect(m_gui, SIGNAL(signalDisconnect()), this, SLOT(slotDisconnect())); connect(m_gui, SIGNAL(SendClientToServer(Message::CMessageConnectToServerPtr)), m_manager, SLOT(TakeServerConnect(Message::CMessageConnectToServerPtr))); connect(m_gui, SIGNAL(SendClientToSingleGame(Message::CMessageConnectToSingleGamePtr)), m_singleGame, SLOT(TakeServerConnect(Message::CMessageConnectToSingleGamePtr)), Qt::QueuedConnection); connect(m_gui, SIGNAL(signalPause()), m_game, SLOT(SlotPause())); connect(m_gui, SIGNAL(signalPause()), m_singleGame, SLOT(TakePause())); connect(m_gui, SIGNAL(signalExit()), m_game, SLOT(SlotExitGame())); connect(m_gui, SIGNAL(signalChoiceNetworkGame()), this, SLOT(slotChoiceNetworkGame())); connect(m_gui, SIGNAL(signalChoiceSingleGame()), this, SLOT(slotChoiceSingleGame())); connect(m_manager, SIGNAL(SendConfirmConnect(Message::CMessageConfirmationConnectToServerPtr)), m_gui, SLOT(TakeConfirmConnectToServer(Message::CMessageConfirmationConnectToServerPtr))); connect(m_manager, SIGNAL(SendError(Message::CMessageErrorPtr)), m_gui, SLOT(TakeError(Message::CMessageErrorPtr))); connect(m_manager, SIGNAL(SendFinishGame(Message::CMessageFinishGamePtr)), m_game, SLOT(SlotFinishGame(Message::CMessageFinishGamePtr))); connect(m_manager, SIGNAL(SendStateMap(Message::CMessageStateMapPtr)), m_game, SLOT(SlotStateMap(Message::CMessageStateMapPtr))); connect(m_manager, SIGNAL(SendStartGame(Message::CMessageStartMapGamePtr)), m_game, SLOT(SlotStartData(Message::CMessageStartMapGamePtr))); connect(m_manager, SIGNAL(SendTimeToStart(Message::CMessageTimeToStartGamePtr)), m_gui, SLOT(TakeTimeStartToGame(Message::CMessageTimeToStartGamePtr))); connect(m_manager, SIGNAL(SendInInformation(Message::CMessageInformationPtr)), m_gui, SLOT(TakeInInformation(Message::CMessageInformationPtr))); connect(m_singleGame, SIGNAL(SendConfirmConnect(Message::CMessageConfirmationConnectToServerPtr)), m_gui, SLOT(TakeConfirmConnectToServer(Message::CMessageConfirmationConnectToServerPtr))); connect(m_singleGame, SIGNAL(SendError(Message::CMessageErrorPtr)), m_gui, SLOT(TakeError(Message::CMessageErrorPtr))); connect(m_singleGame, SIGNAL(SendFinishGame(Message::CMessageFinishGamePtr)), m_game, SLOT(SlotFinishGame(Message::CMessageFinishGamePtr))); connect(m_singleGame, SIGNAL(SendStateMap(Message::CMessageStateMapPtr)), m_game, SLOT(SlotStateMap(Message::CMessageStateMapPtr))); connect(m_singleGame, SIGNAL(SendStartGame(Message::CMessageStartMapGamePtr)), m_game, SLOT(SlotStartData(Message::CMessageStartMapGamePtr))); connect(m_singleGame, SIGNAL(SendTimeToStart(Message::CMessageTimeToStartGamePtr)), m_gui, SLOT(TakeTimeStartToGame(Message::CMessageTimeToStartGamePtr))); connect(m_singleGame, SIGNAL(SendInInformation(Message::CMessageInformationPtr)), m_gui, SLOT(TakeInInformation(Message::CMessageInformationPtr))); }
void MainWindow::openMain(){ scene->deleteLater(); scene = new Menu; connect(scene, SIGNAL(signalGame()), this, SLOT(openGame())); connect(scene, SIGNAL(signalEditor()), this, SLOT(openEditor())); connect(scene, SIGNAL(signalMusic()), this, SLOT(slotMusic())); connect(scene, SIGNAL(signalExit()), this, SLOT(exit())); setupView(); }
void AgoApp::sighandler(int signo) { switch(signo) { case SIGINT: case SIGQUIT: AGO_DEBUG() << "Exit signal catched, shutting down"; signalExit(); break; default: AGO_WARNING() << "Unmapped signal " << signo << " received"; } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), scene(new Menu), view (new QGraphicsView) { music = Phonon::createPlayer(Phonon::MusicCategory, Phonon::MediaSource(":/music/Fly12.mp3")); music->play(); connect(music, SIGNAL(aboutToFinish()), this , SLOT(slotRepeat())); connect(scene, SIGNAL(signalGame()), this, SLOT(openGame())); connect(scene, SIGNAL(signalEditor()), this, SLOT(openEditor())); connect(scene, SIGNAL(signalExit()), this, SLOT(exit())); connect(scene, SIGNAL(signalMusic()), this, SLOT(slotMusic())); setupView(); }
DbgMainWindow::DbgMainWindow(IGui *igui, event_def *init_done) { igui_ = igui; initDone_ = init_done; setWindowTitle(tr("RISC-V platform debugger")); resize(QDesktopWidget().availableGeometry(this).size() * 0.7); listConsoleListeners_.make_list(0); /** Console commands used by main window: */ cmdIsRunning_.make_string("isrunning"); cmdRun_.make_string("c"); cmdHalt_.make_string("halt"); cmdStep_.make_string("c 1"); createActions(); createMenus(); createStatusBar(); createMdiWindow(); /** QT documeneted behaviour: * * If you add a child widget to an already visible widget * you must explicitly show the child to make it visible. * * @todo Fix exception with PNP when initially opened */ addWidgets(); setUnifiedTitleAndToolBarOnMac(true); /** * To use the following type in SIGNAL -> SLOT definitions * we have to register them using qRegisterMetaType template */ qRegisterMetaType<uint64_t>("uint64_t"); qRegisterMetaType<uint32_t>("uint32_t"); connect(this, SIGNAL(signalPostInit(AttributeType *)), this, SLOT(slotPostInit(AttributeType *))); connect(this, SIGNAL(signalExit()), this, SLOT(slotExit())); tmrGlobal_ = new QTimer(this); connect(tmrGlobal_, SIGNAL(timeout()), this, SLOT(slotConfigDone())); tmrGlobal_->setSingleShot(true); tmrGlobal_->setInterval(1); tmrGlobal_->start(); }
MainMenubar::MainMenubar (QMainWindow *mw) : QMenuBar (mw, "mainMenubar") { actions.setAutoDelete(FALSE); RcFile rcfile; QPixmap icon(finished); QAction *action = new QAction(this, "actionExit"); action->setMenuText(tr("E&xit")); action->setIconSet(icon); action->setAccel(Qt::CTRL+Qt::Key_Q); action->setStatusTip(tr("Quit Qtstalker (Ctrl+Q)")); action->setToolTip(tr("Quit Qtstalker (Ctrl+Q)")); connect(action, SIGNAL(activated()), this, SIGNAL(signalExit())); actions.replace(Exit, action); icon = configure; action = new QAction(this, "actionOptions"); action->setMenuText(tr("Edit &Preferences")); action->setIconSet(icon); action->setStatusTip(tr("Modify user preferences (Ctrl+0)")); action->setToolTip(tr("Modify user preferences (Ctrl+0)")); connect(action, SIGNAL(activated()), mw, SLOT(slotOptions())); actions.replace(Options, action); icon = nav; bool b; rcfile.loadData(RcFile::ShowSidePanel, b); action = new QAction(this, "actionPanel"); action->setMenuText(tr("Side &Panel")); action->setIconSet(icon); action->setStatusTip(tr("Toggle side-panel view (Ctrl+1)")); action->setToolTip(tr("Toggle side-panel view (Ctrl+1)")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), mw, SLOT(slotHideNav(bool))); actions.replace(SidePanel, action); icon = gridicon; rcfile.loadData(RcFile::Grid, b); action = new QAction(this, "actionGrid"); action->setMenuText(tr("Chart &Grid")); action->setIconSet(icon); action->setStatusTip(tr("Toggle chart grid (Ctrl+2)")); action->setToolTip(tr("Toggle chart grid (Ctrl+2)")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalGrid(bool))); actions.replace(Grid, action); icon = scaletoscreen; rcfile.loadData(RcFile::ScaleToScreen, b); action = new QAction(this, "actionScale"); action->setMenuText(tr("&Scale To Screen")); action->setIconSet(icon); action->setStatusTip(tr("Scale chart to current screen data (Ctrl+3)")); action->setToolTip(tr("Scale chart to current screen data (Ctrl+3)")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalScale(bool))); actions.replace(ScaleToScreen, action); icon = crosshair; rcfile.loadData(RcFile::Crosshairs, b); action = new QAction(this, "actionCrosshairs"); action->setMenuText(tr("Toggle &Crosshairs")); action->setIconSet(icon); action->setStatusTip(tr("Toggle crosshairs (Ctrl+4)")); action->setToolTip(tr("Toggle crosshairs (Ctrl+4)")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalCrosshairs(bool))); actions.replace(Crosshairs, action); icon = co; rcfile.loadData(RcFile::DrawMode, b); action = new QAction(this, "actionDraw"); action->setMenuText(tr("Toggle &Draw Mode")); action->setIconSet(icon); action->setStatusTip(tr("Toggle drawing mode (Ctrl+5)")); action->setToolTip(tr("Toggle drawing mode (Ctrl+5)")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalDraw(bool))); actions.replace(DrawMode, action); icon = papertrade; rcfile.loadData(RcFile::PaperTradeMode, b); action = new QAction(this, "actionPaperTrade"); action->setMenuText(tr("Toggle &Trade Mode")); action->setIconSet(icon); action->setStatusTip(tr("Toggle paper-trade mode")); action->setToolTip(tr("Toggle paper-trade mode")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalPaperTrade(bool))); actions.replace(PaperTrade, action); icon = indicator; action = new QAction(this, "actionNewIndicator"); action->setMenuText(tr("New &Indicator")); action->setIconSet(icon); action->setStatusTip(tr("Add new indicator (Ctrl+7)")); action->setToolTip(tr("Add new indicator (Ctrl+7)")); connect(action, SIGNAL(activated()), this, SIGNAL(signalNewIndicator())); actions.replace(NewIndicator, action); icon = datawindow; action = new QAction(this, "actionDataWindow"); action->setMenuText(tr("&Data Window")); action->setIconSet(icon); action->setAccel(Qt::ALT+Qt::Key_1); action->setStatusTip(tr("Show data window (Alt+1)")); action->setToolTip(tr("Show data window (Alt+1)")); connect(action, SIGNAL(activated()), mw, SLOT(slotDataWindow())); actions.replace(DataWindow, action); icon = quotes; action = new QAction(this, "actionQuote"); action->setMenuText(tr("Load Quotes")); action->setIconSet(icon); action->setStatusTip(tr("Load Quotes (Ctrl+Y)")); action->setToolTip(tr("Load Quotes (Ctrl+Y)")); connect(action, SIGNAL(activated()), mw, SLOT(slotQuotes())); actions.replace(Quotes, action); icon = qtstalker; action = new QAction(this, "actionAbout"); action->setMenuText(tr("&About")); action->setIconSet(icon); action->setStatusTip(tr("About Qtstalker.")); action->setToolTip(tr("About Qtstalker.")); connect(action, SIGNAL(activated()), mw, SLOT(slotAbout())); actions.replace(About, action); icon = help; action = new QAction(this, "actionHelp"); action->setMenuText(tr("&Help")); action->setIconSet(icon); action->setAccel(Qt::Key_F1); action->setStatusTip(tr("Display Help (F1)")); action->setToolTip(tr("Display Help (F1)")); connect(action, SIGNAL(activated()), mw, SLOT(slotHelp())); actions.replace(Help, action); action = new QAction(this, "actionAdvancePaperTrade"); action->setAccel(Qt::CTRL+Qt::Key_Right); connect(action, SIGNAL(activated()), this, SIGNAL(signalAdvancePaperTrade())); actions.replace(AdvancePaperTrade, action); action = new QAction(this, "actionIndicatorSummary"); action->setMenuText(tr("Indicator Summary")); action->setStatusTip(tr("Indicator Summary")); action->setToolTip(tr("Indicator Summary")); connect(action, SIGNAL(activated()), mw, SLOT(slotIndicatorSummary())); actions.replace(IndicatorSummary, action); Q3Accel *a = new Q3Accel(mw); connect(a, SIGNAL(activated(int)), this, SLOT(slotAccel(int))); a->insertItem(Qt::CTRL+Qt::Key_0, Options); a->insertItem(Qt::CTRL+Qt::Key_1, SidePanel); a->insertItem(Qt::CTRL+Qt::Key_2, Grid); a->insertItem(Qt::CTRL+Qt::Key_3, ScaleToScreen); a->insertItem(Qt::CTRL+Qt::Key_4, Crosshairs); a->insertItem(Qt::CTRL+Qt::Key_5, DrawMode); a->insertItem(Qt::CTRL+Qt::Key_7, NewIndicator); a->insertItem(Qt::CTRL+Qt::Key_Y, Quotes); a->insertItem(Qt::CTRL+Qt::Key_Right, AdvancePaperTrade); a->insertItem(Qt::CTRL+Qt::Key_Escape, 8); createMenus(); rcfile.loadData(RcFile::ShowMenuBar, b); if (!b) hide(); }
void sysExit(int exitValue) { struct Process *proc = getCurrentThread()->process; proc->exitInfo.si_status = (exitValue & SIG_STATUS_MASK) | SIG_EXITED; signalExit(); }
void CGalcon::connectSingleSendersToTakers() { connect(m_gui, SIGNAL(SendStepPlayer(Message::CMessageStepPlayerPtr)), m_singleGame, SLOT(TakeStepPlayer(Message::CMessageStepPlayerPtr))); connect(m_gui, SIGNAL(signalExit()), m_singleGame, SLOT(TakeExit())); }
void DbgMainWindow::callExit() { emit signalExit(); }
/** * Handles the input. * Detects the pending events, and handles them appropriately. */ void InputHandler::handleInput(){ this->keyStates[GameKeys::SPACE] = false; this->keyStates[GameKeys::ROLL] = false; this->keyStates[GameKeys::LATTACK] = false; this->keyStates[GameKeys::NLATTACK] = false; this->keyStates[GameKeys::ACTION] = false; int pendingEvent = 0; do{ pendingEvent = SDL_PollEvent(&this->sdlEvent); if(this->sdlEvent.type == SDL_CONTROLLERBUTTONDOWN || this->sdlEvent.type == SDL_CONTROLLERBUTTONUP || this->sdlEvent.type == SDL_CONTROLLERAXISMOTION){ this->controllerHandler->handleInput(this->sdlEvent); for(unsigned int i = 0; i < this->keyStates.size(); i++) this->keyStates[i] = this->controllerHandler->keyStates[i]; } // On keydown. if(this->sdlEvent.type == SDL_KEYDOWN){ switch(this->sdlEvent.key.keysym.sym){ case SDLK_SPACE: // Jump. if(this->sdlEvent.key.repeat == 0){ this->keyStates[GameKeys::SPACE] = true; } break; case SDLK_UP: // UP. this->keyStates[GameKeys::UP] = true; break; case SDLK_DOWN: // DOWN. this->keyStates[GameKeys::DOWN] = true; break; case SDLK_LEFT: // Move left. this->keyStates[GameKeys::LEFT] = true; break; case SDLK_RIGHT: // Move right. this->keyStates[GameKeys::RIGHT] = true; break; case SDLK_c: // roll. if(this->sdlEvent.key.repeat == 0){ this->keyStates[GameKeys::ROLL] = true; } break; case SDLK_LCTRL: // crouch this->keyStates[GameKeys::CROUCH] = true; break; case SDLK_a: // a. if(this->sdlEvent.key.repeat == 0){ this->keyStates[GameKeys::ACTION] = true; } break; case SDLK_LSHIFT: // d. this->keyStates[GameKeys::AIM] = true; break; case SDLK_z: // z. if(this->sdlEvent.key.repeat == 0){ this->keyStates[GameKeys::LATTACK] = true; } break; case SDLK_TAB: this->keyStates[GameKeys::ITEMS] = true; break; case SDLK_ESCAPE: // Esc. if(this->sdlEvent.key.repeat == 0){ this->keyStates[GameKeys::ESCAPE] = true; } break; default: break; } } // On keyup. else if(this->sdlEvent.type == SDL_KEYUP){ switch(this->sdlEvent.key.keysym.sym){ case SDLK_SPACE: // Jump. this->keyStates[GameKeys::SPACE] = false; break; case SDLK_UP: // UP. this->keyStates[GameKeys::UP] = false; break; case SDLK_DOWN: // DOWN. this->keyStates[GameKeys::DOWN] = false; break; case SDLK_LEFT: // Move left. this->keyStates[GameKeys::LEFT] = false; break; case SDLK_RIGHT: // Move right. this->keyStates[GameKeys::RIGHT] = false; break; case SDLK_c: // Roll. this->keyStates[GameKeys::ROLL] = false; break; case SDLK_LCTRL: // crouch this->keyStates[GameKeys::CROUCH] = false; case SDLK_a: // a. this->keyStates[GameKeys::ACTION] = false; break; case SDLK_LSHIFT: // d. this->keyStates[GameKeys::AIM] = false; break; case SDLK_z: // z. this->keyStates[GameKeys::LATTACK] = false; break; case SDLK_TAB: this->keyStates[GameKeys::ITEMS] = false; break; case SDLK_ESCAPE: // Esc. this->keyStates[GameKeys::ESCAPE] = false; break; default: break; } } //On window exit (X). else if(this->sdlEvent.type == SDL_QUIT){ signalExit(); } } while(pendingEvent != 0); }