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 "exportwidget.h"
  9. #include "importwidget.h"
  10. #include "managewidget.h"
  11. #include "browsewidget.h"
  12. #include "lotroprogresswidget.h"
  13. namespace Ui {
  14. class MainWindow;
  15. }
  16. class MenuEntry;
  17. class LotroManager;
  18. class MainWindow : public QMainWindow
  19. {
  20. Q_OBJECT
  21. public:
  22. explicit MainWindow(QWidget *parent = 0);
  23. void changeFontSizeRecursive(size_t percent, QWidget* widget);
  24. ~MainWindow();
  25. protected:
  26. void mouseMoveEvent(QMouseEvent *event) override;
  27. void mousePressEvent(QMouseEvent *event) override;
  28. void resizeEvent(QResizeEvent *event) override;
  29. public slots:
  30. void enableMenuItems();
  31. void disableMenuItems();
  32. private slots:
  33. void randomChangeBackground();
  34. void on_menuentry_1_common_clicked();
  35. void on_menuentry_2_common_clicked();
  36. void on_menuentry_3_common_clicked();
  37. void on_menuentry_4_common_clicked();
  38. void onHoverMenuentry();
  39. void on_closeButton_clicked();
  40. void on_minimizeButton_clicked();
  41. void setupWindowBackgroundAndMask(QPixmap background);
  42. void onLotroManagerStarted(QString, QVector<QVariant>);
  43. void onLotroManagerFinished(QString, QVector<QVariant>);
  44. void onLotroManagerErrorOccured(QString, QVector<QVariant>);
  45. private:
  46. void makeConnections();
  47. void setupMenuHoverWidget();
  48. void moveMenuHoverWidget(MenuEntry* target);
  49. void checkMenuIsHovered();
  50. void hideAllContentWidgets();
  51. private:
  52. Ui::MainWindow *ui;
  53. LotroManager* lotro_manager;
  54. QThread *lotro_mgr_thread;
  55. ExportWidget *export_widget;
  56. ImportWidget *import_widget;
  57. ManageWidget *manage_widget;
  58. BrowseWidget *browse_widget;
  59. LotroProgressWidget *lotro_progress_widget;
  60. QWidget* menuHoverWidget;
  61. QPropertyAnimation* menuHoverWidgetAnimation;
  62. QPropertyAnimation* menuHoverWidgetScaleAnimation;
  63. QTimer menu_hover_checker_timer;
  64. QPoint dragPosition;
  65. int current_bg_id;
  66. QPixmap current_bg;
  67. QBitmap current_mask;
  68. QTimer background_update_timer;
  69. const int MAX_PIXMAP_ID = 14;
  70. const size_t common_font_size = 15;
  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