main.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. Copyright (C) 2010 Matthias Kretz <kretz@kde.org>
  3. Permission to use, copy, modify, and distribute this software
  4. and its documentation for any purpose and without fee is hereby
  5. granted, provided that the above copyright notice appear in all
  6. copies and that both that the copyright notice and this
  7. permission notice and warranty disclaimer appear in supporting
  8. documentation, and that the name of the author not be used in
  9. advertising or publicity pertaining to distribution of the
  10. software without specific, written prior permission.
  11. The author disclaim all warranties with regard to this
  12. software, including all implied warranties of merchantability
  13. and fitness. In no event shall the author be liable for any
  14. special, indirect or consequential damages or any damages
  15. whatsoever resulting from loss of use, data or profits, whether
  16. in an action of contract, negligence or other tortious action,
  17. arising out of or in connection with the use or performance of
  18. this software.
  19. */
  20. #ifndef MAIN_H
  21. #define MAIN_H
  22. #include <QImage>
  23. #include <QMouseEvent>
  24. #include <QPaintEvent>
  25. #include <QResizeEvent>
  26. #include <QWheelEvent>
  27. #include <QWidget>
  28. #include "mandel.h"
  29. class MainWindow : public QWidget
  30. {
  31. Q_OBJECT
  32. public:
  33. MainWindow(QWidget *parent = 0);
  34. protected:
  35. void paintEvent(QPaintEvent *);
  36. void resizeEvent(QResizeEvent *);
  37. void mousePressEvent(QMouseEvent *);
  38. void mouseMoveEvent(QMouseEvent *);
  39. void mouseReleaseEvent(QMouseEvent *);
  40. void wheelEvent(QWheelEvent *);
  41. private slots:
  42. void vcImage(const QImage &, quint64);
  43. void scalarImage(const QImage &, quint64);
  44. private:
  45. void recreateImage();
  46. void updateTitle();
  47. float m_x; // left
  48. float m_y; // top
  49. float m_scale;
  50. QImage m_img1;
  51. QImage m_img2;
  52. QRect m_rect1;
  53. QRect m_rect2;
  54. QPoint m_dragStart;
  55. QPoint m_dragDelta;
  56. float m_cycles1, m_cycles2;
  57. Mandel<VcImpl> m_mandelVc;
  58. Mandel<ScalarImpl> m_mandelScalar;
  59. };
  60. #endif // MAIN_H