/* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. */ #ifndef CONSISTENCYCHECK_H #define CONSISTENCYCHECK_H #include #include #include #include class QPushButton; class QPlainTextEdit; class QLabel; class QString; class QCheckBox; class ConsistencyChecker; class ConsistencyCheck : public QDialog { Q_OBJECT public: enum Mode { DbCheck, FsCheck }; explicit ConsistencyCheck(QWidget *parent = 0, Qt::WindowFlags f = 0); private slots: void startChecker(int checkerType); void addMessage(const QString &message); void checkerStarted(); void checkerFinished(); void cancelChecker(); void showErrorsChanged(int state); private: QPushButton *mCancelExit; QPushButton *mCheckDb; QPushButton *mCheckFs; QPlainTextEdit *mDisplay; QLabel *mCheckLabel; QCheckBox *mErrorsOnly; ConsistencyChecker *mChecker; }; class ConsistencyChecker : public QThread { Q_OBJECT public: enum Status { Ok, Fail }; explicit ConsistencyChecker(QObject *parent = 0); ~ConsistencyChecker(); int mode() const { return mMode; } void setMode(int mode) { mMode = mode; } int status() const { return mStatus; } void setStatus(int status) { mStatus = status; } void check(); public slots: void setCancel(bool cancel); private slots: void dbCheck(); signals: void consistencyMsg(const QString &msg); protected: void run(); private: QString archivePath(const QString &fileName, const QString &md5sum) const; bool mCanceled; int mMode; int mStatus; QSqlDatabase mDb; QMutex mCancelMutex; }; #endif // CONSISTENCYCHECK_H