importproxy.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef IMPORTPROXY_H
  2. #define IMPORTPROXY_H
  3. #include <QtCore>
  4. #include "numberlistmodel.h"
  5. #include "snccore.h"
  6. #include "SNCCore_global.h"
  7. #include "importconsumer.h"
  8. #include "importproducer.h"
  9. #include "numberbuilder.h"
  10. class SNCCORESHARED_EXPORT ImportProxy : public QThread
  11. {
  12. Q_OBJECT
  13. public:
  14. explicit ImportProxy(NumberListModel *oldModel);
  15. ~ImportProxy();
  16. void setFetchList(QStringList list);
  17. void setBuildType(NumberBuildType buildType);
  18. signals:
  19. void progressMaxUpdated(int max);
  20. void progressUpdated(int i);
  21. void numberBuilt(NumberListModel *newModel);
  22. void threadAborted();
  23. protected:
  24. void run();
  25. private:
  26. void appendModel();
  27. void setFetchMaxSize();
  28. private:
  29. int counter;
  30. bool stop;
  31. int batchSize;
  32. QMutex mutex;
  33. QStringList fetchList;
  34. QStringList segments;
  35. QList<QStringList> numbers;
  36. NumberListModel *oldModel;
  37. NumberListModel *newModel;
  38. QList<QStringList> *buffer;
  39. QMutex *mutex2;
  40. int resAvailable;
  41. int all_file_size;
  42. int current_file_size;
  43. bool readFinished;
  44. NumberBuildType buildType;
  45. int step1Progress;
  46. int step2Progress;
  47. int threadAlive;
  48. int threadDead;
  49. int bufferTakedTimes;
  50. int bufferAppendedTimes;
  51. public slots:
  52. void onChildTaskFinished(QStringList segments,QList<QStringList> numbers);
  53. void abort();
  54. void onProduced(int strSize);
  55. void onProducerFinished();
  56. void onThreadDestroy();
  57. void onBufferAppended();
  58. void onBufferTaked();
  59. };
  60. #endif // IMPORTPROXY_H