コード例 #1
0
void FileTransferWidget::UpdateProgress()
{
    qint64 progress = 0, totalSize = 0;
    if (m_transferMode == TM_RECIEVE_CLIENT)
    {
        progress = m_currentFileSize;
        totalSize = m_filesHashIter->value();
    }
    else if (m_transferMode == TM_SEND_SERVER)
    {
        progress = m_currentFile.pos();
        totalSize = m_currentFile.size();
    }

    m_ui->doneLabel->setText(MRIMCommonUtils::GetFileSize(progress));
    m_ui->progressBar->setValue(progress);
    m_ui->speedLabel->setText(MRIMCommonUtils::GetFileSize(m_speedBytes)+tr("/sec"));
    SetRemainTime();
    m_speedBytes = 0;

    if (progress >= totalSize)
    {
        m_ui->statusLabel->setText(tr("Done!"));
        m_ui->speedLabel->setText("");
        return;
    }

    if ( m_socket->state() == QAbstractSocket::ConnectedState )
        QTimer::singleShot(1000, this, SLOT(UpdateProgress()));
}
コード例 #2
0
ファイル: Item.cpp プロジェクト: xianyinchen/LUNAPlus
void CItem::Render()
{
	if( !m_bActive )
	{
		return;
	}
	if( m_ItemBaseInfo.nSealed == eITEM_TYPE_SEAL )
	{
		cDialog::Render();

		m_SealImage.RenderSprite( NULL, NULL, 0, &m_absPos, 
									RGBA_MERGE(0xffffff, 255));
		
		/*RECT rect={(LONG)m_absPos.x, (LONG)m_absPos.y+12, 1,1};
		CFONT_OBJ->RenderFont(0,"[봉인]", strlen("[봉인]"),&rect,RGBA_MAKE(250,250,128,255));*/
	}
	// 071124 LYW --- Item : 봉인 해제 아이템 시간 툴팁 처리.
	else if( m_ItemBaseInfo.nSealed == eITEM_TYPE_UNSEAL )
	{
		cIcon::Render();

		DWORD dwElapsedMill	= gCurTime -m_ItemBaseInfo.LastCheckTime ;
		DWORD dwElapsedSecond = dwElapsedMill / 1000 ;

		SetLastCheckTime(gCurTime - ( dwElapsedMill - dwElapsedSecond * 1000 )) ;

		if( GetItemBaseInfo().nRemainSecond > (int)dwElapsedSecond )
		{
			int nRemainTime = GetItemBaseInfo().nRemainSecond - (int)dwElapsedSecond ;
			SetRemainTime(nRemainTime) ;
		}
		else
		{
			SetRemainTime(0) ;
		}
	}
	else
	{
		cIcon::Render();
	}

	if( m_Param == 1 )
	{
		m_LockImage.RenderSprite( NULL, NULL, 0, &m_absPos, 
			RGBA_MERGE(0xffffff, m_alpha * m_dwOptionAlpha / 100));
	}

	if( m_bZeroCount )
	{
		m_ZeroImage.RenderSprite( NULL, NULL, 0, &m_absPos, 
									RGBA_MERGE(0xffffff, 200 * m_dwOptionAlpha / 100));
	}

	if( mIsVisibleDurability &&
		ITEMMGR->IsDupItem(m_ItemBaseInfo.wIconIdx) )
	{
		static char nums[3];
		wsprintf(nums,"%2d", m_ItemBaseInfo.Durability);
		//RECT rect={(LONG)m_absPos.x+23, (LONG)m_absPos.y+25, 1,1};
		//CFONT_OBJ->RenderFont(0,nums,strlen(nums),&rect,RGBA_MERGE(m_dwImageRGB, m_alpha * m_dwOptionAlpha / 100 ));		// color hard coding : taiyo 
		RECT rect ;

		rect.top = (LONG)m_absPos.y+24 ;
		rect.right = 1 ;
		rect.bottom = 1 ;

		if( m_ItemBaseInfo.Durability > 99 )
		{
			rect.left = (LONG)m_absPos.x+16 ;
			
		}
		else
		{
			rect.left = (LONG)m_absPos.x+22 ;
		}
		CFONT_OBJ->RenderFontShadow(0, 1, nums,strlen(nums),&rect,RGBA_MERGE(m_dwImageRGB, m_alpha * m_dwOptionAlpha / 100 ));		// color hard coding : taiyo 
	}
}