Adwaita-derived (GNOME Project, LGPL-3-or-CC-BY-SA), recoloured per light/dark skin and laid out in IDM's toolbar positions per docs/03-gui-spec.md §1. Licence and per-file provenance recorded in gui/resources/icons/LICENSE. New IconTheme mirrors ThemeManager's colorSchemeChanged hook so a live light/dark switch swaps every action's glyph, not just the QSS. Toolbar/menu actions, the tray icon and the window icon all now use it instead of the SP_ArrowDown placeholder. Install-path notes for PKG filed as R5 in gui/docs/pkg-qa-requests-m1.md. Also rebases lane/gui onto main (13 commits, no gui/ conflicts). Verified: full build clean, all 13 gui ctest targets pass (including gui_no_download_logic), unhappy-path DoD gate PASS against mockd (--drop-connection). Co-Authored-By: Claude Sonnet 5 <[email protected]>
130 lines
3.4 KiB
C++
130 lines
3.4 KiB
C++
// 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 <QHash>
|
|
#include <QJsonArray>
|
|
#include <QMainWindow>
|
|
#include <QPoint>
|
|
|
|
#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
|