void MainWnd::keyPressEvent( QKeyEvent * event ) { switch( event->key() ) { case Qt::Key_W: slotForward(); break; case Qt::Key_S: slotBackward(); break; case Qt::Key_A: slotLeft(); break; case Qt::Key_D: slotRight(); break; } }
CCreateMapFineTune::CCreateMapFineTune(QWidget * parent) : QWidget(parent) { setupUi(this); toolUp->setIcon(QIcon(":/icons/iconUpload16x16.png")); toolDown->setIcon(QIcon(":/icons/iconDownload16x16.png")); toolLeft->setIcon(QIcon(":/icons/iconLeft16x16.png")); toolRight->setIcon(QIcon(":/icons/iconRight16x16.png")); connect(pushOpenFile, SIGNAL(clicked()), this, SLOT(slotOpenFile())); connect(toolUp, SIGNAL(clicked()), this, SLOT(slotUp())); connect(toolDown, SIGNAL(clicked()), this, SLOT(slotDown())); connect(toolLeft, SIGNAL(clicked()), this, SLOT(slotLeft())); connect(toolRight, SIGNAL(clicked()), this, SLOT(slotRight())); connect(pushSave, SIGNAL(clicked()), this, SLOT(slotSave())); progressBar->hide(); }
MainWnd::MainWnd( QWidget * parent ) : QMainWindow( parent ) { ui.setupUi( this ); connect( this, SIGNAL(sigLog(const QString &)), this, SLOT(slotLog(const QString &)), Qt::QueuedConnection ); connect( ui.console, SIGNAL(line_validate(const QString &)), this, SLOT(slotSend(const QString &)), Qt::QueuedConnection ); QObject::connect( ui.clearLog, SIGNAL(triggered()), this, SLOT(slotClearLog()) ); QObject::connect( ui.dontSleep, SIGNAL(triggered()), this, SLOT(slotDontSleep()) ); QObject::connect( ui.showFullLog, SIGNAL(triggered()), this, SLOT(slotShowFullLog()) ); QObject::connect( ui.queryStatus, SIGNAL(triggered()), this, SLOT(slotStatus()) ); QObject::connect( ui.queryOsc, SIGNAL(triggered()), this, SLOT(slotOsc()) ); QObject::connect( ui.shutdown, SIGNAL(triggered()), this, SLOT(slotShutdown()) ); QObject::connect( ui.setupPipe, SIGNAL(triggered()), this, SLOT(slotSetupPipe()) ); QObject::connect( ui.lightBtn, SIGNAL(clicked()), this, SLOT(slotLight()) ); QObject::connect( ui.motoEnBtn, SIGNAL(clicked()), this, SLOT(slotMotoEn()) ); QObject::connect( ui.fwdBtn, SIGNAL(pressed()), this, SLOT(slotForward()) ); QObject::connect( ui.bwdBtn, SIGNAL(pressed()), this, SLOT(slotBackward()) ); QObject::connect( ui.leftBtn, SIGNAL(pressed()), this, SLOT(slotLeft()) ); QObject::connect( ui.rightBtn, SIGNAL(pressed()), this, SLOT(slotRight()) ); QObject::connect( ui.fwdBtn, SIGNAL(released()), this, SLOT(slotStop()) ); QObject::connect( ui.bwdBtn, SIGNAL(released()), this, SLOT(slotStop()) ); QObject::connect( ui.leftBtn, SIGNAL(released()), this, SLOT(slotStop()) ); QObject::connect( ui.rightBtn, SIGNAL(released()), this, SLOT(slotStop()) ); QObject::connect( ui.showFullLog, SIGNAL(triggered()), this, SLOT(slotShowFullLog()) ); m_peer = new QXmppPeer( this ); QObject::connect( m_peer, SIGNAL(connected()), this, SLOT(slotConnected()) ); QObject::connect( m_peer, SIGNAL(disconnected()), this, SLOT(slotDisconnected()) ); QObject::connect( m_peer, SIGNAL(textmsg(QString)), this, SLOT(qxmppMessageReceived(QString)) ); m_video = new QXmppVideo( m_peer ); // It also connects frameReady() signal to an appropriate slot. ui.view->setVideo( m_video ); this->setCentralWidget( ui.view ); QSettings ini( CONFIG_FILE, QSettings::IniFormat ); ini.beginGroup( "main" ); QString selfJid = ini.value( "selfJid", "client@xmpp" ).toString(); QString destJid = ini.value( "destJid", "host@xmpp" ).toString(); QString password = ini.value( "password", "12345" ).toString(); QString host = ini.value( "host", QString() ).toString(); int port = ini.value( "port", -1 ).toInt(); bool tls = ini.value( "tls", true ).toBool(); bool updateDest = ini.value( "updateDest", true ).toBool(); m_peer->setTarget( destJid, updateDest ); m_video->setTarget( destJid ); m_peer->connect( selfJid, password, host, port, tls ); m_jidDest = destJid; m_pipe = new QXmppMsgPipe( m_peer, 1 ); m_pipe->setOutPipe( m_jidDest, 1234, 22, "localhost" ); m_dontSleepTimer = new QTimer( this ); m_dontSleepTimer->setInterval( 15000 ); QObject::connect( m_dontSleepTimer, SIGNAL(timeout()), this, SLOT(slotDontSleepTimeout()) ); }