mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-03 02:14:16 +00:00
- Added some more function for rss feeds grouping
This commit is contained in:
parent
73dbce45b2
commit
05569a5011
29
src/rss.cpp
29
src/rss.cpp
@ -104,6 +104,7 @@ RssFolder* RssFolder::addFolder(QStringList full_path) {
|
|||||||
Q_ASSERT(!this->contains(name));
|
Q_ASSERT(!this->contains(name));
|
||||||
RssFolder *subfolder = new RssFolder(this, rssmanager, BTSession, name);
|
RssFolder *subfolder = new RssFolder(this, rssmanager, BTSession, name);
|
||||||
(*this)[name] = subfolder;
|
(*this)[name] = subfolder;
|
||||||
|
return subfolder;
|
||||||
} else {
|
} else {
|
||||||
QString subfolder_name = full_path.takeFirst();
|
QString subfolder_name = full_path.takeFirst();
|
||||||
// Check if the subfolder exists and create it if it does not
|
// Check if the subfolder exists and create it if it does not
|
||||||
@ -291,6 +292,26 @@ QList<RssStream*> RssFolder::getAllFeeds() const {
|
|||||||
return streams;
|
return streams;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RssFolder::removeFileRef(RssFile* item) {
|
||||||
|
if(item->getType() == RssFile::STREAM) {
|
||||||
|
Q_ASSERT(this->contains(((RssStream*)item)->getUrl()));
|
||||||
|
this->remove(((RssStream*)item)->getUrl());
|
||||||
|
} else {
|
||||||
|
Q_ASSERT(this->contains(((RssFolder*)item)->getName()));
|
||||||
|
this->remove(((RssFolder*)item)->getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RssFolder::addFile(RssFile * item) {
|
||||||
|
if(item->getType() == RssFile::STREAM) {
|
||||||
|
Q_ASSERT(!this->contains(((RssStream*)item)->getUrl()));
|
||||||
|
(*this)[((RssStream*)item)->getUrl()] = item;
|
||||||
|
} else {
|
||||||
|
Q_ASSERT(!this->contains(((RssFolder*)item)->getName()));
|
||||||
|
(*this)[((RssFolder*)item)->getName()] = item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** RssManager **/
|
/** RssManager **/
|
||||||
|
|
||||||
RssManager::RssManager(bittorrent *BTSession): RssFolder(0, this, BTSession, QString::null) {
|
RssManager::RssManager(bittorrent *BTSession): RssFolder(0, this, BTSession, QString::null) {
|
||||||
@ -337,6 +358,14 @@ void RssManager::forwardFeedIconChanged(QString url, QString icon_path) {
|
|||||||
emit feedIconChanged(url, icon_path);
|
emit feedIconChanged(url, icon_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RssManager::moveFile(QStringList old_path, QStringList new_path) {
|
||||||
|
RssFile* item = getFile(old_path);
|
||||||
|
RssFolder* src_folder = item->getParent();
|
||||||
|
QString new_name = new_path.takeLast();
|
||||||
|
RssFolder* dest_folder = (RssFolder*)getFile(new_path);
|
||||||
|
dest_folder->addFile(item);
|
||||||
|
src_folder->removeFileRef(item);
|
||||||
|
}
|
||||||
|
|
||||||
void RssManager::saveStreamList(){
|
void RssManager::saveStreamList(){
|
||||||
QList<QPair<QString, QString> > streamsList;
|
QList<QPair<QString, QString> > streamsList;
|
||||||
|
@ -91,6 +91,7 @@ public:
|
|||||||
virtual QString getName() const = 0;
|
virtual QString getName() const = 0;
|
||||||
virtual void rename(QStringList path, QString new_name) = 0;
|
virtual void rename(QStringList path, QString new_name) = 0;
|
||||||
virtual void markAllAsRead() = 0;
|
virtual void markAllAsRead() = 0;
|
||||||
|
virtual RssFolder* getParent() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Item of a rss stream, single information
|
// Item of a rss stream, single information
|
||||||
@ -388,6 +389,7 @@ public slots:
|
|||||||
public:
|
public:
|
||||||
RssStream(RssFolder* parent, RssManager *rssmanager, bittorrent *BTSession, QString _url);
|
RssStream(RssFolder* parent, RssManager *rssmanager, bittorrent *BTSession, QString _url);
|
||||||
~RssStream();
|
~RssStream();
|
||||||
|
RssFolder* getParent() { return parent; }
|
||||||
FileType getType() const;
|
FileType getType() const;
|
||||||
void refresh();
|
void refresh();
|
||||||
QStringList getPath() const;
|
QStringList getPath() const;
|
||||||
@ -434,6 +436,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
RssFolder(RssFolder *parent, RssManager *rssmanager, bittorrent *BTSession, QString name);
|
RssFolder(RssFolder *parent, RssManager *rssmanager, bittorrent *BTSession, QString name);
|
||||||
~RssFolder();
|
~RssFolder();
|
||||||
|
RssFolder* getParent() { return parent; }
|
||||||
unsigned int getNbUnRead() const;
|
unsigned int getNbUnRead() const;
|
||||||
FileType getType() const;
|
FileType getType() const;
|
||||||
RssStream* addStream(QStringList full_path);
|
RssStream* addStream(QStringList full_path);
|
||||||
@ -448,6 +451,8 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void refreshAll();
|
void refreshAll();
|
||||||
|
void removeFileRef(RssFile* item);
|
||||||
|
void addFile(RssFile * item);
|
||||||
void removeFile(QStringList full_path);
|
void removeFile(QStringList full_path);
|
||||||
void refresh(QStringList full_path);
|
void refresh(QStringList full_path);
|
||||||
void processFinishedDownload(QString url, QString path);
|
void processFinishedDownload(QString url, QString path);
|
||||||
@ -473,6 +478,7 @@ public slots:
|
|||||||
void saveStreamList();
|
void saveStreamList();
|
||||||
void forwardFeedInfosChanged(QString url, QString aliasOrUrl, unsigned int nbUnread);
|
void forwardFeedInfosChanged(QString url, QString aliasOrUrl, unsigned int nbUnread);
|
||||||
void forwardFeedIconChanged(QString url, QString icon_path);
|
void forwardFeedIconChanged(QString url, QString icon_path);
|
||||||
|
void moveFile(QStringList old_path, QStringList new_path);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RssManager(bittorrent *BTSession);
|
RssManager(bittorrent *BTSession);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user