#pragma once #include #include #include class QMainWindow; class QSplitter; class QVBoxLayout; class QVariantAnimation; class QTimer; class QWidget; class SidebarController final : public QObject { Q_OBJECT public: SidebarController(QMainWindow *window, QSplitter *splitter, std::function setStackHostInset, QObject *parent); // Hand the controller the sidebar content widget (e.g. the tab tree) // and the docked layout it lives in. The controller will reparent it // into the floating overlay on hover-while-collapsed and back when the // sidebar is re-docked. void setSidebarContent(QWidget *content, QVBoxLayout *dockedLayout); void setHidden(bool hidden); void expandAnimated(); void positionHoverZone(); void positionFloating(); bool hoverZoneVisible() const; bool floatingVisible() const; protected: bool eventFilter(QObject *obj, QEvent *ev) override; private: void showFloating(); void hideFloatingAnimated(); void hideFloatingImmediate(); void dockContent(); QMainWindow *m_window = nullptr; QSplitter *m_splitter = nullptr; QWidget *m_hoverZone = nullptr; QWidget *m_floating = nullptr; QWidget *m_floatingInner = nullptr; QVBoxLayout *m_floatingLayout = nullptr; QPointer m_content; QPointer m_dockedLayout; QVariantAnimation *m_anim = nullptr; QVariantAnimation *m_slideAnim = nullptr; QTimer *m_dismissTimer = nullptr; QTimer *m_hoverPoll = nullptr; std::function m_setStackHostInset; bool m_hoverArmed = true; bool m_slidingOut = false; bool m_floatingChromeApplied = false; };