FlightGear next
InstallSceneryDialog.hxx
Go to the documentation of this file.
1// InstallSceneryDialog.hxx - part of GUI launcher using Qt5
2//
3// Written by James Turner, started June 2016.
4//
5// Copyright (C) 2016 James Turner <zakalawe@mac.com>
6//
7// This program is free software; you can redistribute it and/or
8// modify it under the terms of the GNU General Public License as
9// published by the Free Software Foundation; either version 2 of the
10// License, or (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful, but
13// WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15// General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program; if not, write to the Free Software
19// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
21#ifndef FG_GUI_INSTALL_SCENERY_DIALOG_HXX
22#define FG_GUI_INSTALL_SCENERY_DIALOG_HXX
23
24#include <QDialog>
25#include <QUrl>
26
27namespace Ui {
29}
30
32
33class InstallSceneryDialog : public QDialog
34{
35 Q_OBJECT
36
37public:
38 explicit InstallSceneryDialog(QWidget *parent, QString downloadDir);
40
41 QString sceneryPath();
42private slots:
43 virtual void reject() override;
44 virtual void accept() override;
45
46private:
47 void updateUi();
48
49 void pickFiles();
50
51 void onThreadFinished();
52 void onExtractError(QString file, QString msg);
53 void onExtractProgress(int percent);
54 void onExtractFile(QString file);
55
56 enum State {
57 STATE_START = 0, // awaiting user input on first screen
58 STATE_EXTRACTING = 1, // in-progress, showing progress page
59 STATE_FINISHED = 2, // catalog added ok, showing summary page
60 STATE_EXTRACT_FAILED = 3
61 };
62
63 State m_state;
64 QString m_downloadDir;
65
66 Ui::InstallSceneryDialog *ui;
67
68 QScopedPointer<InstallSceneryThread> m_thread;
69};
70
71#endif // FG_GUI_INSTALL_SCENERY_DIALOG_HXX
InstallSceneryDialog(QWidget *parent, QString downloadDir)