替换 NIM 为独立 TTUI 引擎并完善窗口交互
移除 NIM 源码及主题依赖,加入 Win32、Direct2D、DirectWrite UI 静态库。迁移主页面、添加任务及外观设置,完善虚拟列表、统一窗口透明度和首次显示初始化。增加 Windows 7 API 回退与回归测试,在 AGENTS.md 记录后续控件体系和布局系统计划。
This commit is contained in:
1 parent
7c0ee5d964
commit
db38ec5c03
408 files changed
+1575
-55735
No files matched your search
@@ -1,102 +1,63 @@
|
||||
#pragma once
|
||||
|
||||
#include "aero_backdrop.h"
|
||||
#pragma once
|
||||
#include "ttui/window.h"
|
||||
#include "ttui/virtual_list.h"
|
||||
#include "download_engine.h"
|
||||
#include "skin_settings.h"
|
||||
|
||||
#include <shellapi.h>
|
||||
#include <memory>
|
||||
|
||||
#include <unordered_map>
|
||||
class SettingsForm;
|
||||
|
||||
class DownloaderForm : public ui::WindowImplBase
|
||||
{
|
||||
class AddTaskForm;
|
||||
class DownloaderForm final : public ttui::Window {
|
||||
public:
|
||||
DownloaderForm();
|
||||
~DownloaderForm();
|
||||
|
||||
virtual std::wstring GetSkinFolder() override;
|
||||
virtual std::wstring GetSkinFile() override;
|
||||
virtual std::wstring GetWindowClassName() const override;
|
||||
|
||||
virtual void InitWindow() override;
|
||||
virtual LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) override;
|
||||
virtual LRESULT OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) override;
|
||||
virtual LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) override;
|
||||
virtual LRESULT OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) override;
|
||||
|
||||
bool OnClicked(ui::EventArgs* args);
|
||||
bool OnReturn(ui::EventArgs* args);
|
||||
bool OnListItemSelect(ui::EventArgs* args);
|
||||
bool OnListItemDoubleClick(ui::EventArgs* args);
|
||||
|
||||
static const std::wstring kClassName;
|
||||
static constexpr UINT kTrayIconMessage = WM_APP + 1;
|
||||
static constexpr UINT kShowMainWindowMessage = WM_APP + 2;
|
||||
|
||||
DownloaderForm();
|
||||
~DownloaderForm() override;
|
||||
static const std::wstring kClassName;
|
||||
static constexpr UINT kTrayIconMessage=WM_APP+1;
|
||||
static constexpr UINT kShowMainWindowMessage=WM_APP+2;
|
||||
private:
|
||||
struct TaskRow
|
||||
{
|
||||
TaskInfo info;
|
||||
ui::ListContainerElement* item = nullptr;
|
||||
ui::Label* name = nullptr;
|
||||
ui::Label* status = nullptr;
|
||||
ui::Progress* progress = nullptr;
|
||||
ui::Label* speed = nullptr;
|
||||
};
|
||||
|
||||
void AddTask(const std::wstring& url);
|
||||
void PauseSelectedTask();
|
||||
void StartSelectedTask();
|
||||
void DeleteSelectedTask();
|
||||
void HandleEngineEvent(const EngineEvent& event);
|
||||
|
||||
void PrepareFileDrag(LPARAM lParam);
|
||||
int HitTestRow(const POINT& pt) const;
|
||||
void ShowTaskMenu(LPARAM lParam);
|
||||
void OpenSelectedLocation();
|
||||
|
||||
TaskRow CreateTaskRow(const TaskInfo& task);
|
||||
void UpdateRow(int index, double speed);
|
||||
void RemoveRow(int index);
|
||||
int FindRowIndex(int64_t id) const;
|
||||
|
||||
void UpdateSummary(const std::wstring& tip = std::wstring());
|
||||
void UpdateSelectedInfo();
|
||||
|
||||
void AddTrayIcon();
|
||||
void RemoveTrayIcon();
|
||||
void ShowTrayMenu();
|
||||
|
||||
void ShowTitleMenu();
|
||||
void ShowSettingsForm();
|
||||
void ApplySkinSettings();
|
||||
void LoadSkinSettings();
|
||||
void SaveSkinSettings();
|
||||
|
||||
NOTIFYICONDATAW tray_icon_ = {};
|
||||
UINT taskbar_created_message_ = 0;
|
||||
|
||||
ui::RichEdit* edit_url_ = nullptr;
|
||||
ui::RichEdit* edit_path_ = nullptr;
|
||||
ui::ListBox* task_list_ = nullptr;
|
||||
ui::Label* lbl_summary_ = nullptr;
|
||||
ui::Label* lbl_selected_ = nullptr;
|
||||
ui::Control* content_root_ = nullptr;
|
||||
ui::Control* panel_header_ = nullptr;
|
||||
ui::Control* panel_input_ = nullptr;
|
||||
ui::Control* panel_table_header_ = nullptr;
|
||||
ui::Control* panel_bottom_ = nullptr;
|
||||
|
||||
SkinSettings skin_;
|
||||
SettingsForm* settings_form_ = nullptr;
|
||||
bool aero_mode_ = false;
|
||||
AeroBackdrop aero_backdrop_;
|
||||
|
||||
std::vector<TaskRow> rows_;
|
||||
std::unique_ptr<DownloadEngine> engine_;
|
||||
|
||||
bool ole_initialized_ = false;
|
||||
bool drag_pending_ = false;
|
||||
POINT drag_origin_ = {};
|
||||
std::wstring drag_path_;
|
||||
struct TaskRow { TaskInfo info; double speed=0; };
|
||||
void OnCreate() override;
|
||||
void OnLayout() override;
|
||||
void OnPaint(ttui::Canvas&) override;
|
||||
void OnCommand(int) override;
|
||||
std::optional<LRESULT> OnMessage(UINT,WPARAM,LPARAM) override;
|
||||
void StopEngine();
|
||||
void ShowAddTaskForm();
|
||||
void PauseSelectedTask();
|
||||
void StartSelectedTask();
|
||||
void DeleteSelectedTask();
|
||||
void HandleEngineEvent(const EngineEvent&);
|
||||
void PrepareFileDrag(LPARAM);
|
||||
int HitTestRow(const POINT&) const;
|
||||
void ShowTaskMenu(LPARAM);
|
||||
void OpenSelectedLocation();
|
||||
void OpenSelectedFile();
|
||||
int FindRowIndex(int64_t) const;
|
||||
void UpdateSummary(const std::wstring& tip=L"");
|
||||
void UpdateSelectedInfo();
|
||||
void UpdateViewport();
|
||||
void AddTrayIcon();
|
||||
void RemoveTrayIcon();
|
||||
void ShowTrayMenu();
|
||||
void ShowSettingsForm();
|
||||
void ApplySkinSettings();
|
||||
void LoadSkinSettings();
|
||||
void SaveSkinSettings();
|
||||
NOTIFYICONDATAW tray_icon_{};
|
||||
UINT taskbar_created_message_=0;
|
||||
HWND scrollbar_=nullptr;
|
||||
ttui::Rect list_rect_{};
|
||||
ttui::VirtualList list_;
|
||||
SkinSettings skin_;
|
||||
std::unique_ptr<SettingsForm> settings_form_;
|
||||
std::unique_ptr<AddTaskForm> add_task_form_;
|
||||
std::wstring summary_, selected_text_;
|
||||
std::vector<TaskRow> rows_;
|
||||
std::unordered_map<int64_t,int> indices_;
|
||||
std::unique_ptr<DownloadEngine> engine_;
|
||||
bool engine_failed_=false;
|
||||
bool drag_pending_=false;
|
||||
POINT drag_origin_{};
|
||||
std::wstring drag_path_;
|
||||
};
|
||||
Reference in new issue
Block a user