mainwindow.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3. #include <QMainWindow>
  4. #include <QPropertyAnimation>
  5. #include <QTimer>
  6. #include "statuswidget.h"
  7. #include "rusificationwidget.h"
  8. #include "settingswidget.h"
  9. #include "newswidget.h"
  10. #include "helpwidget.h"
  11. namespace Ui {
  12. class MainWindow;
  13. }
  14. class MenuEntry;
  15. class LegacyApp;
  16. class MainWindow : public QMainWindow
  17. {
  18. Q_OBJECT
  19. public:
  20. explicit MainWindow(LegacyApp *app = 0, QWidget *parent = 0);
  21. void Init();
  22. void changeFontSizeRecursive(size_t percent, QWidget* widget);
  23. ~MainWindow();
  24. protected:
  25. void mouseMoveEvent(QMouseEvent *event) override;
  26. void mousePressEvent(QMouseEvent *event) override;
  27. void resizeEvent(QResizeEvent *event) override;
  28. private slots:
  29. void on_menuentry_1_common_clicked();
  30. void on_menuentry_2_common_clicked();
  31. void on_menuentry_3_common_clicked();
  32. void on_menuentry_4_common_clicked();
  33. void on_menuentry_5_common_clicked();
  34. void onHoverMenuentry();
  35. void on_closeButton_clicked();
  36. void on_minimizeButton_clicked();
  37. private:
  38. void setupWindowBackgroundAndMask(int bg_id);
  39. void setupMenuHoverWidget();
  40. void moveMenuHoverWidget(MenuEntry* target);
  41. void checkMenuIsHovered();
  42. void hideAllContentWidgets();
  43. private:
  44. LegacyApp *app;
  45. Ui::MainWindow *ui;
  46. QWidget* menuHoverWidget;
  47. QPropertyAnimation* menuHoverWidgetAnimation;
  48. QPropertyAnimation* menuHoverWidgetScaleAnimation;
  49. QTimer menu_hover_checker_timer;
  50. QPoint dragPosition;
  51. StatusWidget *status_frame;
  52. RusificationWidget *rusification_frame;
  53. SettingsWidget *settings_frame;
  54. NewsWidget *news_frame;
  55. HelpWidget *help_frame;
  56. const size_t common_font_size = 15;
  57. const size_t title_font_size = 16;
  58. const size_t supertitle_font_size = 32;
  59. const size_t bigbutton_font_size = 22;
  60. };
  61. #endif // MAINWINDOW_H