global-state.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #ifndef GLOBAL_STATE_H_GUARD_
  2. #define GLOBAL_STATE_H_GUARD_
  3. #include "ds/stringutils.h"
  4. #include "vec.h"
  5. #include <stdbool.h>
  6. #include <stdint.h>
  7. #include <inttypes.h>
  8. #define HASH64BIT uint_fast64_t
  9. #define MAX_HASH_THREADS 16
  10. enum StagesProcessing
  11. {
  12. STAGE_PROC_NONE,
  13. STAGE_PROC_SCANNING,
  14. STAGE_PROC_VALIDATING,
  15. STAGE_PROC_HASHD64,
  16. STAGE_PROC_COMPARED64,
  17. STAGE_PROC_DECOUPLING,
  18. STAGE_PROC_HASHD256,
  19. STAGE_PROC_COMPARED256,
  20. STAGE_PROC_FINISHED
  21. };
  22. enum StagesMeta
  23. {
  24. STAGE_NONE,
  25. STAGE_READY,
  26. STAGE_PROCESSING,
  27. STAGE_SORTING
  28. };
  29. typedef struct UIState
  30. {
  31. /* Stages */
  32. int stage;
  33. int processingStage;
  34. /* Window controls */
  35. bool helpScreen;
  36. bool buttonApplyOptions;
  37. bool buttonNext;
  38. bool buttonDelLeft;
  39. bool buttonDelRight;
  40. bool buttonDelBoth;
  41. bool buttonLaunch;
  42. bool buttonReset;
  43. bool buttonStopSorting;
  44. bool buttonPause;
  45. /* Options */
  46. bool recursive;
  47. bool extraPassD256;
  48. float threshSlider;
  49. bool biggerIsBetter;
  50. int resolution;
  51. int threadNum;
  52. char * windowName;
  53. string * statusline;
  54. string * threshString;
  55. string * directoryPaths;
  56. string * dirPathCount;
  57. float progress;
  58. bool threadPaused;
  59. string * imgLeftPath;
  60. string * imgRightPath;
  61. string * imgLeftResolution;
  62. string * imgRightResolution;
  63. string * groupCount;
  64. string * groupSize;
  65. string * totalDupes;
  66. string * fullPaths;
  67. string * processingExplained;
  68. } UIState;
  69. typedef struct ProcessingOptions
  70. {
  71. bool recursive;
  72. bool extraPassD256;
  73. float threshold;
  74. int threads;
  75. } ProcessingOptions;
  76. typedef struct Imagefile
  77. {
  78. string * path;
  79. HASH64BIT * hash;
  80. bool hashed;
  81. bool disposed;
  82. struct ImageGroup * group;
  83. } Imagefile;
  84. typedef vec_t(Imagefile *) imagefile_vec_t;
  85. typedef struct ImageGroup
  86. {
  87. size_t hashlen;
  88. HASH64BIT * hash;
  89. imagefile_vec_t images;
  90. } ImageGroup;
  91. typedef vec_t(ImageGroup *) imagegroup_vec_t;
  92. typedef vec_t(string *) string_vec_t;
  93. typedef struct FilesState
  94. {
  95. unsigned long hashedfiles;
  96. unsigned long failedfiles;
  97. unsigned long dupenum;
  98. int compareiter;
  99. string_vec_t dirs;
  100. imagegroup_vec_t groups;
  101. imagefile_vec_t images;
  102. } FilesState;
  103. void PUGS_Init ( void );
  104. #endif