mainwindow.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 "statuswidget.h"
  9. #include "rusificationwidget.h"
  10. #include "settingswidget.h"
  11. #include "helpwidget.h"
  12. namespace Ui {
  13. class MainWindow;
  14. }
  15. class MenuEntry;
  16. class LotroDatManager;
  17. // class NetworkUpdater;
  18. class PatchDownloader;
  19. class MainWindow : public QMainWindow
  20. {
  21. Q_OBJECT
  22. public:
  23. explicit MainWindow(QWidget *parent = 0);
  24. void changeFontSizeRecursive(size_t percent, QWidget* widget);
  25. ~MainWindow();
  26. protected:
  27. void mouseMoveEvent(QMouseEvent *event) override;
  28. void mousePressEvent(QMouseEvent *event) override;
  29. void resizeEvent(QResizeEvent *event) override;
  30. bool eventFilter(QObject *watched, QEvent *event) override;
  31. private slots:
  32. void randomChangeBackground();
  33. void on_menuentry_1_clicked();
  34. void on_menuentry_2_clicked();
  35. void on_menuentry_3_clicked();
  36. void on_menuentry_4_clicked();
  37. void onHoverMenuentry();
  38. void on_closeButton_clicked();
  39. void on_minimizeButton_clicked();
  40. void setupWindowBackgroundAndMask(QPixmap background);
  41. private:
  42. void makeConnections();
  43. void setupMenuHoverWidget();
  44. void moveMenuHoverWidget(MenuEntry* target);
  45. void checkMenuIsHovered();
  46. void hideAllContentWidgets();
  47. bool buttonsMouseMoveEventFilter(QObject *obj, QEvent *event);
  48. void setEventFilterRecursive(QObject* widget);
  49. private:
  50. PatchDownloader *patch_updater;
  51. LotroDatManager *lotro_manager;
  52. QThread *lotro_functions_thread;
  53. Ui::MainWindow *ui;
  54. StatusWidget *status_widget;
  55. RusificationWidget *rusification_widget;
  56. SettingsWidget *settings_widget;
  57. HelpWidget *help_widget;
  58. QWidget* menuHoverWidget;
  59. QPropertyAnimation* menuHoverWidgetAnimation;
  60. QPropertyAnimation* menuHoverWidgetScaleAnimation;
  61. QTimer menu_hover_checker_timer;
  62. QPoint dragPosition;
  63. int current_bg_id;
  64. QPixmap current_bg;
  65. QBitmap current_mask;
  66. QTimer background_update_timer;
  67. const int MAX_PIXMAP_ID = 14;
  68. const size_t small_font_size = 13;
  69. const size_t common_font_size = 14;
  70. const size_t menuentry_font_size = 16;
  71. const size_t title_font_size = 17;
  72. const size_t supertitle_font_size = 32;
  73. const size_t bigbutton_font_size = 22;
  74. };
  75. #endif // MAINWINDOW_H