23 #include "checkwadsdlg.h"
24 #include "configuration/doomseekerconfig.h"
25 #include "pathfinder/pathfinder.h"
26 #include "pathfinder/wadpathfinder.h"
29 #include <QScopedPointer>
32 DClass<CheckWadsDlg> :
public Ui::CheckWadsDlg
38 QScopedPointer<QTimer> checkWadTimer;
39 QScopedPointer<QTimer> showWindow;
40 bool checkIncompatibility;
47 assert(pathFinder !=
nullptr);
48 d->pathFinder = pathFinder;
49 d->checkIncompatibility = gConfig.doomseeker.bCheckTheIntegrityOfWads;
50 d->checkWadTimer.reset(
new QTimer);
51 d->showWindow.reset(
new QTimer);
54 connect(d->checkWadTimer.data(), SIGNAL(timeout()),
this, SLOT(performCheckStep()));
55 connect(d->showWindow.data(), SIGNAL(timeout()),
this, SLOT(openWindow()));
56 connect(d->buttonBox, SIGNAL(clicked(QAbstractButton*)), SLOT(abortCheck()));
59 CheckWadsDlg::~CheckWadsDlg()
66 d->progressBar->setMaximum(d->progressBar->value() + wads.size());
71 d->showWindow->setSingleShot(
true);
72 d->showWindow->start(500);
73 d->checkWadTimer->start(0);
77 connect(
this, SIGNAL(finishedChecking()), &loop, SLOT(quit()));
80 d->showWindow->stop();
82 return d->wadsChecked;
85 void CheckWadsDlg::openWindow()
90 void CheckWadsDlg::performCheckStep()
92 if (d->wads.isEmpty())
94 d->checkWadTimer->stop();
95 emit finishedChecking();
99 const PWad wad = d->wads.first();
100 d->wads.removeFirst();
104 if (!findResult.isValid())
105 d->wadsChecked.missingWads << wad;
106 else if (d->checkIncompatibility && !wad.
validFile(findResult.path()))
107 d->wadsChecked.incompatibleWads << wad;
109 d->wadsChecked.foundWads << wad;
111 d->progressBar->setValue(d->progressBar->value() + 1);
114 void CheckWadsDlg::abortCheck()
116 d->checkIncompatibility =
false;