void MainWindow::onLogoutCompleted()
{
	if(isShuttingDown)
	{
		QDEBUG("MainWindow::onLogoutCompleted() - shutting down, forcing quit");
		forceQuit();
	}
}
示例#2
0
Indexer::Indexer(const QString& path) {

    chemin = path;
    filtre << FORMATS_SUPPORTES;
    this->setTerminationEnabled(true);
    loopRunning = true;
    saver = new NutshSqlSaver;
    saver->savePath(path);
    connect(this, SIGNAL(finished()), this, SLOT(quit()));
    connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(forceQuit()));
}
void MainWindow::shutDown()
{
	bool isOnline = INFOMANAGER->isUserOnline();

	if (isShuttingDown || !logout(true))
		return;

	if (isOnline)
	{
		// wait a little for logoutCompleted
		QTimer::singleShot(2000, this, SLOT(forceQuit()));
	}
	else
	{
		QDEBUG("MainWindow::shutDown() - not online, quit immediately");
		forceQuit();
	}
    
#ifdef Q_WS_MAC
    macCleanup();
#endif
}
BOOL Editor::OCommand(ULONG msg, MPARAM mp1, MPARAM mp2)
{
 switch(msg)
  {
   case WM_SIZE:
     WinSetWindowPos(textfield->hwnd, HWND_TOP, 0, 0, 
                     SHORT1FROMMP(mp2),  SHORT2FROMMP(mp2), 
                     SWP_MOVE | SWP_SIZE);
     textfield->setFocus();
     break; 


   case WM_COMMAND:
     switch(SHORT1FROMMP(mp1))
      {
       case EDITOR_QUIT:
        WinSendMsg(hwnd, WM_CLOSE, NULL, NULL);
        break;

       case EDITOR_LOAD:
        textfield->loadFile();
        setWindowText(textfield->openedFile);
        break;

       case EDITOR_SAVE:
        textfield->saveFileThr.run();
        break;

       case EDITOR_SAVEAS:
        textfield->saveFileAs(); 
        setWindowText(textfield->openedFile);
        break; 
      }
     break;

   case WM_CLOSE:
     forceQuit();
     break; 

   default:
     return(OFrame::OCommand(msg, mp1, mp2));
  }
 return(TRUE);
#ifdef __BCPLUSPLUS__
  #pragma warn -par
#endif
}
BOOL BalloonServer::OCommand(ULONG msg, MPARAM mp1, MPARAM mp2)
{
 switch(msg)
  {
   case WM_CLOSE:
    if (connectedClients > 0) {
      pipeMessage.Type = PIPE_SERVER_EXIT;
      pipeMessage.Data = 0;
      postPipe(&pipeMessage, 0); }   // post to all clients
    OBook::OCommand(msg, mp1, mp2);
    stopPiping();
    forceQuit();
    break;

   default:
    return(OBook::OCommand(msg, mp1, mp2));
  }
 return(TRUE);
}
BOOL ValueSample::OCommand(ULONG msg, MPARAM mp1, MPARAM mp2)
{
 switch(msg)
  {
   case WM_CONTROL:
    switch(SHORT2FROMMP(mp1)) {
     case VN_SELECT:
     case VN_ENTER: {
       OString Notification;
       CHAR    pszTmp[5];

       VSet.querySelected();
       if ((SHORT2FROMMP(mp1)) == VN_SELECT)
         Notification << OString(STR_VN_SELECT, NULLHANDLE);
       else
         Notification << OString(STR_VN_ENTER, NULLHANDLE);
       _itoa(VSet.selected.row, pszTmp, 10);
       Notification + pszTmp;
       Notification + " Column ";
       _itoa(VSet.selected.col, pszTmp, 10);
       Notification + pszTmp;
       WinSetDlgItemText(hwnd, VALUE_STATUS, Notification);
       break; }}
     break;

   case WM_COMMAND:
     WinSendMsg(hwnd, WM_CLOSE, NULL, NULL);
     break;

   case WM_CLOSE:
     hideDlg();
     forceQuit();
     break;

   default:
     return(FALSE);
  }
 return(TRUE);
#ifdef __BCPLUSPLUS__
  #pragma warn -par
#endif
}
示例#7
0
void Game::handleEvents()
{
	sf::Event event;
	while (m_window->pollEvent(event))
	{
		if(event.type == sf::Event::Closed)
		{
			forceQuit();
		}

		if(event.type == sf::Event::MouseMoved)
		{
			//Buttons
			for(int i = 0; i < m_questionButtons.size(); i++)
			{
				if(m_questionButtons[i].getShape().getGlobalBounds().contains(event.mouseMove.x, event.mouseMove.y))
					m_questionButtons[i].startHover();
				else
					m_questionButtons[i].endHover();
			}
		}

		//clicks
		if(event.type == sf::Event::MouseButtonReleased)
		{
			if(event.mouseButton.button == sf::Mouse::Left)
			{
				for(int i = 1; i < m_questionButtons.size(); i++)
				{
					if(m_questionButtons[i].getShape().getGlobalBounds().contains(event.mouseButton.x, event.mouseButton.y))
					{
						nextQuestion(m_questionButtons[i].getString() == m_currentQuestion.getAnswer(), 
							m_currentQuestion.getQuestion(), m_currentQuestion.getAnswer(), 
							m_questionButtons[i].getString());
						
					}
				}
			}
		}
	}
}
BOOL DragSamp::OCommand(ULONG msg, MPARAM mp1, MPARAM mp2)
{
 switch(msg)
  {
   case WM_INITDLG:
     odf_a.inherit(hwnd);
     odf_b.inherit(hwnd);
     odf_c.inherit(hwnd);
     break;

   case WM_COMMAND:
     WinSendMsg(hwnd, WM_CLOSE, NULL, NULL);
     break;

   case WM_CLOSE:
     hideDlg();
     forceQuit();
     break;

   default:
     return(FALSE);
  } 
 return(TRUE);
}
示例#9
0
/*
	Name:	handleEvents
	Desc:	handles all the window events and the events related to the paused and end game screens
	Args:	None
	Rtrn:	None
*/
void Game::handleEvents()
{
	sf::Event event;
	while (m_window->pollEvent(event))
	{
		if(event.type == sf::Event::Closed)
			m_window->close();

		//In game mouse events.
		if(!m_paused && !m_gameOver)
		{
			if(event.type == sf::Event::MouseMoved)
			{
				m_player.setPosition(event.mouseMove.x, event.mouseMove.y);
				m_player.getParticleSys().moveEmitter(sf::Vector2f(event.mouseMove.x, event.mouseMove.y));
				//Distance formulae
				int points = sqrt((event.mouseMove.x - m_player.getLastPos().x) * (event.mouseMove.x - m_player.getLastPos().x))
					+	sqrt((event.mouseMove.y - m_player.getLastPos().y) * (event.mouseMove.y - m_player.getLastPos().y));
				m_player.addPoints(points);
				m_player.setLastPosition(sf::Vector2f(event.mouseMove.x, event.mouseMove.y));
			}

			if(event.type == sf::Event::LostFocus)
				beginPause();
			//Feature not implemented due to unforseen problems. Related to pausing the game when the mouse leaves the 
			//window area.
			/*
			if(!sf::IntRect(sf::Vector2i(m_window->getPosition()),
				sf::Vector2i(m_window->getSize())).contains(sf::Mouse::getPosition()))
			{
				BeginPause();
			}
			*/
		}

		//In paused mouse events.
		else if(m_paused && !m_gameOver)
		{
			if(event.type == sf::Event::MouseMoved)
			{
				//Buttons
				if(m_pauseCont.getSprite().getGlobalBounds().contains(event.mouseMove.x, event.mouseMove.y))
					m_pauseCont.startHover();
				else
					m_pauseCont.endHover();

				if(m_pauseQuit.getSprite().getGlobalBounds().contains(event.mouseMove.x, event.mouseMove.y))
					m_pauseQuit.startHover();
				else
					m_pauseQuit.endHover();
			}

			if(event.type == sf::Event::MouseButtonPressed)
			{
				if(event.mouseButton.button == sf::Mouse::Left)
				{
					//Continue
					if(m_pauseCont.getSprite().getGlobalBounds().contains(event.mouseButton.x, event.mouseButton.y))
					{
						endPause();
					}
					//Quit
					if(m_pauseQuit.getSprite().getGlobalBounds().contains(event.mouseButton.x, event.mouseButton.y))
					{
						forceQuit();
					}
				}
			}
		}

		//Game over
		else
		{
			if(event.type == sf::Event::MouseMoved)
			{
				//Buttons
				if(m_endRetry.getSprite().getGlobalBounds().contains(event.mouseMove.x, event.mouseMove.y))
					m_endRetry.startHover();
				else
					m_endRetry.endHover();

				if(m_endQuit.getSprite().getGlobalBounds().contains(event.mouseMove.x, event.mouseMove.y))
					m_endQuit.startHover();
				else
					m_endQuit.endHover();
			}

			if(event.type == sf::Event::MouseButtonPressed)
			{
				if(event.mouseButton.button == sf::Mouse::Left)
				{
					//Continue
					if(m_endRetry.getSprite().getGlobalBounds().contains(event.mouseButton.x, event.mouseButton.y))
					{
						m_retry = true;
						forceQuit();
					}
					//Quit
					if(m_endQuit.getSprite().getGlobalBounds().contains(event.mouseButton.x, event.mouseButton.y))
					{
						forceQuit();
					}
				}
			}
		}
	}
}
示例#10
0
 InputStream::~InputStream(void) {
     forceQuit();
 }
int MoodBox::MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: onUserAccountUpdated(); break;
        case 1: onUserStatusChanged((*reinterpret_cast< UserStatus::UserStatusEnum(*)>(_a[1]))); break;
        case 2: onServerError((*reinterpret_cast< ServerResponseHandler::ServerError(*)>(_a[1]))); break;
        case 3: onShowExceptionDialogSendingMessage((*reinterpret_cast< ContactResultCode::ContactResultCodeEnum(*)>(_a[1])),(*reinterpret_cast< qint32(*)>(_a[2]))); break;
        case 4: onLogonStarted(); break;
        case 5: onLogonStopped(); break;
        case 6: onLogonSuccess(); break;
        case 7: showWindow(); break;
        case 8: shutDown(); break;
        case 9: onLogoutCompleted(); break;
        case 10: relogon(); break;
        case 11: offline((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 12: offline(); break;
        case 13: { bool _r = logout((*reinterpret_cast< bool(*)>(_a[1])));
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 14: { bool _r = logout();
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 15: showSettings(); break;
        case 16: ipcMessage((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 17: addFriendByLogin(); break;
        case 18: forceQuit(); break;
        case 19: onTrayIconActivated((*reinterpret_cast< QSystemTrayIcon::ActivationReason(*)>(_a[1]))); break;
        case 20: on_contactListButton_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 21: on_drawButton_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 22: on_historyButton_toggled((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 23: onDownloadNewVersion(); break;
        case 24: onInviteCodeAccepted(); break;
        case 25: onRegistrationSuccess(); break;
        case 26: onResetPassword(); break;
        case 27: onShowClipart(); break;
        case 28: onReply((*reinterpret_cast< const QImage(*)>(_a[1]))); break;
        case 29: showTvWidget(); break;
        case 30: showLogonWidget((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 31: showLogonWidget(); break;
        case 32: showInviteCodeWidget(); break;
        case 33: showRegistrationWidget(); break;
        case 34: showForgotPasswordWidget(); break;
        case 35: showInfoWidget(); break;
        case 36: showWaitingWidget(); break;
        case 37: stopWaitingWidget(); break;
        case 38: hideWaitingWidget(); break;
        case 39: cancelWaitingWidget(); break;
        case 40: onRegistrationBack(); break;
        case 41: onInviteCodeNeeded(); break;
        case 42: onContactSelected((*reinterpret_cast< qint32(*)>(_a[1]))); break;
        case 43: onContactImageDrop((*reinterpret_cast< qint32(*)>(_a[1])),(*reinterpret_cast< const QImage(*)>(_a[2]))); break;
        case 44: onSoundStateChanged((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 45: onPrivateMessageReceived((*reinterpret_cast< qint32(*)>(_a[1])),(*reinterpret_cast< const MessageKey(*)>(_a[2]))); break;
        case 46: onChannelMessageReceived((*reinterpret_cast< qint32(*)>(_a[1])),(*reinterpret_cast< const MessageKey(*)>(_a[2]))); break;
        case 47: onFriendsMessageReceived((*reinterpret_cast< const MessageKey(*)>(_a[1]))); break;
        case 48: onMessageSent(); break;
        case 49: showHelp(); break;
        case 50: requestFinished((*reinterpret_cast< QNetworkReply*(*)>(_a[1]))); break;
        case 51: dataProcessedProgress((*reinterpret_cast< qint64(*)>(_a[1])),(*reinterpret_cast< qint64(*)>(_a[2]))); break;
        case 52: cancelHttpRequest(); break;
        default: ;
        }
        _id -= 53;
    }
    return _id;
}