本文整理汇总了C++中CFileItem::GetLocalFile方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItem::GetLocalFile方法的具体用法?C++ CFileItem::GetLocalFile怎么用?C++ CFileItem::GetLocalFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItem
的用法示例。
在下文中一共展示了CFileItem::GetLocalFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnRemoveSelected
void CQueueViewFailed::OnRemoveSelected(wxCommandEvent& event)
{
#ifndef __WXMSW__
// GetNextItem is O(n) if nothing is selected, GetSelectedItemCount() is O(1)
if (!GetSelectedItemCount())
return;
#endif
std::list<CQueueItem*> selectedItems;
long item = -1;
while (true)
{
item = GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (item == -1)
break;
selectedItems.push_front(GetQueueItem(item));
SetItemState(item, 0, wxLIST_STATE_SELECTED);
}
CEditHandler* pEditHandler = CEditHandler::Get();
while (!selectedItems.empty())
{
CQueueItem* pItem = selectedItems.front();
selectedItems.pop_front();
CQueueItem* pTopLevelItem = pItem->GetTopLevelItem();
if (pItem->GetType() == QueueItemType_Server)
{
CServerItem* pServerItem = (CServerItem*)pItem;
if (pEditHandler && pEditHandler->GetFileCount(CEditHandler::remote, CEditHandler::upload_and_remove_failed, &pServerItem->GetServer()))
pEditHandler->RemoveAll(CEditHandler::upload_and_remove_failed, &pServerItem->GetServer());
}
else if (pItem->GetType() == QueueItemType_File)
{
CFileItem* pFileItem = (CFileItem*)pItem;
if (pFileItem->m_edit == CEditHandler::remote && pEditHandler)
{
wxFileName fn(pFileItem->GetLocalFile());
if (pFileItem->m_edit == CEditHandler::local)
{
enum CEditHandler::fileState state = pEditHandler->GetFileState(pFileItem->GetLocalFile());
if (state == CEditHandler::upload_and_remove_failed)
pEditHandler->Remove(pFileItem->GetLocalFile());
}
else
{
CServerItem* pServerItem = (CServerItem*)pFileItem->GetTopLevelItem();
enum CEditHandler::fileState state = pEditHandler->GetFileState(pFileItem->GetRemoteFile(), pFileItem->GetRemotePath(), pServerItem->GetServer());
if (state == CEditHandler::upload_and_remove_failed)
pEditHandler->Remove(pFileItem->GetRemoteFile(), pFileItem->GetRemotePath(), pServerItem->GetServer());
}
}
}
if (!pTopLevelItem->GetChild(1))
{
// Parent will get deleted
// If next selected item is parent, remove it from list
if (!selectedItems.empty() && selectedItems.front() == pTopLevelItem)
selectedItems.pop_front();
}
RemoveItem(pItem, true, false, false);
}
DisplayNumberQueuedFiles();
SaveSetItemCount(m_itemCount);
RefreshListOnly();
if (!m_itemCount && m_pQueue->GetQueueView()->GetItemCount())
m_pQueue->SetSelection(0);
}
示例2: OnGetItemText
wxString CQueueViewBase::OnGetItemText(long item, long column) const
{
CQueueViewBase* pThis = const_cast<CQueueViewBase*>(this);
CQueueItem* pItem = pThis->GetQueueItem(item);
if (!pItem)
return _T("");
switch (pItem->GetType())
{
case QueueItemType_Server:
{
CServerItem* pServerItem = reinterpret_cast<CServerItem*>(pItem);
if (!column)
return pServerItem->GetName();
}
break;
case QueueItemType_File:
{
CFileItem* pFileItem = reinterpret_cast<CFileItem*>(pItem);
switch (column)
{
case 0:
return pFileItem->GetIndent() + pFileItem->GetLocalFile();
case 1:
if (pFileItem->Download())
if (pFileItem->Queued())
return _T("<--");
else
return _T("<<--");
else
if (pFileItem->Queued())
return _T("-->");
else
return _T("-->>");
break;
case 2:
return pFileItem->GetRemotePath().FormatFilename(pFileItem->GetRemoteFile());
case 3:
{
const wxLongLong& size = pFileItem->GetSize();
if (size >= 0)
return FormatSize(size);
else
return _T("?");
}
case 4:
switch (pFileItem->GetPriority())
{
case 0:
return _("Lowest");
case 1:
return _("Low");
default:
case 2:
return _("Normal");
case 3:
return _("High");
case 4:
return _("Highest");
}
break;
case 5:
return pFileItem->m_statusMessage;
default:
break;
}
}
break;
case QueueItemType_FolderScan:
{
CFolderScanItem* pFolderItem = reinterpret_cast<CFolderScanItem*>(pItem);
switch (column)
{
case 0:
return _T(" ") + pFolderItem->GetLocalPath();
case 1:
if (pFolderItem->Download())
if (pFolderItem->Queued())
return _T("<--");
else
return _T("<<--");
else
if (pFolderItem->Queued())
return _T("-->");
else
return _T("-->>");
break;
case 2:
return pFolderItem->GetRemotePath().GetPath();
case 5:
return pFolderItem->m_statusMessage;
default:
break;
}
}
break;
case QueueItemType_Folder:
{
CFileItem* pFolderItem = reinterpret_cast<CFolderItem*>(pItem);
//.........这里部分代码省略.........
示例3: OnRequeueSelected
void CQueueViewFailed::OnRequeueSelected(wxCommandEvent& event)
{
#ifndef __WXMSW__
// GetNextItem is O(n) if nothing is selected, GetSelectedItemCount() is O(1)
if (!GetSelectedItemCount())
return;
#endif
bool failedToRequeueAll = false;
std::list<CQueueItem*> selectedItems;
long item = -1;
long skipTo = -1;
while (true)
{
item = GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (item == -1)
break;
SetItemState(item, 0, wxLIST_STATE_SELECTED);
if (item < skipTo)
continue;
CQueueItem* pItem = GetQueueItem(item);
if (pItem->GetType() == QueueItemType_Server)
skipTo = item + pItem->GetChildrenCount(true) + 1;
selectedItems.push_back(GetQueueItem(item));
}
if (selectedItems.empty())
return;
CQueueView* pQueueView = m_pQueue->GetQueueView();
while (!selectedItems.empty())
{
CQueueItem* pItem = selectedItems.front();
selectedItems.pop_front();
if (pItem->GetType() == QueueItemType_Server)
{
CServerItem* pOldServerItem = (CServerItem*)pItem;
CServerItem* pServerItem = pQueueView->CreateServerItem(pOldServerItem->GetServer());
unsigned int childrenCount = pOldServerItem->GetChildrenCount(false);
for (unsigned int i = 0; i < childrenCount; i++)
{
CFileItem* pFileItem = (CFileItem*)pItem->GetChild(i, false);
pFileItem->m_errorCount = 0;
pFileItem->m_statusMessage.Clear();
if (!pFileItem->Download() && !wxFileName::FileExists(pFileItem->GetLocalFile()))
{
failedToRequeueAll = true;
RemoveItem(pItem, true, false, false);
continue;
}
if (pFileItem->m_edit == CEditHandler::remote)
{
CEditHandler* pEditHandler = CEditHandler::Get();
if (!pEditHandler)
{
failedToRequeueAll = true;
delete pFileItem;
continue;
}
enum CEditHandler::fileState state = pEditHandler->GetFileState(pFileItem->GetRemoteFile(), pFileItem->GetRemotePath(), pServerItem->GetServer());
if (state == CEditHandler::unknown)
{
wxASSERT(pFileItem->Download());
wxString file = pFileItem->GetRemoteFile();
if (!pEditHandler->AddFile(CEditHandler::remote, file, pFileItem->GetRemotePath(), pServerItem->GetServer()))
{
failedToRequeueAll = true;
delete pFileItem;
continue;
}
pFileItem->SetLocalFile(file);
}
else if (state == CEditHandler::upload_and_remove_failed)
{
wxASSERT(!pFileItem->Download());
if (!pEditHandler->UploadFile(pFileItem->GetRemoteFile(), pFileItem->GetRemotePath(), pServerItem->GetServer(), true))
failedToRequeueAll = true;
delete pFileItem;
continue;
}
else
{
failedToRequeueAll = true;
delete pFileItem;
continue;
}
}
pFileItem->SetParent(pServerItem);
pQueueView->InsertItem(pServerItem, pFileItem);
}
m_fileCount -= childrenCount;
m_itemCount -= childrenCount + 1;
//.........这里部分代码省略.........
示例4: OnGetItemText
wxString CQueueViewBase::OnGetItemText(CQueueItem* pItem, ColumnId column) const
{
switch (pItem->GetType())
{
case QueueItemType::Server:
{
CServerItem* pServerItem = reinterpret_cast<CServerItem*>(pItem);
if (!column)
return pServerItem->GetName();
}
break;
case QueueItemType::File:
{
CFileItem* pFileItem = reinterpret_cast<CFileItem*>(pItem);
switch (column)
{
case colLocalName:
return pFileItem->GetIndent() + pFileItem->GetLocalPath().GetPath() + pFileItem->GetLocalFile();
case colDirection:
if (pFileItem->Download())
if (pFileItem->queued())
return _T("<--");
else
return _T("<<--");
else
if (pFileItem->queued())
return _T("-->");
else
return _T("-->>");
break;
case colRemoteName:
return pFileItem->GetRemotePath().FormatFilename(pFileItem->GetRemoteFile());
case colSize:
{
const wxLongLong& size = pFileItem->GetSize();
if (size >= 0)
return CSizeFormat::Format(size);
else
return _T("?");
}
case colPriority:
switch (pFileItem->GetPriority())
{
case QueuePriority::lowest:
return _("Lowest");
case QueuePriority::low:
return _("Low");
default:
case QueuePriority::normal:
return _("Normal");
case QueuePriority::high:
return _("High");
case QueuePriority::highest:
return _("Highest");
}
break;
case colTransferStatus:
case colErrorReason:
return pFileItem->m_statusMessage;
case colTime:
return CTimeFormat::FormatDateTime(pItem->GetTime());
default:
break;
}
}
break;
case QueueItemType::FolderScan:
{
CFolderScanItem* pFolderItem = reinterpret_cast<CFolderScanItem*>(pItem);
switch (column)
{
case colLocalName:
return _T(" ") + pFolderItem->GetLocalPath().GetPath();
case colDirection:
if (pFolderItem->Download())
if (pFolderItem->queued())
return _T("<--");
else
return _T("<<--");
else
if (pFolderItem->queued())
return _T("-->");
else
return _T("-->>");
break;
case colRemoteName:
return pFolderItem->GetRemotePath().GetPath();
case colTransferStatus:
case colErrorReason:
return pFolderItem->m_statusMessage;
case colTime:
return CTimeFormat::FormatDateTime(pItem->GetTime());
default:
break;
}
}
break;
case QueueItemType::Folder:
{
CFileItem* pFolderItem = reinterpret_cast<CFolderItem*>(pItem);
//.........这里部分代码省略.........