当前位置: 首页>>代码示例>>C++>>正文


C++ CKnownFile::GetUpPriority方法代码示例

本文整理汇总了C++中CKnownFile::GetUpPriority方法的典型用法代码示例。如果您正苦于以下问题:C++ CKnownFile::GetUpPriority方法的具体用法?C++ CKnownFile::GetUpPriority怎么用?C++ CKnownFile::GetUpPriority使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CKnownFile的用法示例。


在下文中一共展示了CKnownFile::GetUpPriority方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DrawItem


//.........这里部分代码省略.........
#ifdef MODVERSION
                        image = (client->IsNextEMF())?16:1;
#else //Modversion
                        image = 1;
#endif //Modversion
//<==Modversion [shadow2004]


                }
                else {
                    if (client->credits->GetScoreRatio(client/*->GetIP()*/) > 1)
//==> Xman CreditSystem [shadow2004]
                        image = 2;
                    else
                        image = 0;
                }

                POINT point = {cur_rec.left, cur_rec.top+1};
                imagelist.Draw(dc,image, point, ILD_NORMAL | ((client->Credits() && client->Credits()->GetCurrentIdentState(client->GetIP()) == IS_IDENTIFIED) ? INDEXTOOVERLAYMASK(1) : 0));
                Sbuffer = client->GetUserName();
                cur_rec.left +=20;
                dc.DrawText(Sbuffer,Sbuffer.GetLength(),&cur_rec,DLC_DT_TEXT);
                cur_rec.left -=20;
                break;
            }
            case 1:
                if(file)
                    Sbuffer = file->GetFileName();
                else
                    Sbuffer = _T("?");
                break;
            case 2:
                if(file) {
                    switch (file->GetUpPriority()) {
                    case PR_VERYLOW : {
                        Sbuffer = GetResString(IDS_PRIOVERYLOW);
                        break;
                    }
                    case PR_LOW : {
                        if( file->IsAutoUpPriority() )
                            Sbuffer = GetResString(IDS_PRIOAUTOLOW);
                        else
                            Sbuffer = GetResString(IDS_PRIOLOW);
                        break;
                    }
                    case PR_NORMAL : {
                        if( file->IsAutoUpPriority() )
                            Sbuffer = GetResString(IDS_PRIOAUTONORMAL);
                        else
                            Sbuffer = GetResString(IDS_PRIONORMAL);
                        break;
                    }
                    case PR_HIGH : {
                        if( file->IsAutoUpPriority() )
                            Sbuffer = GetResString(IDS_PRIOAUTOHIGH);
                        else
                            Sbuffer = GetResString(IDS_PRIOHIGH);
                        break;
                    }
                    case PR_VERYHIGH : {
                        Sbuffer = GetResString(IDS_PRIORELEASE);
                        break;
                    }
                    default:
                        Sbuffer.Empty();
                    }
开发者ID:BackupTheBerlios,项目名称:nextemf,代码行数:67,代码来源:QueueListCtrl.cpp

示例2: DrawItem


//.........这里部分代码省略.........
							image = 3;
						else
							image = 1;
					}
					else{
						if (client->credits->GetScoreRatio(client->GetIP()) > 1)
							image = 2;
						else
							image = 0;
					}
					uint32 nOverlayImage = 0;
					if ((client->Credits() && client->Credits()->GetCurrentIdentState(client->GetIP()) == IS_IDENTIFIED))
						nOverlayImage |= 1;
					if (client->IsObfuscatedConnectionEstablished())
						nOverlayImage |= 2;
					int iIconPosY = (cur_rec.Height() > 16) ? ((cur_rec.Height() - 16) / 2) : 1;
					POINT point = {cur_rec.left, cur_rec.top + iIconPosY};
					imagelist.Draw(dc,image, point, ILD_NORMAL | INDEXTOOVERLAYMASK(nOverlayImage));
					
					Sbuffer = client->GetUserName();
					cur_rec.left += 20;
					dc.DrawText(Sbuffer, Sbuffer.GetLength(), &cur_rec, DLC_DT_TEXT);
					cur_rec.left -= 20;
					break;
				}
				case 1:
					if(file)
						Sbuffer = file->GetFileName();
					else
						Sbuffer = _T("?");
					break;
				case 2:
					if(file){
						switch (file->GetUpPriority()) {
							case PR_VERYLOW : {
								Sbuffer = GetResString(IDS_PRIOVERYLOW);
								break; }
							case PR_LOW : {
								if( file->IsAutoUpPriority() )
									Sbuffer = GetResString(IDS_PRIOAUTOLOW);
								else
									Sbuffer = GetResString(IDS_PRIOLOW);
								break; }
							case PR_NORMAL : {
								if( file->IsAutoUpPriority() )
									Sbuffer = GetResString(IDS_PRIOAUTONORMAL);
								else
									Sbuffer = GetResString(IDS_PRIONORMAL);
								break; }
							case PR_HIGH : {
								if( file->IsAutoUpPriority() )
									Sbuffer = GetResString(IDS_PRIOAUTOHIGH);
								else
									Sbuffer = GetResString(IDS_PRIOHIGH);
								break; }
							case PR_VERYHIGH : {
								Sbuffer = GetResString(IDS_PRIORELEASE);
								break; }
							default:
								Sbuffer.Empty();
						}
					}
					else
						Sbuffer = _T("?");
					break;
				case 3:
开发者ID:acat,项目名称:emule,代码行数:67,代码来源:QueueListCtrl.cpp

示例3: OnRightClick

void CSharedFilesCtrl::OnRightClick(wxListEvent& event)
{
	long item_hit = CheckSelection(event);

	if ( (m_menu == NULL) && (item_hit != -1)) {
		m_menu = new wxMenu(_("Shared Files"));
		wxMenu* prioMenu = new wxMenu();
		prioMenu->AppendCheckItem(MP_PRIOVERYLOW, _("Very low"));
		prioMenu->AppendCheckItem(MP_PRIOLOW, _("Low"));
		prioMenu->AppendCheckItem(MP_PRIONORMAL, _("Normal"));
		prioMenu->AppendCheckItem(MP_PRIOHIGH, _("High"));
		prioMenu->AppendCheckItem(MP_PRIOVERYHIGH, _("Very High"));
		prioMenu->AppendCheckItem(MP_POWERSHARE, _("Release"));
		prioMenu->AppendCheckItem(MP_PRIOAUTO, _("Auto"));

		m_menu->Append(0,_("Priority"),prioMenu);
		m_menu->AppendSeparator();

		CKnownFile* file = (CKnownFile*)GetItemData(item_hit);
		if (file->GetFileComment().IsEmpty() && !file->GetFileRating()) {
			m_menu->Append(MP_CMT, _("Add Comment/Rating"));
		} else {
			m_menu->Append(MP_CMT, _("Edit Comment/Rating"));
		}
		
		m_menu->AppendSeparator();
		m_menu->Append(MP_RENAME, _("Rename"));
		m_menu->AppendSeparator();

		if (file->GetFileName().GetExt() == wxT("emulecollection")) {
			m_menu->Append( MP_ADDCOLLECTION, _("Add files in collection to transfer list"));
			m_menu->AppendSeparator();
		}
		m_menu->Append(MP_GETMAGNETLINK,_("Copy magnet &URI to clipboard"));
		m_menu->Append(MP_GETED2KLINK,_("Copy eD2k &link to clipboard"));
		m_menu->Append(MP_GETSOURCEED2KLINK,_("Copy eD2k link to clipboard (&Source)"));
		m_menu->Append(MP_GETCRYPTSOURCEDED2KLINK,_("Copy eD2k link to clipboard (Source) (&With Crypt options)"));
		m_menu->Append(MP_GETHOSTNAMESOURCEED2KLINK,_("Copy eD2k link to clipboard (&Hostname)"));
		m_menu->Append(MP_GETHOSTNAMECRYPTSOURCEED2KLINK,_("Copy eD2k link to clipboard (Hostname) (With &Crypt options)"));		
		m_menu->Append(MP_GETAICHED2KLINK,_("Copy eD2k link to clipboard (&AICH info)"));
		m_menu->Append(MP_WS,_("Copy feedback to clipboard"));
		
		m_menu->Enable(MP_GETAICHED2KLINK, file->HasProperAICHHashSet());
		m_menu->Enable(MP_GETHOSTNAMESOURCEED2KLINK, !thePrefs::GetYourHostname().IsEmpty());
		m_menu->Enable(MP_GETHOSTNAMECRYPTSOURCEED2KLINK, !thePrefs::GetYourHostname().IsEmpty());

		int priority = file->IsAutoUpPriority() ? PR_AUTO : file->GetUpPriority();

		prioMenu->Check(MP_PRIOVERYLOW,	priority == PR_VERYLOW);
		prioMenu->Check(MP_PRIOLOW,	priority == PR_LOW);
		prioMenu->Check(MP_PRIONORMAL,	priority == PR_NORMAL);
		prioMenu->Check(MP_PRIOHIGH,	priority == PR_HIGH);
		prioMenu->Check(MP_PRIOVERYHIGH,priority == PR_VERYHIGH);
		prioMenu->Check(MP_POWERSHARE,	priority == PR_POWERSHARE);
		prioMenu->Check(MP_PRIOAUTO,	priority == PR_AUTO);

		PopupMenu( m_menu, event.GetPoint() );

		delete m_menu;

		m_menu = NULL;
	}
}
开发者ID:donkey4u,项目名称:donkeyseed,代码行数:63,代码来源:SharedFilesCtrl.cpp

示例4: OnDrawItem

void CSharedFilesCtrl::OnDrawItem( int item, wxDC* dc, const wxRect& rect, const wxRect& rectHL, bool highlighted )
{
	CKnownFile *file = (CKnownFile*)GetItemData(item);
	wxASSERT( file );

	if ( highlighted ) {
		CMuleColour newcol(GetFocus() ? wxSYS_COLOUR_HIGHLIGHT : wxSYS_COLOUR_BTNSHADOW);	
		dc->SetBackground(newcol.Blend(125).GetBrush());
		dc->SetTextForeground( CMuleColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
		// The second blending goes over the first one.
		dc->SetPen(newcol.Blend(65).GetPen());
	} else {
		dc->SetBackground( CMuleColour(wxSYS_COLOUR_LISTBOX).GetBrush() );
		dc->SetTextForeground(CMuleColour(wxSYS_COLOUR_WINDOWTEXT));
		dc->SetPen(*wxTRANSPARENT_PEN);
	}
	
	dc->SetBrush(dc->GetBackground());
	dc->DrawRectangle(rectHL);
	dc->SetPen(*wxTRANSPARENT_PEN);

	// Offset based on the height of the fonts
	const int textVOffset = ( rect.GetHeight() - dc->GetCharHeight() ) / 2;
	// Empty space to each side of a column
	const int SPARE_PIXELS_HORZ	= 4;

	// The leftmost position of the current column
	int columnLeft = 0;
	
	for ( int i = 0; i < GetColumnCount(); ++i ) {
		const int columnWidth = GetColumnWidth(i);

		if (columnWidth > 2*SPARE_PIXELS_HORZ) {
			wxRect columnRect(
				columnLeft + SPARE_PIXELS_HORZ, rect.y,
				columnWidth - 2 * SPARE_PIXELS_HORZ, rect.height);
			
			wxDCClipper clipper(*dc, columnRect);
			
			wxString textBuffer;
			switch ( i ) {
				case ID_SHARED_COL_NAME:
					textBuffer = file->GetFileName().GetPrintable();

					if (file->GetFileRating() || file->GetFileComment().Length()) {
						int image = Client_CommentOnly_Smiley;
						if (file->GetFileRating()) {
							image = Client_InvalidRating_Smiley + file->GetFileRating() - 1;
						}	
							
						wxASSERT(image >= Client_InvalidRating_Smiley);
						wxASSERT(image <= Client_CommentOnly_Smiley);

						int imgWidth = 16;
						
						theApp->amuledlg->m_imagelist.Draw(image, *dc, columnRect.x,
								columnRect.y + 1, wxIMAGELIST_DRAW_TRANSPARENT);

						// Move the text to the right
						columnRect.x += (imgWidth + 4);
					}

					break;
				
				case ID_SHARED_COL_SIZE:
					textBuffer = CastItoXBytes(file->GetFileSize());
					break;

				case ID_SHARED_COL_TYPE:
					textBuffer = GetFiletypeByName(file->GetFileName());
					break;

				case ID_SHARED_COL_PRIO:
					textBuffer = PriorityToStr(file->GetUpPriority(), file->IsAutoUpPriority());
					break;

				case ID_SHARED_COL_ID:
					textBuffer = file->GetFileHash().Encode();
					break;
				
				case ID_SHARED_COL_REQ:
					textBuffer = CFormat(wxT("%u (%u)"))
							% file->statistic.GetRequests()
							% file->statistic.GetAllTimeRequests();
					break;

				case ID_SHARED_COL_AREQ:
					textBuffer = CFormat(wxT("%u (%u)"))
							% file->statistic.GetAccepts()
							% file->statistic.GetAllTimeAccepts();
					break;

				case ID_SHARED_COL_TRA:
					textBuffer = CastItoXBytes(file->statistic.GetTransferred())
						+ wxT(" (") + CastItoXBytes(file->statistic.GetAllTimeTransferred()) + wxT(")");
					break;
					
				case ID_SHARED_COL_RTIO:
					textBuffer = CFormat(wxT("%.2f")) %	((double)file->statistic.GetAllTimeTransferred() / file->GetFileSize());
					break;
//.........这里部分代码省略.........
开发者ID:donkey4u,项目名称:donkeyseed,代码行数:101,代码来源:SharedFilesCtrl.cpp

示例5: DrawItem


//.........这里部分代码省略.........
                if (client->IsObfuscatedConnectionEstablished())
                    nOverlayImage |= 2;
                POINT point = {cur_rec.left, cur_rec.top+1};
                imagelist.Draw(dc,image, point, ILD_NORMAL | ((client->Credits() && client->Credits()->GetCurrentIdentState(client->GetIP()) == IS_IDENTIFIED) ? INDEXTOOVERLAYMASK(1) : 0));
                Sbuffer = client->GetUserName();

                //EastShare Start - added by AndCycle, IP to Country
                CString tempStr;
                tempStr.Format(_T("%s%s"), client->GetCountryName(), Sbuffer);
                Sbuffer = tempStr;

                if(CGlobalVariable::ip2country->ShowCountryFlag()) {
                    cur_rec.left += 20;
                    POINT point2= {cur_rec.left,cur_rec.top+1};
                    CGlobalVariable::ip2country->GetFlagImageList()->DrawIndirect(dc, client->GetCountryFlagIndex(), point2, CSize(18,16), CPoint(0,0), ILD_NORMAL);
                }
                //EastShare End - added by AndCycle, IP to Country

                cur_rec.left += 20;
                dc.DrawText(Sbuffer, Sbuffer.GetLength(), &cur_rec, DLC_DT_TEXT);
                cur_rec.left -= 20;

                //EastShare Start - added by AndCycle, IP to Country
                if(CGlobalVariable::ip2country->ShowCountryFlag()) {
                    cur_rec.left-=20;
                }
                //EastShare End - added by AndCycle, IP to Country

                break;
            }
            case 1:
                if (file)
                    Sbuffer = file->GetFileName();
                else
                    Sbuffer = _T("?");
                if(file && file->GetUpPriority()==PR_POWER) ///PowerRelease
                    dc->SetBkColor(RGB(255,225,225));
                break;
            case 2:
                Sbuffer = CastItoXBytes(client->GetDatarate(), false, true);
                break;
            case 3:
                // NOTE: If you change (add/remove) anything which is displayed here, update also the sorting part..
                if (thePrefs.m_bExtControls)
                    Sbuffer.Format( _T("%s (%s)"), CastItoXBytes(client->GetSessionUp(), false, false), CastItoXBytes(client->GetQueueSessionPayloadUp(), false, false));
                else
                    Sbuffer = CastItoXBytes(client->GetSessionUp(), false, false);
                break;
            case 4:
                if (client->HasLowID())
                    Sbuffer.Format(_T("%s (%s)"), CastSecondsToHM(client->GetWaitTime()/1000), GetResString(IDS_IDLOW));
                else
                    Sbuffer = CastSecondsToHM(client->GetWaitTime()/1000);
                break;
            case 5:
                Sbuffer = CastSecondsToHM(client->GetUpStartTimeDelay()/1000);
                break;
            case 6:
                Sbuffer = client->GetUploadStateDisplayString();
                break;
            case 7:
                cur_rec.bottom--;
                cur_rec.top++;
                client->DrawUpStatusBar(dc, &cur_rec, false, thePrefs.UseFlatBar());
                cur_rec.bottom++;
                cur_rec.top--;
                break;
            }
            if (iColumn != 7 && iColumn != 0)
                dc.DrawText(Sbuffer, Sbuffer.GetLength(), &cur_rec, DLC_DT_TEXT);
            dc->SetBkColor( crOldBackColor );
            cur_rec.left += GetColumnWidth(iColumn);
        }
    }

    //draw rectangle around selected item(s)
    if (lpDrawItemStruct->itemState & ODS_SELECTED)
    {
        RECT outline_rec = lpDrawItemStruct->rcItem;

        outline_rec.top--;
        outline_rec.bottom++;
        dc.FrameRect(&outline_rec, &CBrush(GetBkColor()));
        outline_rec.top++;
        outline_rec.bottom--;
        outline_rec.left++;
        outline_rec.right--;

        if (bCtrlFocused)
            dc.FrameRect(&outline_rec, &CBrush(m_crFocusLine));
        else
            dc.FrameRect(&outline_rec, &CBrush(m_crNoFocusLine));
    }

    /*
    	if (m_crWindowTextBk == CLR_NONE)
    		dc.SetBkMode(iOldBkMode);
    	dc.SelectObject(pOldFont);
    	dc.SetTextColor(crOldTextColor);*/
}
开发者ID:techpub,项目名称:archive-code,代码行数:101,代码来源:UploadListCtrl.cpp


注:本文中的CKnownFile::GetUpPriority方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。