FlightGear next
SetupRootDialog.hxx
Go to the documentation of this file.
1// SetupRootDialog.hxx - part of GUI launcher using Qt5
2//
3// Written by James Turner, started December 2014.
4//
5// Copyright (C) 2014 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#include <QDialog>
22#include <QScopedPointer>
23#include <QString>
24
25#include <string>
26
27#include <simgear/misc/sg_path.hxx>
28
29#include "QtLauncher.hxx"
30
31namespace Ui
32{
33 class SetupRootDialog;
34}
35
36class SetupRootDialog : public QDialog
37{
38 Q_OBJECT
39public:
40
42
43 static bool runDialog(bool usingDefaultRoot);
44
46
47 static void askRootOnNextLaunch();
48
49 static QString rootPathKey();
50private slots:
51
52 void onBrowse();
53
54 void onDownload();
55
56 void onUseDefaults();
57
58 void updatePromptText();
59private:
60 enum PromptState
61 {
62 DefaultPathCheckFailed,
63 ExplicitPathCheckFailed,
64 VersionCheckFailed,
65 ManualChoiceRequested,
66 ChoseInvalidLocation,
67 ChoseInvalidVersion
68 };
69
70 SetupRootDialog(PromptState prompt);
71
72 static bool runDialog(PromptState prompt);
73
74 static bool validatePath(QString path);
75 static bool validateVersion(QString path);
76
77 static bool defaultRootAcceptable();
78
79
80 PromptState m_promptState;
81 QScopedPointer<Ui::SetupRootDialog> m_ui;
82 QString m_browsedPath;
83};
static flightgear::SetupRootResult restoreUserSelectedRoot(SGPath &path)
static QString rootPathKey()
static bool runDialog(bool usingDefaultRoot)
static void askRootOnNextLaunch()