1 /**************************************************************************
2 * Otter Browser: Web browser controlled by the user, not vice-versa.
3 * Copyright (C) 2014 - 2015 Piotr Wójcik <chocimier@tlen.pl>
4 * Copyright (C) 2015 - 2018 Michal Dutkiewicz aka Emdek <michal@emdek.pl>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 **************************************************************************/
20 
21 #ifndef OTTER_IMPORTDIALOG_H
22 #define OTTER_IMPORTDIALOG_H
23 
24 #include "Dialog.h"
25 #include "../core/Importer.h"
26 
27 namespace Otter
28 {
29 
30 namespace Ui
31 {
32 	class ImportDialog;
33 }
34 
35 class ImportDialog final : public Dialog
36 {
37 	Q_OBJECT
38 
39 public:
40 	~ImportDialog();
41 
42 	static void createDialog(const QString &importerName, QWidget *parent = nullptr);
43 
44 protected:
45 	explicit ImportDialog(Importer *importer, QWidget *parent);
46 
47 	void closeEvent(QCloseEvent *event) override;
48 	void changeEvent(QEvent *event) override;
49 
50 protected slots:
51 	void handleImportRequested();
52 	void handleImportStarted(Importer::ImportType type, int total);
53 	void handleImportProgress(Importer::ImportType type, int total, int amount);
54 	void handleImportFinished(Importer::ImportType type, Importer::ImportResult result, int total);
55 	void setPath(const QString &path);
56 
57 private:
58 	Importer *m_importer;
59 	QString m_path;
60 	Ui::ImportDialog *m_ui;
61 };
62 
63 }
64 
65 #endif
66