mainwindow.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3. #include <QMainWindow>
  4. #include <QPropertyAnimation>
  5. #include <QTimer>
  6. #include <QPixmap>
  7. #include <QBitmap>
  8. #include <QGraphicsBlurEffect>
  9. #include <QFont>
  10. #include <QCloseEvent>
  11. #include <QMutex>
  12. #include <QMutexLocker>
  13. #include "statuswidget.h"
  14. #include "aboutwidget.h"
  15. #include "helpwidget.h"
  16. #include "legacyapplication.h"
  17. namespace Ui {
  18. class MainWindow;
  19. }
  20. class MenuEntry;
  21. class LotroDatManager;
  22. class PatchDownloader;
  23. class MainWindow : public QMainWindow
  24. {
  25. Q_OBJECT
  26. public:
  27. explicit MainWindow(QWidget *parent = 0);
  28. ~MainWindow();
  29. public slots:
  30. void onErrorStatusChanged(AppErrorStatus status);
  31. void updateFontSizes();
  32. signals:
  33. void messageDialogFinished(QObject* emitter, int result);
  34. protected:
  35. virtual void closeEvent(QCloseEvent *event) override;
  36. void mouseMoveEvent(QMouseEvent *event) override;
  37. void mousePressEvent(QMouseEvent *event) override;
  38. void resizeEvent(QResizeEvent *event) override;
  39. bool eventFilter(QObject *watched, QEvent *event) override;
  40. private slots:
  41. void randomChangeBackground();
  42. void on_menuentry_1_clicked();
  43. void on_menuentry_2_clicked();
  44. void on_menuentry_4_clicked();
  45. void onHoverMenuentry(MenuEntry* hovered_entry);
  46. void on_closeButton_clicked();
  47. void on_minimizeButton_clicked();
  48. void setupWindowBackgroundAndMask(QPixmap background);
  49. private:
  50. void makeConnections();
  51. void setupMenuHoverWidget();
  52. void moveMenuHoverWidget(MenuEntry* target);
  53. void checkMenuIsHovered();
  54. void hideAllContentWidgets();
  55. bool buttonsMouseMoveEventFilter(QObject *obj, QEvent *event);
  56. void setEventFilterRecursive(QObject* widget);
  57. private:
  58. bool show_warning_on_close = false;
  59. Ui::MainWindow *ui = nullptr;
  60. MenuEntry* current_active_entry_ = nullptr;
  61. MenuEntry* current_hovered_entry_ = nullptr;
  62. StatusWidget *status_widget_ = nullptr;
  63. HelpWidget *help_widget_ = nullptr;
  64. AboutWidget *about_widget_ = nullptr;
  65. QWidget* menu_hover_widget_ = nullptr;
  66. QPropertyAnimation* menu_hover_widget_animation_ = nullptr;
  67. QTimer menu_hover_checker_timer_;
  68. QPoint drag_position_;
  69. int current_bg_id_;
  70. QPixmap current_bg_;
  71. QBitmap current_mask_;
  72. QTimer background_update_timer_;
  73. const int MAX_PIXMAP_ID = 21;
  74. };
  75. #endif // MAINWINDOW_H