// #pragma once // #include // #include // #include // #include // #include // #include // #include // #include // #include // #include // #include // #include // #include // #include // #include // #include // #include // #include // #include // #include // #include // #ifdef _WIN32 // #include // #include // #include // #include // #pragma comment(lib, "dwmapi.lib") // #pragma comment(lib, "shell32.lib") // #pragma comment(lib, "psapi.lib") // #pragma comment(lib, "user32.lib") // #pragma comment(lib, "gdi32.lib") // #endif // /** // * 简化版屏幕墙实现 // * 不依赖AvRecorder,使用Windows API直接捕获 // * 适用于快速原型和独立部署 // */ // // 简化的窗口信息结构 // struct SimpleWindowInfo { // HWND hwnd = nullptr; // QString title; // QString processName; // QIcon icon; // QPixmap thumbnail; // QRect geometry; // bool isMinimized = false; // bool isVisible = true; // DWORD processId = 0; // }; // // 简化的配置结构 // struct SimpleScreenWallConfig { // int desktopUpdateInterval = 1000; // 桌面更新间隔(ms) // int windowUpdateInterval = 2000; // 窗口列表更新间隔(ms) // int previewUpdateInterval = 500; // 窗口预览更新间隔(ms) // QSize thumbnailSize = QSize(120, 90); // 缩略图尺寸 // QSize desktopPreviewSize = QSize(320, 240); // 桌面预览尺寸 // int maxCachedThumbnails = 50; // 最大缓存缩略图数量 // bool enableDesktopPreview = true; // 启用桌面预览 // bool enableWindowPreview = true; // 启用窗口预览 // bool showMinimizedWindows = true; // 显示最小化窗口 // }; // /** // * 简化的窗口查找器 // */ // class SimpleWindowFinder { // public: // static QVector getWindowList(bool includeMinimized = true); // static QPixmap captureWindow(HWND hwnd, const QSize& size = QSize()); // static QPixmap captureDesktop(const QSize& size = QSize()); // static QIcon getWindowIcon(HWND hwnd); // static QString getWindowTitle(HWND hwnd); // static QString getProcessName(HWND hwnd); // static bool isValidWindow(HWND hwnd); // private: // static BOOL CALLBACK enumWindowsProc(HWND hwnd, LPARAM lParam); // // 多种窗口捕获方法 // static QPixmap captureDWMThumbnail(HWND hwnd, int width, int height); // static QPixmap capturePrintWindow(HWND hwnd, int width, int height); // static QPixmap captureScreenshot(HWND hwnd, const RECT& rect); // static QPixmap convertBitmapToPixmap(HBITMAP hBitmap, int width, int height); // }; // /** // * 简化的桌面预览组件 // */ // class SimpleDesktopPreview : public QLabel { // Q_OBJECT // public: // explicit SimpleDesktopPreview(QWidget* parent = nullptr); // ~SimpleDesktopPreview(); // void startPreview(); // void stopPreview(); // void setUpdateInterval(int ms); // signals: // void clicked(); // protected: // void mousePressEvent(QMouseEvent* event) override; // void paintEvent(QPaintEvent* event) override; // private slots: // void updateDesktop(); // private: // QTimer* m_updateTimer; // QSize m_previewSize; // bool m_isActive; // }; // /** // * 简化的窗口图标列表组件 // */ // class SimpleWindowList : public QScrollArea { // Q_OBJECT // public: // explicit SimpleWindowList(QWidget* parent = nullptr); // ~SimpleWindowList(); // void setThumbnailSize(const QSize& size); // void setShowMinimized(bool show); // void refreshWindowList(); // signals: // void windowSelected(HWND hwnd, const QString& title); // void windowDoubleClicked(HWND hwnd); // void desktopClicked(); // protected: // void resizeEvent(QResizeEvent* event) override; // bool eventFilter(QObject* obj, QEvent* event) override; // private: // void updateLayout(); // QWidget* createWindowItem(const SimpleWindowInfo& info); // QWidget* createDesktopPreviewItem(); // void clearLayout(); // private: // QWidget* m_contentWidget; // QGridLayout* m_layout; // QVector m_windows; // QSize m_thumbnailSize; // bool m_showMinimized; // int m_columnsCount; // }; // /** // * 简化的窗口预览组件 // */ // class SimpleWindowPreview : public QLabel { // Q_OBJECT // public: // explicit SimpleWindowPreview(QWidget* parent = nullptr); // ~SimpleWindowPreview(); // void setTargetWindow(HWND hwnd, const QString& title = QString()); // void startPreview(); // void stopPreview(); // void setUpdateInterval(int ms); // protected: // void paintEvent(QPaintEvent* event) override; // private slots: // void updatePreview(); // void checkWindowState(); // private: // QTimer* m_updateTimer; // QTimer* m_stateTimer; // HWND m_targetHwnd; // QString m_windowTitle; // QPixmap m_lastFrame; // bool m_isActive; // bool m_isWindowMinimized; // }; // /** // * 简化的屏幕墙主组件 // */ // class SimpleScreenWall : public QWidget { // Q_OBJECT // public: // explicit SimpleScreenWall(QWidget* parent = nullptr); // ~SimpleScreenWall(); // void setConfig(const SimpleScreenWallConfig& config); // const SimpleScreenWallConfig& config() const { return m_config; } // public slots: // void startScreenWall(); // void stopScreenWall(); // bool isRunning() const { return m_isRunning; } // void refreshWindowList(); // signals: // void windowSelected(HWND hwnd, const QString& title); // void desktopSelected(); // void started(); // void stopped(); // protected: // void showEvent(QShowEvent* event) override; // void hideEvent(QHideEvent* event) override; // void resizeEvent(QResizeEvent* event) override; // private slots: // void onWindowSelected(HWND hwnd, const QString& title); // void onDesktopClicked(); // void onWindowDoubleClicked(HWND hwnd); // private: // void setupUI(); // void setupConnections(); // void updateLayout(); // private: // // UI组件 // QVBoxLayout* m_mainLayout; // SimpleDesktopPreview* m_desktopPreview; // SimpleWindowList* m_windowList; // // 配置和状态 // SimpleScreenWallConfig m_config; // bool m_isRunning; // HWND m_selectedWindow; // // 定时器 // QTimer* m_refreshTimer; // }; // /** // * 简化的屏幕墙主窗口 // */ // class SimpleScreenWallWindow : public QWidget { // Q_OBJECT // public: // explicit SimpleScreenWallWindow(QWidget* parent = nullptr); // ~SimpleScreenWallWindow(); // protected: // void closeEvent(QCloseEvent* event) override; // private slots: // void startScreenWall(); // void stopScreenWall(); // void refreshWindows(); // void showSettings(); // void showAbout(); // void onWindowSelected(HWND hwnd, const QString& title); // void onDesktopSelected(); // void onScreenWallStarted(); // void onScreenWallStopped(); // private: // void setupUI(); // void setupConnections(); // void updateControlButtons(); // private: // // UI组件 // QVBoxLayout* m_mainLayout; // QWidget* m_controlPanel; // QHBoxLayout* m_controlLayout; // QPushButton* m_startButton; // QPushButton* m_stopButton; // QPushButton* m_refreshButton; // QPushButton* m_settingsButton; // QLabel* m_statusLabel; // SimpleScreenWall* m_screenWall; // }; // /** // * 缓存管理器 // */ // class SimpleCacheManager { // public: // static SimpleCacheManager& instance(); // void cacheThumbnail(HWND hwnd, const QPixmap& thumbnail); // QPixmap getCachedThumbnail(HWND hwnd) const; // void cacheIcon(HWND hwnd, const QIcon& icon); // QIcon getCachedIcon(HWND hwnd) const; // void clearCache(); // void setMaxCacheSize(int size); // private: // SimpleCacheManager() = default; // private: // QCache m_thumbnailCache; // QCache m_iconCache; // }; // /** // * 工具函数 // */ // namespace SimpleScreenWallUtils { // // 窗口操作 // bool activateWindow(HWND hwnd); // bool minimizeWindow(HWND hwnd); // bool restoreWindow(HWND hwnd); // bool closeWindow(HWND hwnd); // // 图像处理 // QPixmap scalePixmap(const QPixmap& pixmap, const QSize& size, Qt::AspectRatioMode mode = Qt::KeepAspectRatio); // QPixmap addBorder(const QPixmap& pixmap, int borderWidth, const QColor& color); // QPixmap addShadow(const QPixmap& pixmap, int shadowSize, const QColor& color); // // 系统信息 // QString getSystemInfo(); // QStringList getRunningProcesses(); // int getSystemMemoryUsage(); // int getCpuUsage(); // // 配置管理 // void saveConfig(const SimpleScreenWallConfig& config, const QString& filePath = QString()); // SimpleScreenWallConfig loadConfig(const QString& filePath = QString()); // } // // 内联实现一些简单函数 // inline bool SimpleScreenWallUtils::activateWindow(HWND hwnd) { // #ifdef _WIN32 // return SetForegroundWindow(hwnd) && ShowWindow(hwnd, SW_RESTORE); // #else // Q_UNUSED(hwnd) // return false; // #endif // } // inline bool SimpleScreenWallUtils::minimizeWindow(HWND hwnd) { // #ifdef _WIN32 // return ShowWindow(hwnd, SW_MINIMIZE); // #else // Q_UNUSED(hwnd) // return false; // #endif // } // inline bool SimpleScreenWallUtils::restoreWindow(HWND hwnd) { // #ifdef _WIN32 // return ShowWindow(hwnd, SW_RESTORE); // #else // Q_UNUSED(hwnd) // return false; // #endif // } // inline bool SimpleScreenWallUtils::closeWindow(HWND hwnd) { // #ifdef _WIN32 // return PostMessage(hwnd, WM_CLOSE, 0, 0); // #else // Q_UNUSED(hwnd) // return false; // #endif // }