// #ifndef SCREENWALL_WIDGET_H // #define SCREENWALL_WIDGET_H // #include // #include // #include // #include // #include // #include // #include // #include // #include // #include // #include // #include // #include // #include // #include "../AvRecorder/ui/opengl_video_widget.h" // #include "../AvRecorder/recorder/video_recorder.h" // #include "../AvRecorder/capturer/finder.h" // class DesktopPreviewWidget; // class WindowIconListWidget; // class WindowPreviewWidget; // class EnhancedWindowFinder; // /** // * 屏幕墙主组件 // * 提供桌面预览、窗口列表和实时窗口预览功能 // */ // class ScreenWallWidget : public QWidget // { // Q_OBJECT // public: // struct ScreenWallConfig { // int desktopFrameRate = 15; // 桌面预览帧率 // int windowFrameRate = 30; // 窗口预览帧率 // QSize thumbnailSize = QSize(200, 150); // 缩略图尺寸 // int maxConcurrentCaptures = 6; // 最大同时捕获数 // bool enableMinimizedPreview = true; // 启用最小化窗口预览 // int updateInterval = 1000; // 窗口列表更新间隔(ms) // }; // explicit ScreenWallWidget(QWidget* parent = nullptr); // ~ScreenWallWidget(); // void setConfig(const ScreenWallConfig& config); // void startScreenWall(); // void stopScreenWall(); // bool isRunning() const { return m_isRunning; } // public slots: // void refreshWindowList(); // void onWindowSelected(HWND hwnd); // void onDesktopClicked(); // signals: // void windowSelected(HWND hwnd, const QString& title); // void desktopSelected(); // protected: // void resizeEvent(QResizeEvent* event) override; // void showEvent(QShowEvent* event) override; // void hideEvent(QHideEvent* event) override; // private slots: // void updatePreviews(); // void onWindowStateChanged(); // private: // void setupUI(); // void setupConnections(); // void optimizePerformance(); // void cleanupResources(); // // UI组件 // QVBoxLayout* m_mainLayout; // DesktopPreviewWidget* m_desktopPreview; // WindowIconListWidget* m_windowList; // WindowPreviewWidget* m_windowPreview; // // 控制组件 // QTimer* m_updateTimer; // QTimer* m_performanceTimer; // // 配置和状态 // ScreenWallConfig m_config; // bool m_isRunning; // HWND m_selectedWindow; // int m_activeCaptureCount; // }; // /** // * 桌面预览组件 // * 显示整个桌面的实时预览 // */ // class DesktopPreviewWidget : public OpenGLVideoWidget // { // Q_OBJECT // public: // explicit DesktopPreviewWidget(QWidget* parent = nullptr); // ~DesktopPreviewWidget(); // void startDesktopCapture(int frameRate = 15); // void stopDesktopCapture(); // bool isCapturing() const { return m_isCapturing; } // protected: // void mousePressEvent(QMouseEvent* event) override; // void paintEvent(QPaintEvent* event) override; // signals: // void clicked(); // private slots: // void captureDesktop(); // private: // VideoRecorder m_desktopRecorder; // QTimer* m_captureTimer; // bool m_isCapturing; // int m_monitorIndex; // }; // /** // * 窗口图标列表组件 // * 显示所有可用窗口的图标和标题 // */ // class WindowIconListWidget : public QScrollArea // { // Q_OBJECT // public: // struct WindowInfo { // HWND hwnd; // QString title; // QString processName; // QIcon icon; // QPixmap thumbnail; // bool isMinimized; // bool isVisible; // RECT rect; // DWORD processId; // }; // explicit WindowIconListWidget(QWidget* parent = nullptr); // ~WindowIconListWidget(); // void refreshWindowList(); // void setThumbnailSize(const QSize& size); // QVector getWindowList() const { return m_windows; } // signals: // void windowSelected(HWND hwnd); // void windowDoubleClicked(HWND hwnd); // protected: // void resizeEvent(QResizeEvent* event) override; // bool eventFilter(QObject* obj, QEvent* event) override; // private slots: // void onWindowClicked() {} // void onWindowDoubleClicked() {} // private: // void setupLayout(); // void clearLayout(); // QWidget* createWindowIcon(const WindowInfo& info); // void updateLayout(); // QWidget* m_contentWidget; // QGridLayout* m_layout; // QVector m_windows; // QSize m_thumbnailSize; // int m_columnsCount; // }; // /** // * 窗口实时预览组件 // * 显示选中窗口的实时内容 // */ // class WindowPreviewWidget : public OpenGLVideoWidget // { // Q_OBJECT // public: // explicit WindowPreviewWidget(QWidget* parent = nullptr); // ~WindowPreviewWidget(); // void setTargetWindow(HWND hwnd); // void startPreview(int frameRate = 30); // void stopPreview(); // bool isPreviewActive() const { return m_isPreviewActive; } // // 最小化窗口支持 // void setLastFrame(const QPixmap& frame); // QPixmap getLastFrame() const { return m_lastFrame; } // protected: // void paintEvent(QPaintEvent* event) override; // private slots: // void captureWindow(); // void checkWindowState(); // private: // void handleMinimizedWindow(); // void handleRestoredWindow(); // VideoRecorder m_windowRecorder; // QTimer* m_captureTimer; // QTimer* m_stateTimer; // HWND m_targetHwnd; // bool m_isPreviewActive; // bool m_isWindowMinimized; // QPixmap m_lastFrame; // QString m_windowTitle; // }; // /** // * 增强的窗口查找器 // * 扩展现有WindowFinder功能,增加图标和缩略图获取 // */ // class EnhancedWindowFinder : public WindowFinder // { // public: // using ExtendedInfo = WindowIconListWidget::WindowInfo; // static QVector GetExtendedList(bool includeMinimized = true); // static QIcon GetWindowIcon(HWND hwnd); // static QPixmap GetWindowThumbnail(HWND hwnd, const QSize& size = QSize(200, 150)); // static bool IsWindowMinimized(HWND hwnd); // static QString GetProcessName(HWND hwnd); // static DWORD GetProcessId(HWND hwnd); // static RECT GetWindowRect(HWND hwnd); // private: // static QPixmap CaptureWindow(HWND hwnd, const QSize& size); // static HICON GetWindowIconHandle(HWND hwnd); // }; // /** // * 资源管理器 // * 管理捕获会话和内存使用 // */ // class ResourceManager // { // public: // static ResourceManager& instance(); // bool canStartCapture() const; // void addCaptureSession(HWND hwnd); // void removeCaptureSession(HWND hwnd); // void cacheThumbnail(HWND hwnd, const QPixmap& thumbnail); // QPixmap getCachedThumbnail(HWND hwnd) const; // void cleanup(); // private: // ResourceManager() = default; // static const int MAX_CONCURRENT_CAPTURES = 6; // static const int MAX_THUMBNAIL_CACHE = 50; // QSet m_activeSessions; // QCache m_thumbnailCache; // }; // #endif // SCREENWALL_WIDGET_H