Dooble
dooble_downloads.h
1 /*
2 ** Copyright (c) 2008 - present, Alexis Megas.
3 ** All rights reserved.
4 **
5 ** Redistribution and use in source and binary forms, with or without
6 ** modification, are permitted provided that the following conditions
7 ** are met:
8 ** 1. Redistributions of source code must retain the above copyright
9 ** notice, this list of conditions and the following disclaimer.
10 ** 2. Redistributions in binary form must reproduce the above copyright
11 ** notice, this list of conditions and the following disclaimer in the
12 ** documentation and/or other materials provided with the distribution.
13 ** 3. The name of the author may not be used to endorse or promote products
14 ** derived from Dooble without specific prior written permission.
15 **
16 ** DOOBLE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 ** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 ** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 ** DOOBLE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #ifndef dooble_downloads_h
29 #define dooble_downloads_h
30 
31 #include <QMainWindow>
32 #include <QSqlDatabase>
33 #include <QTimer>
34 
35 #include "ui_dooble_downloads.h"
36 
37 class QWebEngineDownloadItem;
38 class QWebEngineProfile;
39 
40 class dooble_downloads: public QMainWindow
41 {
42  Q_OBJECT
43 
44  public:
45  dooble_downloads(void);
46  QString download_path(void) const;
47  bool contains(QWebEngineDownloadItem *download) const;
48  bool has_downloads_for_profile(QWebEngineProfile *profile) const;
49  bool is_finished(void) const;
50  static void create_tables(QSqlDatabase &db);
51  void abort(void);
52  void purge(void);
53  void record_download(QWebEngineDownloadItem *download);
54 
55  public slots:
56  void show(void);
57  void showNormal(void);
58 
59  protected:
60  void closeEvent(QCloseEvent *event);
61  void keyPressEvent(QKeyEvent *event);
62  void resizeEvent(QResizeEvent *event);
63 
64  private:
65  QHash<QObject *, char> m_downloads;
66  QTimer m_download_path_inspection_timer;
67  QTimer m_search_timer;
68  Ui_dooble_downloads m_ui;
69  void delete_selected(void);
70  void remove_entry(qintptr oid);
71  void save_settings(void);
72 
73  private slots:
74  void slot_clear_finished_downloads(void);
75  void slot_copy_download_location(void);
76  void slot_delete_row(void);
77  void slot_download_destroyed(void);
78  void slot_download_finished(void);
79  void slot_download_path_inspection_timer_timeout(void);
80  void slot_download_requested(QWebEngineDownloadItem *download);
81  void slot_find(void);
82  void slot_open_download_page(void);
83  void slot_populate(void);
84  void slot_reload(const QString &file_name, const QUrl &url);
85  void slot_search_timer_timeout(void);
86  void slot_select_path(void);
87  void slot_show_context_menu(const QPoint &point);
88 
89  signals:
90  void finished(void);
91  void open_link(const QUrl &url);
92  void populated(void);
93  void started(void);
94 };
95 
96 #endif
Definition: dooble_downloads.h:40