bool MsgBubbleSnapChat::OnClicked(ui::EventArgs* arg) { //如果是阅后即焚,则需要先下载好图片 Json::Value json; if (StringToJson(msg_.attach_, json)) { std::string url = json["data"]["url"].asString(); if (nbase::FilePathIsExist(src_image_path_, false)) { ImageViewManager::GetInstance()->StartViewPic(src_image_path_, L"", true, true); nim::MsgLog::DeleteAsync(sid_, type_, msg_.client_msg_id_, nim::MsgLog::DeleteCallback()); SessionBox* session = dynamic_cast<SessionBox*>(SessionManager::GetInstance()->FindSessionBox(sid_)); if (session) session->OnSnapchatReadCallback(msg_.client_msg_id_); } else { nim::NOS::DownloadResource(url, ToWeakCallback([this](int res_code, const std::string& file_path, const std::string& call_id, const std::string& res_id) { if (res_code == nim::kNIMResSuccess) { std::wstring ws_file_path = nbase::UTF8ToUTF16(file_path); if (nbase::FilePathIsExist(ws_file_path, false)) { ImageViewManager::GetInstance()->StartViewPic(ws_file_path, L"", true, true); nim::MsgLog::DeleteAsync(sid_, type_, msg_.client_msg_id_, nim::MsgLog::DeleteCallback()); SessionBox* session_form = dynamic_cast<SessionBox*>(SessionManager::GetInstance()->FindSessionBox(sid_)); if (session_form) session_form->OnSnapchatReadCallback(msg_.client_msg_id_); } } })); } } return true; }
void RtsForm::ShowEndMsg() { nim::IMMessage msg; msg.session_type_ = nim::kNIMSessionTypeP2P; msg.receiver_accid_ = uid_; msg.sender_accid_ = LoginManager::GetInstance()->GetAccount(); msg.client_msg_id_ = QString::GetGUID(); //base获取的时间单位是s,服务器的时间单位是ms msg.timetag_ = 1000 * nbase::Time::Now().ToTimeT(); msg.status_ = nim::kNIMMsgLogStatusSent; msg.type_ = nim::kNIMMessageTypeCustom; Json::Value json; Json::FastWriter writer; json["type"] = CustomMsgType_Rts; json["data"]["flag"] = 1; msg.content_ = nbase::UTF16ToUTF8(L"白板"); msg.attach_ = writer.write(json); nim::MsgLog::WriteMsglogToLocalAsync(uid_, msg, false, nim::MsgLog::WriteMsglogCallback()); SessionBox* session = SessionManager::GetInstance()->FindSessionBox(uid_); if (session) { session->AddNewMsg(msg, false); } }
void SessionForm::FlashTaskbar(SessionBox &session_box) { taskbar_manager_.SetTabActive(*session_box.GetTaskbarItem()); FLASHWINFO flash_info = { sizeof(FLASHWINFO), m_hWnd, FLASHW_TRAY, 3, 0 }; ::FlashWindowEx(&flash_info); }
int orthos_skin_update() { exaUpdate(); float time = 0; while (time < 0.035) { time += exaGetElapsedTime(); exaUSleep (2000); } rot += time; box.update (time); sess.update (time); shut.update (time); if (exaIsKeyHit (EKEY_RETURN) ) switch (Mode) { case 0: login = box.text; Mode = 1; box.clear(); box.setcaption ("password"); box.setcolor (0.2, 0.2, 0.2); box.pwmask (true); break; case 1: pw = box.text; box.clear(); if (selected_session) { if (validate_login (login.c_str(), pw.c_str() ) ) { Mode = 0; box.setcaption (login_line); box.setcolor (0.4, 0.4, 0.4); box.flash (1, 0, 0); box.pwmask (false); } else Mode = 3; } else { Mode = 2; box.setcaption ("session"); box.setcolor (0.1, 0.1, 0.4); box.pwmask (false); } break; case 2: session = box.text; box.clear(); if (validate_login (login.c_str(), pw.c_str() ) ) { Mode = 0; box.setcaption (login_line); box.setcolor (0.4, 0.4, 0.4); box.flash (1, 0, 0); box.pwmask (false); } else Mode = 3; break; case 3: case 4: break; default: Mode = 0; box.clear(); box.setcaption (login_line); box.pwmask (false); box.setcolor (0.4, 0.4, 0.4); box.flash (0, 0, 0); break; } glClear (GL_COLOR_BUFFER_BIT); glLoadIdentity(); glTranslatef (0, 0, -1); glRotatef (rot, 1, 0, 0.3); glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE); do_sphere(); glDisable (GL_BLEND); if (invert) { glPushMatrix(); glLoadIdentity(); glMatrixMode (GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrtho (0, 1, 0, 1, 1, -1); glColor4f (1, 1, 1, 1); glEnable (GL_BLEND); glBlendFunc (GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA); glBegin (GL_QUADS); glVertex2f (0, 0); glVertex2f (0, 1); glVertex2f (1, 1); glVertex2f (1, 0); glEnd(); glPopMatrix(); glMatrixMode (GL_MODELVIEW); glPopMatrix(); } glLoadIdentity(); glTranslatef (0, -13, -25); box.draw(); glTranslatef (0, 2, 0); sess.draw(); glTranslatef (0, -6, 0); shut.draw(); exaglSwapBuffers(); switch (Mode) { case 3: do_login (login.c_str(), selected_session ? sessions[selected_session].cmd.c_str() : session.c_str() ); return 0; case 4: return 0; } return 1; }
int orthos_skin_update() { exaUpdate(); float time=0; while(time<0.02) { time+=exaGetElapsedTime(); exaUSleep(2000); } rot+=time; box.update(time); sess.update(time); shut.update(time); if(exaIsKeyHit(EKEY_RETURN)) switch(Mode) { case 0: login=box.text; Mode=1; box.clear(); box.setcaption("password"); box.setcolor(0.2,0.2,0.2); box.pwmask(true); break; case 1: pw=box.text; box.clear(); if(selected_session) { if(validate_login(login.c_str(),pw.c_str())) { Mode=0; box.setcaption(login_line); box.setcolor(0.4,0.4,0.4); box.flash(1,0,0); box.pwmask(false); } else Mode=3; } else { Mode=2; box.setcaption("session"); box.setcolor(0.1,0.1,0.4); box.pwmask(false); } break; case 2: session=box.text; box.clear(); if(validate_login(login.c_str(),pw.c_str())) { Mode=0; box.setcaption(login_line); box.setcolor(0.4,0.4,0.4); box.flash(1,0,0); box.pwmask(false); } else Mode=3; break; case 3: case 4: break; default: Mode=0; box.clear(); box.setcaption(login_line); box.pwmask(false); box.setcolor(0.4,0.4,0.4); box.flash(0,0,0); break; } glClear(GL_COLOR_BUFFER_BIT); glLoadIdentity(); glTranslatef(0,0,-5); glRotatef(rot,0,0,1); for(int i=0; i<10; ++i) { glBegin(GL_TRIANGLE_STRIP); glColor3f(0,0,0); glVertex3f(1,5,5); glVertex3f(-1,5,5); glColor3f(0,0.1,0.3); glVertex3f(1,5,-1); glVertex3f(-1,5,-1); glColor3f(0,0,0); glVertex3f(1,5,-20); glVertex3f(-1,5,-20); glEnd(); glRotatef(36,0,0,1); } glLoadIdentity(); glTranslatef(0,0,-25); box.draw(); glTranslatef(0,2,0); sess.draw(); glTranslatef(0,-6,0); shut.draw(); exaglSwapBuffers(); switch (Mode) { case 3: do_login(login.c_str(),selected_session?sessions[selected_session].cmd.c_str():session.c_str()); return 0; case 4: return 0; } return 1; }