Browse Source

Merge pull request #5262 from Chocobo1/text

Improve wordings 2
adaptive-webui-19844
sledgehammer999 9 years ago
parent
commit
529c208170
  1. 32
      src/base/scanfoldersmodel.cpp
  2. 5
      src/base/scanfoldersmodel.h
  3. 10
      src/gui/options_imp.cpp
  4. 6
      src/gui/scanfoldersdelegate.cpp

32
src/base/scanfoldersmodel.cpp

@ -28,20 +28,17 @@
* Contact : chris@qbittorrent.org * Contact : chris@qbittorrent.org
*/ */
#include "scanfoldersmodel.h"
#include <QDir> #include <QDir>
#include <QFileInfo> #include <QFileInfo>
#include <QString>
#include <QStringList> #include <QStringList>
#include <QTemporaryFile>
#include <QTextStream> #include <QTextStream>
#include "utils/misc.h"
#include "utils/fs.h"
#include "preferences.h"
#include "logger.h"
#include "filesystemwatcher.h"
#include "bittorrent/session.h" #include "bittorrent/session.h"
#include "scanfoldersmodel.h" #include "filesystemwatcher.h"
#include "preferences.h"
#include "utils/fs.h"
struct ScanFoldersModel::PathData struct ScanFoldersModel::PathData
{ {
@ -128,10 +125,8 @@ QVariant ScanFoldersModel::data(const QModelIndex &index, int role) const
else if (role == Qt::DisplayRole) { else if (role == Qt::DisplayRole) {
switch (pathData->downloadType) { switch (pathData->downloadType) {
case DOWNLOAD_IN_WATCH_FOLDER: case DOWNLOAD_IN_WATCH_FOLDER:
value = tr("Watch Folder");
break;
case DEFAULT_LOCATION: case DEFAULT_LOCATION:
value = tr("Default Folder"); value = pathTypeDisplayName(pathData->downloadType);
break; break;
case CUSTOM_LOCATION: case CUSTOM_LOCATION:
value = pathData->downloadPath; 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();
}

5
src/base/scanfoldersmodel.h

@ -34,10 +34,7 @@
#include <QAbstractListModel> #include <QAbstractListModel>
#include <QList> #include <QList>
QT_BEGIN_NAMESPACE
class QStringList; class QStringList;
QT_END_NAMESPACE
class FileSystemWatcher; class FileSystemWatcher;
class ScanFoldersModel: public QAbstractListModel class ScanFoldersModel: public QAbstractListModel
@ -73,6 +70,8 @@ public:
static void freeInstance(); static void freeInstance();
static ScanFoldersModel* instance(); static ScanFoldersModel* instance();
static QString pathTypeDisplayName(const PathType type);
int rowCount(const QModelIndex &parent = QModelIndex()) const; int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;

10
src/gui/options_imp.cpp

@ -1314,20 +1314,20 @@ int options_imp::getActionOnDblClOnTorrentFn() const
void options_imp::on_addScanFolderButton_clicked() void options_imp::on_addScanFolderButton_clicked()
{ {
Preferences* const pref = Preferences::instance(); Preferences* const pref = Preferences::instance();
const QString dir = QFileDialog::getExistingDirectory(this, tr("Add directory to scan"), const QString dir = QFileDialog::getExistingDirectory(this, tr("Select folder to monitor"),
Utils::Fs::toNativePath(Utils::Fs::folderName(pref->getScanDirsLastPath()))); Utils::Fs::toNativePath(Utils::Fs::folderName(pref->getScanDirsLastPath())));
if (!dir.isEmpty()) { if (!dir.isEmpty()) {
const ScanFoldersModel::PathStatus status = ScanFoldersModel::instance()->addPath(dir, ScanFoldersModel::DEFAULT_LOCATION, QString(), false); const ScanFoldersModel::PathStatus status = ScanFoldersModel::instance()->addPath(dir, ScanFoldersModel::DEFAULT_LOCATION, QString(), false);
QString error; QString error;
switch (status) { switch (status) {
case ScanFoldersModel::AlreadyInList: case ScanFoldersModel::AlreadyInList:
error = tr("Folder is already being watched."); error = tr("Folder is already being monitored:");
break; break;
case ScanFoldersModel::DoesNotExist: case ScanFoldersModel::DoesNotExist:
error = tr("Folder does not exist."); error = tr("Folder does not exist:");
break; break;
case ScanFoldersModel::CannotRead: case ScanFoldersModel::CannotRead:
error = tr("Folder is not readable."); error = tr("Folder is not readable:");
break; break;
default: default:
pref->setScanDirsLastPath(dir); pref->setScanDirsLastPath(dir);
@ -1338,7 +1338,7 @@ void options_imp::on_addScanFolderButton_clicked()
} }
if (!error.isEmpty()) if (!error.isEmpty())
QMessageBox::warning(this, tr("Failure"), tr("Failed to add Scan Folder '%1': %2").arg(dir).arg(error)); QMessageBox::critical(this, tr("Adding entry failed"), QString("%1\n%2").arg(error).arg(dir));
} }
} }

6
src/gui/scanfoldersdelegate.cpp

@ -63,9 +63,9 @@ QWidget *ScanFoldersDelegate::createEditor(QWidget *parent, const QStyleOptionVi
QComboBox* editor = new QComboBox(parent); QComboBox* editor = new QComboBox(parent);
editor->setFocusPolicy(Qt::StrongFocus); editor->setFocusPolicy(Qt::StrongFocus);
editor->addItem(tr("Same as monitored folder")); editor->addItem(ScanFoldersModel::pathTypeDisplayName(ScanFoldersModel::DOWNLOAD_IN_WATCH_FOLDER));
editor->addItem(tr("Default save location")); editor->addItem(ScanFoldersModel::pathTypeDisplayName(ScanFoldersModel::DEFAULT_LOCATION));
editor->addItem(tr("Browse...")); editor->addItem(ScanFoldersModel::pathTypeDisplayName(ScanFoldersModel::CUSTOM_LOCATION));
if (index.data(Qt::UserRole).toInt() == ScanFoldersModel::CUSTOM_LOCATION) { if (index.data(Qt::UserRole).toInt() == ScanFoldersModel::CUSTOM_LOCATION) {
editor->insertSeparator(3); editor->insertSeparator(3);
editor->addItem(index.data().toString()); editor->addItem(index.data().toString());

Loading…
Cancel
Save