本文整理汇总了C++中CFileItem::GetLocalPath方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItem::GetLocalPath方法的具体用法?C++ CFileItem::GetLocalPath怎么用?C++ CFileItem::GetLocalPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItem
的用法示例。
在下文中一共展示了CFileItem::GetLocalPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveLocalPath
bool CQueueStorage::Impl::SaveFile(wxLongLong server, const CFileItem& file)
{
if (file.m_edit != CEditHandler::none)
return true;
Bind(insertFileQuery_, file_table_column_names::source_file, file.GetSourceFile());
auto const& targetFile = file.GetTargetFile();
if (targetFile)
Bind(insertFileQuery_, file_table_column_names::target_file, *targetFile);
else
BindNull(insertFileQuery_, file_table_column_names::target_file);
int64_t localPathId = SaveLocalPath(file.GetLocalPath());
int64_t remotePathId = SaveRemotePath(file.GetRemotePath());
if (localPathId == -1 || remotePathId == -1)
return false;
Bind(insertFileQuery_, file_table_column_names::local_path, localPathId);
Bind(insertFileQuery_, file_table_column_names::remote_path, remotePathId);
Bind(insertFileQuery_, file_table_column_names::download, file.Download() ? 1 : 0);
if (file.GetSize() != -1)
Bind(insertFileQuery_, file_table_column_names::size, file.GetSize());
else
BindNull(insertFileQuery_, file_table_column_names::size);
if (file.m_errorCount)
Bind(insertFileQuery_, file_table_column_names::error_count, file.m_errorCount);
else
BindNull(insertFileQuery_, file_table_column_names::error_count);
Bind(insertFileQuery_, file_table_column_names::priority, static_cast<int>(file.GetPriority()));
Bind(insertFileQuery_, file_table_column_names::ascii_file, file.Ascii() ? 1 : 0);
if (file.m_defaultFileExistsAction != CFileExistsNotification::unknown)
Bind(insertFileQuery_, file_table_column_names::default_exists_action, file.m_defaultFileExistsAction);
else
BindNull(insertFileQuery_, file_table_column_names::default_exists_action);
int res;
do {
res = sqlite3_step(insertFileQuery_);
} while (res == SQLITE_BUSY);
sqlite3_reset(insertFileQuery_);
return res == SQLITE_DONE;
}
示例2: 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);
//.........这里部分代码省略.........
示例3: OnRemoveSelected
void CQueueViewFailed::OnRemoveSelected(wxCommandEvent&)
{
#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;
for (;;)
{
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)
{
if (pFileItem->m_edit == CEditHandler::local)
{
wxString fullPath(pFileItem->GetLocalPath().GetPath() + pFileItem->GetLocalFile());
enum CEditHandler::fileState state = pEditHandler->GetFileState(fullPath);
if (state == CEditHandler::upload_and_remove_failed)
pEditHandler->Remove(fullPath);
}
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);
}