partially replaced obsolete qregexp - still stome places remain
This commit is contained in:
parent
45b29b8e33
commit
54ce2d6cf6
17 changed files with 60 additions and 53 deletions
|
@ -15,9 +15,8 @@
|
||||||
#include <QThreadPool>
|
#include <QThreadPool>
|
||||||
|
|
||||||
FeedDownloader::FeedDownloader(QObject* parent)
|
FeedDownloader::FeedDownloader(QObject* parent)
|
||||||
: QObject(parent), m_feeds(QList<Feed*>()), m_mutex(new QMutex()), m_threadPool(new QThreadPool(this)),
|
: QObject(parent), m_mutex(new QMutex()), m_threadPool(new QThreadPool(this)),
|
||||||
m_results(FeedDownloadResults()), m_feedsUpdated(0),
|
m_feedsUpdated(0), m_feedsUpdating(0), m_feedsOriginalCount(0) {
|
||||||
m_feedsUpdating(0), m_feedsOriginalCount(0) {
|
|
||||||
qRegisterMetaType<FeedDownloadResults>("FeedDownloadResults");
|
qRegisterMetaType<FeedDownloadResults>("FeedDownloadResults");
|
||||||
m_threadPool->setMaxThreadCount(2);
|
m_threadPool->setMaxThreadCount(2);
|
||||||
}
|
}
|
||||||
|
@ -35,7 +34,7 @@ bool FeedDownloader::isUpdateRunning() const {
|
||||||
|
|
||||||
void FeedDownloader::updateAvailableFeeds() {
|
void FeedDownloader::updateAvailableFeeds() {
|
||||||
foreach (const Feed* feed, m_feeds) {
|
foreach (const Feed* feed, m_feeds) {
|
||||||
CacheForServiceRoot* cache = dynamic_cast<CacheForServiceRoot*>(feed->getParentServiceRoot());
|
auto* cache = dynamic_cast<CacheForServiceRoot*>(feed->getParentServiceRoot());
|
||||||
|
|
||||||
if (cache != nullptr) {
|
if (cache != nullptr) {
|
||||||
qDebug("Saving cache for feed with DB ID %d and title '%s'.", feed->id(), qPrintable(feed->title()));
|
qDebug("Saving cache for feed with DB ID %d and title '%s'.", feed->id(), qPrintable(feed->title()));
|
||||||
|
@ -130,8 +129,6 @@ void FeedDownloader::finalizeUpdate() {
|
||||||
emit updateFinished(m_results);
|
emit updateFinished(m_results);
|
||||||
}
|
}
|
||||||
|
|
||||||
FeedDownloadResults::FeedDownloadResults() : m_updatedFeeds(QList<QPair<QString, int>>()) {}
|
|
||||||
|
|
||||||
QString FeedDownloadResults::overview(int how_many_feeds) const {
|
QString FeedDownloadResults::overview(int how_many_feeds) const {
|
||||||
QStringList result;
|
QStringList result;
|
||||||
|
|
||||||
|
@ -142,7 +139,7 @@ QString FeedDownloadResults::overview(int how_many_feeds) const {
|
||||||
QString res_str = result.join(QSL("\n"));
|
QString res_str = result.join(QSL("\n"));
|
||||||
|
|
||||||
if (m_updatedFeeds.size() > how_many_feeds) {
|
if (m_updatedFeeds.size() > how_many_feeds) {
|
||||||
res_str += QObject::tr("\n\n+ %n other feeds.", 0, m_updatedFeeds.size() - how_many_feeds);
|
res_str += QObject::tr("\n\n+ %n other feeds.", nullptr, m_updatedFeeds.size() - how_many_feeds);
|
||||||
}
|
}
|
||||||
|
|
||||||
return res_str;
|
return res_str;
|
||||||
|
|
|
@ -16,8 +16,6 @@ class QMutex;
|
||||||
// Represents results of batch feed updates.
|
// Represents results of batch feed updates.
|
||||||
class FeedDownloadResults {
|
class FeedDownloadResults {
|
||||||
public:
|
public:
|
||||||
explicit FeedDownloadResults();
|
|
||||||
|
|
||||||
QList<QPair<QString, int>> updatedFeeds() const;
|
QList<QPair<QString, int>> updatedFeeds() const;
|
||||||
QString overview(int how_many_feeds) const;
|
QString overview(int how_many_feeds) const;
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ FeedsModel::~FeedsModel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
QMimeData* FeedsModel::mimeData(const QModelIndexList& indexes) const {
|
QMimeData* FeedsModel::mimeData(const QModelIndexList& indexes) const {
|
||||||
QMimeData* mime_data = new QMimeData();
|
auto* mime_data = new QMimeData();
|
||||||
QByteArray encoded_data;
|
QByteArray encoded_data;
|
||||||
QDataStream stream(&encoded_data, QIODevice::WriteOnly);
|
QDataStream stream(&encoded_data, QIODevice::WriteOnly);
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ QMimeData* FeedsModel::mimeData(const QModelIndexList& indexes) const {
|
||||||
RootItem* item_for_index = itemForIndex(index);
|
RootItem* item_for_index = itemForIndex(index);
|
||||||
|
|
||||||
if (item_for_index->kind() != RootItemKind::Root) {
|
if (item_for_index->kind() != RootItemKind::Root) {
|
||||||
stream << (quintptr) item_for_index;
|
stream << quintptr(item_for_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,6 +81,7 @@ QStringList FeedsModel::mimeTypes() const {
|
||||||
return QStringList() << QSL(MIME_TYPE_ITEM_POINTER);
|
return QStringList() << QSL(MIME_TYPE_ITEM_POINTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef RootItem* RootItemPtr;
|
||||||
bool FeedsModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column,
|
bool FeedsModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column,
|
||||||
const QModelIndex& parent) {
|
const QModelIndex& parent) {
|
||||||
Q_UNUSED(row)
|
Q_UNUSED(row)
|
||||||
|
@ -105,7 +106,7 @@ bool FeedsModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int
|
||||||
quintptr pointer_to_item; stream >> pointer_to_item;
|
quintptr pointer_to_item; stream >> pointer_to_item;
|
||||||
|
|
||||||
// We have item we want to drag, we also determine the target item.
|
// We have item we want to drag, we also determine the target item.
|
||||||
RootItem* dragged_item = (RootItem*) pointer_to_item;
|
auto* dragged_item = RootItemPtr(pointer_to_item);
|
||||||
RootItem* target_item = itemForIndex(parent);
|
RootItem* target_item = itemForIndex(parent);
|
||||||
ServiceRoot* dragged_item_root = dragged_item->getParentServiceRoot();
|
ServiceRoot* dragged_item_root = dragged_item->getParentServiceRoot();
|
||||||
ServiceRoot* target_item_root = target_item->getParentServiceRoot();
|
ServiceRoot* target_item_root = target_item->getParentServiceRoot();
|
||||||
|
@ -190,7 +191,7 @@ QModelIndex FeedsModel::index(int row, int column, const QModelIndex& parent) co
|
||||||
RootItem* parent_item = itemForIndex(parent);
|
RootItem* parent_item = itemForIndex(parent);
|
||||||
RootItem* child_item = parent_item->child(row);
|
RootItem* child_item = parent_item->child(row);
|
||||||
|
|
||||||
if (child_item) {
|
if (child_item != nullptr) {
|
||||||
return createIndex(row, column, child_item);
|
return createIndex(row, column, child_item);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -10,8 +10,7 @@
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
FeedsProxyModel::FeedsProxyModel(FeedsModel* source_model, QObject* parent)
|
FeedsProxyModel::FeedsProxyModel(FeedsModel* source_model, QObject* parent)
|
||||||
: QSortFilterProxyModel(parent), m_sourceModel(source_model), m_selectedItem(nullptr),
|
: QSortFilterProxyModel(parent), m_sourceModel(source_model), m_selectedItem(nullptr), m_showUnreadOnly(false) {
|
||||||
m_showUnreadOnly(false), m_hiddenIndices(QList<QPair<int, QModelIndex>>()) {
|
|
||||||
setObjectName(QSL("FeedsProxyModel"));
|
setObjectName(QSL("FeedsProxyModel"));
|
||||||
setSortRole(Qt::EditRole);
|
setSortRole(Qt::EditRole);
|
||||||
setSortCaseSensitivity(Qt::CaseInsensitive);
|
setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||||
|
@ -28,10 +27,10 @@ FeedsProxyModel::~FeedsProxyModel() {
|
||||||
|
|
||||||
QModelIndexList FeedsProxyModel::match(const QModelIndex& start, int role, const QVariant& value, int hits, Qt::MatchFlags flags) const {
|
QModelIndexList FeedsProxyModel::match(const QModelIndex& start, int role, const QVariant& value, int hits, Qt::MatchFlags flags) const {
|
||||||
QModelIndexList result;
|
QModelIndexList result;
|
||||||
const uint match_type = flags & 0x0F;
|
const int match_type = flags & 0x0F;
|
||||||
const Qt::CaseSensitivity cs = Qt::CaseInsensitive;
|
const Qt::CaseSensitivity cs = Qt::CaseInsensitive;
|
||||||
const bool recurse = flags & Qt::MatchRecursive;
|
const bool recurse = (flags& Qt::MatchRecursive) > 0;
|
||||||
const bool wrap = flags & Qt::MatchWrap;
|
const bool wrap = (flags& Qt::MatchWrap) > 0;
|
||||||
const bool all_hits = (hits == -1);
|
const bool all_hits = (hits == -1);
|
||||||
QString entered_text;
|
QString entered_text;
|
||||||
const QModelIndex p = parent(start);
|
const QModelIndex p = parent(start);
|
||||||
|
@ -66,14 +65,18 @@ QModelIndexList FeedsProxyModel::match(const QModelIndex& start, int role, const
|
||||||
|
|
||||||
switch (match_type) {
|
switch (match_type) {
|
||||||
case Qt::MatchRegExp:
|
case Qt::MatchRegExp:
|
||||||
if (QRegExp(entered_text, cs).exactMatch(item_text)) {
|
if (QRegularExpression(entered_text,
|
||||||
|
QRegularExpression::PatternOption::CaseInsensitiveOption |
|
||||||
|
QRegularExpression::PatternOption::UseUnicodePropertiesOption).match(item_text).hasMatch()) {
|
||||||
result.append(idx);
|
result.append(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::MatchWildcard:
|
case Qt::MatchWildcard:
|
||||||
if (QRegExp(entered_text, cs, QRegExp::Wildcard).exactMatch(item_text)) {
|
if (QRegularExpression(QRegularExpression::wildcardToRegularExpression(entered_text),
|
||||||
|
QRegularExpression::PatternOption::CaseInsensitiveOption |
|
||||||
|
QRegularExpression::PatternOption::UseUnicodePropertiesOption).match(item_text).hasMatch()) {
|
||||||
result.append(idx);
|
result.append(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,8 +115,8 @@ QModelIndexList FeedsProxyModel::match(const QModelIndex& start, int role, const
|
||||||
|
|
||||||
if (recurse && hasChildren(idx)) {
|
if (recurse && hasChildren(idx)) {
|
||||||
result +=
|
result +=
|
||||||
match(index(0, idx.column(), idx), role, (entered_text.isEmpty() ? value : entered_text), (all_hits ? -1 : hits - result.count()),
|
match(index(0, idx.column(), idx), role, (entered_text.isEmpty() ? value : entered_text),
|
||||||
flags);
|
(all_hits ? -1 : hits - result.count()), flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
Enclosure::Enclosure(const QString& url, const QString& mime) : m_url(url), m_mimeType(mime) {}
|
Enclosure::Enclosure(QString url, QString mime) : m_url(std::move(url)), m_mimeType(std::move(mime)) {}
|
||||||
|
|
||||||
QList<Enclosure> Enclosures::decodeEnclosuresFromString(const QString& enclosures_data) {
|
QList<Enclosure> Enclosures::decodeEnclosuresFromString(const QString& enclosures_data) {
|
||||||
QList<Enclosure> enclosures;
|
QList<Enclosure> enclosures;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// Represents single enclosure.
|
// Represents single enclosure.
|
||||||
struct Enclosure {
|
struct Enclosure {
|
||||||
public:
|
public:
|
||||||
explicit Enclosure(const QString& url = QString(), const QString& mime = QString());
|
explicit Enclosure(QString url = QString(), QString mime = QString());
|
||||||
|
|
||||||
QString m_url;
|
QString m_url;
|
||||||
QString m_mimeType;
|
QString m_mimeType;
|
||||||
|
@ -51,7 +51,7 @@ class Message {
|
||||||
|
|
||||||
// Is true if "created" date was obtained directly
|
// Is true if "created" date was obtained directly
|
||||||
// from the feed, otherwise is false
|
// from the feed, otherwise is false
|
||||||
bool m_createdFromFeed;
|
bool m_createdFromFeed = false;
|
||||||
|
|
||||||
friend inline bool operator==(const Message& lhs, const Message& rhs) {
|
friend inline bool operator==(const Message& lhs, const Message& rhs) {
|
||||||
return lhs.m_accountId == rhs.m_accountId && lhs.m_id == rhs.m_id;
|
return lhs.m_accountId == rhs.m_accountId && lhs.m_id == rhs.m_id;
|
||||||
|
|
|
@ -78,7 +78,7 @@ QModelIndexList MessagesProxyModel::mapListFromSource(const QModelIndexList& ind
|
||||||
QModelIndexList MessagesProxyModel::match(const QModelIndex& start, int role,
|
QModelIndexList MessagesProxyModel::match(const QModelIndex& start, int role,
|
||||||
const QVariant& entered_value, int hits, Qt::MatchFlags flags) const {
|
const QVariant& entered_value, int hits, Qt::MatchFlags flags) const {
|
||||||
QModelIndexList result;
|
QModelIndexList result;
|
||||||
const uint match_type = flags & 0x0F;
|
const int match_type = flags & 0x0F;
|
||||||
const Qt::CaseSensitivity case_sensitivity = Qt::CaseInsensitive;
|
const Qt::CaseSensitivity case_sensitivity = Qt::CaseInsensitive;
|
||||||
const bool wrap = flags & Qt::MatchWrap;
|
const bool wrap = flags & Qt::MatchWrap;
|
||||||
const bool all_hits = (hits == -1);
|
const bool all_hits = (hits == -1);
|
||||||
|
@ -113,14 +113,18 @@ QModelIndexList MessagesProxyModel::match(const QModelIndex& start, int role,
|
||||||
|
|
||||||
switch (match_type) {
|
switch (match_type) {
|
||||||
case Qt::MatchRegExp:
|
case Qt::MatchRegExp:
|
||||||
if (QRegExp(entered_text, case_sensitivity).exactMatch(item_text)) {
|
if (QRegularExpression(entered_text,
|
||||||
|
QRegularExpression::PatternOption::CaseInsensitiveOption |
|
||||||
|
QRegularExpression::PatternOption::UseUnicodePropertiesOption).match(item_text).hasMatch()) {
|
||||||
result.append(idx);
|
result.append(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::MatchWildcard:
|
case Qt::MatchWildcard:
|
||||||
if (QRegExp(entered_text, case_sensitivity, QRegExp::Wildcard).exactMatch(item_text)) {
|
if (QRegularExpression(QRegularExpression::wildcardToRegularExpression(entered_text),
|
||||||
|
QRegularExpression::PatternOption::CaseInsensitiveOption |
|
||||||
|
QRegularExpression::PatternOption::UseUnicodePropertiesOption).match(item_text).hasMatch()) {
|
||||||
result.append(idx);
|
result.append(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,8 @@ void FormSettings::applySettings() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!panels_for_restart.isEmpty()) {
|
if (!panels_for_restart.isEmpty()) {
|
||||||
const QStringList changed_settings_description = panels_for_restart.replaceInStrings(QRegExp(QSL("^")), QString::fromUtf8(" • "));
|
const QStringList changed_settings_description = panels_for_restart.replaceInStrings(QRegularExpression(QSL("^")),
|
||||||
|
QString::fromUtf8(" • "));
|
||||||
const QMessageBox::StandardButton clicked_button = MessageBox::show(this,
|
const QMessageBox::StandardButton clicked_button = MessageBox::show(this,
|
||||||
QMessageBox::Question,
|
QMessageBox::Question,
|
||||||
tr("Critical settings were changed"),
|
tr("Critical settings were changed"),
|
||||||
|
@ -101,7 +102,8 @@ void FormSettings::cancelSettings() {
|
||||||
reject();
|
reject();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const QStringList changed_settings_description = changed_panels.replaceInStrings(QRegExp(QSL("^")), QString::fromUtf8(" • "));
|
const QStringList changed_settings_description = changed_panels.replaceInStrings(QRegularExpression(QSL("^")),
|
||||||
|
QString::fromUtf8(" • "));
|
||||||
|
|
||||||
if (MessageBox::show(this,
|
if (MessageBox::show(this,
|
||||||
QMessageBox::Critical,
|
QMessageBox::Critical,
|
||||||
|
|
|
@ -241,15 +241,16 @@ QString MessagePreviewer::prepareHtmlForMessage(const Message& message) {
|
||||||
html += QString("[%2] <a href=\"%1\">%1</a><br/>").arg(enc_url, enc.m_mimeType);
|
html += QString("[%2] <a href=\"%1\">%1</a><br/>").arg(enc_url, enc.m_mimeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
int offset = 0;
|
QRegularExpression imgTagRegex("\\<img[^\\>]*src\\s*=\\s*\"([^\"]*)\"[^\\>]*\\>",
|
||||||
QRegExp imgTagRegex("\\<img[^\\>]*src\\s*=\\s*\"([^\"]*)\"[^\\>]*\\>", Qt::CaseInsensitive);
|
QRegularExpression::PatternOption::CaseInsensitiveOption |
|
||||||
|
QRegularExpression::PatternOption::InvertedGreedinessOption);
|
||||||
|
QRegularExpressionMatchIterator i = imgTagRegex.globalMatch(message.m_contents);
|
||||||
|
|
||||||
imgTagRegex.setMinimal(true);
|
while (i.hasNext()) {
|
||||||
|
QRegularExpressionMatch match = i.next();
|
||||||
|
|
||||||
while ((offset = imgTagRegex.indexIn(message.m_contents, offset)) != -1) {
|
m_pictures.append(match.captured(1));
|
||||||
m_pictures.append(imgTagRegex.cap(1));
|
html += QString("[%1] <a href=\"%2\">%2</a><br/>").arg(tr("image"), match.captured(1));
|
||||||
offset += imgTagRegex.matchedLength();
|
|
||||||
html += QString("[%2] <a href=\"%1\">%1</a><br/>").arg(imgTagRegex.cap(1), tr("image"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
html += "<br/>";
|
html += "<br/>";
|
||||||
|
|
|
@ -21,13 +21,14 @@ double TimeSpinBox::valueFromText(const QString& text) const {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QRegExp rx("\\b[0-9]{1,}\\b");
|
QRegularExpression rx("\\b[0-9]{1,}\\b");
|
||||||
QStringList numbers;
|
QStringList numbers;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
QRegularExpressionMatchIterator i = rx.globalMatch(text);
|
||||||
|
|
||||||
while ((pos = rx.indexIn(text, pos)) != -1) {
|
while (i.hasNext()) {
|
||||||
numbers.append(rx.cap(0));
|
numbers.append(i.next().captured());
|
||||||
|
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
++pos;
|
++pos;
|
||||||
|
@ -45,7 +46,7 @@ double TimeSpinBox::valueFromText(const QString& text) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TimeSpinBox::textFromValue(double val) const {
|
QString TimeSpinBox::textFromValue(double val) const {
|
||||||
int minutes_total = (int)val;
|
int minutes_total = int(val);
|
||||||
int minutes_val = minutes_total % 60;
|
int minutes_val = minutes_total % 60;
|
||||||
int hours_val = (minutes_total - minutes_val) / 60;
|
int hours_val = (minutes_total - minutes_val) / 60;
|
||||||
QString hours = tr("%n hour(s)", "", hours_val);
|
QString hours = tr("%n hour(s)", "", hours_val);
|
||||||
|
|
|
@ -55,8 +55,8 @@ void IconFactory::setupSearchPaths() {
|
||||||
QIcon::setThemeSearchPaths(QIcon::themeSearchPaths() << APP_THEME_PATH);
|
QIcon::setThemeSearchPaths(QIcon::themeSearchPaths() << APP_THEME_PATH);
|
||||||
qDebug("Available icon theme paths: %s.",
|
qDebug("Available icon theme paths: %s.",
|
||||||
qPrintable(QIcon::themeSearchPaths()
|
qPrintable(QIcon::themeSearchPaths()
|
||||||
.replaceInStrings(QRegExp(QSL("^|$")), QSL("\'"))
|
.replaceInStrings(QRegularExpression(QSL("^|$")), QSL("\'"))
|
||||||
.replaceInStrings(QRegExp(QSL("/")), QDir::separator()).join(QSL(", "))));
|
.replaceInStrings(QRegularExpression(QSL("/")), QDir::separator()).join(QSL(", "))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IconFactory::setCurrentIconTheme(const QString& theme_name) {
|
void IconFactory::setCurrentIconTheme(const QString& theme_name) {
|
||||||
|
@ -75,8 +75,8 @@ void IconFactory::loadCurrentIconTheme() {
|
||||||
// Display list of installed themes.
|
// Display list of installed themes.
|
||||||
qDebug("Installed icon themes are: %s.",
|
qDebug("Installed icon themes are: %s.",
|
||||||
qPrintable(QStringList(installed_themes)
|
qPrintable(QStringList(installed_themes)
|
||||||
.replaceInStrings(QRegExp(QSL("^|$")), QSL("\'"))
|
.replaceInStrings(QRegularExpression(QSL("^|$")), QSL("\'"))
|
||||||
.replaceInStrings(QRegExp(QSL("^\\'$")), QSL("\'\'")).join(QSL(", "))));
|
.replaceInStrings(QRegularExpression(QSL("^\\'$")), QSL("\'\'")).join(QSL(", "))));
|
||||||
|
|
||||||
if (installed_themes.contains(theme_name_from_settings)) {
|
if (installed_themes.contains(theme_name_from_settings)) {
|
||||||
// Desired icon theme is installed and can be loaded.
|
// Desired icon theme is installed and can be loaded.
|
||||||
|
|
|
@ -70,7 +70,7 @@ void Downloader::manipulateData(const QString& url,
|
||||||
|
|
||||||
if (non_const_url.startsWith(URI_SCHEME_FEED)) {
|
if (non_const_url.startsWith(URI_SCHEME_FEED)) {
|
||||||
qDebug("Replacing URI schemes for '%s'.", qPrintable(non_const_url));
|
qDebug("Replacing URI schemes for '%s'.", qPrintable(non_const_url));
|
||||||
request.setUrl(non_const_url.replace(QRegExp(QString('^') + URI_SCHEME_FEED), QString(URI_SCHEME_HTTP)));
|
request.setUrl(non_const_url.replace(QRegularExpression(QString('^') + URI_SCHEME_FEED), QString(URI_SCHEME_HTTP)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
request.setUrl(non_const_url);
|
request.setUrl(non_const_url);
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QRegExp>
|
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
#if defined (USE_WEBENGINE)
|
#if defined (USE_WEBENGINE)
|
||||||
|
@ -67,7 +66,7 @@ bool WebFactory::openUrlInExternalBrowser(const QString& url) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString WebFactory::stripTags(QString text) {
|
QString WebFactory::stripTags(QString text) {
|
||||||
return text.remove(QRegExp(QSL("<[^>]*>")));
|
return text.remove(QRegularExpression(QSL("<[^>]*>")));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString WebFactory::escapeHtml(const QString& html) {
|
QString WebFactory::escapeHtml(const QString& html) {
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "qtlocalpeer.h"
|
#include "qtlocalpeer.h"
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
|
#include <QRegularExpression>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
|
@ -81,7 +82,7 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString& appId)
|
||||||
prefix = id.section(QLatin1Char('/'), -1);
|
prefix = id.section(QLatin1Char('/'), -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
prefix.remove(QRegExp("[^a-zA-Z]"));
|
prefix.remove(QRegularExpression("[^a-zA-Z]"));
|
||||||
prefix.truncate(6);
|
prefix.truncate(6);
|
||||||
QByteArray idc = id.toUtf8();
|
QByteArray idc = id.toUtf8();
|
||||||
quint16 idNum = qChecksum(idc.constData(), idc.size());
|
quint16 idNum = qChecksum(idc.constData(), idc.size());
|
||||||
|
|
|
@ -185,10 +185,10 @@ void Feed::run() {
|
||||||
msgs[i].m_title = QUrl::fromPercentEncoding(msgs[i].m_title.toUtf8())
|
msgs[i].m_title = QUrl::fromPercentEncoding(msgs[i].m_title.toUtf8())
|
||||||
|
|
||||||
// Replace all continuous white space.
|
// Replace all continuous white space.
|
||||||
.replace(QRegExp(QSL("[\\s]{2,}")), QSL(" "))
|
.replace(QRegularExpression(QSL("[\\s]{2,}")), QSL(" "))
|
||||||
|
|
||||||
// Remove all newlines and leading white space.
|
// Remove all newlines and leading white space.
|
||||||
.remove(QRegExp(QSL("([\\n\\r])|(^\\s)")));
|
.remove(QRegularExpression(QSL("([\\n\\r])|(^\\s)")));
|
||||||
}
|
}
|
||||||
|
|
||||||
emit messagesObtained(msgs, error_during_obtaining);
|
emit messagesObtained(msgs, error_during_obtaining);
|
||||||
|
|
|
@ -107,7 +107,7 @@ void FormFeedDetails::onDescriptionChanged(const QString& new_description) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormFeedDetails::onUrlChanged(const QString& new_url) {
|
void FormFeedDetails::onUrlChanged(const QString& new_url) {
|
||||||
if (QRegExp(URL_REGEXP).exactMatch(new_url)) {
|
if (QRegularExpression(URL_REGEXP).match(new_url).hasMatch()) {
|
||||||
// New url is well-formed.
|
// New url is well-formed.
|
||||||
m_ui->m_txtUrl->setStatus(LineEditWithStatus::Ok, tr("The URL is ok."));
|
m_ui->m_txtUrl->setStatus(LineEditWithStatus::Ok, tr("The URL is ok."));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue