void CLogDlg::OnBnClickedRefresh() { if(isPaused == false) { RefreshLog(); } else { isPaused = false; RefreshLog(); isPaused = true; } }
void CLogDlg::OnCbnSelchangeWarningLevel() { if(isPaused == false) { RefreshLog(); } else { isPaused = false; RefreshLog(); isPaused = true; } }
void CLogDlg::OnCbnSelchangeObject() { if(isPaused == false) { RefreshLog(); } else { isPaused = false; RefreshLog(); isPaused = true; } }
void MainWindow::createInfoDock()//创建文件Dock { m_infodock=new SAMInfoDock(this); // m_infodock->refresh(core); m_infodock->setCore(core); this->addDockWidget(Qt::LeftDockWidgetArea,m_infodock); connect(m_filedock,SIGNAL(InfoRefresh(QString)),m_infodock,SLOT(RefreshInfo(QString))); connect(core,SIGNAL(writeLog()),m_infodock,SLOT(RefreshLog())); }
// Start the specified threads // [in] AllThreads : If you start all threads, true is to be passed. Otherwize false is passed. // [out] Result Code int StkThreadGuiManager::StartThreads(bool AllThreads) { if (DlgWndHndl != NULL) { SetFocus(DlgWndHndl); // TABフォーカスが失われるのを防止する施策 //Disable Start and Stop button. EnableWindow(GetDlgItem(DlgWndHndl, IDC_START), false); EnableWindow(GetDlgItem(DlgWndHndl, IDC_STOP), false); } // Change the status on GUI. for (int RowLoop = 0; RowLoop < GetNumOfStkThread(); RowLoop++) { if (AllThreads == true || ListView_GetCheckState(ListWndHndl, RowLoop) == TRUE) { if (GetStkThreadStatusByIndex(RowLoop) != STKTHREAD_STATUS_RUNNING) { ReplaceStatus(RowLoop, STKTHREAD_STATUS_STARTING); } } } // Does selected thread IDs are stored into Ids[] variable. int Ids[MAX_NUM_OF_THREADS]; int IdsIndex = 0; for (int RowLoop = 0; RowLoop < GetNumOfStkThread(); RowLoop++) { if ((AllThreads == true || ListView_GetCheckState(ListWndHndl, RowLoop) == TRUE) && GetStkThreadStatusByIndex(RowLoop) == STKTHREAD_STATUS_READY) { Ids[IdsIndex] = GetStkThreadIdByIndex(RowLoop); IdsIndex++; } } // Start selected threads. StartSpecifiedStkThreads(Ids, IdsIndex); // When AllThreads is true, check whether all threads are running or not. // If some threads are not running, wait for the status change. while (AllThreads) { bool AllRunning = true; for (int RowLoop = 0; RowLoop < GetNumOfStkThread(); RowLoop++) { if (GetStkThreadStatusByIndex(RowLoop) != STKTHREAD_STATUS_RUNNING) { AllRunning = false; break; } } if (AllRunning == true) { break; } else { Sleep(100); } } RefreshLog(false); return 0; }
void CLogDlg::WriteToLog(int warningLevel, int object, LPCTSTR strToWrite) { CTime currentTime = CTime::GetCurrentTime(); logEntry.push_back(LogEntry(currentTime.Format("%m/%d %H:%M:%S").GetString(),warningLevel,object, string(strToWrite))); if(logEntry.size() > MAX_LOG_SIZE) { logEntry.erase(&logEntry.front()); //pop the front if the log gets too big if(m_richLog.GetTextLength() > 1024*1024) // if text box gets too big { RefreshLog(); return; } } WriteEntry((int)logEntry.size() - 1); }
void CLogDlg::OnBnClickedPause() { if(isPaused == false) { isPaused = true; m_pause.SetWindowText("Resume"); } else { isPaused = false; RefreshLog(); m_pause.SetWindowText("Pause"); } }
void CLogListView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) { m_nType = (UINT)lHint; switch (m_nType) { case LOG: InitHeadForLog(); RefreshLog((CAdapterInfo *)pHint); break; default: break; } ((CMainFrame *)AfxGetMainWnd())->SendMessage(WM_SIZE); }
// Stop the specified threads // [in] AllThreads : If you stop all threads, true is to be passed. Otherwize false is passed. // [out] Result Code int StkThreadGuiManager::StopThreads(bool AllThreads) { if (DlgWndHndl != NULL) { SetFocus(DlgWndHndl); // TABフォーカスが失われるのを防止する施策 //Disable Start and Stop button. EnableWindow(GetDlgItem(DlgWndHndl, IDC_START), false); EnableWindow(GetDlgItem(DlgWndHndl, IDC_STOP), false); } // Change the status on GUI. for (int RowLoop = 0; RowLoop < GetNumOfStkThread(); RowLoop++) { if (AllThreads == true || ListView_GetCheckState(ListWndHndl, RowLoop) == TRUE) { if (GetStkThreadStatusByIndex(RowLoop) != STKTHREAD_STATUS_READY) { ReplaceStatus(RowLoop, STKTHREAD_STATUS_STOPPING); } } } // Does selected thread IDs are stored into Ids[] variable. int Ids[MAX_NUM_OF_THREADS]; int IdsIndex = 0; for (int RowLoop = 0; RowLoop < GetNumOfStkThread(); RowLoop++) { if ((AllThreads == true || ListView_GetCheckState(ListWndHndl, RowLoop) == TRUE) && GetStkThreadStatusByIndex(RowLoop) == STKTHREAD_STATUS_RUNNING) { Ids[IdsIndex] = GetStkThreadIdByIndex(RowLoop); IdsIndex++; } } // Stop selected threads. StopSpecifiedStkThreads(Ids, IdsIndex); RefreshLog(false); return 0; }