📄 callanswersub.cxx
字号:
//// The contents of this file are subject to the Mozilla Public License// Version 1.0 (the "License"); you may not use this file except in// compliance with the License. You may obtain a copy of the License at// http://www.mozilla.org/MPL/// // Software distributed under the License is distributed on an "AS IS"// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See// the License for the specific language governing rights and limitations// under the License.// // The Original Code is CPhone, a cross platform voip gui.//// The Initial Developer of the Original Code is Derek Smithies.//// Copyright (C) 2002 Indranet Technologies Ltd, // http://www.indranet-technologies.com// All Rights Reserved.//// Contributor(s): _______________/* * * $Log: callanswerSub.cxx,v $ * Revision 1.2 2003/04/04 04:37:49 dereksmithies * Major upgrade. * Ixj & microtelco support added. Fix threading issues. * * Revision 1.1.1.1 2002/05/12 22:55:05 dereksmithies * Initial release. * * * * */#include <ptlib.h>#include <qmessagebox.h>#include <qpushbutton.h>#include <qlabel.h>#include <qtimer.h>#include <qevent.h>#include <qapplication.h>#include "mainwindowSub.h"#include "callanswerSub.h"#define CUSTOM_EVENT_SETUP (QEvent::User + 1)CallAnswer::CallAnswer(QString remote) : FormCallAnswer( 0, "Call Answer", FALSE, WStyle_NoBorderEx), remoteNode(remote){ CPhone::Current().SetWindowId(eCallAnswer, winId()); QApplication::postEvent(this, new QCustomEvent(CUSTOM_EVENT_SETUP));}void CallAnswer::Setup(){ TextLabelCallFrom->setText("Call from " + remoteNode); move(600,60); qApp->beep(); //Alert the user. We need a response. startTimer(1000 * 30);//1 minute timeout on user response.}/* * Destroys the object and frees any allocated resources */CallAnswer::~CallAnswer(){}void CallAnswer::AcceptIncomingCall_slot(){ if (CPhone::Current().ForgetExists(eCallAnswer, winId())); AdviseParent(CALL_ANSWER_RESPONSE_YES); close (TRUE);}void CallAnswer::RejectIncomingCall_slot(){ if (CPhone::Current().ForgetExists(eCallAnswer, winId())); AdviseParent(CALL_ANSWER_RESPONSE_NO); close (TRUE);}void CallAnswer::closeEvent(QCloseEvent *e){ if (CPhone::Current().ForgetExists(eCallAnswer, winId())); AdviseParent(CALL_ANSWER_RESPONSE_TMO); e->accept();}void CallAnswer::timerEvent(QTimerEvent *){ if (CPhone::Current().ForgetExists(eCallAnswer, winId())); { AdviseParent(CALL_ANSWER_RESPONSE_TMO); CPhone::GetUi().DisplayMessage("Ignoring incoming call from " + remoteNode); } close(TRUE); //TRUE means delete this class.}void CallAnswer::AdviseParent(unsigned action){ QCustomEvent *ce = new QCustomEvent(action); QApplication::postEvent(&CPhone::Current().GetUi(), ce);}void CallAnswer::customEvent( QCustomEvent *e){ if (e->type() == CUSTOM_EVENT_DIE) close(TRUE); if (e->type() == CUSTOM_EVENT_SETUP) Setup();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -