Merge pull request #5262 from Chocobo1/text

Improve wordings 2
This commit is contained in:
sledgehammer999
2016-05-17 14:40:47 -05:00
4 changed files with 35 additions and 26 deletions

View File

@@ -28,20 +28,17 @@
* Contact : chris@qbittorrent.org
*/
#include "scanfoldersmodel.h"
#include <QDir>
#include <QFileInfo>
#include <QString>
#include <QStringList>
#include <QTemporaryFile>
#include <QTextStream>
#include "utils/misc.h"
#include "utils/fs.h"
#include "preferences.h"
#include "logger.h"
#include "filesystemwatcher.h"
#include "bittorrent/session.h"
#include "scanfoldersmodel.h"
#include "filesystemwatcher.h"
#include "preferences.h"
#include "utils/fs.h"
struct ScanFoldersModel::PathData
{
@@ -128,10 +125,8 @@ QVariant ScanFoldersModel::data(const QModelIndex &index, int role) const
else if (role == Qt::DisplayRole) {
switch (pathData->downloadType) {
case DOWNLOAD_IN_WATCH_FOLDER:
value = tr("Watch Folder");
break;
case DEFAULT_LOCATION:
value = tr("Default Folder");
value = pathTypeDisplayName(pathData->downloadType);
break;
case CUSTOM_LOCATION:
value = pathData->downloadPath;
@@ -392,3 +387,18 @@ void ScanFoldersModel::addTorrentsToSession(const QStringList &pathList)
}
}
}
QString ScanFoldersModel::pathTypeDisplayName(const PathType type)
{
switch(type) {
case DOWNLOAD_IN_WATCH_FOLDER:
return tr("Monitored folder");
case DEFAULT_LOCATION:
return tr("Default save location");
case CUSTOM_LOCATION:
return tr("Browse...");
default:
qDebug("Invalid PathType: %d", type);
};
return QString();
}

View File

@@ -34,13 +34,10 @@
#include <QAbstractListModel>
#include <QList>
QT_BEGIN_NAMESPACE
class QStringList;
QT_END_NAMESPACE
class FileSystemWatcher;
class ScanFoldersModel : public QAbstractListModel
class ScanFoldersModel: public QAbstractListModel
{
Q_OBJECT
Q_DISABLE_COPY(ScanFoldersModel)
@@ -71,7 +68,9 @@ public:
static bool initInstance(QObject *parent = 0);
static void freeInstance();
static ScanFoldersModel *instance();
static ScanFoldersModel* instance();
static QString pathTypeDisplayName(const PathType type);
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
@@ -81,8 +80,8 @@ public:
// TODO: removePaths(); singular version becomes private helper functions;
// also: remove functions should take modelindexes
PathStatus addPath(const QString &watchPath, const PathType& downloadType, const QString &downloadPath, bool addToFSWatcher = true);
PathStatus updatePath(const QString &watchPath, const PathType& downloadType, const QString &downloadPath);
PathStatus addPath(const QString &watchPath, const PathType &downloadType, const QString &downloadPath, bool addToFSWatcher = true);
PathStatus updatePath(const QString &watchPath, const PathType &downloadType, const QString &downloadPath);
// PRECONDITION: The paths must have been added with addPath() first.
void addToFSWatcher(const QStringList &watchPaths);
void removePath(int row, bool removeFromFSWatcher = true);