void CProgressBar::slotFinishItem(const unsigned int handle) { if (isValidHandle(handle) && mProgressItemList[handle] != NULL) { QMutexLocker Locker(&mMutex); removeProgressItem(mProgressItemList[handle]); mProgressItemList[handle]->deleteLater(); mProgressItemList[handle] = NULL; } mSlotFinished = true; mWaitSlot.wakeAll(); }
void ProgressFloatItem::initialize() { const HttpDownloadManager* manager = marbleModel()->downloadManager(); Q_ASSERT( manager ); connect( manager, SIGNAL(progressChanged(int,int)), this, SLOT(handleProgress(int,int)) , Qt::UniqueConnection ); connect( manager, SIGNAL(jobRemoved()), this, SLOT(removeProgressItem()), Qt::UniqueConnection ); // Calculate font size QFont myFont = font(); const QString text = "100%"; int fontSize = myFont.pointSize(); while( QFontMetrics( myFont ).boundingRect( text ).width() < contentRect().width() - 2 ) { ++fontSize; myFont.setPointSize( fontSize ); } m_fontSize = fontSize - 1; m_isInitialized = true; }
bool CProgressBar::finish() { // The method must only be called from the main thread! CQProgressItem ** ppIt = mProgressItemList.array(); CQProgressItem ** ppEnd = ppIt + mProgressItemList.size(); for (; ppIt != ppEnd; ++ppIt) { if (*ppIt != NULL) { removeProgressItem(*ppIt); (*ppIt)->deleteLater(); (*ppIt) = NULL; } } CProcessReport::finish(); done(1); return mProceed; }