Browse Source

Merge pull request #10734 from Chocobo1/folder

Use native folder icon in content tree
adaptive-webui-19844
Mike Tzou 6 years ago committed by GitHub
parent
commit
87dcbbbd23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      src/gui/torrentcontentmodel.cpp

11
src/gui/torrentcontentmodel.cpp

@ -30,7 +30,6 @@
#include <algorithm> #include <algorithm>
#include <QDir>
#include <QFileIconProvider> #include <QFileIconProvider>
#include <QFileInfo> #include <QFileInfo>
#include <QIcon> #include <QIcon>
@ -51,8 +50,8 @@
#include "base/bittorrent/downloadpriority.h" #include "base/bittorrent/downloadpriority.h"
#include "base/global.h" #include "base/global.h"
#include "base/utils/misc.h"
#include "base/utils/fs.h" #include "base/utils/fs.h"
#include "base/utils/misc.h"
#include "guiiconprovider.h" #include "guiiconprovider.h"
#include "torrentcontentmodelfile.h" #include "torrentcontentmodelfile.h"
#include "torrentcontentmodelfolder.h" #include "torrentcontentmodelfolder.h"
@ -64,12 +63,6 @@
namespace namespace
{ {
QIcon getDirectoryIcon()
{
static QIcon cached = GuiIconProvider::instance()->getIcon("inode-directory");
return cached;
}
class UnifiedFileIconProvider : public QFileIconProvider class UnifiedFileIconProvider : public QFileIconProvider
{ {
public: public:
@ -359,7 +352,7 @@ QVariant TorrentContentModel::data(const QModelIndex &index, int role) const
if ((index.column() == TorrentContentModelItem::COL_NAME) && (role == Qt::DecorationRole)) { if ((index.column() == TorrentContentModelItem::COL_NAME) && (role == Qt::DecorationRole)) {
if (item->itemType() == TorrentContentModelItem::FolderType) if (item->itemType() == TorrentContentModelItem::FolderType)
return getDirectoryIcon(); return m_fileIconProvider->icon(QFileIconProvider::Folder);
return m_fileIconProvider->icon(QFileInfo(item->name())); return m_fileIconProvider->icon(QFileInfo(item->name()));
} }

Loading…
Cancel
Save