-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdeleteotherfiles.cpp
46 lines (37 loc) · 1.42 KB
/
deleteotherfiles.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 "deleteotherfiles.h"
#include "ui_deleteotherfiles.h"
deleteOtherFiles::deleteOtherFiles(QWidget *parent) :
QDialog(parent),
ui(new Ui::deleteOtherFiles) {
qInfo() << "deleteOtherFiles::deleteOtherFiles: constructor";
ui->setupUi(this);
this->setWindowFlags(this->windowFlags().operator ^=(Qt::WindowContextHelpButtonHint));
}
deleteOtherFiles::~deleteOtherFiles() {
delete ui;
}
// Получение данных о лишних файлах
void deleteOtherFiles::showDialog(const QList< QMap<QString, QString> > otherF, QString addonsP) {
qInfo() << "deleteOtherFiles::showDialog: start";
otherFiles = otherF;
addonsPath = addonsP;
ui->filesTree->clear();
for(int i = 0; i<otherFiles.size();i++) {
QTreeWidgetItem *item = new QTreeWidgetItem(ui->filesTree);
item->setText(0, otherFiles[i]["Path"]+'\\'+otherFiles[i]["Pbo"]);
item->setCheckState(0, Qt::Checked);
}
this->open();
}
// Слот удаления лишних файлов
void deleteOtherFiles::on_deleteFiles_clicked() {
qInfo() << "deleteOtherFiles::on_deleteFiles_clicked: start";
for(int i = 0; i<ui->filesTree->topLevelItemCount();i++) {
QTreeWidgetItem *item = ui->filesTree->topLevelItem(i);
if(item->checkState(0) == Qt::Checked) {
QFile::remove(addonsPath + "/" + item->text(0));
}
}
emit filesDelete();
this->close();
}