File: feedpropertiesdialog.h

package info (click to toggle)
quiterss 0.19.4%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 10,128 kB
  • sloc: cpp: 34,969; sh: 47; xml: 30; makefile: 9
file content (215 lines) | stat: -rwxr-xr-x 7,296 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
/* ============================================================
 * QuiteRSS is a open-source cross-platform RSS/Atom news feeds reader
 * Copyright (C) 2011-2020 QuiteRSS Team <quiterssteam@gmail.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 * ============================================================ */
#ifndef FEEDPROPERTIESDIALOG_H
#define FEEDPROPERTIESDIALOG_H

#include "dialog.h"
#include "lineedit.h"
#include "toolbutton.h"

//! Feed properties structure
typedef struct {
  //! General properties
  struct general{
    QString text; //!< Text field from feed-xml
    QString title; //!< Title field from feed-xml
    QString url; //!< URL field from feed-xml
    QString homepage; //!< Homepage field from feed-xml
    QByteArray image;
    bool disableUpdate;
    bool updateEnable; //!< Flag enabling autoupdate
    int updateInterval; //!< Update interval
    int intervalType; //!< Update interval type (sec, min, day)
    bool updateOnStartup; //!< Flag to update feed on startup
    int displayOnStartup; //!< Flag to display feed on startup in sepatare tab
    bool starred; //!< Starred feed (favourite)
    bool duplicateNewsMode; //!< Automatically delete news duplicates
    bool avoidedOldSingleNewsDateOn; //!< Avoid adding news before this date into the database
    bool addSingleNewsAnyDateOn; //!< Add news with any date into the database
    QDate avoidedOldSingleNewsDate; //!< Date to avoid
  } general;

  //! Autthentication properties
  struct authentication{
    bool on;        //!< Enabling flag
    QString user;   //!< Username
    QString pass;   //!< User password
  } authentication;

  //! Reading properties
  struct reading{
    bool markSelectedAsRead; //!< Mark focused news as Read
    quint32 markSelectedTime; //!< Mark focused news as Read after elapsed time (sec)
    bool markReadWhileReading; //!< Mark news as Read while reading in newspaper layout
    bool markDisplayedAsReadWhenSwitch; //!< Mark displayed news as Read on switching feed
    bool markDisplayedAsReadWhenClose; //!< Mark displayed news as Read on closing tab
    bool markDisplayedAsReadOnMin; //!< Mark displayed news as Read on minimize
  } reading ;

  //! Display properties
  struct display {
    quint16 layoutType; //!< display layout
    quint16 filterType; //!< Filter mode
    quint16 groupType; //!< Group mode
    int displayNews; //!< Display news mode
    int displayEmbeddedImages; //!< Display embedded images
    bool loadMoviesAndOtherContent; //!< Flag to load media content
    bool openLink; //!< Flag to open news link
    int layoutDirection; //!< LTR or RTL layout
    int javaScriptEnable;
  } display;

  //! Columns properties
  struct column {
    QList<int> columns; //!< Indexes list of columns to display
    int sortBy; //!< Index of column to sort by
    int sortType; //!< Type of sort (ascending|descending - 0|1)
    QList<int> indexList; //!< Indexes list of all columns
    QStringList nameList; //!< Names list of all columns
  } column;

  //! Columns default properties
  struct columnDefault {
    QList<int> columns; //!< List of column to display
    int sortBy; //!< Name of column to sort by
    int sortType; //!< Type of sort (ascending|descending)
  } columnDefault;

  //! Cleaup properties
  struct cleanup {
    bool enableMaxNews; //!< Enable flag for \a maxNewsToKeep
    quint32 maxNewsToKeep; //!< Maximum number of news to keep in DB
    bool enableAgeNews; //!< Enable flag for \a ageOfNewsToKeep
    quint32 ageOfNewsToKeep; //!< Time to keep news (days)
    bool deleteReadNews; //!< Flag to delete already read news
    bool neverDeleteUnread; //!< Flag to never delete unread news
    bool neverDeleteLabeled; //!< Flag to never delete labeled news
  } cleanup;

  //! Status properties
  struct status {
    QString feedStatus; //!< Feed status
    QString description; //!< Feed description
    QDateTime createdTime; //!< Time when feed created
    QDateTime lastDisplayed; //!< Last time that feed displayed
    QDateTime lastUpdate; //!< Time of feed last update
    QDateTime lastBuildDate;
    int undeleteCount; //!< Number of all news
    int newCount; //!< Number of new news
    int unreadCount; //!< Number of unread news
    int feedsCount; //!< Number of feeds
  } status;

} FEED_PROPERTIES;

//! Feed properties dialog
class FeedPropertiesDialog : public Dialog
{
  Q_OBJECT
public:
  explicit FeedPropertiesDialog(bool isFeed, QWidget *parent);

  FEED_PROPERTIES getFeedProperties(); //!< Get feed properties from dialog
  void setFeedProperties(FEED_PROPERTIES properties); //!< Set feed properties into dialog

public slots:
  void slotFaviconUpdate(const QString &feedUrl, const QByteArray &faviconData);

signals:
  void signalLoadIcon(const QString &urlString, const QString &feedUrl);

protected:
  virtual void showEvent(QShowEvent *);

private slots:
  void setDefaultTitle();
  void loadDefaultIcon();
  void selectIcon();
  void slotCurrentColumnChanged(QTreeWidgetItem *current, QTreeWidgetItem *);
  void showMenuAddButton();
  void addColumn(QAction *action);
  void removeColumn();
  void moveUpColumn();
  void moveDownColumn();
  void defaultColumns();
  void setGroupBoxCheckboxState(bool _on);

private:
  QTabWidget *tabWidget;

  // Tab "General"
  LineEdit *editURL; //!< Feed URL
  LineEdit *editTitle; //!< Feed title
  QLabel *labelHomepage; //!< Link to feed's homepage
  QToolButton *selectIconButton_;
  QCheckBox *disableUpdate_;
  QCheckBox *updateEnable_;
  QSpinBox *updateInterval_;
  QComboBox *updateIntervalType_;
  QCheckBox *displayOnStartup;
  QCheckBox *starredOn_;
  QCheckBox *duplicateNewsMode_;
  QCheckBox *addSingleNewsAnyDateOn_;
  QGroupBox *avoidedOldSingleNewsDateOn_;
  QCalendarWidget *avoidedOldSingleNewsDate_;

  QWidget *createGeneralTab();

  // Tab "Display"
  QCheckBox *showDescriptionNews_;
  QCheckBox *loadImagesOn_;
  QCheckBox *javaScriptEnable_;
  QCheckBox *layoutDirection_;

  QWidget *createDisplayTab();

  // Tab "Columns"
  QTreeWidget *columnsTree_;
  QComboBox *sortByColumnBox_;
  QComboBox *sortOrderBox_;

  QMenu *addButtonMenu_;

  QPushButton *addButton_;
  QPushButton *removeButton_;
  QPushButton *moveUpButton_;
  QPushButton *moveDownButton_;
  QWidget *createColumnsTab();

  // Tab "Authentication"
  QGroupBox *authentication_;
  LineEdit *user_;
  LineEdit *pass_;
  QWidget *createAuthenticationTab();

  // Tab "Status"
  QLabel *statusFeed_;
  QTextEdit *descriptionText_;
  QLabel *createdFeed_;
  QLabel *lastUpdateFeed_;
  QLabel *newsCount_;
  QLabel *feedsCount_;
  QWidget *createStatusTab();

  FEED_PROPERTIES feedProperties;

  bool isFeed_;

};

#endif // FEEDPROPERTIESDIALOG_H