diff options
author | Arno <am@disconnect.de> | 2010-11-06 13:44:10 +0100 |
---|---|---|
committer | Arno <am@disconnect.de> | 2010-11-06 13:44:10 +0100 |
commit | b62368501e5b37aea3d8d5feac884a254c71380d (patch) | |
tree | d618dcf351ddb374f47019299af8eca9a696e277 /consistencycheck.h | |
parent | 8230ea0228bd300316529c852858f7105ee75a3d (diff) | |
download | SheMov-b62368501e5b37aea3d8d5feac884a254c71380d.tar.gz SheMov-b62368501e5b37aea3d8d5feac884a254c71380d.tar.bz2 SheMov-b62368501e5b37aea3d8d5feac884a254c71380d.zip |
Finish ConsistencyChecker
This commit reverts the previous one. You don't need a QTimer to start a
QThread member function in a separate thread. Calling start() creates a
new thread.
Implemented filesystem check and polished the dialog.
Diffstat (limited to 'consistencycheck.h')
-rw-r--r-- | consistencycheck.h | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/consistencycheck.h b/consistencycheck.h index 2f934fc..f5470e3 100644 --- a/consistencycheck.h +++ b/consistencycheck.h @@ -12,12 +12,15 @@ #include <QThread> #include <QSqlDatabase> #include <QMutex> +#include <QStringList> +#include <QList> class QPushButton; class QPlainTextEdit; class QLabel; class QString; -class QCheckBox; +class QSqlQuery; +class QFileInfo; class ConsistencyChecker; class ConsistencyCheck : public QDialog { @@ -32,15 +35,16 @@ class ConsistencyCheck : public QDialog { void checkerStarted(); void checkerFinished(); void cancelChecker(); - void showErrorsChanged(int state); + void cleanup(); private: + void moveFiles(const QStringList &files); QPushButton *mCancelExit; QPushButton *mCheckDb; QPushButton *mCheckFs; - QPlainTextEdit *mDisplay; - QLabel *mCheckLabel; - QCheckBox *mErrorsOnly; + QPushButton *mCleanup; + QPlainTextEdit *mOkDisplay; + QPlainTextEdit *mErrorDisplay; ConsistencyChecker *mChecker; }; @@ -55,12 +59,18 @@ class ConsistencyChecker : public QThread { int status() const { return mStatus; } void setStatus(int status) { mStatus = status; } void check(); + const QStringList strayFiles(); + void clearStrayFiles(); + const QList<int> strayIds(); + void clearStrayIds(); public slots: void setCancel(bool cancel); + void deleteIds(const QList<int> &ids); private slots: void dbCheck(); + void fsCheck(); signals: void consistencyMsg(const QString &msg); @@ -70,11 +80,17 @@ class ConsistencyChecker : public QThread { private: QString archivePath(const QString &fileName, const QString &md5sum) const; + void doFsCheck(const QFileInfo &start); bool mCanceled; int mMode; int mStatus; QSqlDatabase mDb; + QSqlQuery *mFileQuery; QMutex mCancelMutex; + QMutex mStrayFilesMutex; + QMutex mStrayIdsMutex; + QStringList mStrayFiles; + QList<int> mStrayIds; }; #endif // CONSISTENCYCHECK_H |