1 // For license of this file, see <project-root-folder>/LICENSE.md.
2 
3 #ifndef FEEDMESSAGEVIEWER_H
4 #define FEEDMESSAGEVIEWER_H
5 
6 #include "gui/tabcontent.h"
7 
8 #include "core/messagesmodel.h"
9 
10 #include <QTextBrowser>
11 
12 #if defined(USE_WEBENGINE)
13 class WebBrowser;
14 #endif
15 
16 class MessagePreviewer;
17 class MessagesView;
18 class MessagesToolBar;
19 class FeedsToolBar;
20 class WebBrowser;
21 class FeedsView;
22 class StandardFeed;
23 class QToolBar;
24 class QSplitter;
25 class QProgressBar;
26 
27 class RSSGUARD_DLLSPEC FeedMessageViewer : public TabContent {
28   Q_OBJECT
29 
30   public:
31     explicit FeedMessageViewer(QWidget* parent = nullptr);
32     virtual ~FeedMessageViewer();
33 
34 #if defined(USE_WEBENGINE)
35     virtual WebBrowser* webBrowser() const;
36 #endif
37 
38     FeedsView* feedsView() const;
39     MessagesView* messagesView() const;
40     MessagesToolBar* messagesToolBar() const;
41     FeedsToolBar* feedsToolBar() const;
42     MessagePreviewer* messagesBrowser() const;
43 
44     bool areToolBarsEnabled() const;
45     bool areListHeadersEnabled() const;
46 
47   public slots:
48     void saveSize();
49     void loadSize();
50 
51     void loadMessageViewerFonts();
52 
53     // Switches orientation horizontal/vertical.
54     void switchMessageSplitterOrientation(bool save_settings);
55 
56     // Enables/disables main toolbars or list headers.
57     void setToolBarsEnabled(bool enable);
58     void setListHeadersEnabled(bool enable);
59 
60     // Reloads some changeable visual settings.
61     void refreshVisualProperties();
62 
63     // Switches visibility of feed list and related
64     // toolbar.
65     void switchFeedComponentVisibility();
66 
67     void toggleShowOnlyUnreadMessages();
68     void toggleShowOnlyUnreadFeeds();
69     void toggleShowFeedTreeBranches();
70     void toggleItemsAutoExpandingOnSelection();
71     void alternateRowColorsInLists();
72 
73   private slots:
74     void displayMessage(const Message& message, RootItem* root);
75 
76   protected:
77     void initialize();
78 
79     // Initializes both messages/feeds views.
80     void initializeViews();
81 
82     // Sets up connections.
83     void createConnections();
84 
85   private:
86     bool m_toolBarsEnabled;
87     bool m_listHeadersEnabled;
88     FeedsToolBar* m_toolBarFeeds;
89     MessagesToolBar* m_toolBarMessages;
90     QSplitter* m_feedSplitter;
91     QSplitter* m_messageSplitter;
92     MessagesView* m_messagesView;
93     FeedsView* m_feedsView;
94     QWidget* m_feedsWidget;
95     QWidget* m_messagesWidget;
96     MessagePreviewer* m_messagesBrowser;
97 };
98 
99 #endif // FEEDMESSAGEVIEWER_H
100