1
0

Almond.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #pragma once
  2. #ifndef ALMOND_H
  3. #define ALMOND_H
  4. #include <QtWidgets/QMainWindow>
  5. #include "ui_Almond.h"
  6. #include <Mandel.h>
  7. #include "BackgroundTask.h"
  8. #include "choosegenerators.h"
  9. #include "customgenerator.h"
  10. #include "FractalWidget.h"
  11. #include "AlmondMenuWidget.h"
  12. #include "ExportImageMenu.h"
  13. #include "ExportVideoMenu.h"
  14. #include "GradientMenu.h"
  15. #include <memory>
  16. struct ViewState
  17. {
  18. mnd::MandelViewport viewport;
  19. mnd::MandelGenerator* generator;
  20. };
  21. enum ViewType
  22. {
  23. MANDELBROT,
  24. JULIA,
  25. CUSTOM,
  26. };
  27. class Almond : public QMainWindow
  28. {
  29. Q_OBJECT
  30. private:
  31. mnd::MandelContext mandelContext;
  32. QThreadPool backgroundTasks;
  33. bool stoppingBackgroundTasks = false;
  34. AlmondMenuWidget* amw;
  35. ExportImageMenu* eim;
  36. ExportVideoMenu* evm;
  37. GradientMenu* gradientMenu;
  38. bool fullscreenMode = false;
  39. bool maximizedBeforeFullscreen = true;
  40. QWidget* cw;
  41. public:
  42. FractalWidget* fractalWidget;
  43. private:
  44. //std::unique_ptr<BenchmarkDialog> benchmarkDialog;
  45. std::unique_ptr<CustomGenerator> customGeneratorDialog;
  46. std::vector<std::unique_ptr<FractalDef>> customGenerators;
  47. FractalDef* currentCustom;
  48. mnd::AdaptiveGenerator* customGenerator;
  49. std::vector<std::unique_ptr<mnd::AdaptiveGenerator>> adjustedGenerators;
  50. ViewType currentView;
  51. mnd::MandelViewport mandelViewSave;
  52. mnd::MandelViewport customViewSave;
  53. mnd::AdaptiveGenerator* mandelGenerator;
  54. public:
  55. mnd::MandelGenerator* currentGenerator;
  56. public:
  57. Almond(QWidget *parent = Q_NULLPTR);
  58. ~Almond(void);
  59. void submitBackgroundTask(BackgroundTask* task);
  60. void stopBackgroundTask();
  61. bool eventFilter(QObject *target, QEvent *event);
  62. void submenuOK(int smIndex);
  63. void imageExportOk(void);
  64. void videoExportOk(void);
  65. void gradientEditOk(void);
  66. public slots:
  67. void toggleFullscreen(void);
  68. private slots:
  69. void on_zoom_out_clicked();
  70. void on_zoom_in_clicked();
  71. void on_maxIterations_editingFinished();
  72. void on_chooseGradient_clicked();
  73. void on_exportVideo_clicked();
  74. void on_smooth_stateChanged(int arg1);
  75. void on_exportImage_clicked();
  76. void on_resetZoom_clicked();
  77. void on_displayInfo_stateChanged(int arg1);
  78. void on_chooseGenerator_clicked();
  79. void backgroundTaskFinished(bool, QString message);
  80. void backgroundTaskProgress(float percentage);
  81. void pointSelected(mnd::Real x, mnd::Real y);
  82. void on_wMandel_toggled(bool checked);
  83. void saveView(void);
  84. void setViewType(ViewType v);
  85. void on_wMandel_clicked();
  86. void on_radioButton_toggled(bool checked);
  87. void on_radioButton_2_toggled(bool checked);
  88. void on_createCustom_clicked();
  89. void on_cancelProgress_clicked();
  90. private:
  91. Ui::AlmondClass ui;
  92. };
  93. #endif // ALMOND_H