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 <QTimer>
33 
34 #include "ui_dooble_downloads.h"
35 
36 class QWebEngineDownloadItem;
37 
38 class dooble_downloads: public QMainWindow
39 {
40  Q_OBJECT
41 
42  public:
43  dooble_downloads(void);
44  QString download_path(void) const;
45  bool contains(QWebEngineDownloadItem *download) const;
46  bool is_finished(void) const;
47  void abort(void);
48  void purge(void);
49  void record_download(QWebEngineDownloadItem *download);
50 
51  public slots:
52  void show(void);
53  void showNormal(void);
54 
55  protected:
56  void closeEvent(QCloseEvent *event);
57  void keyPressEvent(QKeyEvent *event);
58  void resizeEvent(QResizeEvent *event);
59 
60  private:
61  QHash<QObject *, char> m_downloads;
62  QTimer m_download_path_inspection_timer;
63  QTimer m_search_timer;
64  Ui_dooble_downloads m_ui;
65  void delete_selected(void);
66  void remove_entry(qintptr oid);
67  void save_settings(void);
68 
69  private slots:
70  void slot_clear_finished_downloads(void);
71  void slot_copy_download_location(void);
72  void slot_delete_row(void);
73  void slot_download_destroyed(void);
74  void slot_download_finished(void);
75  void slot_download_path_inspection_timer_timeout(void);
76  void slot_download_requested(QWebEngineDownloadItem *download);
77  void slot_find(void);
78  void slot_open_download_page(void);
79  void slot_populate(void);
80  void slot_search_timer_timeout(void);
81  void slot_select_path(void);
82  void slot_show_context_menu(const QPoint &point);
83 
84  signals:
85  void finished(void);
86  void open_url(const QUrl &url);
87  void started(void);
88 };
89 
90 #endif
Definition: dooble_downloads.h:38