MainWindow.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3. #include <QFrame>
  4. #include <QMainWindow>
  5. class ProjectInfo;
  6. class PopUpAniStackedWidget;
  7. class QHBoxLayout;
  8. class NavigationInterface;
  9. class CustomTitleBar;
  10. class HomeView;
  11. class ExpertManageView;
  12. class EvaluateView;
  13. class LoginView;
  14. class UserView;
  15. class AboutView;
  16. class SettingView;
  17. class QStackedWidget;
  18. class StackedWidget : public QFrame
  19. {
  20. Q_OBJECT
  21. public:
  22. StackedWidget(QWidget *parent = nullptr);
  23. void addWidget(QWidget *widget);
  24. QWidget *widget(int index) const;
  25. void removeWidget(QWidget *widget);
  26. void setCurrentWidget(QWidget *widget, bool popOut = false);
  27. void setCurrentIndex(int index, bool popOut = false);
  28. PopUpAniStackedWidget *view() const;
  29. int index(const QString routeKey);
  30. signals:
  31. void currentWidgetChanged(QWidget *);
  32. private:
  33. QHBoxLayout *m_hBoxLayout;
  34. PopUpAniStackedWidget *m_view;
  35. };
  36. class MainWindow : public QMainWindow
  37. {
  38. Q_OBJECT
  39. public:
  40. MainWindow(QWidget *parent = nullptr);
  41. ~MainWindow();
  42. private:
  43. void initLoginPage();
  44. void initMainPage();
  45. void initNavigation();
  46. void setNaviInterfaceHidden(bool hidden);
  47. int titleBarIndent() const;
  48. void resizeEvent(QResizeEvent *event) override;
  49. int routeIndex(const QString routeKey) const;
  50. private slots:
  51. void slotLogin();
  52. void slotLogout();
  53. void slotCancelLogin();
  54. void slotNaviItemClicked();
  55. void slotOpenProject(ProjectInfo *proj);
  56. void slotCloseProject();
  57. void slotDeleteProject(ProjectInfo *proj);
  58. private:
  59. CustomTitleBar *m_titleBar = 0;
  60. QStackedWidget *m_mainStackedWidget = 0;
  61. LoginView *m_loginView = 0;
  62. QWidget *m_mainWidget = 0;
  63. QHBoxLayout *m_hBoxLayout = 0;
  64. QHBoxLayout *m_widgetLayout = 0;
  65. StackedWidget *m_stackWidget = 0;
  66. NavigationInterface *m_naviInterface = 0;
  67. HomeView *m_homeView = 0;
  68. AboutView *m_aboutView = 0;
  69. SettingView *m_settingView = 0;
  70. UserView *m_userView = 0;
  71. };
  72. #endif // MAINWINDOW_H