screenwall_widget.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. // #ifndef SCREENWALL_WIDGET_H
  2. // #define SCREENWALL_WIDGET_H
  3. // #include <QWidget>
  4. // #include <QVBoxLayout>
  5. // #include <QHBoxLayout>
  6. // #include <QGridLayout>
  7. // #include <QScrollArea>
  8. // #include <QLabel>
  9. // #include <QPushButton>
  10. // #include <QTimer>
  11. // #include <QPixmap>
  12. // #include <QIcon>
  13. // #include <QCache>
  14. // #include <QMap>
  15. // #include <QVector>
  16. // #include <Windows.h>
  17. // #include "../AvRecorder/ui/opengl_video_widget.h"
  18. // #include "../AvRecorder/recorder/video_recorder.h"
  19. // #include "../AvRecorder/capturer/finder.h"
  20. // class DesktopPreviewWidget;
  21. // class WindowIconListWidget;
  22. // class WindowPreviewWidget;
  23. // class EnhancedWindowFinder;
  24. // /**
  25. // * 屏幕墙主组件
  26. // * 提供桌面预览、窗口列表和实时窗口预览功能
  27. // */
  28. // class ScreenWallWidget : public QWidget
  29. // {
  30. // Q_OBJECT
  31. // public:
  32. // struct ScreenWallConfig {
  33. // int desktopFrameRate = 15; // 桌面预览帧率
  34. // int windowFrameRate = 30; // 窗口预览帧率
  35. // QSize thumbnailSize = QSize(200, 150); // 缩略图尺寸
  36. // int maxConcurrentCaptures = 6; // 最大同时捕获数
  37. // bool enableMinimizedPreview = true; // 启用最小化窗口预览
  38. // int updateInterval = 1000; // 窗口列表更新间隔(ms)
  39. // };
  40. // explicit ScreenWallWidget(QWidget* parent = nullptr);
  41. // ~ScreenWallWidget();
  42. // void setConfig(const ScreenWallConfig& config);
  43. // void startScreenWall();
  44. // void stopScreenWall();
  45. // bool isRunning() const { return m_isRunning; }
  46. // public slots:
  47. // void refreshWindowList();
  48. // void onWindowSelected(HWND hwnd);
  49. // void onDesktopClicked();
  50. // signals:
  51. // void windowSelected(HWND hwnd, const QString& title);
  52. // void desktopSelected();
  53. // protected:
  54. // void resizeEvent(QResizeEvent* event) override;
  55. // void showEvent(QShowEvent* event) override;
  56. // void hideEvent(QHideEvent* event) override;
  57. // private slots:
  58. // void updatePreviews();
  59. // void onWindowStateChanged();
  60. // private:
  61. // void setupUI();
  62. // void setupConnections();
  63. // void optimizePerformance();
  64. // void cleanupResources();
  65. // // UI组件
  66. // QVBoxLayout* m_mainLayout;
  67. // DesktopPreviewWidget* m_desktopPreview;
  68. // WindowIconListWidget* m_windowList;
  69. // WindowPreviewWidget* m_windowPreview;
  70. // // 控制组件
  71. // QTimer* m_updateTimer;
  72. // QTimer* m_performanceTimer;
  73. // // 配置和状态
  74. // ScreenWallConfig m_config;
  75. // bool m_isRunning;
  76. // HWND m_selectedWindow;
  77. // int m_activeCaptureCount;
  78. // };
  79. // /**
  80. // * 桌面预览组件
  81. // * 显示整个桌面的实时预览
  82. // */
  83. // class DesktopPreviewWidget : public OpenGLVideoWidget
  84. // {
  85. // Q_OBJECT
  86. // public:
  87. // explicit DesktopPreviewWidget(QWidget* parent = nullptr);
  88. // ~DesktopPreviewWidget();
  89. // void startDesktopCapture(int frameRate = 15);
  90. // void stopDesktopCapture();
  91. // bool isCapturing() const { return m_isCapturing; }
  92. // protected:
  93. // void mousePressEvent(QMouseEvent* event) override;
  94. // void paintEvent(QPaintEvent* event) override;
  95. // signals:
  96. // void clicked();
  97. // private slots:
  98. // void captureDesktop();
  99. // private:
  100. // VideoRecorder m_desktopRecorder;
  101. // QTimer* m_captureTimer;
  102. // bool m_isCapturing;
  103. // int m_monitorIndex;
  104. // };
  105. // /**
  106. // * 窗口图标列表组件
  107. // * 显示所有可用窗口的图标和标题
  108. // */
  109. // class WindowIconListWidget : public QScrollArea
  110. // {
  111. // Q_OBJECT
  112. // public:
  113. // struct WindowInfo {
  114. // HWND hwnd;
  115. // QString title;
  116. // QString processName;
  117. // QIcon icon;
  118. // QPixmap thumbnail;
  119. // bool isMinimized;
  120. // bool isVisible;
  121. // RECT rect;
  122. // DWORD processId;
  123. // };
  124. // explicit WindowIconListWidget(QWidget* parent = nullptr);
  125. // ~WindowIconListWidget();
  126. // void refreshWindowList();
  127. // void setThumbnailSize(const QSize& size);
  128. // QVector<WindowInfo> getWindowList() const { return m_windows; }
  129. // signals:
  130. // void windowSelected(HWND hwnd);
  131. // void windowDoubleClicked(HWND hwnd);
  132. // protected:
  133. // void resizeEvent(QResizeEvent* event) override;
  134. // bool eventFilter(QObject* obj, QEvent* event) override;
  135. // private slots:
  136. // void onWindowClicked() {}
  137. // void onWindowDoubleClicked() {}
  138. // private:
  139. // void setupLayout();
  140. // void clearLayout();
  141. // QWidget* createWindowIcon(const WindowInfo& info);
  142. // void updateLayout();
  143. // QWidget* m_contentWidget;
  144. // QGridLayout* m_layout;
  145. // QVector<WindowInfo> m_windows;
  146. // QSize m_thumbnailSize;
  147. // int m_columnsCount;
  148. // };
  149. // /**
  150. // * 窗口实时预览组件
  151. // * 显示选中窗口的实时内容
  152. // */
  153. // class WindowPreviewWidget : public OpenGLVideoWidget
  154. // {
  155. // Q_OBJECT
  156. // public:
  157. // explicit WindowPreviewWidget(QWidget* parent = nullptr);
  158. // ~WindowPreviewWidget();
  159. // void setTargetWindow(HWND hwnd);
  160. // void startPreview(int frameRate = 30);
  161. // void stopPreview();
  162. // bool isPreviewActive() const { return m_isPreviewActive; }
  163. // // 最小化窗口支持
  164. // void setLastFrame(const QPixmap& frame);
  165. // QPixmap getLastFrame() const { return m_lastFrame; }
  166. // protected:
  167. // void paintEvent(QPaintEvent* event) override;
  168. // private slots:
  169. // void captureWindow();
  170. // void checkWindowState();
  171. // private:
  172. // void handleMinimizedWindow();
  173. // void handleRestoredWindow();
  174. // VideoRecorder m_windowRecorder;
  175. // QTimer* m_captureTimer;
  176. // QTimer* m_stateTimer;
  177. // HWND m_targetHwnd;
  178. // bool m_isPreviewActive;
  179. // bool m_isWindowMinimized;
  180. // QPixmap m_lastFrame;
  181. // QString m_windowTitle;
  182. // };
  183. // /**
  184. // * 增强的窗口查找器
  185. // * 扩展现有WindowFinder功能,增加图标和缩略图获取
  186. // */
  187. // class EnhancedWindowFinder : public WindowFinder
  188. // {
  189. // public:
  190. // using ExtendedInfo = WindowIconListWidget::WindowInfo;
  191. // static QVector<ExtendedInfo> GetExtendedList(bool includeMinimized = true);
  192. // static QIcon GetWindowIcon(HWND hwnd);
  193. // static QPixmap GetWindowThumbnail(HWND hwnd, const QSize& size = QSize(200, 150));
  194. // static bool IsWindowMinimized(HWND hwnd);
  195. // static QString GetProcessName(HWND hwnd);
  196. // static DWORD GetProcessId(HWND hwnd);
  197. // static RECT GetWindowRect(HWND hwnd);
  198. // private:
  199. // static QPixmap CaptureWindow(HWND hwnd, const QSize& size);
  200. // static HICON GetWindowIconHandle(HWND hwnd);
  201. // };
  202. // /**
  203. // * 资源管理器
  204. // * 管理捕获会话和内存使用
  205. // */
  206. // class ResourceManager
  207. // {
  208. // public:
  209. // static ResourceManager& instance();
  210. // bool canStartCapture() const;
  211. // void addCaptureSession(HWND hwnd);
  212. // void removeCaptureSession(HWND hwnd);
  213. // void cacheThumbnail(HWND hwnd, const QPixmap& thumbnail);
  214. // QPixmap getCachedThumbnail(HWND hwnd) const;
  215. // void cleanup();
  216. // private:
  217. // ResourceManager() = default;
  218. // static const int MAX_CONCURRENT_CAPTURES = 6;
  219. // static const int MAX_THUMBNAIL_CACHE = 50;
  220. // QSet<HWND> m_activeSessions;
  221. // QCache<HWND, QPixmap> m_thumbnailCache;
  222. // };
  223. // #endif // SCREENWALL_WIDGET_H