#define FILEOPERATOR_H
#include <QWidget>
-#include <QProgressBar>
#include <QFileInfo>
#include <QThread>
#include <QMutex>
#include <QWaitCondition>
#include <QDir>
+#include <QFSFileEngine>
#include <QMap>
#include <QSet>
+#include "progressbar.h"
+
class FileManipulatorThread;
FileOperator(QWidget *parent = 0);
static QString shortenPath(const QString &path);
+ static QString unwindPath(const QString &path);
void deleteFiles(const QFileInfoList &files);
void copyFiles(const QFileInfoList &files, QDir &destination);
void remove(FileManipulatorThread* manipulator);
void setBarSize(FileManipulatorThread* manipulator, unsigned int size);
void updateProgress(FileManipulatorThread* manipulator, int value);
+ void updateMainText(FileManipulatorThread* manipulator, const QString &text);
+ void showPaused(FileManipulatorThread* manipulator);
+
+ void togglePauseOperation(FileManipulatorThread* manipulator);
+ void abortOperation(FileManipulatorThread* manipulator);
protected:
void caterNewThread(FileManipulatorThread *thread);
QList<FileManipulatorThread*> manipulatorList;
+ QPixmap deleteIcon, inverseDeleteIcon, copyIcon, inverseCopyIcon, moveIcon, inverseMoveIcon;
};
void setText(int value);
- QProgressBar *progressBar;
+ void wake();
+
+ ProgressBar *progressBar;
- time_t startTime;
QMutex mutex;
- QWaitCondition waitCond;
// the new name entered from the overwrite dialog
QString newNameFromDialog;
+ // flags to abort/pause the operation
+ bool abort, pause;
protected:
void processFiles(const QFileInfoList &files);
void updateProgress(int value);
void updateFile(const QString &name);
+ void waitOnCond();
+
+ bool checkSequentialFile(const QFSFileEngine &engine);
+
+ QWaitCondition waitCond;
+
// files to process by the operation
const QFileInfoList files;
// destination for files - changes as the operation recurses into directories
// responses from the dialog prompts (error and overwrite)
FileOperator::Response response;
FileOperator::Response overwriteAll;
- // a flag to abort the operation
- bool abort;
// an array indicating whether to always ignore the error of index errno
bool ignoreAll[256];
// 1 for a file and file count for dirs (or both for copy&delete)
QMap<QString, qint64> fileSizeMap;
- // the name of the file thats being processed (for progressBar) and the text of the progressBar (the format)
- QString fileName, barText;
+ // the text of the progressBar (the format)
+ QString barText;
// stamp of the last ETA recalculation - done every second
time_t lastTimeUpdate;
+ time_t startTime, waitTime;
char timeBuf[10];
// progress information of the bar and for the current file
unsigned int barSize, barValue, fileSize, fileValue;
void finished(FileManipulatorThread*);
void setBarSize(FileManipulatorThread*, unsigned int);
void updateProgress(FileManipulatorThread*, int);
+ void updateFileName(FileManipulatorThread*, QString);
+ void operationPaused(FileManipulatorThread*);
};