Something went wrong. Try again.
plyght's own C++ browser for macOS
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960#pragma once
#include <QObject>#include <QPointer>#include <functional>
class QMainWindow;class QSplitter;class QVBoxLayout;class QVariantAnimation;class QTimer;class QWidget;
class SidebarController final : public QObject { Q_OBJECTpublic: SidebarController(QMainWindow *window, QSplitter *splitter, std::function<void(bool)> 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<QWidget> m_content; QPointer<QVBoxLayout> m_dockedLayout; QVariantAnimation *m_anim = nullptr; QVariantAnimation *m_slideAnim = nullptr; QTimer *m_dismissTimer = nullptr; QTimer *m_hoverPoll = nullptr; std::function<void(bool)> m_setStackHostInset; bool m_hoverArmed = true; bool m_slidingOut = false; bool m_floatingChromeApplied = false;};