mainwindow.h 2.6 KB

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