#define FILEOPERATOR_H
#include <QWidget>
-#include <QProgressBar>
#include <QFileInfo>
#include <QThread>
#include <QMutex>
#include <QMap>
#include <QSet>
+#include "progressbar.h"
+
class FileManipulatorThread;
void remove(FileManipulatorThread* manipulator);
void setBarSize(FileManipulatorThread* manipulator, unsigned int size);
void updateProgress(FileManipulatorThread* manipulator, int value);
+ void showPaused(FileManipulatorThread* manipulator);
+
+ void togglePauseOperation(FileManipulatorThread* manipulator);
+ void abortOperation(FileManipulatorThread* manipulator);
protected:
void caterNewThread(FileManipulatorThread *thread);
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();
+
+ 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];
QString fileName, 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 operationPaused(FileManipulatorThread*);
};