MainWidget::MainWidget(QWidget *parent) : QWidget(parent) { m_controller = new ControllerObject; m_gpsWgt = new GPSWidget; m_gsmWgt = new GSMWidget; /////////////////////////////////////////////// QGroupBox* gpsGroupBox = new QGroupBox("GPS"); m_gpsWgt = new GPSWidget; QVBoxLayout* gpsLayout = new QVBoxLayout; gpsLayout->addWidget( m_gpsWgt ); gpsGroupBox->setLayout(gpsLayout); QGroupBox* gsmGroupBox = new QGroupBox("GSM"); m_gsmWgt = new GSMWidget; QVBoxLayout* gsmLayout = new QVBoxLayout; gsmLayout->addWidget( m_gsmWgt ); gsmGroupBox->setLayout(gsmLayout); QHBoxLayout* mainLayout = new QHBoxLayout; mainLayout->addWidget( gpsGroupBox ); mainLayout->addWidget( gsmGroupBox ); setLayout( mainLayout ); ///////////////////////////////////////// connect( m_gsmWgt, SIGNAL(newSMS(QString,QString)), m_controller, SLOT(setMessage(QString,QString))); connect( m_controller, SIGNAL(newSMS(QString,QString)), this, SLOT(sendSMS(QString,QString))); }
bool PhoneMonitorVoiceReportBase::event(QEvent *e) { //printf("PhoneReport::event===%d\n",e->type()); switch((int)(e->type())) { case NEW_CALL_EVENT: { PhoneMonitorNewCallEventC *phoneEvent =(PhoneMonitorNewCallEventC*)e; newCall(phoneEvent->cPhoneNumber); return TRUE; } case CALL_CONNECTED_EVENT: { PhoneMonitorCallConnectEventC *phoneEvent =(PhoneMonitorCallConnectEventC*)e; callConnect(); return TRUE; } case CALL_HANG_UP_EVENT: { PhoneMonitorCallHangUpEventC *phoneEvent =(PhoneMonitorCallHangUpEventC*)e; callHangUp(phoneEvent->reason); return TRUE; } case CALL_HANG_UP_BY_SELF_EVENT: { PhoneMonitorHangupBySelfEventC *phoneEvent = (PhoneMonitorHangupBySelfEventC *)e; hangupBySelf(); return TRUE; } case MISS_CALL_EVENT: { PhoneMonitorMissCallEventC *phoneEvent =(PhoneMonitorMissCallEventC*)e; missCall(phoneEvent->cPhoneNumber); return TRUE; } case NEW_SMS_EVENT: { PhoneMonitorNewSMSEventC *phoneEvent =(PhoneMonitorNewSMSEventC*)e; newSMS(phoneEvent->SMSData); return TRUE; } case SMS_SEND_RESULT_EVENT: { PhoneMonitorSmsSendResultEventC *phoneEvent =(PhoneMonitorSmsSendResultEventC*)e; smsSendResult(phoneEvent->result); return TRUE; } case SMS_SEND_WITH_ID_RESULT_EVENT: { PhoneMonitorSmsSendWithIdResultEventC *phoneEvent =(PhoneMonitorSmsSendWithIdResultEventC*)e; smsSendWithIdResult(phoneEvent->id, phoneEvent->result); return TRUE; } case SIGNAL_NETWORK_TYPE_NOTIFY_EVENT: { PhoneMonitorSignalAndNetworkTypeNotifyEventC *phoneEvent =(PhoneMonitorSignalAndNetworkTypeNotifyEventC*)e; signalAndNetworkType(phoneEvent->signal,phoneEvent->networkType); return TRUE; } case SIGNAL_NETWORK_SERVICE_TYPE_NOTIFY_EVENT: { PhoneMonitorSignalAndNetworkTypeAndServiceTypeNotifyEventC *phoneEvent =(PhoneMonitorSignalAndNetworkTypeAndServiceTypeNotifyEventC*)e; IBD_PRINTF(DEBUG_INFOMATION, "update signal network type and service type (main thread)\n") signalAndNetworkTypeAndServiceType(phoneEvent->signal,phoneEvent->network,phoneEvent->service,phoneEvent->signal_strength); int signal; if( Strength_0 == phoneEvent->signal ) signal = 0; else if( Strength_1 == phoneEvent->signal ) signal = 1; else if( Strength_2 == phoneEvent->signal ) signal = 2; else if( Strength_3 == phoneEvent->signal ) signal = 3; else if( Strength_4 == phoneEvent->signal ) signal = 4; else if( Strength_5 == phoneEvent->signal ) signal = 5; else signal = -1; int networkType; if( Network_3G == phoneEvent->network ) networkType = 3; else if( Network_2G == phoneEvent->network ) networkType = 2; else networkType = 0; signalAndNetworkType(signal,networkType); return TRUE; } case RING_EVENT: { PhoneMonitorRingEventC *phoneEvent =(PhoneMonitorRingEventC*)e; ring(phoneEvent->cPhoneNumber); return TRUE; } case NEW_FACE_TIME_CALL_EVENT: { PhoneMonitorNewFaceTimeCallEventC *phoneEvent =(PhoneMonitorNewFaceTimeCallEventC*)e; newFaceTimeCall(phoneEvent->cPhoneNumber); return TRUE; } case END_FACE_TIME_CALL_EVENT: { PhoneMonitorEndFaceTimeCallEventC *phoneEvent =(PhoneMonitorEndFaceTimeCallEventC*)e; endFaceTimeCall(phoneEvent->reason); return TRUE; } case FACE_TIME_CALL_CONNECTED_EVENT: { PhoneMonitorFaceTimeCallConnectEventC *phoneEvent =(PhoneMonitorFaceTimeCallConnectEventC*)e; connectFaceTimeCall(); return TRUE; } case MISS_FACE_TIME_CALL_EVENT: { PhoneMonitorMissFaceTimeCallEventC *phoneEvent =(PhoneMonitorMissFaceTimeCallEventC*)e; missFaceTimeCall(phoneEvent->cPhoneNumber); return TRUE; } default: return QObject::event(e); } }