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 class EnginePlugin;
33 
34 class MissingWadsDialog : public QDialog
35 {
36  Q_OBJECT
37 
38 public:
39  enum MissingWadsProceed
40  {
41  Ignore,
42  Cancel,
43  Install
44  };
45 
46  MissingWadsDialog(const QList<PWad> &missingWads, const QList<PWad> &incompatibleWads, EnginePlugin *plugin = nullptr, QWidget *parent = nullptr);
47  ~MissingWadsDialog() override;
48 
49  MissingWadsProceed decision() const;
50  QList<PWad> filesToDownload() const;
51  void setAllowIgnore(bool);
52 
53 private:
55 
56  QList<PWad> downloadableFiles() const;
57  QList<PWad> forbiddenFiles() const;
58  QList<PWad> optionalFiles() const;
59 
60  QList<PWad> incompatibleFiles() const;
61  bool hasAnyAllowedFile() const;
62  bool isFreedoomReplaceableOnList(const QStringList &files) const;
63  QList<PWad> selectedOptionalFiles() const;
64  QList<PWad> selectedIncompatibleFiles() const;
65  QList<PWad> filenamesToPwads(const QStringList &names, QList<PWad> files) const;
66  void setup();
67  void setupForbiddenFilesArea();
68  void setupDownloadableFilesArea();
69  void setupIncompatibleFilesArea();
70  void setupOptionalFilesArea();
71  void setupWadseekerIsRunning();
72  void setupWadseekerNotRunning();
73 
74 private slots:
75  void ignoreMissingFiles();
76  void installFreedoom();
77  void installMissingFiles();
78  void updateStateAccordingToFileSelection();
79 };
80 
81 #endif