Ejemplo n.º 1
0
int main(int, char **)
{
	time_t time;

	std::time(&time);
	struct tm *current_time;

	current_time = localtime(&time);

	char time_string[17];
	strftime(time_string, 17, "%Y-%m-%d %H:%M", current_time);
	std::cout << "Current time: " << time_string << std::endl;

	EventManager events;

	events.add(inputEvent());
	
	KeyEvent key = KeyEvent::OTHER;
	do
	{
		if(kbhit())
		{
			key = getKeyEvent();
			switch(key)
			{
			case KeyEvent::NEW:
				events.add(inputEvent());
				break;

			case KeyEvent::QUIT:
				break;

			default:
				break;
			}
		}

		std::vector<Event> overdue = events.getOverDue();

		if (!overdue.empty())
		{
			for(Event event : overdue)
				std::cout << event.getMessage() << std::endl;

			break;
		}
	}
	while (key != KeyEvent::QUIT);

	return 0;
}
Ejemplo n.º 2
0
QmlProfilerApplication::QmlProfilerApplication(int &argc, char **argv) :
    QCoreApplication(argc, argv),
    m_runMode(LaunchMode),
    m_process(0),
    m_hostName(QLatin1String("127.0.0.1")),
    m_port(3768),
    m_pendingRequest(REQUEST_NONE),
    m_verbose(false),
    m_recording(true),
    m_interactive(false),
    m_qmlProfilerClient(&m_connection),
    m_v8profilerClient(&m_connection),
    m_connectionAttempts(0),
    m_qmlDataReady(false),
    m_v8DataReady(false)
{
    m_connectTimer.setInterval(1000);
    connect(&m_connectTimer, SIGNAL(timeout()), this, SLOT(tryToConnect()));

    connect(&m_connection, SIGNAL(connected()), this, SLOT(connected()));
    connect(&m_connection, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(connectionStateChanged(QAbstractSocket::SocketState)));
    connect(&m_connection, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(connectionError(QAbstractSocket::SocketError)));

    connect(&m_qmlProfilerClient, SIGNAL(enabledChanged()), this, SLOT(traceClientEnabled()));
    connect(&m_qmlProfilerClient, SIGNAL(range(QQmlProfilerDefinitions::RangeType,QQmlProfilerDefinitions::BindingType,qint64,qint64,QStringList,QmlEventLocation)),
            &m_profilerData, SLOT(addQmlEvent(QQmlProfilerDefinitions::RangeType,QQmlProfilerDefinitions::BindingType,qint64,qint64,QStringList,QmlEventLocation)));
    connect(&m_qmlProfilerClient, SIGNAL(traceFinished(qint64)), &m_profilerData, SLOT(setTraceEndTime(qint64)));
    connect(&m_qmlProfilerClient, SIGNAL(traceStarted(qint64)), &m_profilerData, SLOT(setTraceStartTime(qint64)));
    connect(&m_qmlProfilerClient, SIGNAL(traceStarted(qint64)), this, SLOT(notifyTraceStarted()));
    connect(&m_qmlProfilerClient, SIGNAL(frame(qint64,int,int,int)), &m_profilerData, SLOT(addFrameEvent(qint64,int,int,int)));
    connect(&m_qmlProfilerClient, SIGNAL(sceneGraphFrame(QQmlProfilerDefinitions::SceneGraphFrameType,
                                         qint64,qint64,qint64,qint64,qint64,qint64)),
            &m_profilerData, SLOT(addSceneGraphFrameEvent(QQmlProfilerDefinitions::SceneGraphFrameType,
                                  qint64,qint64,qint64,qint64,qint64,qint64)));
    connect(&m_qmlProfilerClient, SIGNAL(pixmapCache(QQmlProfilerDefinitions::PixmapEventType,qint64,
                                                     QmlEventLocation,int,int,int)),
            &m_profilerData, SLOT(addPixmapCacheEvent(QQmlProfilerDefinitions::PixmapEventType,qint64,
                                                      QmlEventLocation,int,int,int)));
    connect(&m_qmlProfilerClient, SIGNAL(memoryAllocation(QQmlProfilerDefinitions::MemoryType,qint64,
                                                          qint64)),
            &m_profilerData, SLOT(addMemoryEvent(QQmlProfilerDefinitions::MemoryType,qint64,
                                                 qint64)));
    connect(&m_qmlProfilerClient, SIGNAL(inputEvent(QQmlProfilerDefinitions::EventType,qint64)),
            &m_profilerData, SLOT(addInputEvent(QQmlProfilerDefinitions::EventType,qint64)));

    connect(&m_qmlProfilerClient, SIGNAL(complete()), this, SLOT(qmlComplete()));

    connect(&m_v8profilerClient, SIGNAL(enabledChanged()), this, SLOT(profilerClientEnabled()));
    connect(&m_v8profilerClient, SIGNAL(range(int,QString,QString,int,double,double)),
            &m_profilerData, SLOT(addV8Event(int,QString,QString,int,double,double)));
    connect(&m_v8profilerClient, SIGNAL(complete()), this, SLOT(v8Complete()));

    connect(&m_profilerData, SIGNAL(error(QString)), this, SLOT(logError(QString)));
    connect(&m_profilerData, SIGNAL(dataReady()), this, SLOT(traceFinished()));

}
Ejemplo n.º 3
0
LayeredRemoteVGView::LayeredRemoteVGView( IConnector * connector,
                                          QString viewName,
                                          QObject * parent )
    : QObject( parent )
{
    m_vgView.reset( connector-> makeRemoteVGView( viewName ) );

    /// forward repainted signals directly
    connect( m_vgView.get(), SIGNAL( repainted( qint64 ) ), this, SIGNAL( repainted( qint64 ) ) );

    /// forward input signals directly
    connect( m_vgView.get(), SIGNAL( inputEvent( InputEvent ) ), this,
             SIGNAL( inputEvent( InputEvent ) ) );

    //    connect( m_vgView.get(), SIGNAL( sizeChanged() ), this, SIGNAL( sizeChanged() ) );
    connect( m_vgView.get(), & IRemoteVGView::sizeChanged, this, & Me::p_sizeChangedCB );

    m_timer = new QTimer( this );
    m_timer-> setSingleShot( true );
    m_timer-> setInterval( 1 );
    connect( m_timer, & QTimer::timeout, this, & Me::p_timerCB );
}
Ejemplo n.º 4
0
int main(int argc, char **argv)
{
	if(!initWindowEx()) REPORT_ERROR("建立窗体失败");
	if(!_GGame::GetInstance().init()) REPORT_ERROR("初始化失败");

	while(!inputEvent()) 
	{//程序主循环
		_GGame::GetInstance().move(XEE::engineIdle());
		XEE::clearScreen();			//清除屏幕
		_GGame::GetInstance().draw();

		XEE::updateScreen();			//更新屏幕的内容
		//mySleep(1);
	}
	_GGame::GetInstance().release();
	XEE::release();
	return 0;	
}
Ejemplo n.º 5
0
void OccView::onLButtonUp( const int theFlags, const QPoint thePoint )
{
    // Hide the QRubberBand
    if (myRectBand)
    {
        myRectBand->hide();
    }

    // Ctrl for multi selection.
    if (thePoint.x() == myXmin && thePoint.y() == myYmin)
    {
        if (theFlags & Qt::ControlModifier)
        {
            multiInputEvent(thePoint.x(), thePoint.y());
        }
        else
        {
            inputEvent(thePoint.x(), thePoint.y());
        }
    }

}
Ejemplo n.º 6
0
void SearchPopup::updateInputContext(bool commit)
{
	QInputMethodEvent inputEvent(
		preeditString_,
		QList<QInputMethodEvent::Attribute>()
			<< QInputMethodEvent::Attribute(
				QInputMethodEvent::Cursor,
				preeditCursor_, 1,
				preeditCursor_
			)
	);
	if (commit) {
		if (preeditString_.length() > 0) {
			inputEvent.setCommitString(preeditString_);
			preeditString_ = "";
			preeditCursor_ = 0;
			updateInputContext();
		}
	}
	emit searchPatternChanged(preeditString_);
	listView_->viewport()->update();
	if (widget_)
		QCoreApplication::sendEvent(widget_, &inputEvent);
}
Ejemplo n.º 7
0
void HotkeySettings::eraseInput() {
  activeInput = inputManager->hotkeyMap[inputList.selection()];
  inputEvent(hidNull, 0, 0, 0, 1);
}
Ejemplo n.º 8
0
void Splash::input(sf::Event &event)
{
    inputEvent(event);
}
Ejemplo n.º 9
0
//下面是事件处理函数,例如:键盘事件或者鼠标事件
int SDL_event()
{
	int ret =0;
	SDL_Event event;		//SDL事件句柄

	while(SDL_PollEvent(&event)) 
	{
		switch(event.type)
		{
		case SDL_QUIT:
			ret = 1;
			break;
		case SDL_KEYUP:
			break;
		case SDL_KEYDOWN:

			switch(event.key.keysym.sym )
			{
			case SDLK_s:
				break;
			case SDLK_d:
				break;
			case SDLK_a:
				break;
			case SDLK_LALT:
				break;
			case SDLK_RALT:
				break;
			case SDLK_F1:
				SDL_WM_ToggleFullScreen(XEE_screen);
				break;
			case SDLK_RIGHT:
				break;
			case SDLK_LEFT:
				break;
			case SDLK_UP:
				break;
			case SDLK_DOWN:
				break;
			}
			break;
		case SDL_MOUSEMOTION:	//鼠标移动
			break;
		case SDL_MOUSEBUTTONDOWN:
			if(event.button.button == 1)
			{//左键
			}else
			if(event.button.button == 3)
			{//右键
			}
			break;
		case SDL_MOUSEBUTTONUP:
			if(event.button.button == 1)
			{//左键
			}else
			if(event.button.button == 3)
			{//右键
			}
			break;
		}
		inputEvent(event);
	}
	return ret;
}