Redesign RSS subsystem

This commit is contained in:
Vladimir Golovnev (Glassez)
2017-03-07 16:10:42 +03:00
parent 090a2edc1a
commit 989a70fe60
64 changed files with 5116 additions and 4727 deletions

View File

@@ -214,12 +214,12 @@ bool Utils::Fs::sameFiles(const QString& path1, const QString& path2)
return same;
}
QString Utils::Fs::toValidFileSystemName(const QString &name, bool allowSeparators)
QString Utils::Fs::toValidFileSystemName(const QString &name, bool allowSeparators, const QString &pad)
{
QRegExp regex(allowSeparators ? "[:?\"*<>|]+" : "[\\\\/:?\"*<>|]+");
QString validName = name.trimmed();
validName.replace(regex, " ");
validName.replace(regex, pad);
qDebug() << "toValidFileSystemName:" << name << "=>" << validName;
return validName;

View File

@@ -48,7 +48,8 @@ namespace Utils
QString folderName(const QString& file_path);
qint64 computePathSize(const QString& path);
bool sameFiles(const QString& path1, const QString& path2);
QString toValidFileSystemName(const QString &name, bool allowSeparators = false);
QString toValidFileSystemName(const QString &name, bool allowSeparators = false
, const QString &pad = QLatin1String(" "));
bool isValidFileSystemName(const QString& name, bool allowSeparators = false);
qulonglong freeDiskSpaceOnPath(const QString &path);
QString branchPath(const QString& file_path, QString* removed = 0);

View File

@@ -35,6 +35,7 @@
#include <QByteArray>
#include <QDebug>
#include <QProcess>
#include <QRegularExpression>
#include <QThread>
#include <QSysInfo>
#include <boost/version.hpp>
@@ -503,9 +504,10 @@ QList<bool> Utils::Misc::boolListfromStringList(const QStringList &l)
bool Utils::Misc::isUrl(const QString &s)
{
const QString scheme = QUrl(s).scheme();
QRegExp is_url("http[s]?|ftp", Qt::CaseInsensitive);
return is_url.exactMatch(scheme);
static const QRegularExpression reURLScheme(
"http[s]?|ftp", QRegularExpression::CaseInsensitiveOption);
return reURLScheme.match(QUrl(s).scheme()).hasMatch();
}
QString Utils::Misc::parseHtmlLinks(const QString &raw_text)