2018-11-04 09:48:33 -05:00
|
|
|
/*******************************************************************************
|
|
|
|
* plugins/FeedReader/gui/FeedReaderDialog.h *
|
|
|
|
* *
|
|
|
|
* Copyright (C) 2012 by Thunder *
|
|
|
|
* *
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU Affero General Public License as *
|
|
|
|
* published by the Free Software Foundation, either version 3 of the *
|
|
|
|
* License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU Affero General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Affero General Public License *
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
|
|
|
* *
|
|
|
|
*******************************************************************************/
|
2012-08-02 09:17:53 -04:00
|
|
|
|
|
|
|
#ifndef _FEEDREADERDIALOG_H
|
|
|
|
#define _FEEDREADERDIALOG_H
|
|
|
|
|
|
|
|
#include <retroshare-gui/mainpage.h>
|
|
|
|
#include "interface/rsFeedReader.h"
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class FeedReaderDialog;
|
|
|
|
}
|
|
|
|
|
|
|
|
class QTreeWidgetItem;
|
|
|
|
class RsFeedReader;
|
|
|
|
class RSTreeWidgetItemCompareRole;
|
|
|
|
class FeedReaderNotify;
|
2012-12-25 18:53:55 -05:00
|
|
|
class FeedReaderMessageWidget;
|
2012-08-02 09:17:53 -04:00
|
|
|
|
|
|
|
class FeedReaderDialog : public MainPage
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2013-01-08 17:07:52 -05:00
|
|
|
FeedReaderDialog(RsFeedReader *feedReader, FeedReaderNotify *notify, QWidget *parent = 0);
|
2012-08-02 09:17:53 -04:00
|
|
|
~FeedReaderDialog();
|
|
|
|
|
2013-01-10 17:51:04 -05:00
|
|
|
static QIcon iconFromFeed(const FeedInfo &feedInfo);
|
|
|
|
|
2012-08-02 09:17:53 -04:00
|
|
|
protected:
|
2020-01-26 17:19:20 -05:00
|
|
|
virtual UserNotify *createUserNotify(QObject *parent) override;
|
2012-12-29 21:41:53 -05:00
|
|
|
virtual void showEvent(QShowEvent *event);
|
2012-08-02 09:17:53 -04:00
|
|
|
bool eventFilter(QObject *obj, QEvent *ev);
|
|
|
|
|
|
|
|
private slots:
|
2013-01-05 21:30:10 -05:00
|
|
|
void settingsChanged();
|
2012-08-13 17:35:11 -04:00
|
|
|
void feedTreeCustomPopupMenu(QPoint point);
|
2012-12-29 21:41:53 -05:00
|
|
|
void feedTreeItemActivated(QTreeWidgetItem *item);
|
2013-01-05 21:30:10 -05:00
|
|
|
void feedTreeMiddleButtonClicked(QTreeWidgetItem *item);
|
2012-12-29 21:41:53 -05:00
|
|
|
void openInNewTab();
|
2012-08-02 09:17:53 -04:00
|
|
|
void newFolder();
|
|
|
|
void newFeed();
|
|
|
|
void removeFeed();
|
|
|
|
void editFeed();
|
|
|
|
void activateFeed();
|
|
|
|
void processFeed();
|
2023-04-13 09:53:14 -04:00
|
|
|
void feedTreeReparent(QTreeWidgetItem *item, QTreeWidgetItem *newParent);
|
2012-12-25 18:53:55 -05:00
|
|
|
|
|
|
|
void messageTabCloseRequested(int index);
|
2012-12-29 21:41:53 -05:00
|
|
|
void messageTabChanged(int index);
|
|
|
|
void messageTabInfoChanged(QWidget *widget);
|
2012-08-02 09:17:53 -04:00
|
|
|
|
|
|
|
/* FeedReaderNotify */
|
2020-11-08 07:22:59 -05:00
|
|
|
void feedChanged(uint32_t feedId, int type);
|
2012-08-02 09:17:53 -04:00
|
|
|
|
|
|
|
private:
|
2020-11-08 07:22:59 -05:00
|
|
|
uint32_t currentFeedId();
|
|
|
|
void setCurrentFeedId(uint32_t feedId);
|
2012-08-02 09:17:53 -04:00
|
|
|
void processSettings(bool load);
|
2020-11-08 07:22:59 -05:00
|
|
|
void addFeedToExpand(uint32_t feedId);
|
|
|
|
void getExpandedFeedIds(QList<uint32_t> &feedIds);
|
|
|
|
void updateFeeds(uint32_t parentId, QTreeWidgetItem *parentItem);
|
2013-01-10 17:51:04 -05:00
|
|
|
void updateFeedItem(QTreeWidgetItem *item, const FeedInfo &feedInfo);
|
2020-11-08 07:22:59 -05:00
|
|
|
void openFeedInNewTab(uint32_t feedId);
|
2012-08-02 09:17:53 -04:00
|
|
|
|
|
|
|
void calculateFeedItems();
|
2013-01-10 17:51:04 -05:00
|
|
|
void calculateFeedItem(QTreeWidgetItem *item, uint32_t &unreadCount, uint32_t &newCount, bool &loading);
|
2012-08-02 09:17:53 -04:00
|
|
|
|
2020-11-08 07:22:59 -05:00
|
|
|
FeedReaderMessageWidget *feedMessageWidget(uint32_t feedId);
|
|
|
|
FeedReaderMessageWidget *createMessageWidget(uint32_t feedId);
|
2012-12-25 18:53:55 -05:00
|
|
|
|
2020-11-08 07:22:59 -05:00
|
|
|
private:
|
2012-08-02 09:17:53 -04:00
|
|
|
bool mProcessSettings;
|
2020-11-08 07:22:59 -05:00
|
|
|
QList<uint32_t> *mOpenFeedIds;
|
2012-08-02 09:17:53 -04:00
|
|
|
QTreeWidgetItem *mRootItem;
|
|
|
|
RSTreeWidgetItemCompareRole *mFeedCompareRole;
|
2012-12-29 21:41:53 -05:00
|
|
|
FeedReaderMessageWidget *mMessageWidget;
|
2012-08-02 09:17:53 -04:00
|
|
|
|
|
|
|
// gui interface
|
|
|
|
RsFeedReader *mFeedReader;
|
|
|
|
FeedReaderNotify *mNotify;
|
|
|
|
|
|
|
|
/** Qt Designer generated object */
|
|
|
|
Ui::FeedReaderDialog *ui;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|