global-state.h 2.0 KB

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