23 #include "checkwadsdlg.h"
24 #include "configuration/doomseekerconfig.h"
25 #include "gui/commongui.h"
26 #include "pathfinder/pathfinder.h"
27 #include "pathfinder/wadpathfinder.h"
30 #include <QScopedPointer>
33 DClass<CheckWadsDlg> :
public Ui::CheckWadsDlg
39 QScopedPointer<QTimer> checkWadTimer;
40 QScopedPointer<QTimer> showWindow;
41 bool checkIncompatibility;
48 assert(pathFinder !=
nullptr);
49 d->pathFinder = pathFinder;
50 d->checkIncompatibility = gConfig.doomseeker.bCheckTheIntegrityOfWads;
51 d->checkWadTimer.reset(
new QTimer);
52 d->showWindow.reset(
new QTimer);
56 connect(d->checkWadTimer.data(), SIGNAL(timeout()),
this, SLOT(performCheckStep()));
57 connect(d->showWindow.data(), SIGNAL(timeout()),
this, SLOT(openWindow()));
58 connect(d->buttonBox, SIGNAL(clicked(QAbstractButton*)), SLOT(abortCheck()));
61 CheckWadsDlg::~CheckWadsDlg()
68 d->progressBar->setMaximum(d->progressBar->value() + wads.size());
73 d->showWindow->setSingleShot(
true);
74 d->showWindow->start(500);
75 d->checkWadTimer->start(0);
79 connect(
this, SIGNAL(finishedChecking()), &loop, SLOT(quit()));
82 d->showWindow->stop();
84 return d->wadsChecked;
87 void CheckWadsDlg::openWindow()
92 void CheckWadsDlg::performCheckStep()
94 if (d->wads.isEmpty())
96 d->checkWadTimer->stop();
97 emit finishedChecking();
101 const PWad wad = d->wads.first();
102 d->wads.removeFirst();
106 if (!findResult.isValid())
107 d->wadsChecked.missingWads << wad;
108 else if (d->checkIncompatibility && !wad.
validFile(findResult.path()))
109 d->wadsChecked.incompatibleWads << wad;
111 d->wadsChecked.foundWads << wad;
113 d->progressBar->setValue(d->progressBar->value() + 1);
116 void CheckWadsDlg::abortCheck()
118 d->checkIncompatibility =
false;