UserStatus userStatusFor(const Jid& jid, QList<UserListItem*> ul, bool forceEmptyResource) { if (ul.isEmpty()) return UserStatus(); UserStatus u; u.userListItem = ul.first(); if (jid.resource().isEmpty() || forceEmptyResource) { // use priority if (u.userListItem->isAvailable()) { const UserResource &r = *u.userListItem->userResourceList().priority(); u.statusType = r.status().type(); u.status = r.status().status(); u.publicKeyID = r.publicKeyID(); } } else { // use specific UserResourceList::ConstIterator rit = u.userListItem->userResourceList().find(jid.resource()); if (rit != u.userListItem->userResourceList().end()) { u.statusType = (*rit).status().type(); u.status = (*rit).status().status(); u.publicKeyID = (*rit).publicKeyID(); } } if (u.statusType == XMPP::Status::Offline) u.status = u.userListItem->lastUnavailableStatus().status(); return u; }
// 给该玩家发送某好友下线的信息 VOID USER::SendRelationOfflineMsg(USER* pUser) { __ENTER_FUNCTION Assert( pUser ); if( UserStatus() != US_NORMAL ) { return; } ServerPlayer* pServerPlayer = g_pServerManager->GetServerPlayer( GetServerID() ); if( pServerPlayer == NULL ) { Assert( pServerPlayer ); return; } WGRelation Msg; WG_RELATION* pRelation = Msg.GetRelation(); pRelation->SetPlayerID( GetPlayerID() ); pRelation->m_Type = RET_RELATIONOFFLINE; pRelation->m_RelationGUID.SetTargetGUID( pUser->GetGUID() ); pServerPlayer->SendPacket( &Msg ); __LEAVE_FUNCTION }
VSCMainWindows::VSCMainWindows(ClientFactory &pFactory, QWidget *parent) : m_pFactory(pFactory), QMainWindow(parent), m_VidIdx(VSC_VID_IDX_LAST) { ui.setupUi(this); #ifdef WIN32 setStyleSheet(QString::fromUtf8("font: 10pt \"\345\276\256\350\275\257\351\233\205\351\273\221\";")); #endif m_pToolBar = new VSCToolBar(this); SetupToolBar(); VSCLoading *loading = new VSCLoading(NULL); loading->show(); QDesktopWidget *desktop = QApplication::desktop(); QRect rect = desktop->screenGeometry(0); loading->setGeometry(rect.width()/2, rect.height()/2, 64, 64); QCoreApplication::processEvents(); //QDockWidget *m_pDockDevicelist = new QDockWidget(tr("Devices"), this); m_pDockDevicelist = new QDockWidget(m_parent); m_pDockDevicelist->setFeatures(QDockWidget::DockWidgetMovable); //m_pDockDevicelist->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); m_pDockDevicelist->setAllowedAreas(Qt::LeftDockWidgetArea); m_pDockDevicelist->setTitleBarWidget(new QWidget(m_parent)); m_pVidList = new VSCVidList(m_pDockDevicelist); m_pDockDevicelist->setWidget(m_pVidList); /* Show the Live default */ m_pVidLive = new VSCVidLive(m_pFactory, this); m_pVidConf = new VSCVidInf(m_pFactory, this);//TODO m_pVidPb = new VSCVidInf(m_pFactory, this);//TODO ShowVidLive(); delete loading; setWindowTitle(QApplication::translate("VSCMainWindowsClass", VE_INFO, 0)); connect(m_pToolBar->ui.pbFullScreen, SIGNAL(clicked()), this, SLOT(SetFullScreen())); connect(m_pToolBar->ui.pbAbout, SIGNAL(clicked()), this, SLOT(about())); connect(m_pToolBar->ui.pbUser, SIGNAL(clicked()), this, SLOT(UserStatus())); connect(m_pToolBar->ui.pbVidLive, SIGNAL(clicked()), this, SLOT(ShowVidLive())); connect(m_pToolBar->ui.pbVidLiveView, SIGNAL(clicked()), m_pVidLive, SLOT(SlotNewLiveView())); connect(m_pToolBar->ui.pbEmap, SIGNAL(clicked()), m_pVidLive, SLOT(SlotNewEmap())); connect(m_pToolBar->ui.pbVidPb, SIGNAL(clicked()), this, SLOT(ShowVidPb())); connect(m_pToolBar->ui.pbVidConf, SIGNAL(clicked()), this, SLOT(ShowVidConf())); }
void VSCMainWindows::SetupConnections() { connect(m_pMainArea, SIGNAL(tabCloseRequested(int)), this, SLOT(MainCloseTab(int))); connect(m_pDeviceList, SIGNAL(SurveillanceClicked()), this, SLOT(AddSurveillance())); connect(m_pDeviceList, SIGNAL(CameraAddClicked()), this, SLOT(AddCamera())); connect(m_pDeviceList, SIGNAL(EmapClicked()), this, SLOT(AddEmap())); connect(m_pDeviceList, SIGNAL(DminingClicked()), this, SLOT(AddDmining())); connect(m_pDeviceList, SIGNAL(SearchClicked()), this, SLOT(Search())); connect(m_pDeviceList, SIGNAL(RecorderClicked()), this, SLOT(AddRecorder())); connect(m_pDeviceList, SIGNAL(CameraEditClicked(int)), this, SLOT(EditCamera(int))); connect(m_pDeviceList, SIGNAL(CameraDeleteClicked(int)), this, SLOT(DeleteCamera(int))); /* VIPC */ connect(m_pDeviceList, SIGNAL(VIPCAddClicked()), this, SLOT(AddVIPC())); connect(m_pDeviceList, SIGNAL(VIPCEditClicked(int)), this, SLOT(EditVIPC(int))); connect(m_pDeviceList, SIGNAL(VIPCDeleteClicked(int)), this, SLOT(DeleteVIPC(int))); /* Camera Group */ connect(m_pDeviceList, SIGNAL(VGroupAddClicked()), this, SLOT(AddVGroup())); connect(m_pDeviceList, SIGNAL(VGroupEditClicked(int)), this, SLOT(EditVGroup(int))); connect(m_pDeviceList, SIGNAL(VGroupDeleteClicked(int)), this, SLOT(DeleteVGroup(int))); connect(m_pDeviceList, SIGNAL(VGroupMapClicked()), this, SLOT(MapVGroup())); /* Disk edit */ connect(m_pDeviceList, SIGNAL(DiskEditClicked()), this, SLOT(EditDisk())); /* View */ connect(m_pDeviceList, SIGNAL(ViewDeleteClicked(int)), this, SLOT(DeleteView(int))); /* VMS */ connect(m_pDeviceList, SIGNAL(VMSDeleteClicked(int)), this, SLOT(DeleteVMS(int))); //connect(this, SIGNAL(CameraDeleted()), m_pDeviceList, SLOT(CameraTreeUpdated())); connect(m_pToolBar->ui.pbFullScreen, SIGNAL(clicked()), this, SLOT(SetFullScreen())); connect(m_pToolBar->ui.pbAbout, SIGNAL(clicked()), this, SLOT(about())); connect(m_pToolBar->ui.pbAlarm, SIGNAL(clicked()), this, SLOT(AddEvent())); connect(m_pToolBar->ui.pbSetting, SIGNAL(clicked()), this, SLOT(Setting())); connect(m_pToolBar->ui.pbUser, SIGNAL(clicked()), this, SLOT(UserStatus())); connect(m_pEventThread, SIGNAL(EventNotifyNoParam()), m_pToolBar, SLOT(NewAlarm())); }
VSCMainWindows::VSCMainWindows(ClientFactory &pFactory, QWidget *parent) : m_pFactory(pFactory), QMainWindow(parent), m_VidIdx(VSC_VID_IDX_LAST), m_pMainView(NULL), m_pDashBoard(NULL), m_pEventConsole(NULL) { ui.setupUi(this); #ifdef WIN32 setStyleSheet(QString::fromUtf8("font: 10pt \"\345\276\256\350\275\257\351\233\205\351\273\221\";")); #endif m_pToolBar = new VSCToolBar(this); SetupToolBar(); VSCLoading *loading = new VSCLoading(NULL); loading->show(); QDesktopWidget *desktop = QApplication::desktop(); QRect rect = desktop->screenGeometry(0); loading->setGeometry(rect.width()/2, rect.height()/2, 64, 64); QCoreApplication::processEvents(); //QDockWidget *m_pDockDevicelist = new QDockWidget(tr("Devices"), this); m_pDockDevicelist = new QDockWidget(this); m_pDockDevicelist->setFeatures(QDockWidget::DockWidgetMovable); m_pDockDevicelist->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); //m_pDockDevicelist->setAllowedAreas(Qt::LeftDockWidgetArea); m_pDockDevicelist->setTitleBarWidget(new QWidget(this)); m_pVidList = new VSCVidList(m_pDockDevicelist); m_pDockDevicelist->setWidget(m_pVidList); addDockWidget(Qt::LeftDockWidgetArea, m_pDockDevicelist); //addDockWidget(Qt::RightDockWidgetArea, m_pDockDevicelist); m_pMainArea = new QTabWidget(this); m_pMainArea->setTabsClosable(true); m_pMainArea->setMovable(true); setCentralWidget(m_pMainArea); connect(m_pMainArea, SIGNAL(tabCloseRequested(int)), this, SLOT(MainCloseTab(int))); /* Show the Live default */ m_pVidLive = new VSCVidLive(m_pFactory, *m_pMainArea, this); m_pMainView = m_pVidLive->GetMainView(); m_pVidConf = new VSCVidConf(m_pFactory, *m_pMainArea, this); m_pVidPb = new VSCVidSearchPB(m_pFactory, *m_pMainArea, this); /* First hide all */ m_pToolBar->ui.pbVidEventSearch->hide(); m_pToolBar->ui.pbVidMotionSearch->hide(); m_pVidLive->VidHide(); m_pVidConf->VidHide(); m_pVidPb->VidHide(); ShowVidLive(); delete loading; setWindowTitle(QApplication::translate("VSCMainWindowsClass", VE_INFO, 0)); connect(m_pToolBar->ui.pbFullScreen, SIGNAL(clicked()), this, SLOT(SetFullScreen())); //connect(m_pToolBar->ui.pbAbout, SIGNAL(clicked()), this, SLOT(ShowAbout())); connect(m_pToolBar->ui.pbAbout, SIGNAL(clicked()), this, SLOT(about())); connect(m_pToolBar->ui.pbUser, SIGNAL(clicked()), this, SLOT(UserStatus())); connect(m_pToolBar->ui.pbVidLive, SIGNAL(clicked()), this, SLOT(ShowVidLive())); connect(m_pToolBar->ui.pbVidLiveView, SIGNAL(clicked()), m_pVidLive, SLOT(SlotNewLiveView())); connect(m_pToolBar->ui.pbVidPb, SIGNAL(clicked()), m_pVidLive, SLOT(SlotNewLivePB())); connect(m_pToolBar->ui.pbVidSearch, SIGNAL(clicked()), this, SLOT(ShowVidPb())); connect(m_pToolBar->ui.pbVidEventSearch, SIGNAL(clicked()), m_pVidPb, SLOT(SlotNewEventSearch())); connect(m_pToolBar->ui.pbVidMotionSearch, SIGNAL(clicked()), m_pVidPb, SLOT(SlotNewMotionSearch())); connect(m_pToolBar->ui.pbVidPb, SIGNAL(clicked()), m_pVidLive, SLOT(SlotNewLivePB())); connect(m_pToolBar->ui.pbVidConf, SIGNAL(clicked()), this, SLOT(ShowVidConf())); connect(m_pToolBar->ui.pbVidDashBoard, SIGNAL(clicked()), this, SLOT(ShowDashBoard())); connect(m_pToolBar->ui.pbAlarm, SIGNAL(clicked()), this, SLOT(ShowEventConsole())); connect(&(m_pFactory.GetStorFactory()), SIGNAL(SignalEvent1()), m_pToolBar, SLOT(NewAlarm())); m_pEventConsole = new VSCEventConsole(m_pFactory, this); m_pEventConsole->hide(); }