-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatasetloader.cpp
46 lines (35 loc) · 1018 Bytes
/
datasetloader.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "datasetloader.h"
DatasetLoader::DatasetLoader(const QString &file, arma::mat * matrix, QProgressBar * progressBar)
{
this->progressBar = progressBar;
this->matrix = matrix;
this->file = file;
}
void DatasetLoader::loadDataset()
{
this->progressBar->setRange(0,0);
this->progressBar->show();
bool success = data::Load(file.toStdString().c_str(), *matrix, false);
QString datasetDir;
QString datasetName;
if (success) {
datasetDir = this->getDirectory(file);
datasetName = this->getFileName(file);
} else {
datasetDir = "";
datasetName = "";
}
this->progressBar->hide();
emit finished(datasetDir, datasetName, success);
}
QString DatasetLoader::getDirectory(const QString &filePath) {
QString ret = filePath;
ret.remove(this->getFileName(filePath));
return ret;
}
QString DatasetLoader::getFileName(const QString &filePath)
{
QFileInfo i(filePath);
QString ret = i.fileName();
return ret;
}