Ejemplo n.º 1
0
void ResultsTree::ShowFileItem(const QString &name)
{
    QStandardItem *item = FindFileItem(name);
    if (item) {
        setRowHidden(0, mModel.indexFromItem(item), false);
    }
}
Ejemplo n.º 2
0
QStandardItem *ResultsTree::EnsureFileItem(const QString &fullpath, const QString &file0, bool hide)
{
    QString name = StripPath(fullpath, false);
    // Since item has path with native separators we must use path with
    // native separators to find it.
    QStandardItem *item = FindFileItem(QDir::toNativeSeparators(name));

    if (item) {
        return item;
    }

    // Ensure shown path is with native separators
    name = QDir::toNativeSeparators(name);
    item = CreateNormalItem(name);
    item->setIcon(QIcon(":images/text-x-generic.png"));

    //Add user data to that item
    QMap<QString, QVariant> data;
    data["file"] = fullpath;
    data["file0"] = file0;
    item->setData(QVariant(data));
    mModel.appendRow(item);

    setRowHidden(mModel.rowCount() - 1, QModelIndex(), hide);

    return item;
}
Ejemplo n.º 3
0
void CDownloadList::RemoveFile(CPartFile *pPartFile)
{
	if (pPartFile != NULL)
	{
		PFIter		itFile = FindFileItem(pPartFile);

	//	If it was found...
		if (IsValidIterator(itFile))
		{
			CPartFileDLItem		*pFileItem = GetFileItem(itFile);

		//	Remove the file item from the file map
			m_mapFiles.erase(itFile);

		//
		//	If it's in the dirty list, remove it from there too
			PartFileItemVector::iterator	it = ::find(m_pvecDirtyFiles->begin(),m_pvecDirtyFiles->end(),pFileItem);

			if (it != m_pvecDirtyFiles->end())
			{
				m_pvecDirtyFiles->erase(it);
			}

		//	NOTE: This call must remain synchronous as the item is destroyed immediately after.
			m_pctlDownloadList->RemoveFileItem(pFileItem);

		//	Destroy the file item
			delete pFileItem;
		}
	}
}
Ejemplo n.º 4
0
	void ChoroidTab::showNextImage ()
	{
		auto current = FindFileItem (QFileInfo (CurrentImage_.path ()).fileName ());
		if (!current)
			return;

		const auto rc = QMLFilesModel_->rowCount ();
		const auto& url = QMLFilesModel_->item ((current->row () + 1) % rc)->data (ILRImage).value<QUrl> ();
		ShowImage (url);
	}
Ejemplo n.º 5
0
	void ChoroidTab::showPrevImage ()
	{
		auto current = FindFileItem (QFileInfo (CurrentImage_.path ()).fileName ());
		if (!current)
			return;

		auto prev = current->row () - 1;
		if (prev < 0)
			prev = QMLFilesModel_->rowCount () - 1;
		const auto& url = QMLFilesModel_->item (prev)->data (ILRImage).value<QUrl> ();
		ShowImage (url);
	}
Ejemplo n.º 6
0
void CDownloadList::UpdateFile(CPartFile *pPartFile)
{
	if (pPartFile != NULL)
	{
		PFIter		itFileItem = FindFileItem(pPartFile);

	//	For each file item associated with 'pFile'...
		if (IsValidIterator(itFileItem))
		{
			CPartFileDLItem  *pFileItem = GetFileItem(itFileItem);

			if (pFileItem != NULL)
			{
				AddDirtyFile(pFileItem);
			}
		}
		m_pctlDownloadList->PostRefreshMessage();
	}
}
Ejemplo n.º 7
0
	delete m_pvecDirtySources;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//	AddFile() adds part file 'pPartFile' to the download list and notifies the download list ctrl of the addition.
void CDownloadList::AddFile(CPartFile *pPartFile)
{
	EMULE_TRY

	if (pPartFile == NULL)
		return;

//	Create new Item
	CPartFileDLItem	   *pFileItem = new CPartFileDLItem(pPartFile);

//	The same file shall be added only once
	ASSERT(!IsValidIterator(FindFileItem(pPartFile)));
	InsertFileItem(pPartFile, pFileItem);

	m_pctlDownloadList->AddFileItem(pFileItem);

	EMULE_CATCH
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CDownloadList::RemoveFile(CPartFile *pPartFile)
{
	if (pPartFile != NULL)
	{
		PFIter		itFile = FindFileItem(pPartFile);

	//	If it was found...
		if (IsValidIterator(itFile))