Skip to content

Commit 83153a3

Browse files
author
Travis CI
committedMay 28, 2021
[ci skip] Travis AUTO FORMAT
1 parent 79ba1db commit 83153a3

File tree

5 files changed

+31
-41
lines changed

5 files changed

+31
-41
lines changed
 

‎deletetask.cpp

100755100644
+11-12
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ deletetask::deletetask(QStringList something, QLabel *status,
88
}
99

1010
void deletetask::deleteFileRm(QString filepath) {
11-
QFileInfo tmp(filepath);
12-
if (tmp.isFile()) {
13-
QFile file(filepath);
14-
if (!file.remove()) {
15-
qDebug() << "File not deleted: " << file.fileName();
16-
}
17-
} else {
18-
QDir folder(filepath);
19-
if (!folder.removeRecursively()) {
20-
qDebug() << "Not all was deleted: " << folder.absolutePath();
21-
}
11+
QFileInfo tmp(filepath);
12+
if (tmp.isFile()) {
13+
QFile file(filepath);
14+
if (!file.remove()) {
15+
qDebug() << "File not deleted: " << file.fileName();
2216
}
17+
} else {
18+
QDir folder(filepath);
19+
if (!folder.removeRecursively()) {
20+
qDebug() << "Not all was deleted: " << folder.absolutePath();
21+
}
22+
}
2323
}
2424

2525
void deletetask::run() {
@@ -37,7 +37,6 @@ void deletetask::run() {
3737
qDebug() << "Not deleted: " << toDelete;
3838
qDebug() << "Trying to rm ";
3939
deleteFileRm(toDelete);
40-
4140
}
4241
#endif
4342
}

‎deletetask.h

100755100644
+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class deletetask : public QRunnable {
1212
deletetask(QStringList, QLabel *, QList<QString> *);
1313
void run() override;
1414
void deleteFileRm(QString filepath);
15+
1516
private:
1617
QLabel *status;
1718
QList<QString> *deleteList;

‎mywindows.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ void myWindows::clickedNew(QModelIndex index, QModelIndex) {
161161
updatePath(index);
162162
QString fileName = model->fileName(index);
163163
QFileInfo infoFile(lastFilePath);
164-
QString ext = fileName.split(".").back(); // We could use here QFileInfo::completeSuffix()
164+
QString ext = fileName.split(".")
165+
.back(); // We could use here QFileInfo::completeSuffix()
165166
int SIZE_NAME_MAX = 50;
166167
if (fileName.length() > SIZE_NAME_MAX) {
167168
info->setName(fileName.mid(0, SIZE_NAME_MAX));
@@ -341,15 +342,14 @@ void myWindows::saveSettings() {
341342
}
342343

343344
int myWindows::canDelete() {
344-
QMessageBox box;
345-
box.setText("Selected files/folders will be eternally deleted !!");
346-
box.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
347-
box.setWindowFlags(Qt::WindowStaysOnTopHint);
348-
box.setDefaultButton(QMessageBox::Ok);
349-
return box.exec();
345+
QMessageBox box;
346+
box.setText("Selected files/folders will be eternally deleted !!");
347+
box.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
348+
box.setWindowFlags(Qt::WindowStaysOnTopHint);
349+
box.setDefaultButton(QMessageBox::Ok);
350+
return box.exec();
350351
}
351352

352-
353353
void myWindows::keyboardDel() {
354354
// If oldDelete i.e rm -r, ask for confirmation else move to bin
355355
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)

‎refreshtask.cpp

+7-16
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
11
#include "refreshtask.h"
22

3-
4-
5-
refreshtask::refreshtask(QLabel *preview, QString path, int depth)
6-
{
7-
shouldrun = false;
8-
maxdepth = depth;
9-
currentPath = path;
10-
this->preview = preview;
3+
refreshtask::refreshtask(QLabel *preview, QString path, int depth) {
4+
shouldrun = false;
5+
maxdepth = depth;
6+
currentPath = path;
7+
this->preview = preview;
118
}
129

10+
void refreshtask::run() {}
1311

14-
void refreshtask::run() {
15-
16-
17-
}
18-
19-
void refreshtask::stop() {
20-
shouldrun = true;
21-
}
12+
void refreshtask::stop() { shouldrun = true; }

‎refreshtask.h

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
#ifndef REFRESHTASK_H
22
#define REFRESHTASK_H
33

4-
#include <QRunnable>
4+
#include <QDir>
55
#include <QFileInfo>
66
#include <QLabel>
7-
#include <QDir>
8-
7+
#include <QRunnable>
98

10-
class refreshtask: public QRunnable
11-
{
9+
class refreshtask : public QRunnable {
1210
public:
1311
refreshtask(QLabel *preview, QString currentPath, int depth);
1412
void run() override;
1513
void stop();
14+
1615
private:
1716
bool shouldrun;
1817
QLabel *preview;

0 commit comments

Comments
 (0)
Please sign in to comment.