int CDlgCommonProgress::OffsetPos(int nPos) { PumpMessages(); int iResult = m_Progress.OffsetPos(nPos); UpdatePercent(iResult+nPos); return iResult; }
int CDlgCommonProgress::StepIt() { PumpMessages(); int iResult = m_Progress.StepIt(); UpdatePercent(iResult+m_nStep); return iResult; }
int CProgressDlg::SetPos(int nPos) { PumpMessages(); int iResult = m_Progress.SetPos(nPos); UpdatePercent(nPos); return iResult; }
PBIBackend::PBIBackend(QWidget *parent, QSplashScreen *splash) : QObject(){ parentWidget = parent; Splash = splash; updateSplashScreen(tr("Initializing")); sysArch = Extras::getSystemArch(); sysUser = Extras::getRegularUser(); autoDE = false; //automatically create desktop entries after an install PKGRUN.clear(); //make sure this is empty initially appAvailable = -1; //quick default pkgAvailable = -1; //quick default pkgProc = new DLProcess(this); pkgProc->setParentWidget(parentWidget); pkgProc->setDLType("PKG"); connect(pkgProc, SIGNAL(UpdateMessage(QString)), this, SLOT(procMessage(QString)) ); connect(pkgProc, SIGNAL(UpdatePercent(QString,QString,QString)), this, SLOT(procPercent(QString,QString,QString)) ); connect(pkgProc, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(procFinished(int, QProcess::ExitStatus)) ); sysDB = new PBIDBAccess(); //Now startup the syncing process UpdateIndexFiles(false); //do not force pbi index redownload on startup //Done with initial sync - disable splash screen updateSplashScreen(tr("Starting UI")); Splash = 0; }
int CProgressDlg::SetPos(int nPos, LPCTSTR szMessage) { PumpMessages(); int iResult = m_Progress.SetPos(nPos); UpdatePercent(nPos); GetDlgItem(CG_IDC_PROGDLG_PERCENT)->SetWindowText(szMessage); return iResult; }
int CDlgCommonProgress::SetPos(int nPos) { int iResult = TRUE; PumpMessages(); if (GetSafeHwnd() != NULL) { m_Progress.SetPos(nPos); UpdatePercent(nPos); } return iResult; }
int CProgressDlg::OffsetPos(long nPos) { if (!nPos) return 0; PumpMessages(); int iResult = m_Progress.OffsetPos(nPos); UpdatePercent(iResult+nPos); return iResult; }
int CProgressDlg::SetPos(long nPos) { if (nPos == m_Progress.GetPos()) return nPos; PumpMessages(); int iResult = m_Progress.SetPos(nPos); UpdatePercent(nPos); return iResult; }
CAbstractUpdateController::CAbstractUpdateController() { mCurrentState= eNOT_INITIALIZED; mUpdProc.setProcessChannelMode(QProcess::MergedChannels); connect(&mUpdProc, SIGNAL(UpdateMessage(QString)), this, SLOT(slotProcessRead(QString))); connect(&mUpdProc, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(slotProcessFinished(int,QProcess::ExitStatus))); connect(&mUpdProc, SIGNAL(UpdatePercent(QString, QString, QString)), this, SLOT(slotDLProcUpdatePercent(QString, QString, QString))); }
// =============== // PRIVATE FUNCTIONS // =============== void DLProcess::calculateStats(QString current, QString total, QString speed, QString filename){ //Assumes all values are in KB or KB/s bool totok, curok, spdok; double tot, cur, spd, percent; tot = total.toDouble(&totok); cur = current.toDouble(&curok); //qDebug() << " - DownloadStats:" << tot << cur << spd; if(totok && tot==0){totok=false;} if(curok && cur==0){curok=false;} //Now format the output string //Get percentage complete if(totok && curok){ //Calculate the percentage percent = (cur/tot)*100; percent = int(percent*10)/10.0; }else{ percent = -1; } //Check if total is known if(!totok && curok){ //Only Current is known tot = cur; //output current instead of total since no percent either } //OTHER input (speed, filename) QString other = "??"; //Check the speed if(!speed.isEmpty()){ spd = speed.toDouble(&spdok); if(spdok && spd<=0){ spdok=false; } if(spdok){ other = kbToString(spd)+"/s"; } //Check for a filename instead }else if(!filename.isEmpty() ){ other = filename; } //Now emit the stats QString perc = "??"; if(percent >= 0){ perc = QString::number(percent); } QString tota = "??"; if(tot >= 0){ tota = kbToString(tot); } emit UpdatePercent(perc, tota, other); }
void wxGISProcess::ProcessInput(wxString &sInputData) { if(m_nState != enumGISTaskWork) return; sInputData = sInputData.Trim(true).Trim(false); wxString sRest; if( sInputData.StartsWith(wxT("DONE: "), &sRest) ) { UpdatePercent(sRest.Trim(true).Trim(false).Truncate(sRest.Len() - 1)); return; } if( sInputData.StartsWith(wxT("INFO: "), &sRest) ) { AddInfo(enumGISMessageNorm, sRest); return; } if( sInputData.StartsWith(wxT("ERR: "), &sRest) ) { AddInfo(enumGISMessageErr, sRest); return; } if( sInputData.StartsWith(wxT("WARN: "), &sRest) ) { AddInfo(enumGISMessageWarning, sRest); return; } if( sInputData.StartsWith(wxT("SND: "), &sRest) ) { AddInfo(enumGISMessageSend, sRest); return; } if( sInputData.StartsWith(wxT("RCV: "), &sRest) ) { AddInfo(enumGISMessageReceive, sRest); return; } AddInfo(enumGISMessageUnk, sInputData); }