MainWindow.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3. #include <QFrame>
  4. #include <QMainWindow>
  5. class PopUpAniStackedWidget;
  6. class QHBoxLayout;
  7. class NavigationInterface;
  8. class StandardTitleBar;
  9. class LoginView;
  10. class AboutView;
  11. class StackedWidget : public QFrame
  12. {
  13. Q_OBJECT
  14. public:
  15. StackedWidget(QWidget *parent = nullptr);
  16. void addWidget(QWidget *widget);
  17. void setCurrentWidget(QWidget *widget, bool popOut = false);
  18. void setCurrentIndex(int index, bool popOut = false);
  19. PopUpAniStackedWidget *view() const;
  20. signals:
  21. void currentWidgetChanged(QWidget *);
  22. private:
  23. QHBoxLayout *m_hBoxLayout;
  24. PopUpAniStackedWidget *m_view;
  25. };
  26. class MainWindow : public QMainWindow
  27. {
  28. Q_OBJECT
  29. public:
  30. MainWindow(QWidget *parent = nullptr);
  31. ~MainWindow();
  32. private:
  33. void initialize();
  34. void initWindow();
  35. void initLayout();
  36. void initNavigation();
  37. void connectSignalsAndSlots();
  38. void setNaviInterfaceHidden(bool hidden);
  39. int titleBarIndent() const;
  40. void resizeEvent(QResizeEvent *event) override;
  41. void switchTo(QWidget *widget, bool triggerByUser = true);
  42. private slots:
  43. void loginViewClicked();
  44. void aboutViewClicked();
  45. private:
  46. StandardTitleBar *m_titleBar;
  47. QHBoxLayout *m_hBoxLayout;
  48. QHBoxLayout *m_widgetLayout;
  49. StackedWidget *m_stackWidget;
  50. NavigationInterface *m_naviInterface;
  51. LoginView *m_loginView;
  52. AboutView *m_aboutView;
  53. };
  54. #endif // MAINWINDOW_H