qtmobileextensions/examples/keycaptureex/keycapturetestapp.cpp
changeset 19 46686fb6258c
parent 15 1f895d8a5b2b
child 27 6bfad47013df
equal deleted inserted replaced
15:1f895d8a5b2b 19:46686fb6258c
    37 #include <QString>
    37 #include <QString>
    38 #include <QMenu>
    38 #include <QMenu>
    39 #include <QMenuBar>
    39 #include <QMenuBar>
    40 #include <QAction>
    40 #include <QAction>
    41 #include <QEvent>
    41 #include <QEvent>
    42 #include <XQRemConKeyEvent>
    42 
    43 
    43 
    44 #include <QFont>
    44 #include <QFont>
    45 
    45 
    46 #include "keycapturetestapp.h"
    46 #include "keycapturetestapp.h"
    47 #include "txlogger.h"
    47 #include "txlogger.h"
   259 
   259 
   260 void KeyCaptureTestApp::enableRemBasic(bool enable)
   260 void KeyCaptureTestApp::enableRemBasic(bool enable)
   261 {
   261 {
   262     if (enable) {
   262     if (enable) {
   263         addTextLine("Remote Basic enabled");
   263         addTextLine("Remote Basic enabled");
   264         mKeyCapture->captureRemoteKeys(XQKeyCapture::CaptureBasic);
   264         QFlags<XQKeyCapture::CapturingFlag> flags = XQKeyCapture::CaptureNone;
       
   265         if (toggleRemoteExtEvents->isChecked())
       
   266             flags = XQKeyCapture::CaptureEnableRemoteExtEvents;
       
   267         if (toggleRemoteCallHandlingEx->isChecked())
       
   268             flags |= XQKeyCapture::CaptureCallHandlingExt;
       
   269         mKeyCapture->captureRemoteKeys(flags |= XQKeyCapture::CaptureBasic);
   265     } else {
   270     } else {
   266         addTextLine("Remote Basic disabled");
   271         addTextLine("Remote Basic disabled");
   267         mKeyCapture->cancelCaptureRemoteKeys(XQKeyCapture::CaptureBasic);
   272         mKeyCapture->cancelCaptureRemoteKeys(XQKeyCapture::CaptureBasic);
   268     }
   273     }
   269 }
   274 }
   270 
   275 
   271 void KeyCaptureTestApp::enableRemCallHandlingEx(bool enable)
   276 void KeyCaptureTestApp::enableRemCallHandlingEx(bool enable)
   272 {
   277 {
   273     if (enable) {
   278     if (enable) {
   274         addTextLine("Remote Call Handling Ext. enabled");
   279         addTextLine("Remote Call Handling Ext. enabled");
   275         mKeyCapture->captureRemoteKeys(XQKeyCapture::CaptureCallHandlingExt);
   280         QFlags<XQKeyCapture::CapturingFlag> flags = XQKeyCapture::CaptureNone;
       
   281         if (toggleRemoteExtEvents->isChecked())
       
   282             flags = XQKeyCapture::CaptureEnableRemoteExtEvents;
       
   283         if (toggleRemoteBasic->isChecked())
       
   284             flags |= XQKeyCapture::CaptureBasic;
       
   285         mKeyCapture->captureRemoteKeys(flags | XQKeyCapture::CaptureCallHandlingExt);
   276     } else {
   286     } else {
   277         addTextLine("Remote Call Handling Ext. disabled");
   287         addTextLine("Remote Call Handling Ext. disabled");
   278         mKeyCapture->cancelCaptureRemoteKeys(XQKeyCapture::CaptureCallHandlingExt);
   288         mKeyCapture->cancelCaptureRemoteKeys(XQKeyCapture::CaptureCallHandlingExt);
   279     }
   289     }
   280 }
   290 }
   281 
   291 
   282 void KeyCaptureTestApp::enableRemoteExtEvents(bool enable)
   292 void KeyCaptureTestApp::enableRemoteExtEvents(bool enable)
   283 {
   293 {
   284     if (enable) {
   294     if (enable) {
   285         addTextLine("Remote Events Ext. enabled");
   295         addTextLine("Remote Events Ext. enabled");
   286         mKeyCapture->captureRemoteKeys(XQKeyCapture::CaptureBasic | XQKeyCapture::CaptureEnableRemoteExtEvents);
   296         QFlags<XQKeyCapture::CapturingFlag> flags = XQKeyCapture::CaptureNone;
   287         toggleRemoteBasic->setChecked(true);
   297         if (toggleRemoteCallHandlingEx->isChecked())
       
   298             flags = XQKeyCapture::CaptureCallHandlingExt;
       
   299         if (toggleRemoteBasic->isChecked())
       
   300             flags |= XQKeyCapture::CaptureBasic;
       
   301         mKeyCapture->captureRemoteKeys(flags | XQKeyCapture::CaptureEnableRemoteExtEvents);
   288     } else {
   302     } else {
   289         addTextLine("Remote Events Ext. disabled");
   303         addTextLine("Remote Events Ext. disabled");
   290         mKeyCapture->cancelCaptureRemoteKeys(XQKeyCapture::CaptureBasic | XQKeyCapture::CaptureEnableRemoteExtEvents);
   304         mKeyCapture->cancelCaptureRemoteKeys(XQKeyCapture::CaptureEnableRemoteExtEvents);
   291     }
   305     }
   292 }
   306 }
   293 
   307 
   294 void KeyCaptureTestApp::remoteAll(bool enable)
   308 void KeyCaptureTestApp::remoteAll(bool enable)
   295 {
   309 {
   305 void KeyCaptureTestApp::remoteNone(bool enable)
   319 void KeyCaptureTestApp::remoteNone(bool enable)
   306 {
   320 {
   307     Q_UNUSED(enable);
   321     Q_UNUSED(enable);
   308     toggleRemoteBasic->setChecked(false);
   322     toggleRemoteBasic->setChecked(false);
   309     toggleRemoteCallHandlingEx->setChecked(false);
   323     toggleRemoteCallHandlingEx->setChecked(false);
       
   324     toggleRemoteExtEvents->setChecked(false);
   310     addTextLine("Remote: disable all");
   325     addTextLine("Remote: disable all");
   311     mKeyCapture->cancelCaptureRemoteKeys(XQKeyCapture::CaptureCallHandlingExt | XQKeyCapture::CaptureBasic | 
   326     mKeyCapture->cancelCaptureRemoteKeys(XQKeyCapture::CaptureCallHandlingExt | XQKeyCapture::CaptureBasic | 
   312             XQKeyCapture::CaptureEnableRemoteExtEvents);
   327             XQKeyCapture::CaptureEnableRemoteExtEvents);
   313 }
   328 }