Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void * /*reserved*/) { typedef union { JNIEnv *nativeEnvironment; void *venv; } UnionJNIEnvToVoid; LOG_MODEL_DEBUG("CAndroidNotification", "JNI_OnLoad start"); UnionJNIEnvToVoid uenv; uenv.venv = NULL; javaVM = 0; if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK) { LOG_MODEL_ERROR("CAndroidNotification", "GetEnv failed"); return -1; } JNIEnv *env = uenv.nativeEnvironment; if (!registerNatives(env)) { LOG_MODEL_ERROR("CAndroidNotification", "registerNatives failed"); return -1; } javaVM = vm; return JNI_VERSION_1_4; }
int CFrmUserList::InsertUser(CRoster *pRoster) { int nRet = 0; if(NULL == pRoster) { LOG_MODEL_ERROR("CFrmUserList", "Don't memery"); return -1; } QMap<QString, CRoster*>::iterator itRosters; itRosters = m_Rosters.find(pRoster->BareJid()); if(m_Rosters.end() == itRosters) { //新建好友对象实例 m_Rosters.insert(pRoster->BareJid(), pRoster); } else { LOG_MODEL_ERROR("Roster", qPrintable("Error:User had existed")); return -1; } nRet = UpdateGroup(pRoster, pRoster->Groups()); return nRet; }
int CDownLoadHandleVersionFile::OnEnd(int nErrorCode) { if(m_szFile.isEmpty()) return -1; if(nErrorCode) { LOG_MODEL_ERROR("Update", "Don't open version configure file:%s", m_szFile.toStdString().c_str()); return -2; } QFile file(m_szFile); if(!file.open(QIODevice::ReadOnly)) { LOG_MODEL_ERROR("Update", "Don't open version configure file:%s", m_szFile.toStdString().c_str()); return -3; } QString szErr; QDomDocument doc; if(!doc.setContent(&file, &szErr)) { LOG_MODEL_ERROR("Update", "doc.setContent error:%s", szErr.toStdString().c_str()); return -4; } file.close(); if(doc.isNull()) { LOG_MODEL_ERROR("Update", "doc is null"); return -5; } CGlobal::Instance()->SetUpdateDate(QDateTime::currentDateTime()); QDomElement startElem = doc.documentElement(); QString szMajorVersion = startElem.firstChildElement("MAJOR_VERSION_NUMBER").text(); QString szMinorVersion = startElem.firstChildElement("MINOR_VERSION_NUMBER").text(); QString szRevisionVersion = startElem.firstChildElement("REVISION_VERSION_NUMBER").text(); if(szMajorVersion.toInt() <= MAJOR_VERSION_NUMBER) { if(szMinorVersion.toInt() <= MINOR_VERSION_NUMBER) { if(szRevisionVersion.toInt() <= REVISION_VERSION_NUMBER) { LOG_MODEL_DEBUG("Update", "Is already the newest version."); return 0; } } } emit GET_MAINWINDOW->sigUpdateExec(nErrorCode, m_szFile); return 0; }
int CManageCallWebrtcXmpp::WebrtcIqReceived(QXmppWebRtcIq &iq) { if(iq.type() != QXmppIq::Set) { LOG_MODEL_ERROR("CManageCallWebrtcXmpp", "CManageCallWebrtcXmpp" "::WebrtcIqReceived iq type isn't set"); return -1; } QXmppWebRtcIq::ACTION action = iq.GetAction(); if(QXmppWebRtcIq::Call == action) { OnReciveCall(iq); return 0; } QString szId = QXmppUtils::jidToBareJid(iq.from()); QMap<QString, QSharedPointer<CCallObject> >::iterator it = m_Call.find(szId); if(m_Call.end() == it) { LOG_MODEL_ERROR("CManageCallWebrtcXmpp", "CManageCallWebrtcXmpp" "::WebrtcIqReceived don't find %s", szId.toStdString().c_str()); return -2; } QSharedPointer<CCallObject> call = it.value(); if(call.isNull()) { LOG_MODEL_ERROR("CManageCallWebrtcXmpp", "CManageCallWebrtcXmpp" "::WebrtcIqReceived don't find %s", szId.toStdString().c_str()); return -3; } CCallObjectQXmppWebrtc* pCall = (CCallObjectQXmppWebrtc*)call.data(); switch (action) { case QXmppWebRtcIq::Accept: pCall->ReciveAccept(); break; case QXmppWebRtcIq::Stop: pCall->ReciveStop(); break; case QXmppWebRtcIq::DescriptionInfo: pCall->ReciveSeesionDescription(iq); break; case QXmppWebRtcIq::TransportInfo: pCall->ReciveTransportInfo(iq); break; default: break; } return 0; }
int CTool::ConvertFormat(/*[in]*/const std::shared_ptr<CVideoFrame> &inFrame, /*[out]*/ std::shared_ptr<CVideoFrame> &outFrame, /** 转换后图像 */ /*[in]*/ int nOutWidth, /** 转换后的帧的宽度 */ /*[in]*/ int nOutHeight, /** 转换后的帧的高度 */ /*[in]*/ VideoFormat format) { int nRet = 0; if(!inFrame) { LOG_MODEL_ERROR("CTool", "frame is null"); return -1; } AVPixelFormat inFormat, outFormat; inFormat = VideoFormatToFFMpegPixFormat(inFrame->m_VideoInfo.Format); outFormat = VideoFormatToFFMpegPixFormat(format); AVPicture pic; nRet = avpicture_fill(&pic, (uint8_t*)inFrame->GetData(), inFormat, inFrame->m_VideoInfo.nWidth, inFrame->m_VideoInfo.nHeight); if(nRet < 0) { LOG_MODEL_ERROR("Tool", "avpicture_fill fail:%x", nRet); return nRet; } AVPicture outPic; nRet = ConvertFormat(pic, inFrame->m_VideoInfo.nWidth, inFrame->m_VideoInfo.nHeight, inFormat, outPic, nOutWidth, nOutHeight, outFormat); if(nRet) return nRet; int nLen = avpicture_get_size(outFormat, nOutWidth, nOutHeight); VideoInfo vi; vi.Format = format; vi.nHeight = nOutHeight; vi.nWidth = nOutWidth; vi.nRatio = inFrame->m_VideoInfo.nRatio; std::shared_ptr<CVideoFrame> frame( new CVideoFrame(outPic.data[0], nLen, vi, inFrame->m_Timestamp)); outFrame = frame; avpicture_free(&pic); avpicture_free(&outPic); return nRet; }
int CCameraQt::OnOpen(VideoInfo *pVideoInfo) { std::vector<CCameraInfo::CamerInfo> info; CCameraFactory::Instance()->EnumDevice(info); if(0 < m_nIndex || m_nIndex > info.size() - 1) { LOG_MODEL_ERROR("CCameraQt", "Camera [%d] is invalid", m_nIndex); return -1; } if(m_Camera) { LOG_MODEL_WARNING("CCameraQt", "Camera is opened"); return 0; } try{ m_Camera = #if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)) new QCamera((QCamera::Position) m_nIndex); #else new QCamera(QCamera::availableDevices().at(m_nIndex)); #endif }catch(...){ LOG_MODEL_ERROR("CCameraQt", "new QCamera exception "); } if(NULL == m_Camera) { LOG_MODEL_ERROR("CCameraQt", "Don't open camera:%d", m_nIndex); return -1; } if (pVideoInfo) { m_VideoInfo = *pVideoInfo; } m_CameraImageCapture = new QCameraImageCapture(m_Camera); if(m_CameraImageCapture) { bool check = this->connect(m_CameraImageCapture, SIGNAL(imageSaved(int,QString)), SLOT(imageSaved(int,QString))); Q_ASSERT(check); } return 0; }
int CManageCallWebrtcXmpp::LoginInit(const QString &szId) { int nRet = 0; nRet = CManageCall::LoginInit(szId); if(nRet) return nRet; QSharedPointer<CClient> client = GETMANAGER->GetClient(); CClientXmpp* pClient = (CClientXmpp*)client.data(); if(!pClient) { LOG_MODEL_ERROR("Call", "pClient is null"); return -1; } QXmppCallWebrtcManager* pCallManager = pClient->m_Client.findExtension<QXmppCallWebrtcManager>(); if(!pCallManager) { pClient->m_Client.addExtension(new QXmppCallWebrtcManager(this)); pCallManager = pClient->m_Client.findExtension<QXmppCallWebrtcManager>(); } Q_ASSERT(pCallManager); CWebrtcConductor::InitWebrtcGlobal(); return nRet; }
CCamera::CCamera(QObject *parent) : QObject(parent) { if(!parent) LOG_MODEL_ERROR("Video", "CCaptureVideoFrame::CCaptureVideoFrame parent is null"); CFrmVideo* pFrmVideo = (CFrmVideo*)parent; if(pFrmVideo) m_CaptureFrameProcess.moveToThread(pFrmVideo->GetVideoThread()); m_pCamera = NULL; SetDefaultCamera(); bool check = true; check = connect(&m_CaptureVideoFrame, SIGNAL(sigRawCaptureFrame(const QVideoFrame&)), &m_CaptureFrameProcess, SLOT(slotCaptureFrame(const QVideoFrame&))); Q_ASSERT(check); check = connect(&m_CaptureFrameProcess, SIGNAL(sigCaptureFrame(const QVideoFrame&)), this, SIGNAL(sigCaptureFrame(const QVideoFrame&))); Q_ASSERT(check); //捕获的帧转换成了YUV4:2:0格式 check = connect(&m_CaptureFrameProcess, SIGNAL(sigConvertedToYUYVFrame(const QXmppVideoFrame&)), this, SIGNAL(sigConvertedToYUYVFrame(const QXmppVideoFrame&))); Q_ASSERT(check); }
void CDlgUservCard::on_pbBrowse_clicked() { QString szFile, szFilter("*.PNG *.BMP *.JPG *.JPEG *.PBM *.PGM *.PPM *.XBM *.XPM"); szFile = CTool::FileDialog(this, QString(), szFilter, tr("Open File")); if(szFile.isEmpty()) return; //TODO:现在只上传小图片,以后增加上传原图 //原因是openfire把vcard存在数据库中,导制数据库存性能,网络性能降低 QPixmap pixmap(szFile), map; int nWidth = pixmap.width(); int nHeight = pixmap.height(); if(nWidth > RABBITIM_AVATAR_SIZE) nWidth = RABBITIM_AVATAR_SIZE; if(nHeight > RABBITIM_AVATAR_SIZE) nHeight = RABBITIM_AVATAR_SIZE; map = pixmap.scaled(nWidth, nHeight, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); QImageWriter imageWriter(&m_PhotoBuffer, "png"); m_PhotoBuffer.open(QIODevice::WriteOnly); if(!imageWriter.write(map.toImage())) LOG_MODEL_ERROR("CDlgUservCard", "error:%s", imageWriter.errorString().toStdString().c_str()); m_PhotoBuffer.close(); ui->lbPhoto->setPixmap(map); }
int CDownLoadHandleVersionFile::OnError(int nErrorCode, const std::string &szErr) { LOG_MODEL_ERROR("CDownLoadHandleVersionFile", "Download version file error:%d", nErrorCode); return 0; emit GET_MAINWINDOW->sigUpdateExec(nErrorCode, m_szFile); return 0; }
int CUserInfoXmpp::UpdateUserInfo(const QXmppVCardIq &vCard, QString jid) { //if(!vCard.fullName().isEmpty()) // m_szName = vCard.fullName(); m_szNick = vCard.nickName(); m_Birthday = vCard.birthday(); m_szEmail = vCard.email(); m_szDescription = vCard.description(); if(!jid.isEmpty() && m_szJid.isEmpty()) m_szJid = jid; //保存头像 QByteArray photo = vCard.photo(); QBuffer buffer; buffer.setData(photo); buffer.open(QIODevice::ReadOnly); QImageReader imageReader(&buffer); m_imgPhoto = imageReader.read(); buffer.close(); //保存头像到本地 QImageWriter imageWriter(CGlobal::Instance()->GetFileUserAvatar(GetId()), "png"); if(!imageWriter.write(GetPhoto())) LOG_MODEL_ERROR("CUserInfo", "Save avater error, %s", imageWriter.errorString().toStdString().c_str()); return 0; }
int CTool::ConvertFormat(/*[in]*/ const QXmppVideoFrame &inFrame, /*[out]*/AVPicture &outFrame, /*[in]*/ int nOutWidth, /*[in]*/ int nOutHeight, /*[in]*/ AVPixelFormat pixelFormat) { int nRet = 0; AVPicture pic; nRet = avpicture_fill(&pic, (uint8_t*)inFrame.bits(), QXmppVideoFrameFormatToFFMpegPixFormat(inFrame.pixelFormat()), inFrame.width(), inFrame.height()); if(nRet < 0) { LOG_MODEL_ERROR("Tool", "avpicture_fill fail:%x", nRet); return nRet; } nRet = ConvertFormat(pic, inFrame.width(), inFrame.height(), QXmppVideoFrameFormatToFFMpegPixFormat(inFrame.pixelFormat()), outFrame, nOutWidth, nOutHeight, pixelFormat); return nRet; }
int CManageFileTransfer::SendFile(const QString &szId, const QString &szFile, const QString &szDescription) { int nRet = 0; QSharedPointer<CFileTransfer> file; file = GET_CLIENT->SendFile(szId, szFile, szDescription); if(file.isNull()) { return -1; } bool check = connect(file.data(), SIGNAL(sigFinished(const QString&, const QString&)), SLOT(slotFinished(const QString&, const QString&))); Q_ASSERT(check); m_FileTransfer.insertMulti(szId, file); QSharedPointer<CUser> roster = GLOBAL_USER->GetUserInfoRoster(szId); if(roster.isNull()) { LOG_MODEL_ERROR("CManageFileTransfer", "There isn't roster:%s", szId.toStdString().c_str()); return -1; } QSharedPointer<CFileTransferAction> action(new CFileTransferAction(file, szId, QTime::currentTime(), true)); roster->GetMessage()->AddMessage(action); emit GET_CLIENT->sigMessageUpdate(szId); return nRet; }
int QXmppCallWebrtcManager::sendPacket(QXmppWebRtcIq &iq) { if(this->client()->sendPacket(iq)) return 0; LOG_MODEL_ERROR("WEBRTC", "QXmppCallWebrtcManager::sendPacket"); return -1; }
bool CSmileyPack::load(const QString& filename) { // discard old data filenameTable.clear(); imgCache.clear(); emoticons.clear(); path.clear(); // open emoticons.xml QFile xmlFile(filename); if(!xmlFile.open(QIODevice::ReadOnly)) { LOG_MODEL_ERROR("CSmileyPack", "Don't open file:%s", qPrintable(filename)); return false; // cannot open file } /* parse the cfg file * sample: * <?xml version='1.0'?> * <messaging-emoticon-map> * <emoticon file="smile.png" > * <string>:)</string> * <string>:-)</string> * </emoticon> * <emoticon file="sad.png" > * <string>:(</string> * <string>:-(</string> * </emoticon> * </messaging-emoticon-map> */ path = QFileInfo(filename).absolutePath(); QDomDocument doc; doc.setContent(xmlFile.readAll()); QDomNodeList emoticonElements = doc.elementsByTagName("emoticon"); for (int i = 0; i < emoticonElements.size(); ++i) { QString file = emoticonElements.at(i).attributes().namedItem("file").nodeValue(); QDomElement stringElement = emoticonElements.at(i).firstChildElement("string"); QStringList emoticonSet; // { ":)", ":-)" } etc. while (!stringElement.isNull()) { QString emoticon = stringElement.text(); filenameTable.insert(emoticon, file); emoticonSet.push_back(emoticon); cacheSmiley(file); // preload all smileys stringElement = stringElement.nextSibling().toElement(); } emoticons.push_back(emoticonSet); } // success! return true; }
int CCamera::SetDeviceIndex(int index) { LOG_MODEL_DEBUG("Video", "CCamera::SetDeviceIndex:%d", index); if(QCamera::availableDevices().isEmpty()) { LOG_MODEL_ERROR("Video", "There isn't Camera"); return -1; } if(!(QCamera::availableDevices().length() > index)) { LOG_MODEL_ERROR("Video", "QCamera.availableDevices().length() > index"); return -2; } m_CameraPosition = QCamera::availableDevices().at(index); return 0; }
void CDlgScreenShot::mouseReleaseEvent(QMouseEvent *e) { LOG_MODEL_DEBUG("screen shot", "mouseReleaseEvent:e->pos:x:%d;y:%d;QCursor::pos:x:%d;y:%d", e->pos().x(), e->pos().y(), QCursor::pos().x(), QCursor::pos().y()); if(!m_bGrabing) { QWidget::mouseReleaseEvent(e); return; } if(e->button() == Qt::LeftButton) { m_bGrabing = false; setCursor(Qt::ArrowCursor); WId id = qApp->desktop()->winId(); QRect rect = QRect(m_x,m_y,m_width,m_height).normalized(); LOG_MODEL_DEBUG("screen shot", "x:%d;y:%d;width:%d;height:%d;DlgWidth:%d;DlgHeight:%d", rect.x(), rect.y(), rect.width(), rect.height(), this->width(), this->height()); QPixmap pix = QPixmap(); QScreen *pScreen = QGuiApplication::primaryScreen(); pix = pScreen->grabWindow(id, rect.x(), rect.y(), rect.width(), rect.height()); int x = rect.x(), y = rect.y() + rect.height(); m_Editor.toolBar.show(); //需要先显示,才能得到正确的大小 QRect rectToolBar = m_Editor.toolBar.frameGeometry(); LOG_MODEL_DEBUG("screen shot", "x:%d;y:%d;width:%d;height:%d", rectToolBar.x(), rectToolBar.y(), rectToolBar.width(), rectToolBar.height()); if(y + rectToolBar.height() >= this->height()) { y = rect.y() - rectToolBar.height(); } else if(x + rectToolBar.width() >= this->width()) { x = this->width() - rectToolBar.width(); LOG_MODEL_ERROR("screen shot", "x:%d;y:%d;width:%d;height:%d;toolx:%d", rectToolBar.x(), rectToolBar.y(), rectToolBar.width(), rectToolBar.height(), x); } m_Editor.toolBar.move(x, y); m_Editor.resetByImg(pix); m_Editor.move(rect.topLeft());//移动到当前选择的rect的左上角 m_Editor.show(); } }
int CUserInfoXmpp::UpdateStatus(const USER_INFO_STATUS status, const QString jid) { if(jid.isEmpty()) { LOG_MODEL_ERROR("CUserInfoXmpp", "CUserInfoXmpp::UpdateStatus jid is empty"); return -1; } SetStatus(status); m_szJid = jid; return 0; }
void CLbsPositionLogger::readNextPosition() { QByteArray line = m_logFile.readLine().trimmed(); if (line.isEmpty()) { LOG_MODEL_ERROR("CLbsPositionLogger", "no readlien"); return; } QList<QByteArray> data = line.split(','); QGeoCoordinate coordinate; QGeoPositionInfo info; bool hasTimestamp = false; QDateTime timestamp = QDateTime::fromTime_t(data.value(0).toLong(&hasTimestamp), Qt::UTC); if(hasTimestamp && timestamp.isValid()) info.setTimestamp(timestamp); double latitude; bool hasLatitude = false; latitude = data.value(1).toDouble(&hasLatitude); if(hasLatitude) coordinate.setLatitude(latitude); double longitude; bool hasLongitude = false; longitude = data.value(2).toDouble(&hasLongitude); if(hasLongitude) coordinate.setLongitude(longitude); double altitude; bool hasAltitude = false; altitude = data.value(3).toDouble(&hasAltitude); if(hasAltitude) coordinate.setAltitude(altitude); info.setCoordinate(coordinate); double HorizontalAccuracy; bool hasHorizontalAccuracy = false; HorizontalAccuracy = data.value(4).toDouble(&hasHorizontalAccuracy); if(hasHorizontalAccuracy) info.setAttribute(QGeoPositionInfo::HorizontalAccuracy, HorizontalAccuracy); double Direction; bool hasDirection = false; Direction = data.value(5).toDouble(&hasDirection); if(hasDirection) info.setAttribute(QGeoPositionInfo::Direction, Direction); double GroundSpeed; bool hasGroundSpeed = false; GroundSpeed = data.value(6).toDouble(&hasGroundSpeed); if(hasGroundSpeed) info.setAttribute(QGeoPositionInfo::GroundSpeed, GroundSpeed); if (info.isValid()) { m_lastPosition = info; emit positionUpdated(info); } }
int CManageGroupChat::SaveToStorage() { int nRet = 0; if(USER_INFO_LOCALE.isNull()) { LOG_MODEL_ERROR("CManageGroupChat", "USER_INFO_LOCALE is null"); return -1; } QString szFile = CGlobalDir::Instance()->GetDirUserData(USER_INFO_LOCALE->GetInfo()->GetId()) + QDir::separator() + "GroupChat.dat"; QFile out(szFile); if(!out.open(QFile::WriteOnly)) { LOG_MODEL_WARNING("CManageGroupChat", "Don't open file:%s", szFile.toStdString().c_str()); return -1; } try { QDataStream s(&out); //版本号 int nVersion = 1; s << nVersion << m_GroupChat.size(); QMap<QString, QSharedPointer<CGroupChat> >::iterator it; for(it = m_GroupChat.begin(); it != m_GroupChat.end(); it++) { s << it.key() << it.value()->Password() << it.value()->Nick(); } } catch(...) { LOG_MODEL_ERROR("CManageGroupChat", "CManageGroupChat::SaveToStorage exception"); return -1; } out.close(); return nRet; }
int CManagePluginProtocol::RegisterPlugin(const QString &szProtocol, CPluginProtocol *plugin) { if(m_Plugins.find(szProtocol) != m_Plugins.end()) { LOG_MODEL_ERROR("CManagePluginProtocol", "Plugin [%s] is registered", szProtocol.toStdString().c_str()); return -1; } m_Plugins.insert(std::pair<QString, CPluginProtocol* >(szProtocol, plugin)); return 0; }
int CCameraQt::Stop() { if(NULL == m_Camera) { LOG_MODEL_ERROR("CCameraQt", "Camera don't open"); return -1; } if(m_Camera->state() == QCamera::ActiveState) m_Camera->stop(); return 0; }
int CManageCallWebrtcXmpp::Call(const QString &szId, bool bVideo) { //检查是否是好友 QSharedPointer<CUser> roster = GLOBAL_USER->GetUserInfoRoster(szId); if(roster.isNull()) { LOG_MODEL_ERROR("CManageCall", "Don't get roster:%s", qPrintable(szId)); return -1; } QSharedPointer<CUserInfo> info = roster->GetInfo(); CUserInfoXmpp* pInfo = (CUserInfoXmpp*)info.data(); if(pInfo->GetResource().isEmpty()) { LOG_MODEL_ERROR("Call", "CClientXmpp::Call the roster resource is null"); roster->GetMessage()->AddMessage(szId, tr("The roster is offline, don't launch a call."), true); emit GET_CLIENT->sigMessageUpdate(szId); return -2; } return CManageCall::Call(szId, bVideo); }
CPluginProtocol *CManagePluginProtocol::GetPlugin( const QString &szProtocol) { std::map<QString, CPluginProtocol* >::iterator it; it = m_Plugins.find(szProtocol); if(m_Plugins.end() == it) { LOG_MODEL_ERROR("CManagePluginProtocol", "GetPlugin %s is fail", szProtocol.toStdString().c_str()); return NULL; } return it->second; }
static bool registerNatives(JNIEnv *env) { jclass clazz; FIND_AND_CHECK_CLASS("org/KangLinStudio/RabbitIm/RabbitImActivity"); RabbitImActivityClass = static_cast<jclass>(env->NewGlobalRef(clazz)); if (env->RegisterNatives(RabbitImActivityClass, methods, sizeof(methods) / sizeof(methods[0])) < 0) { LOG_MODEL_ERROR("CAndroidNotification", "RegisterNatives failed"); return JNI_FALSE; } return true; }
int CManageCallWebrtcXmpp::OnCall(const QString &szId, QSharedPointer<CCallObject> &call, bool bVideo) { QSharedPointer<CClient> client = GETMANAGER->GetClient(); CClientXmpp* pClient = (CClientXmpp*)client.data(); if(!pClient) { LOG_MODEL_ERROR("CManageCallWebrtcXmpp", "pClient is null"); return -1; } QXmppCallWebrtcManager* pCallManager = pClient->m_Client.findExtension<QXmppCallWebrtcManager>(); if(!pCallManager) return -2; QSharedPointer<CUser> roster = GLOBAL_USER->GetUserInfoRoster(szId); if(roster.isNull()) { LOG_MODEL_ERROR("CManageCallWebrtcXmpp", "CManageCallWebrtcXmpp::OnCall the roster is null"); return -3; } //因为 xmpp iq 协议需要用户的资源(jid)才会进行转发 QSharedPointer<CUserInfo> info = roster->GetInfo(); CUserInfoXmpp* pInfo = (CUserInfoXmpp*)info.data(); QSharedPointer<CCallObjectQXmppWebrtc> callWebrtc( new CCallObjectQXmppWebrtc(pInfo->GetJid(), bVideo, pCallManager)); if(callWebrtc.isNull()) { LOG_MODEL_ERROR("CManageCallWebrtcXmpp", "CManageCallWebrtcXmpp::CallVideo fail"); return -3; } call = callWebrtc; return callWebrtc->Call(); }
int CLbsPositionLogger::OpenFile(const char *pszFile) { if(pszFile) m_szFile = pszFile; m_logFile.setFileName(m_szFile); if(!m_logFile.open(QIODevice::ReadOnly | QIODevice::WriteOnly)) { LOG_MODEL_ERROR("CLbsPositionLogger", "open file fail:%s", m_szFile.toStdString().c_str()); return -1; } return 0; }
int CManageCallWebrtcXmpp::OnReciveCall(QXmppWebRtcIq &iq) { QString szId = iq.from(); LOG_MODEL_DEBUG("CManageCallWebrtcXmpp", "szId:%s", szId.toStdString().c_str()); bool bVideo = iq.IsVideo(); QSharedPointer<CClient> client = GETMANAGER->GetClient(); CClientXmpp* pClient = (CClientXmpp*)client.data(); if(!pClient) { LOG_MODEL_ERROR("CManageCallWebrtcXmpp", "pClient is null"); return -1; } QXmppCallWebrtcManager* pCallManager = pClient->m_Client.findExtension<QXmppCallWebrtcManager>(); if(!pCallManager) return -2; QSharedPointer<CCallObjectQXmppWebrtc> call(new CCallObjectQXmppWebrtc(szId, bVideo, pCallManager)); if(call.isNull()) { LOG_MODEL_ERROR("CManageCallWebrtcXmpp", "CManageCallWebrtcXmpp::CallVideo fail"); return -3; } slotCallReceived(call); return 0; }
int CCameraPjsip::Stop() { int nRet = 0; pj_status_t status = PJ_FALSE; if (m_pVidDevStream) { status = pjmedia_vid_dev_stream_stop(m_pVidDevStream); if (PJ_SUCCESS != status) { LOG_MODEL_ERROR("CCamera", "pjmedia_vid_dev_stream_stop faile"); return -1; } } return nRet; }
void CDlgUservCard::on_pbSaveAs_clicked() { QString szFile, szFilter("*.PNG *.BMP *.JPG *.JPEG *.PBM *.PGM *.PPM *.XBM *.XPM"); szFile = CTool::FileDialog(this, "rabbitim_" + m_szJid + ".PNG", szFilter, tr("Save as"), QFileDialog::AcceptSave); if(szFile.isEmpty()) return; if(m_Image.isNull()) return; if(!m_Image.save(szFile)) LOG_MODEL_ERROR("CDlgAbout", "Save qrencode fail:%s", szFile.toStdString().c_str()); }