1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-22 12:34:19 +00:00

Use a regular pointer instead of a QSharedPointer to fix Qt 4.4 compatibility

This commit is contained in:
Christophe Dumez 2010-02-28 16:00:52 +00:00
parent b2545bb709
commit 33f868144b
2 changed files with 5 additions and 6 deletions

View File

@ -76,7 +76,7 @@ QVariant ScanFoldersModel::data(const QModelIndex &index, int role) const {
if (!index.isValid() || index.row() >= rowCount()) if (!index.isValid() || index.row() >= rowCount())
return QVariant(); return QVariant();
const QSharedPointer<PathData> &pathData = m_pathList.at(index.row()); const PathData* pathData = m_pathList.at(index.row());
if (index.column() == PathColumn && role == Qt::DisplayRole) if (index.column() == PathColumn && role == Qt::DisplayRole)
return pathData->path; return pathData->path;
if (index.column() == DownloadAtTorrentColumn && role == Qt::CheckStateRole) if (index.column() == DownloadAtTorrentColumn && role == Qt::CheckStateRole)
@ -122,7 +122,7 @@ ScanFoldersModel::PathStatus ScanFoldersModel::addPath(const QString &path) {
connect(m_fsWatcher, SIGNAL(torrentsAdded(QStringList&)), this, SIGNAL(torrentsAdded(QStringList&))); connect(m_fsWatcher, SIGNAL(torrentsAdded(QStringList&)), this, SIGNAL(torrentsAdded(QStringList&)));
} }
beginInsertRows(QModelIndex(), rowCount(), rowCount()); beginInsertRows(QModelIndex(), rowCount(), rowCount());
m_pathList << QSharedPointer<PathData>(new PathData(canonicalPath)); m_pathList << new PathData(canonicalPath);
endInsertRows(); endInsertRows();
m_fsWatcher->addPath(canonicalPath); m_fsWatcher->addPath(canonicalPath);
return Ok; return Ok;
@ -169,7 +169,7 @@ bool ScanFoldersModel::downloadInTorrentFolder(const QString &filePath) const {
int ScanFoldersModel::findPathData(const QString &path) const { int ScanFoldersModel::findPathData(const QString &path) const {
for (int i = 0; i < m_pathList.count(); ++i) { for (int i = 0; i < m_pathList.count(); ++i) {
const QSharedPointer<PathData> &pathData = m_pathList.at(i); const PathData* pathData = m_pathList.at(i);
if (pathData->path == path) if (pathData->path == path)
return i; return i;
} }
@ -180,7 +180,7 @@ int ScanFoldersModel::findPathData(const QString &path) const {
void ScanFoldersModel::makePersistent(QSettings &settings) { void ScanFoldersModel::makePersistent(QSettings &settings) {
QStringList paths; QStringList paths;
QList<QVariant> downloadInFolderInfo; QList<QVariant> downloadInFolderInfo;
foreach (const QSharedPointer<PathData> &pathData, m_pathList) { foreach (const PathData* pathData, m_pathList) {
paths << pathData->path; paths << pathData->path;
downloadInFolderInfo << pathData->downloadAtPath; downloadInFolderInfo << pathData->downloadAtPath;
} }

View File

@ -33,7 +33,6 @@
#include <QAbstractTableModel> #include <QAbstractTableModel>
#include <QList> #include <QList>
#include <QSharedPointer>
#include <QStringList> #include <QStringList>
class FileSystemWatcher; class FileSystemWatcher;
@ -75,7 +74,7 @@ private:
class PathData; class PathData;
int findPathData(const QString &path) const; int findPathData(const QString &path) const;
QList<QSharedPointer<PathData> > m_pathList; QList<PathData*> m_pathList;
FileSystemWatcher *m_fsWatcher; FileSystemWatcher *m_fsWatcher;
}; };