Files
gxde-ai-see/src/ui/portalpanel.h
T
shenmo7192 3a73a8c5d1 feat(factory): 内容工厂与链接处理
- 第三栏内容工厂:按拖入类型展示动作,动作按钮本身可接收 drop
- 链接分类:http(s) 按扩展名判定图片/音视频/文档/压缩包/网页
- http 链接动作:打开、下载、另存为、复制、Markdown、复制文件名、待办、问小埃
- 非标准 scheme:尝试打开、复制;thunder 解析 base64 真实地址,magnet 解析 dn
- 文字动作:ICU 分词、正则提取链接、朗读(spd-say)、复制、待办
- 文件/图片动作:打开、提取文字(占位)、生成描述、保存图片、复制路径、待办
- Downloader:异步下载到 XDG 下载目录 / 另存为,面板 toast 提示
- TodoModel:持久化到 todo.json,供「添加到待办」使用
- 无头自测 gxde-ai-see-selftest:链接分类/分词/提取链接/动作匹配
- 合成器 portal 自测脚本 tests/portal(虚拟指针 + GTK 源/目标)
2026-10-30 20:09:01 +08:00

68 lines
1.8 KiB
C++

// SPDX-FileCopyrightText: 2026 GXDE OS Team
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <DBlurEffectWidget>
#include <QWidget>
class ContentFactory;
class QLabel;
class QMimeData;
class QPushButton;
class QTimer;
struct DropContent;
class PortalZone;
class StagingModel;
class StagingView;
/**
* The floating staging panel (传送门 + 暂存区).
*
* On Wayland this is a layer-shell overlay surface so that it does not appear
* in the dock, does not steal keyboard focus and can be positioned exactly.
* On X11 it falls back to a frameless tool window placed bottom-right.
*/
class PortalPanel : public Dtk::Widget::DBlurEffectWidget
{
Q_OBJECT
public:
explicit PortalPanel(StagingModel *model, QWidget *parent = nullptr);
~PortalPanel() override;
void refreshLayout();
void popup();
void dismiss();
signals:
void openChatRequested();
protected:
void showEvent(QShowEvent *event) override;
private:
void setupUi();
void setupWindow();
void updateGeometryForContent();
void updateSelectionBar();
void noteDragContent(const QMimeData *mime);
void noteDragFinished();
void runFactoryAction(const QString &id, const DropContent &content);
void showTextDialog(const QString &title, const QString &text);
void toast(const QString &text);
StagingModel *m_model = nullptr;
StagingView *m_view = nullptr;
PortalZone *m_zone = nullptr;
QWidget *m_header = nullptr;
QWidget *m_selectionBar = nullptr;
ContentFactory *m_factory = nullptr;
QLabel *m_toast = nullptr;
QTimer *m_factoryTimer = nullptr;
QLabel *m_countLabel = nullptr;
QPushButton *m_selectAllButton = nullptr;
QPushButton *m_invertButton = nullptr;
QPushButton *m_deleteButton = nullptr;
};