diff options
author | Arno <am@disconnect.de> | 2012-05-05 19:06:50 +0200 |
---|---|---|
committer | Arno <am@disconnect.de> | 2012-05-05 19:06:50 +0200 |
commit | 969a3ac75517f82fccc48fcf87567bae9f5a2970 (patch) | |
tree | 44bbb890182807ff1e925c1b8e4fb67159eb1734 /consistencycheck.h | |
parent | 5b730390033aebe2b5f99448c64e201b58545769 (diff) | |
download | SheMov-969a3ac75517f82fccc48fcf87567bae9f5a2970.tar.gz SheMov-969a3ac75517f82fccc48fcf87567bae9f5a2970.tar.bz2 SheMov-969a3ac75517f82fccc48fcf87567bae9f5a2970.zip |
Fixed ConsistencyCheck
The consistencychecker was broken since introducing the pictures tab.
Never thought about it. It didn't know anything about the pics table.
Fixed that. Also added some nice QGroupBoxes to the layout. The "delete
stray pictures" thingy isn't tested at all, but it's quite straight
forward.
Diffstat (limited to 'consistencycheck.h')
-rw-r--r-- | consistencycheck.h | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/consistencycheck.h b/consistencycheck.h index b62dfbc..ca078f1 100644 --- a/consistencycheck.h +++ b/consistencycheck.h @@ -23,6 +23,7 @@ class QString; class QSqlQuery; class QFileInfo; class ConsistencyChecker; +class QProgressBar; class ConsistencyCheck : public SmDialog { Q_OBJECT @@ -30,6 +31,10 @@ class ConsistencyCheck : public SmDialog { enum Mode { DbCheck, FsCheck }; explicit ConsistencyCheck(QWidget *parent = 0, Qt::WindowFlags f = 0); + public slots: + void setProgressBarMax(int max); + void setProgress(int value); + private slots: void startChecker(int checkerType); void addMessage(const QString &message); @@ -46,6 +51,8 @@ class ConsistencyCheck : public SmDialog { QPushButton *mCleanup; QPlainTextEdit *mOkDisplay; QPlainTextEdit *mErrorDisplay; + QLabel *mActivity; + QProgressBar *mProgress; ConsistencyChecker *mChecker; }; @@ -56,32 +63,39 @@ class ConsistencyChecker : public QThread { explicit ConsistencyChecker(QObject *parent = 0); ~ConsistencyChecker(); int mode() const { return mMode; } + int count() const { return mCurCount; } void setMode(int mode) { mMode = mode; } int status() const { return mStatus; } void setStatus(int status) { mStatus = status; } void check(); const QStringList strayFiles(); void clearStrayFiles(); - const QList<int> strayIds(); + const QList<int> strayFileIds(); + const QList<int> strayPicIds(); void clearStrayIds(); public slots: void setCancel(bool cancel); - void deleteIds(const QList<int> &ids); + void deleteFileIds(const QList<int> &ids); + void deletePicIds(const QList<int> &ids); private slots: - void dbCheck(); + void dbCheck(); void fsCheck(); signals: void consistencyMsg(const QString &msg); + void approxTotal(int); + void progress(int); protected: void run(); private: QString archivePath(const QString &fileName, const QString &md5sum) const; - void doFsCheck(const QFileInfo &start); + void doFsCheck(const QFileInfo &start, const QVector<QString> &md5sums); + void doDbCheckFiles(); + void doDbCheckPics(); bool mCanceled; int mMode; int mStatus; @@ -89,9 +103,12 @@ class ConsistencyChecker : public QThread { QSqlQuery *mFileQuery; QMutex mCancelMutex; QMutex mStrayFilesMutex; - QMutex mStrayIdsMutex; + QMutex mStrayFileIdMutex; + QMutex mStrayPicsIdMutex; QStringList mStrayFiles; - QList<int> mStrayIds; + QList<int> mStrayFileIds; + QList<int> mStrayPicIds; + int mCurCount; }; #endif // CONSISTENCYCHECK_H |