missingwadsdialog.h
1 //------------------------------------------------------------------------------
2 // missingwadsdialog.h
3 //------------------------------------------------------------------------------
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 // 02110-1301 USA
19 //
20 //------------------------------------------------------------------------------
21 // Copyright (C) 2015 "Zalewa" <zalewapl@gmail.com>
22 //------------------------------------------------------------------------------
23 #ifndef id6b2989fd_5c98_4e31_ad64_cf57b7231a67
24 #define id6b2989fd_5c98_4e31_ad64_cf57b7231a67
25 
26 #include "dptr.h"
27 #include <QDialog>
28 #include <QList>
29 #include <QStringList>
30 
31 class PWad;
32 
33 class MissingWadsDialog : public QDialog
34 {
35  Q_OBJECT
36 
37 public:
38  enum MissingWadsProceed
39  {
40  Ignore,
41  Cancel,
42  Install
43  };
44 
45  MissingWadsDialog(const QList<PWad> &missingWads, const QList<PWad> &incompatibleWads, QWidget *parent);
46  ~MissingWadsDialog() override;
47 
48  MissingWadsProceed decision() const;
49  QList<PWad> filesToDownload() const;
50  void setAllowIgnore(bool);
51 
52 private:
54 
55  QList<PWad> downloadableFiles() const;
56  QList<PWad> forbiddenFiles() const;
57  QList<PWad> optionalFiles() const;
58 
59  QList<PWad> incompatibleFiles() const;
60  bool hasAnyAllowedFile() const;
61  bool isFreedoomReplaceableOnList(const QStringList &files) const;
62  QList<PWad> selectedOptionalFiles() const;
63  QList<PWad> selectedIncompatibleFiles() const;
64  QList<PWad> filenamesToPwads(const QStringList &names, QList<PWad> files) const;
65  void setup();
66  void setupForbiddenFilesArea();
67  void setupDownloadableFilesArea();
68  void setupIncompatibleFilesArea();
69  void setupOptionalFilesArea();
70  void setupWadseekerIsRunning();
71  void setupWadseekerNotRunning();
72 
73 private slots:
74  void ignoreMissingFiles();
75  void installFreedoom();
76  void installMissingFiles();
77  void updateStateAccordingToFileSelection();
78 };
79 
80 #endif
PWAD hosted on a server.