2015-06-10 21:27:11 +00:00
|
|
|
/*
|
|
|
|
* This file Copyright (C) 2009-2015 Mnemosyne LLC
|
|
|
|
*
|
|
|
|
* It may be used under the GNU GPL versions 2 or 3
|
|
|
|
* or any future license endorsed by Mnemosyne LLC.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
#include <cassert>
|
|
|
|
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QStyle>
|
|
|
|
|
|
|
|
#include <libtransmission/transmission.h> // priorities
|
|
|
|
|
|
|
|
#include "FileTreeItem.h"
|
|
|
|
#include "FileTreeModel.h"
|
|
|
|
#include "Formatter.h"
|
|
|
|
#include "Utils.h" // mime icons
|
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
QHash<QString, int> const& FileTreeItem::getMyChildRows()
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-20 16:02:19 +00:00
|
|
|
size_t const n = childCount();
|
2015-06-10 21:27:11 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
// ensure that all the rows are hashed
|
|
|
|
while (myFirstUnhashedRow < n)
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
myChildRows.insert(myChildren[myFirstUnhashedRow]->name(), myFirstUnhashedRow);
|
|
|
|
++myFirstUnhashedRow;
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
return myChildRows;
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
FileTreeItem::~FileTreeItem()
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
assert(myChildren.isEmpty());
|
2015-06-10 21:27:11 +00:00
|
|
|
|
2017-04-30 09:29:58 +00:00
|
|
|
if (myParent != nullptr)
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-20 16:02:19 +00:00
|
|
|
int const pos = row();
|
2017-04-30 16:25:26 +00:00
|
|
|
assert(pos >= 0 && "couldn't find child in parent's lookup");
|
2017-04-19 12:04:45 +00:00
|
|
|
myParent->myChildren.removeAt(pos);
|
|
|
|
myParent->myChildRows.remove(name());
|
|
|
|
myParent->myFirstUnhashedRow = pos;
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
void FileTreeItem::appendChild(FileTreeItem* child)
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-20 16:02:19 +00:00
|
|
|
size_t const n = childCount();
|
2017-04-19 12:04:45 +00:00
|
|
|
child->myParent = this;
|
|
|
|
myChildren.append(child);
|
|
|
|
myFirstUnhashedRow = n;
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
FileTreeItem* FileTreeItem::child(QString const& filename)
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-30 09:29:58 +00:00
|
|
|
FileTreeItem* item(nullptr);
|
2017-04-19 12:04:45 +00:00
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
int const row = getMyChildRows().value(filename, -1);
|
2015-06-10 21:27:11 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
if (row != -1)
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
item = child(row);
|
|
|
|
assert(filename == item->name());
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
return item;
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
int FileTreeItem::row() const
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
int i(-1);
|
2015-06-10 21:27:11 +00:00
|
|
|
|
2017-04-30 16:25:26 +00:00
|
|
|
if (myParent != nullptr)
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
i = myParent->getMyChildRows().value(name(), -1);
|
|
|
|
assert(this == myParent->myChildren[i]);
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
return i;
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
QVariant FileTreeItem::data(int column, int role) const
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
QVariant value;
|
2015-06-10 21:27:11 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
switch (role)
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
case FileTreeModel::FileIndexRole:
|
|
|
|
value.setValue(myFileIndex);
|
2015-08-16 22:07:09 +00:00
|
|
|
break;
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
case FileTreeModel::WantedRole:
|
|
|
|
value.setValue(isSubtreeWanted());
|
2015-08-16 22:07:09 +00:00
|
|
|
break;
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
case FileTreeModel::CompleteRole:
|
|
|
|
value.setValue(isComplete());
|
2015-08-16 22:07:09 +00:00
|
|
|
break;
|
|
|
|
|
2017-09-30 17:26:49 +00:00
|
|
|
case Qt::ToolTipRole:
|
2017-04-19 12:04:45 +00:00
|
|
|
case Qt::EditRole:
|
2015-08-16 22:07:09 +00:00
|
|
|
if (column == FileTreeModel::COL_NAME)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
|
|
|
value.setValue(name());
|
|
|
|
}
|
|
|
|
|
2015-08-16 22:07:09 +00:00
|
|
|
break;
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
case Qt::TextAlignmentRole:
|
2015-08-16 22:07:09 +00:00
|
|
|
if (column == FileTreeModel::COL_SIZE)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
|
|
|
value = Qt::AlignRight + Qt::AlignVCenter;
|
|
|
|
}
|
|
|
|
|
2015-08-16 22:07:09 +00:00
|
|
|
break;
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
case Qt::DisplayRole:
|
|
|
|
case FileTreeModel::SortRole:
|
2015-08-16 22:07:09 +00:00
|
|
|
switch (column)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
|
|
|
case FileTreeModel::COL_NAME:
|
|
|
|
value.setValue(name());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FileTreeModel::COL_SIZE:
|
|
|
|
if (role == Qt::DisplayRole)
|
|
|
|
{
|
|
|
|
value.setValue(sizeString());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
value.setValue<quint64>(size());
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FileTreeModel::COL_PROGRESS:
|
|
|
|
value.setValue(progress());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FileTreeModel::COL_WANTED:
|
|
|
|
value.setValue(isSubtreeWanted());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FileTreeModel::COL_PRIORITY:
|
|
|
|
if (role == Qt::DisplayRole)
|
|
|
|
{
|
|
|
|
value.setValue(priorityString());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
value.setValue(priority());
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-08-16 22:07:09 +00:00
|
|
|
break;
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
case Qt::DecorationRole:
|
2015-08-16 22:07:09 +00:00
|
|
|
if (column == FileTreeModel::COL_NAME)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
2015-08-16 22:07:09 +00:00
|
|
|
if (myFileIndex < 0)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
|
|
|
value = qApp->style()->standardIcon(QStyle::SP_DirOpenIcon);
|
|
|
|
}
|
2015-06-15 21:07:46 +00:00
|
|
|
else
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
|
|
|
value = Utils::guessMimeIcon(name());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-16 22:07:09 +00:00
|
|
|
break;
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
return value;
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
void FileTreeItem::getSubtreeWantedSize(uint64_t& have, uint64_t& total) const
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
if (myIsWanted)
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
have += myHaveSize;
|
|
|
|
total += myTotalSize;
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
for (FileTreeItem const* const i : myChildren)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
|
|
|
i->getSubtreeWantedSize(have, total);
|
|
|
|
}
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
double FileTreeItem::progress() const
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
double d(0);
|
2017-05-01 15:46:41 +00:00
|
|
|
uint64_t have(0);
|
|
|
|
uint64_t total(0);
|
2017-04-19 12:04:45 +00:00
|
|
|
|
|
|
|
getSubtreeWantedSize(have, total);
|
2015-06-10 21:27:11 +00:00
|
|
|
|
2017-04-30 16:25:26 +00:00
|
|
|
if (total != 0)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
|
|
|
d = have / double(total);
|
|
|
|
}
|
2015-06-10 21:27:11 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
return d;
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
QString FileTreeItem::sizeString() const
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
return Formatter::sizeToString(size());
|
2015-06-15 21:07:46 +00:00
|
|
|
}
|
2015-06-10 21:27:11 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
uint64_t FileTreeItem::size() const
|
2015-06-15 21:07:46 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
if (myChildren.isEmpty())
|
|
|
|
{
|
|
|
|
return myTotalSize;
|
|
|
|
}
|
2015-06-10 21:27:11 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
uint64_t have = 0;
|
|
|
|
uint64_t total = 0;
|
|
|
|
getSubtreeWantedSize(have, total);
|
|
|
|
return total;
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
std::pair<int, int> FileTreeItem::update(QString const& name, bool wanted, int priority, uint64_t haveSize, bool updateFields)
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
int changed_count = 0;
|
|
|
|
int changed_columns[4];
|
2015-06-10 21:27:11 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
if (myName != name)
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-30 16:25:26 +00:00
|
|
|
if (myParent != nullptr)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
|
|
|
myParent->myFirstUnhashedRow = row();
|
|
|
|
}
|
2015-06-10 21:27:11 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
myName = name;
|
|
|
|
changed_columns[changed_count++] = FileTreeModel::COL_NAME;
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
if (fileIndex() != -1)
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
if (myHaveSize != haveSize)
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
myHaveSize = haveSize;
|
|
|
|
changed_columns[changed_count++] = FileTreeModel::COL_PROGRESS;
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
if (updateFields)
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
if (myIsWanted != wanted)
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
myIsWanted = wanted;
|
|
|
|
changed_columns[changed_count++] = FileTreeModel::COL_WANTED;
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
if (myPriority != priority)
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
myPriority = priority;
|
|
|
|
changed_columns[changed_count++] = FileTreeModel::COL_PRIORITY;
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
std::pair<int, int> changed(-1, -1);
|
|
|
|
|
|
|
|
if (changed_count > 0)
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
std::sort(changed_columns, changed_columns + changed_count);
|
|
|
|
changed.first = changed_columns[0];
|
|
|
|
changed.second = changed_columns[changed_count - 1];
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
2017-04-19 12:04:45 +00:00
|
|
|
|
|
|
|
return changed;
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
QString FileTreeItem::priorityString() const
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-20 16:02:19 +00:00
|
|
|
int const i = priority();
|
2015-06-10 21:27:11 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
switch (i)
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
case LOW:
|
|
|
|
return tr("Low");
|
|
|
|
|
|
|
|
case HIGH:
|
|
|
|
return tr("High");
|
|
|
|
|
|
|
|
case NORMAL:
|
|
|
|
return tr("Normal");
|
|
|
|
|
|
|
|
default:
|
|
|
|
return tr("Mixed");
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
int FileTreeItem::priority() const
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
int i(0);
|
2015-06-10 21:27:11 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
if (myChildren.isEmpty())
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
switch (myPriority)
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
case TR_PRI_LOW:
|
2015-06-10 21:27:11 +00:00
|
|
|
i |= LOW;
|
|
|
|
break;
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
case TR_PRI_HIGH:
|
2015-06-10 21:27:11 +00:00
|
|
|
i |= HIGH;
|
|
|
|
break;
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
default:
|
2015-06-10 21:27:11 +00:00
|
|
|
i |= NORMAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
for (FileTreeItem const* const child : myChildren)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
|
|
|
i |= child->priority();
|
|
|
|
}
|
2015-06-10 21:27:11 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
return i;
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
void FileTreeItem::setSubtreePriority(int i, QSet<int>& ids)
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
if (myPriority != i)
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
myPriority = i;
|
2015-06-10 21:27:11 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
if (myFileIndex >= 0)
|
|
|
|
{
|
|
|
|
ids.insert(myFileIndex);
|
|
|
|
}
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
for (FileTreeItem* const child : myChildren)
|
|
|
|
{
|
|
|
|
child->setSubtreePriority(i, ids);
|
|
|
|
}
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
int FileTreeItem::isSubtreeWanted() const
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
if (myChildren.isEmpty())
|
|
|
|
{
|
|
|
|
return myIsWanted ? Qt::Checked : Qt::Unchecked;
|
|
|
|
}
|
2015-06-10 21:27:11 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
int wanted(-1);
|
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
for (FileTreeItem const* const child : myChildren)
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-20 16:02:19 +00:00
|
|
|
int const childWanted = child->isSubtreeWanted();
|
2015-06-10 21:27:11 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
if (wanted == -1)
|
|
|
|
{
|
|
|
|
wanted = childWanted;
|
|
|
|
}
|
2015-06-10 21:27:11 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
if (wanted != childWanted)
|
|
|
|
{
|
|
|
|
wanted = Qt::PartiallyChecked;
|
|
|
|
}
|
2015-06-10 21:27:11 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
if (wanted == Qt::PartiallyChecked)
|
|
|
|
{
|
|
|
|
return wanted;
|
|
|
|
}
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
return wanted;
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
void FileTreeItem::setSubtreeWanted(bool b, QSet<int>& ids)
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
if (myIsWanted != b)
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
myIsWanted = b;
|
2015-06-10 21:27:11 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
if (myFileIndex >= 0)
|
|
|
|
{
|
|
|
|
ids.insert(myFileIndex);
|
|
|
|
}
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
for (FileTreeItem* const child : myChildren)
|
|
|
|
{
|
|
|
|
child->setSubtreeWanted(b, ids);
|
|
|
|
}
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
QString FileTreeItem::path() const
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
QString itemPath;
|
2017-04-20 16:02:19 +00:00
|
|
|
FileTreeItem const* item = this;
|
2015-06-10 21:27:11 +00:00
|
|
|
|
2017-04-30 09:29:58 +00:00
|
|
|
while (item != nullptr && !item->name().isEmpty())
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
if (itemPath.isEmpty())
|
|
|
|
{
|
|
|
|
itemPath = item->name();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
itemPath = item->name() + QLatin1Char('/') + itemPath;
|
|
|
|
}
|
|
|
|
|
|
|
|
item = item->parent();
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
return itemPath;
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
bool FileTreeItem::isComplete() const
|
2015-06-10 21:27:11 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
return myHaveSize == totalSize();
|
2015-06-10 21:27:11 +00:00
|
|
|
}
|