mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-02-04 19:27:33 +01:00
Merge branch 'master' of github.com:martinrotter/rssguard
This commit is contained in:
commit
0e73a3c061
@ -20,7 +20,7 @@
|
|||||||
#include <QtConcurrent/QtConcurrentMap>
|
#include <QtConcurrent/QtConcurrentMap>
|
||||||
|
|
||||||
FeedsImportExportModel::FeedsImportExportModel(QObject* parent)
|
FeedsImportExportModel::FeedsImportExportModel(QObject* parent)
|
||||||
: AccountCheckSortedModel(parent), m_mode(Mode::Import) {
|
: AccountCheckSortedModel(parent), m_mode(Mode::Import), m_newRoot(nullptr) {
|
||||||
|
|
||||||
connect(&m_watcherLookup, &QFutureWatcher<bool>::progressValueChanged, this, [=](int prog) {
|
connect(&m_watcherLookup, &QFutureWatcher<bool>::progressValueChanged, this, [=](int prog) {
|
||||||
emit parsingProgress(prog, m_lookup.size());
|
emit parsingProgress(prog, m_lookup.size());
|
||||||
@ -30,7 +30,12 @@ FeedsImportExportModel::FeedsImportExportModel(QObject* parent)
|
|||||||
auto res = m_watcherLookup.future().results();
|
auto res = m_watcherLookup.future().results();
|
||||||
int number_error = boolinq::from(res).count(false);
|
int number_error = boolinq::from(res).count(false);
|
||||||
|
|
||||||
|
emit layoutAboutToBeChanged();
|
||||||
|
setRootItem(m_newRoot);
|
||||||
emit layoutChanged();
|
emit layoutChanged();
|
||||||
|
|
||||||
|
m_newRoot = nullptr;
|
||||||
|
|
||||||
emit parsingFinished(number_error, res.size() - number_error);
|
emit parsingFinished(number_error, res.size() - number_error);
|
||||||
|
|
||||||
// Done, remove lookups.
|
// Done, remove lookups.
|
||||||
@ -269,7 +274,7 @@ void FeedsImportExportModel::importAsOPML20(const QByteArray& data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int completed = 0, total = 0;
|
int completed = 0, total = 0;
|
||||||
auto* root_item = new StandardServiceRoot();
|
m_newRoot = new StandardServiceRoot();
|
||||||
QStack<RootItem*> model_items;
|
QStack<RootItem*> model_items;
|
||||||
QNetworkProxy custom_proxy;
|
QNetworkProxy custom_proxy;
|
||||||
|
|
||||||
@ -277,7 +282,7 @@ void FeedsImportExportModel::importAsOPML20(const QByteArray& data,
|
|||||||
custom_proxy = sourceModel()->rootItem()->getParentServiceRoot()->networkProxy();
|
custom_proxy = sourceModel()->rootItem()->getParentServiceRoot()->networkProxy();
|
||||||
}
|
}
|
||||||
|
|
||||||
model_items.push(root_item);
|
model_items.push(m_newRoot);
|
||||||
QStack<QDomElement> elements_to_process;
|
QStack<QDomElement> elements_to_process;
|
||||||
|
|
||||||
elements_to_process.push(opml_document.documentElement().elementsByTagName(QSL("body")).at(0).toElement());
|
elements_to_process.push(opml_document.documentElement().elementsByTagName(QSL("body")).at(0).toElement());
|
||||||
@ -355,11 +360,6 @@ void FeedsImportExportModel::importAsOPML20(const QByteArray& data,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now, XML is processed and we have result in form of pointer item structure.
|
|
||||||
emit layoutAboutToBeChanged();
|
|
||||||
|
|
||||||
setRootItem(root_item);
|
|
||||||
|
|
||||||
m_lookup.clear();
|
m_lookup.clear();
|
||||||
m_lookup.append(lookup);
|
m_lookup.append(lookup);
|
||||||
|
|
||||||
@ -395,7 +395,7 @@ void FeedsImportExportModel::importAsTxtURLPerLine(const QByteArray& data,
|
|||||||
emit layoutChanged();
|
emit layoutChanged();
|
||||||
|
|
||||||
int completed = 0;
|
int completed = 0;
|
||||||
auto* root_item = new StandardServiceRoot();
|
m_newRoot = new StandardServiceRoot();
|
||||||
QNetworkProxy custom_proxy;
|
QNetworkProxy custom_proxy;
|
||||||
|
|
||||||
if (sourceModel()->rootItem() != nullptr && sourceModel()->rootItem()->getParentServiceRoot() != nullptr) {
|
if (sourceModel()->rootItem() != nullptr && sourceModel()->rootItem()->getParentServiceRoot() != nullptr) {
|
||||||
@ -411,7 +411,7 @@ void FeedsImportExportModel::importAsTxtURLPerLine(const QByteArray& data,
|
|||||||
|
|
||||||
f.custom_proxy = custom_proxy;
|
f.custom_proxy = custom_proxy;
|
||||||
f.fetch_metadata_online = fetch_metadata_online;
|
f.fetch_metadata_online = fetch_metadata_online;
|
||||||
f.parent = root_item;
|
f.parent = m_newRoot;
|
||||||
f.post_process_script = post_process_script;
|
f.post_process_script = post_process_script;
|
||||||
f.url = url;
|
f.url = url;
|
||||||
|
|
||||||
@ -424,11 +424,6 @@ void FeedsImportExportModel::importAsTxtURLPerLine(const QByteArray& data,
|
|||||||
emit parsingProgress(++completed, urls.size());
|
emit parsingProgress(++completed, urls.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now, XML is processed and we have result in form of pointer item structure.
|
|
||||||
emit layoutAboutToBeChanged();
|
|
||||||
|
|
||||||
setRootItem(root_item);
|
|
||||||
|
|
||||||
m_lookup.clear();
|
m_lookup.clear();
|
||||||
m_lookup.append(lookup);
|
m_lookup.append(lookup);
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ class FeedsImportExportModel : public AccountCheckSortedModel {
|
|||||||
private:
|
private:
|
||||||
QMutex m_mtxLookup;
|
QMutex m_mtxLookup;
|
||||||
QList<FeedLookup> m_lookup;
|
QList<FeedLookup> m_lookup;
|
||||||
|
RootItem* m_newRoot;
|
||||||
QFutureWatcher<bool> m_watcherLookup;
|
QFutureWatcher<bool> m_watcherLookup;
|
||||||
Mode m_mode;
|
Mode m_mode;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user