bookunrar.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef BOOKUNRAR_H
  2. #define BOOKUNRAR_H
  3. #include <QObject>
  4. #include <QProcess>
  5. #include "bookitemlist.h"
  6. #include "bookunrarqueuethread.h"
  7. class Book;
  8. class BookUnrar : public QObject
  9. {
  10. Q_OBJECT
  11. public:
  12. BookUnrar(QObject* parent = 0);
  13. void run();
  14. enum States {
  15. Nothing,
  16. Extract,
  17. ExtractFile,
  18. PageCount,
  19. FirstPage
  20. };
  21. signals:
  22. void openedZipPage(int count, int total, QString text);
  23. void extractFinished(BookItemList::ErrorCodes code);
  24. void pageCount(int count);
  25. void firstImageExtracted(BookItemList::ErrorCodes code, Book* book);
  26. public:
  27. void setArchiveName(QString text);
  28. void getPageCount();
  29. void getFirstImage(Book* book);
  30. void extractAll();
  31. public slots:
  32. void startExtractFile(Book* book);
  33. void startFirstImage(Book* book);
  34. private slots:
  35. void onError(QProcess::ProcessError error );
  36. void onFinished( int exitCode, QProcess::ExitStatus exitStatus );
  37. void onReadyReadStandardError();
  38. void onReadyReadStandardOutput();
  39. private:
  40. void extractFile(Book* book);
  41. private:
  42. QString m_archiveName;
  43. bool m_cancel;
  44. QProcess* m_process;
  45. States m_state;
  46. QString m_firstPage;
  47. int m_pageCount;
  48. int m_files;
  49. QStringList m_params;
  50. BookUnrarQueueThread* m_queueExtractFile;
  51. BookUnrarQueueThread* m_queueFirstPage;
  52. Book* m_currentBook;
  53. };
  54. #endif // BOOKUNRAR_H