1 /* ============================================================ 2 * QuiteRSS is a open-source cross-platform RSS/Atom news feeds reader 3 * Copyright (C) 2011-2020 QuiteRSS Team <quiterssteam@gmail.com> 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 * ============================================================ */ 18 #ifndef OPTIONSDIALOG_H 19 #define OPTIONSDIALOG_H 20 21 #ifdef HAVE_QT5 22 #include <QtWidgets> 23 #else 24 #include <QtGui> 25 #endif 26 #include <QtSql> 27 #include <QNetworkProxy> 28 29 #include "dialog.h" 30 #include "lineedit.h" 31 #include "notificationswidget.h" 32 33 #define STATIC_ICON_TRAY 0 34 #define CHANGE_ICON_TRAY 1 35 #define NEW_COUNT_ICON_TRAY 2 36 #define UNREAD_COUNT_ICON_TRAY 3 37 38 class OptionsDialog : public Dialog 39 { 40 Q_OBJECT 41 public: 42 explicit OptionsDialog(QWidget *parent); 43 int currentIndex(); 44 void setCurrentItem(int index); 45 46 // general 47 QCheckBox *showSplashScreen_; 48 QCheckBox *reopenFeedStartup_; 49 QCheckBox *openNewTabNextToActive_; 50 QCheckBox *hideFeedsOpenTab_; 51 QCheckBox *showCloseButtonTab_; 52 QCheckBox *showToggleFeedsTree_; 53 QCheckBox *defaultIconFeeds_; 54 QCheckBox *autocollapseFolder_; 55 QCheckBox *updateCheckEnabled_; 56 QCheckBox *statisticsEnabled_; 57 QCheckBox *storeDBMemory_; 58 QSpinBox *saveDBMemFileInterval_; 59 60 // systemTray 61 void setBehaviorIconTray(int behavior); 62 int behaviorIconTray(); 63 QGroupBox *showTrayIconBox_; 64 QCheckBox *startingTray_; 65 QCheckBox *minimizingTray_; 66 QCheckBox *closingTray_; 67 QCheckBox *singleClickTray_; 68 QCheckBox *clearStatusNew_; 69 QCheckBox *emptyWorking_; 70 71 // network connection 72 QNetworkProxy proxy(); 73 void setProxy(const QNetworkProxy proxy); 74 75 QSpinBox *timeoutRequest_; 76 QSpinBox *numberRequests_; 77 QSpinBox *numberRepeats_; 78 79 // browser 80 QRadioButton *embeddedBrowserOn_; 81 QRadioButton *externalBrowserOn_; 82 QRadioButton *defaultExternalBrowserOn_; 83 QRadioButton *otherExternalBrowserOn_; 84 LineEdit *otherExternalBrowserEdit_; 85 QPushButton *otherExternalBrowserButton_; 86 QCheckBox *autoLoadImages_; 87 QCheckBox *javaScriptEnable_; 88 QCheckBox *pluginsEnable_; 89 QSpinBox *defaultZoomPages_; 90 QCheckBox *openLinkInBackground_; 91 QCheckBox *openLinkInBackgroundEmbedded_; 92 LineEdit *userStyleBrowserEdit_; 93 94 QSpinBox *maxPagesInCache_; 95 QGroupBox *diskCacheOn_; 96 QSpinBox *maxDiskCache_; 97 QLineEdit *dirDiskCacheEdit_; 98 QPushButton *dirDiskCacheButton_; 99 100 QRadioButton *saveCookies_; 101 QRadioButton *deleteCookiesOnClose_; 102 QRadioButton *blockCookies_; 103 QPushButton *clearCookies_; 104 105 LineEdit *downloadLocationEdit_; 106 QCheckBox *askDownloadLocation_; 107 108 // feeds 109 void setOpeningFeed(int action); 110 int getOpeningFeed(); 111 QCheckBox *updateFeedsStartUp_; 112 QCheckBox *updateFeedsEnable_; 113 QSpinBox *updateFeedsInterval_; 114 QComboBox *updateIntervalType_; 115 116 QRadioButton *positionLastNews_; 117 QRadioButton *positionFirstNews_; 118 QRadioButton *positionUnreadNews_; 119 QCheckBox *openNewsWebViewOn_; 120 QRadioButton *nottoOpenNews_; 121 122 QGroupBox *markNewsReadOn_; 123 QRadioButton *markCurNewsRead_; 124 QRadioButton *markPrevNewsRead_; 125 QSpinBox *markNewsReadTime_; 126 QCheckBox *markReadSwitchingFeed_; 127 QCheckBox *markReadClosingTab_; 128 QCheckBox *markReadMinimize_; 129 130 QCheckBox *showDescriptionNews_; 131 132 QComboBox *formatDate_; 133 QComboBox *formatTime_; 134 135 QCheckBox *alternatingRowColorsNews_; 136 QCheckBox *simplifiedDateTime_; 137 138 QComboBox *mainNewsFilter_; 139 140 LineEdit *styleSheetNewsEdit_; 141 142 QCheckBox *changeBehaviorActionNUN_; 143 QCheckBox *notDeleteStarred_; 144 QCheckBox *notDeleteLabeled_; 145 QCheckBox *markIdenticalNewsRead_; 146 147 QGroupBox *cleanupOnShutdownBox_; 148 QCheckBox *dayCleanUpOn_; 149 QSpinBox *maxDayCleanUp_; 150 QCheckBox *newsCleanUpOn_; 151 QSpinBox *maxNewsCleanUp_; 152 QCheckBox *readCleanUp_; 153 QCheckBox *neverUnreadCleanUp_; 154 QCheckBox *neverStarCleanUp_; 155 QCheckBox *neverLabelCleanUp_; 156 QCheckBox *cleanUpDeleted_; 157 QCheckBox *optimizeDB_; 158 159 QGroupBox *avoidedOldNewsDateOn_; 160 QCalendarWidget *avoidedOldNewsDate_; 161 162 // labels 163 QStringList idLabels_; 164 QTreeWidget *labelsTree_; 165 166 // notifier 167 QGroupBox *soundNotifyBox_; 168 QLineEdit *editSoundNotifer_; 169 QPushButton *selectionSoundNotifer_; 170 QPushButton *playSoundNotifer_; 171 172 QGroupBox *showNotifyOn_; 173 QComboBox *screenNotify_; 174 QComboBox *positionNotify_; 175 QSpinBox *transparencyNotify_; 176 QSpinBox *countShowNewsNotify_; 177 QSpinBox *timeShowNewsNotify_; 178 QSpinBox *widthTitleNewsNotify_; 179 180 QCheckBox *showTitlesFeedsNotify_; 181 QCheckBox *showIconFeedNotify_; 182 QCheckBox *showButtonMarkAllNotify_; 183 QCheckBox *showButtonMarkReadNotify_; 184 QCheckBox *showButtonExBrowserNotify_; 185 QCheckBox *showButtonDeleteNotify_; 186 QCheckBox *closeNotify_; 187 188 QCheckBox *fullscreenModeNotify_; 189 QCheckBox *showNotifyInactiveApp_; 190 QCheckBox *onlySelectedFeeds_; 191 QTreeWidget *feedsTreeNotify_; 192 bool itemNotChecked_; 193 Dialog *feedsNotifierDlg_; 194 195 // language 196 QString language(); 197 void setLanguage(const QString &langFileName); 198 199 // fonts 200 QTreeWidget *fontsTree_; 201 QTreeWidget *colorsTree_; 202 QFontComboBox *browserStandardFont_; 203 QFontComboBox *browserFixedFont_; 204 QFontComboBox *browserSerifFont_; 205 QFontComboBox *browserSansSerifFont_; 206 QFontComboBox *browserCursiveFont_; 207 QFontComboBox *browserFantasyFont_; 208 QSpinBox *browserDefaultFontSize_; 209 QSpinBox *browserFixedFontSize_; 210 QSpinBox *browserMinFontSize_; 211 QSpinBox *browserMinLogFontSize_; 212 213 // shortcut 214 void loadActionShortcut(QList<QAction *> actions, QStringList *list); 215 void saveActionShortcut(QList<QAction *> actions, QActionGroup *labelGroup); 216 217 signals: 218 void signalCategoriesTreeKeyUpDownPressed(); 219 void signalShortcutTreeUpDownPressed(); 220 void signalPlaySound(const QString &soundPath); 221 222 protected: 223 bool eventFilter(QObject *obj, QEvent *event); 224 225 private slots: 226 void slotCategoriesItemClicked(QTreeWidgetItem* item, int); 227 void slotCategoriesTreeKeyUpDownPressed(); 228 void manualProxyToggle(bool checked); 229 void updateProxy(); 230 void applyProxy(); 231 void acceptDialog(); 232 void closeDialog(); 233 void slotFontChange(); 234 void slotFontReset(); 235 void slotColorChange(); 236 void slotColorReset(); 237 void shortcutTreeClicked(const QModelIndex &index); 238 void slotShortcutTreeUpDownPressed(); 239 void slotClearShortcut(); 240 void slotResetShortcut(); 241 void filterShortcutChanged(const QString &text); 242 void selectionBrowser(); 243 void selectionUserStyleNews(); 244 void selectionSoundNotifer(); 245 void slotPlaySoundNotifer(); 246 void feedsTreeNotifyItemChanged(QTreeWidgetItem* item,int column); 247 void setCheckStateItem(QTreeWidgetItem *item, Qt::CheckState state); 248 void showNotification(); 249 void deleteNotification(); 250 void newLabel(); 251 void editLabel(); 252 void deleteLabel(); 253 void moveUpLabel(); 254 void moveDownLabel(); 255 void slotCurrentLabelChanged(QTreeWidgetItem *current, QTreeWidgetItem *); 256 void slotDeletePass(); 257 void slotDeleteAllPass(); 258 void slotShowPass(); 259 void selectionUserStyleBrowser(); 260 void selectionDirDiskCache(); 261 void addWhitelist(); 262 void removeWhitelist(); 263 void selectionDownloadLocation(); 264 265 private: 266 void showEvent(QShowEvent*); 267 268 QSqlDatabase db_; 269 270 QLabel *contentLabel_; 271 QTreeWidget *categoriesTree_; 272 QStackedWidget *contentStack_; 273 QScrollArea *scrollArea_; 274 275 //stack widgets 276 QFrame *generalWidget_; 277 QFrame *traySystemWidget_; 278 QFrame *networkConnectionsWidget_; 279 QTabWidget *browserWidget_; 280 QTabWidget *feedsWidget_; 281 QWidget *labelsWidget_; 282 QTabWidget *notifierWidget_; 283 QWidget *passwordsWidget_; 284 QWidget *languageWidget_; 285 QTabWidget *fontsColorsWidget_; 286 QWidget *shortcutWidget_; 287 QWidget *avoidOldNewsWidget_; 288 289 // general 290 void createGeneralWidget(); 291 QCheckBox *autoRunEnabled_; 292 QSettings *autoRunSettings_; 293 294 // systemTray 295 void createTraySystemWidget(); 296 QRadioButton *staticIconTray_; 297 QRadioButton *changeIconTray_; 298 QRadioButton *newCountTray_; 299 QRadioButton *unreadCountTray_; 300 301 // network connection 302 void createNetworkConnectionsWidget(); 303 QRadioButton *systemProxyButton_; 304 QRadioButton *directConnectionButton_; 305 QRadioButton *manualProxyButton_; 306 QWidget *manualWidget_; 307 QComboBox *typeProxy_; 308 LineEdit *editHost_; 309 LineEdit *editPort_; 310 LineEdit *editUser_; 311 LineEdit *editPassword_; 312 QNetworkProxy networkProxy_; 313 314 // browser 315 void createBrowserWidget(); 316 void applyWhitelist(); 317 318 QCheckBox *c2fEnabled_; 319 QTreeWidget *c2fWhitelist_; 320 321 // feeds 322 void createFeedsWidget(); 323 324 // notifier 325 void createNotifierWidget(); 326 void createFeedsNotifierDlg(); 327 void loadNotifier(); 328 void applyNotifier(); 329 bool loadNotifierOk_; 330 NotificationWidget *notificationWidget_; 331 332 // labels 333 void createLabelsWidget(); 334 void loadLabels(); 335 void applyLabels(); 336 void addIdLabelList(const QString &idLabel); 337 QPushButton *newLabelButton_; 338 QPushButton *editLabelButton_; 339 QPushButton *deleteLabelButton_; 340 QPushButton *moveUpLabelButton_; 341 QPushButton *moveDownLabelButton_; 342 bool loadLabelsOk_; 343 344 // passwords 345 void createPasswordsWidget(); 346 void applyPass(); 347 QTreeWidget *passTree_; 348 349 // language 350 void createLanguageWidget(); 351 QTreeWidget *languageFileList_; 352 353 // fonts 354 void createFontsColorsWidget(); 355 356 // shortcut 357 void createShortcutWidget(); 358 QStringList *listDefaultShortcut_; 359 LineEdit *filterShortcut_; 360 QTreeView *shortcutTree_; 361 QStandardItemModel *shortcutModel_; 362 QSortFilterProxyModel *shortcutProxyModel_; 363 LineEdit *editShortcut_; 364 QGroupBox *editShortcutBox; 365 QLabel *warningShortcut_; 366 367 }; 368 369 #endif // OPTIONSDIALOG_H 370