Changeset 28 in chevmsgr
- Timestamp:
- 11/30/15 01:23:56 (8 years ago)
- Location:
- trunk/msvc14/ChevMsgrClient_MFC
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/msvc14/ChevMsgrClient_MFC/AddGroupChat.cpp
r27 r28 36 36 END_MESSAGE_MAP() 37 37 38 BOOL CAddGroupChatDlg::OnInitDialog() 39 { 40 CDialogEx::OnInitDialog(); 41 42 for (size_t iter = 0; iter < mMsgrClntDlg->idList.size(); iter++) 43 { 44 mFriendListToChat.InsertString(iter, str2cstr(mMsgrClntDlg->idList[iter].id)); 45 } 46 47 return TRUE; 48 } 38 49 39 50 // CAddGroupChat ¸Þ½ÃÁö 󸮱âÀÔ´Ï´Ù. … … 41 52 { 42 53 // TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù. 43 54 int leftidx = mFriendListToChat.GetCurSel(); 55 56 mFriendListToChat.GetText(leftidx, selectedId); 57 mListSelectFriend.InsertString(mListSelectFriend.GetCount(), selectedId); 58 mFriendListToChat.DeleteString(leftidx); 44 59 } 45 60 … … 48 63 { 49 64 // TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù. 65 if (mListSelectFriend.GetCount() <= 1) 66 return; 67 68 mListSelectFriend.GetText(0, groupChat); 69 for (size_t iter = 1; iter < mListSelectFriend.GetCount(); iter++) 70 { 71 mListSelectFriend.GetText(iter, selectedId); 72 groupChat = groupChat + "," + selectedId; 73 } 50 74 51 75 CDialogEx::OnOK(); … … 56 80 { 57 81 // TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù. 82 int rightidx = mListSelectFriend.GetCurSel(); 83 84 if (rightidx < 0) 85 return; 86 87 mListSelectFriend.DeleteString(rightidx); 88 mListSelectFriend.GetText(rightidx, selectedId); 89 mFriendListToChat.InsertString(mFriendListToChat.GetCount(), selectedId); 58 90 } -
trunk/msvc14/ChevMsgrClient_MFC/AddGroupChat.h
r27 r28 2 2 #include "msgclnt.h" 3 3 #include "afxwin.h" 4 #include "ChevMsgrClient_MFCDlg.h" 4 5 5 6 // CAddGroupChat ´ëÈ »óÀÚÀÔ´Ï´Ù. … … 13 14 virtual ~CAddGroupChatDlg(); 14 15 chev *chev; 16 CChevMsgrClient_MFCDlg *mMsgrClntDlg; 15 17 16 18 // ´ëÈ »óÀÚ µ¥ÀÌÅÍÀÔ´Ï´Ù. … … 24 26 DECLARE_MESSAGE_MAP() 25 27 public: 28 virtual BOOL OnInitDialog(); 26 29 afx_msg void OnBnClickedAddList(); 27 30 afx_msg void OnBnClickedOk(); … … 29 32 CListBox mFriendListToChat; 30 33 CListBox mListSelectFriend; 34 CString selectedId; 35 CString groupChat; 31 36 }; -
trunk/msvc14/ChevMsgrClient_MFC/ChevMsgrClient_MFC.cpp
r4 r28 49 49 InitCtrls.dwICC = ICC_WIN95_CLASSES; 50 50 InitCommonControlsEx(&InitCtrls); 51 51 52 52 CWinApp::InitInstance(); 53 53 … … 59 59 // MFC ÄÁÆ®·ÑÀÇ Å׸¶¸¦ »ç¿ëÇϱâ À§ÇØ "Windows ¿øÇü" ºñÁÖ¾ó °ü¸®ÀÚ È°¼ºÈ 60 60 CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows)); 61 62 61 // Ç¥ÁØ ÃʱâÈ 63 62 // ÀÌµé ±â´ÉÀ» »ç¿ëÇÏÁö ¾Ê°í ÃÖÁ¾ ½ÇÇà ÆÄÀÏÀÇ Å©±â¸¦ ÁÙÀÌ·Á¸é -
trunk/msvc14/ChevMsgrClient_MFC/ChevMsgrClient_MFCDlg.cpp
r27 r28 84 84 ON_BN_CLICKED(IDC_BTN_ADD_FRIEND, &CChevMsgrClient_MFCDlg::OnBnClickedBtnAddFriend) 85 85 ON_BN_CLICKED(IDC_BTN_ADD_CHAT, &CChevMsgrClient_MFCDlg::OnBnClickedBtnAddChat) 86 ON_LBN_SELCHANGE(IDC_LIST_FRIENDS, &CChevMsgrClient_MFCDlg::OnLbnSelchangeListFriends) 86 87 END_MESSAGE_MAP() 87 88 … … 155 156 chev.listen(cb); 156 157 157 CString cstrId; 158 if (!chev.getFriendList(idList)) 159 { 160 AfxMessageBox(_T("cannot get friend list")); 161 ::SendMessage(GetSafeHwnd(), WM_QUIT, NULL, NULL); 162 } 163 164 for (size_t iter = 0; iter < idList.size(); iter++) 165 { 166 cstrId = str2cstr(idList[iter].id); 167 this->mFriendListBox.InsertString(this->mFriendListBox.GetCount(), cstrId); 168 } 158 UpdateFriendList(); 159 160 scl.resize(idList.size()); 169 161 170 162 return TRUE; // Æ÷Ä¿½º¸¦ ÄÁÆ®·Ñ¿¡ ¼³Á¤ÇÏÁö ¾ÊÀ¸¸é TRUE¸¦ ¹ÝȯÇÕ´Ï´Ù. … … 222 214 int cb_listen(SConversation & chat) 223 215 { 224 gDlg->mChatListBox.InsertString(gDlg->mChatListBox.GetCount(), str2cstr(chat.from)); 225 gDlg->mChatListBox.InsertString(gDlg->mChatListBox.GetCount(), str2cstr(chat.message)); 226 227 gDlg->scl[gDlg->mFriendListBox.GetCurSel()].chatList.push_back(chat); 216 CString cstr; 217 218 if (gDlg->mFriendListBox.GetCurSel() >= 0) 219 { 220 gDlg->mFriendListBox.GetText(gDlg->mFriendListBox.GetCurSel(), cstr); 221 222 if (cstr2str(cstr) == chat.from) 223 { 224 gDlg->mChatListBox.InsertString(gDlg->mChatListBox.GetCount(), str2cstr("<" + chat.from + ">")); 225 gDlg->mChatListBox.InsertString(gDlg->mChatListBox.GetCount(), str2cstr(chat.message)); 226 gDlg->mChatListBox.InsertString(gDlg->mChatListBox.GetCount(), _T("")); 227 } 228 } 229 230 for (int iter = 0; iter < gDlg->mFriendListBox.GetCount(); iter++) 231 { 232 gDlg->mFriendListBox.GetText(iter, cstr); 233 234 if (cstr2str(cstr) == chat.from) 235 { 236 gDlg->scl[iter].chatList.push_back(chat); 237 break; 238 } 239 } 228 240 229 241 return 0; … … 263 275 264 276 if (chev.tell(conversation)) 277 { 278 mChatListBox.InsertString(mChatListBox.GetCount(), str2cstr("<" + mId + ">")); 265 279 mChatListBox.InsertString(mChatListBox.GetCount(), chat); 280 mChatListBox.InsertString(mChatListBox.GetCount(), _T("")); 281 } 282 283 gDlg->scl[gDlg->mFriendListBox.GetCurSel()].chatList.push_back(conversation); 266 284 267 285 SetDlgItemText(IDC_EDIT_INPUT, _T("")); … … 271 289 { 272 290 // TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù. 273 //chev.addFriend();274 291 CAddFriendDlg AFDlg; 275 292 … … 278 295 279 296 AFDlg.DoModal(); 297 UpdateFriendList(); 280 298 } 281 299 … … 287 305 288 306 AGCDlg.chev = &this->chev; 289 307 AGCDlg.mMsgrClntDlg = this; 290 308 AGCDlg.DoModal(); 291 } 309 310 mFriendListBox.InsertString(mFriendListBox.GetCount(), AGCDlg.groupChat); 311 } 312 313 void CChevMsgrClient_MFCDlg::UpdateFriendList() 314 { 315 CString cstrId; 316 if (!chev.getFriendList(idList)) 317 { 318 AfxMessageBox(_T("cannot get friend list")); 319 ::SendMessage(GetSafeHwnd(), WM_QUIT, NULL, NULL); 320 } 321 322 this->mFriendListBox.ResetContent(); 323 324 for (size_t iter = 0; iter < idList.size(); iter++) 325 { 326 cstrId = str2cstr(idList[iter].id); 327 this->mFriendListBox.InsertString(this->mFriendListBox.GetCount(), cstrId); 328 } 329 } 330 331 void CChevMsgrClient_MFCDlg::OnLbnSelchangeListFriends() 332 { 333 // TODO: ¿©±â¿¡ ÄÁÆ®·Ñ ¾Ë¸² 󸮱â Äڵ带 Ãß°¡ÇÕ´Ï´Ù. 334 mChatListBox.ResetContent(); 335 int idx = mFriendListBox.GetCurSel(); 336 337 if (idx < 0) 338 return; 339 340 if (scl[idx].sessionId == "") 341 return; 342 343 for (std::list<SConversation>::iterator iter = scl[idx].chatList.begin(); 344 iter != scl[idx].chatList.end(); iter++) 345 { 346 mChatListBox.InsertString(mChatListBox.GetCount(), str2cstr("<" + iter->from + ">")); 347 mChatListBox.InsertString(mChatListBox.GetCount(), str2cstr(iter->message)); 348 mChatListBox.InsertString(mChatListBox.GetCount(), _T("")); 349 } 350 } -
trunk/msvc14/ChevMsgrClient_MFC/ChevMsgrClient_MFCDlg.h
r27 r28 48 48 afx_msg void OnBnClickedBtnAddFriend(); 49 49 afx_msg void OnBnClickedBtnAddChat(); 50 void UpdateFriendList(); 51 afx_msg void OnLbnSelchangeListFriends(); 50 52 };
Note:
See TracChangeset
for help on using the changeset viewer.