// The main window. Lane GUI. // // M1 slice: menus + toolbar + splitter (category tree | table), the table driven by // mockd, a status-bar connection dot, an offline banner instead of a modal, the Add URL -> // File Info flow, a per-task progress dialog, Options/Scheduler/Speed Limiter/Batch/ // Grabber, and the tray icon. The floating drop target and clipboard capture are still to // come. #pragma once #include #include #include #include #include "models/DownloadFilterProxy.hpp" #include "rpc/Protocol.hpp" class QAction; class QLabel; class QTimer; class QTreeView; namespace velox::gui { class DownloadTableModel; class CategoryPanel; class TrayIcon; class DropTargetWidget; class IconTheme; #ifdef VELOX_GUI_HAVE_DBUS class GlobalShortcut; #endif namespace rpc { class RpcClient; } // namespace rpc class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(rpc::RpcClient *client, QWidget *parent = nullptr); ~MainWindow() override; protected: void closeEvent(QCloseEvent *event) override; private slots: void onConnectionState(rpc::ConnectionState state); void onSpeedGlobal(const QJsonObject ¶ms); void onFilterChanged(const velox::gui::TaskSelection &selection); void scheduleCounts(); // throttled: fires refreshCounts() at most every 400 ms void refreshCounts(); void pauseSelection(); void resumeSelection(); void cancelSelection(); void removeSelection(); void resumeAll(); void pauseAll(); void openAddUrlDialog(); void openPropertiesForSelection(); void showTableContextMenu(const QPoint &pos); void openOptionsDialog(); void openSchedulerDialog(); void openSpeedLimiterDialog(); void openBatchDialog(); void openGrabberWizard(); void showAndRaise(); void onSettingsChanged(const QJsonObject ¶ms); void onUrlDropped(const QString &url); void applyIcons(); private: void buildActions(); void buildMenus(); void buildToolBar(); void buildTray(); void buildDropTarget(); void fetchTree(); void fetchGeneralUiSettings(); QStringList selectedTaskIds() const; QStringList allTaskIds() const; void actOnTasks(const char *methodName, const QStringList &ids); void restoreLayout(); void saveLayout(); rpc::RpcClient *client_; DownloadTableModel *model_; DownloadFilterProxy *proxy_; QTreeView *view_; CategoryPanel *panel_; QAction *actAddUrl_ = nullptr; QAction *actResume_ = nullptr; QAction *actPause_ = nullptr; QAction *actStop_ = nullptr; QAction *actRemove_ = nullptr; QAction *actResumeAll_ = nullptr; QAction *actPauseAll_ = nullptr; QAction *actProperties_ = nullptr; QAction *actOptions_ = nullptr; QAction *actScheduler_ = nullptr; QAction *actSpeedLimiter_ = nullptr; QAction *actBatch_ = nullptr; QAction *actGrabber_ = nullptr; QAction *actShow_ = nullptr; QJsonArray categoriesCache_; QJsonArray queuesCache_; IconTheme *iconTheme_ = nullptr; TrayIcon *trayIcon_ = nullptr; DropTargetWidget *dropTarget_ = nullptr; bool minimizeToTrayEnabled_ = false; #ifdef VELOX_GUI_HAVE_DBUS GlobalShortcut *globalShortcut_ = nullptr; #endif QLabel *connDot_; QLabel *connText_; QLabel *countsLabel_; QWidget *offlineBanner_; QTimer *countsTimer_; qint64 globalDownBps_ = 0; }; } // namespace velox::gui