替换 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,48 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Window shadowattached="false" size="900,600" mininfo="700,480" caption="0,0,0,36" sizebox="4,4,4,4">
|
||||
<VBox name="content_root" bkcolor="bk_wnd_darkcolor">
|
||||
<!-- 标题栏 -->
|
||||
<HBox name="panel_header" width="stretch" height="36" bkcolor="bk_wnd_lightcolor">
|
||||
<Label text="TTDownloader" font="system_bold_14" normaltextcolor="darkcolor" valign="center" margin="12,0,0,0"/>
|
||||
<Control />
|
||||
<Button class="btn_wnd_settings" name="btn_menu" margin="4,8,4,8"/>
|
||||
<Button class="btn_wnd_min" name="minbtn" margin="4,6,0,0"/>
|
||||
<Button class="btn_wnd_close" name="closebtn" margin="4,6,8,0"/>
|
||||
</HBox>
|
||||
|
||||
<!-- 新建任务 -->
|
||||
<VBox name="panel_input" height="auto" margin="12,12,12,0" padding="12,12,12,12" bkcolor="bk_wnd_lightcolor">
|
||||
<HBox height="30">
|
||||
<Label text="下载链接" width="64" font="system_12" normaltextcolor="lightcolor" valign="center"/>
|
||||
<RichEdit class="simple prompt" name="edit_url" width="stretch" height="auto" margin="8,0,8,0" valign="center" font="system_12" prompttext="粘贴一个 HTTP/HTTPS 下载地址" bkcolor="tt_edit_bg"/>
|
||||
<Button class="btn_global_blue_80x30" name="btn_add" text="添加任务" width="96" height="30" font="system_bold_14"/>
|
||||
</HBox>
|
||||
<HBox height="30" margin="0,10,0,0">
|
||||
<Label text="保存到" width="64" font="system_12" normaltextcolor="lightcolor" valign="center"/>
|
||||
<RichEdit class="simple prompt" name="edit_path" width="stretch" height="auto" margin="8,0,0,0" valign="center" font="system_12" prompttext="选择保存目录" bkcolor="tt_edit_bg"/>
|
||||
</HBox>
|
||||
</VBox>
|
||||
|
||||
<!-- 列表表头 -->
|
||||
<HBox name="panel_table_header" height="30" margin="12,12,12,0" bkcolor="bk_wnd_lightcolor">
|
||||
<Label text="任务" width="stretch" margin="12,0,0,0" font="system_bold_12" normaltextcolor="lightcolor" valign="center"/>
|
||||
<Label text="进度" width="200" font="system_bold_12" normaltextcolor="lightcolor" valign="center"/>
|
||||
<Label text="速度" width="96" margin="0,0,12,0" halign="right" font="system_bold_12" normaltextcolor="lightcolor" valign="center"/>
|
||||
</HBox>
|
||||
<Control class="splitline_hor_level1"/>
|
||||
|
||||
<!-- 任务列表 -->
|
||||
<VListBox class="list" name="task_list" height="stretch" padding="0,2,0,2"/>
|
||||
|
||||
<!-- 底部操作与状态 -->
|
||||
<HBox name="panel_bottom" height="44" margin="12,8,12,12" bkcolor="bk_wnd_lightcolor">
|
||||
<Button class="btn_global_white_80x30" name="btn_start" text="开始" width="80" height="30" valign="center" margin="12,0,0,0" font="system_14"/>
|
||||
<Button class="btn_global_white_80x30" name="btn_pause" text="暂停" width="80" height="30" valign="center" margin="8,0,0,0" font="system_14"/>
|
||||
<Button class="btn_global_white_80x30" name="btn_delete" text="删除选中" width="96" height="30" valign="center" margin="8,0,0,0" font="system_14"/>
|
||||
<Button class="btn_global_white_80x30" name="btn_settings" text="设置" width="80" height="30" valign="center" margin="8,0,0,0" font="system_14"/>
|
||||
<Label name="lbl_summary" text="共 0 个任务" width="auto" height="auto" margin="16,0,0,0" valign="center" font="system_12" normaltextcolor="lightcolor"/>
|
||||
<Control />
|
||||
<Label name="lbl_selected" text="" width="auto" height="auto" margin="0,0,12,0" valign="center" font="system_12" normaltextcolor="lightcolor"/>
|
||||
</HBox>
|
||||
</VBox>
|
||||
</Window>
|
||||
@@ -1,48 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Window shadowattached="false" size="900,600" mininfo="700,480" caption="0,0,0,36" sizebox="4,4,4,4">
|
||||
<VBox name="content_root">
|
||||
<!-- 标题栏 -->
|
||||
<HBox name="panel_header" width="stretch" height="36" bkcolor="tt_panel_default">
|
||||
<Label text="TTDownloader" font="system_bold_14" normaltextcolor="darkcolor" valign="center" margin="12,0,0,0"/>
|
||||
<Control />
|
||||
<Button class="btn_wnd_settings" name="btn_menu" margin="4,8,4,8"/>
|
||||
<Button class="btn_wnd_min" name="minbtn" margin="4,6,0,0"/>
|
||||
<Button class="btn_wnd_close" name="closebtn" margin="4,6,8,0"/>
|
||||
</HBox>
|
||||
|
||||
<!-- 新建任务 -->
|
||||
<VBox name="panel_input" height="auto" margin="12,12,12,0" padding="12,12,12,12" bkcolor="tt_panel_default">
|
||||
<HBox height="30">
|
||||
<Label text="下载链接" width="64" font="system_12" normaltextcolor="lightcolor" valign="center"/>
|
||||
<RichEdit class="simple prompt" name="edit_url" width="stretch" height="auto" margin="8,0,8,0" valign="center" font="system_12" prompttext="粘贴一个 HTTP/HTTPS 下载地址" bkcolor="tt_edit_bg"/>
|
||||
<Button class="btn_global_blue_80x30" name="btn_add" text="添加任务" width="96" height="30" font="system_bold_14"/>
|
||||
</HBox>
|
||||
<HBox height="30" margin="0,10,0,0">
|
||||
<Label text="保存到" width="64" font="system_12" normaltextcolor="lightcolor" valign="center"/>
|
||||
<RichEdit class="simple prompt" name="edit_path" width="stretch" height="auto" margin="8,0,0,0" valign="center" font="system_12" prompttext="选择保存目录" bkcolor="tt_edit_bg"/>
|
||||
</HBox>
|
||||
</VBox>
|
||||
|
||||
<!-- 列表表头 -->
|
||||
<HBox name="panel_table_header" height="30" margin="12,12,12,0" bkcolor="tt_panel_default">
|
||||
<Label text="任务" width="stretch" margin="12,0,0,0" font="system_bold_12" normaltextcolor="lightcolor" valign="center"/>
|
||||
<Label text="进度" width="200" font="system_bold_12" normaltextcolor="lightcolor" valign="center"/>
|
||||
<Label text="速度" width="96" margin="0,0,12,0" halign="right" font="system_bold_12" normaltextcolor="lightcolor" valign="center"/>
|
||||
</HBox>
|
||||
<Control class="splitline_hor_level1"/>
|
||||
|
||||
<!-- 任务列表 -->
|
||||
<VListBox class="list" name="task_list" height="stretch" padding="0,2,0,2" bkcolor="tt_panel_default"/>
|
||||
|
||||
<!-- 底部操作与状态 -->
|
||||
<HBox name="panel_bottom" height="44" margin="12,8,12,12" bkcolor="tt_panel_default">
|
||||
<Button class="btn_global_white_80x30" name="btn_start" text="开始" width="80" height="30" valign="center" margin="12,0,0,0" font="system_14"/>
|
||||
<Button class="btn_global_white_80x30" name="btn_pause" text="暂停" width="80" height="30" valign="center" margin="8,0,0,0" font="system_14"/>
|
||||
<Button class="btn_global_white_80x30" name="btn_delete" text="删除选中" width="96" height="30" valign="center" margin="8,0,0,0" font="system_14"/>
|
||||
<Button class="btn_global_white_80x30" name="btn_settings" text="设置" width="80" height="30" valign="center" margin="8,0,0,0" font="system_14"/>
|
||||
<Label name="lbl_summary" text="共 0 个任务" width="auto" height="auto" margin="16,0,0,0" valign="center" font="system_12" normaltextcolor="lightcolor"/>
|
||||
<Control />
|
||||
<Label name="lbl_selected" text="" width="auto" height="auto" margin="0,0,12,0" valign="center" font="system_12" normaltextcolor="lightcolor"/>
|
||||
</HBox>
|
||||
</VBox>
|
||||
</Window>
|
||||
@@ -1,56 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Window size="460,404" mininfo="460,404" caption="0,0,0,36" sizebox="4,4,4,4">
|
||||
<VBox bkcolor="bk_wnd_darkcolor">
|
||||
<!-- 标题栏 -->
|
||||
<HBox name="panel_header" width="stretch" height="36" bkcolor="bk_wnd_lightcolor">
|
||||
<Label text="设置" font="system_bold_14" normaltextcolor="darkcolor" valign="center" margin="12,0,0,0"/>
|
||||
<Control />
|
||||
<Button class="btn_wnd_close" name="closebtn" margin="4,6,8,0"/>
|
||||
</HBox>
|
||||
|
||||
<!-- 背景图片 -->
|
||||
<VBox margin="16,12,16,0" padding="16,12,16,14" height="auto" bkcolor="bk_wnd_lightcolor">
|
||||
<Label text="背景图片" font="system_bold_12" normaltextcolor="darkcolor" height="auto"/>
|
||||
<HBox height="30" margin="0,8,0,0">
|
||||
<Label name="lbl_background" width="stretch" height="auto" valign="center" font="system_12" normaltextcolor="lightcolor" endellipsis="true" text="未设置"/>
|
||||
<Button class="btn_global_white_80x30" name="btn_pick_bg" text="选择图片" width="80" height="30" font="system_12"/>
|
||||
<Button class="btn_global_white_80x30" name="btn_clear_bg" text="清除" width="64" height="30" margin="8,0,0,0" font="system_12"/>
|
||||
</HBox>
|
||||
</VBox>
|
||||
|
||||
<!-- 透明度 -->
|
||||
<VBox margin="16,12,16,16" padding="16,12,16,12" bkcolor="bk_wnd_lightcolor" height="stretch">
|
||||
<Label text="透明度" font="system_bold_12" normaltextcolor="darkcolor" height="auto"/>
|
||||
|
||||
<HBox height="36" margin="0,10,0,0">
|
||||
<Label text="窗口底板" width="96" valign="center" font="system_12" normaltextcolor="darkcolor"/>
|
||||
<Slider name="slider_window" width="stretch" height="18" margin="8,0,8,0" valign="center" min="0" max="100" step="5" thumbsize="14,14" progressbarpadding="0,8,0,8" bkimage="file='../public/slider/slider_hor_bk.png' dest='0,8,1000,10'" progresscolor="bk_progress_progress" thumbnormalimage="../public/slider/slider_thumb.png"/>
|
||||
<Label name="lbl_window" width="52" halign="right" valign="center" font="system_12" normaltextcolor="lightcolor" text="100%"/>
|
||||
</HBox>
|
||||
|
||||
<HBox height="36">
|
||||
<Label text="标题栏" width="96" valign="center" font="system_12" normaltextcolor="darkcolor"/>
|
||||
<Slider name="slider_header" width="stretch" height="18" margin="8,0,8,0" valign="center" min="0" max="100" step="5" thumbsize="14,14" progressbarpadding="0,8,0,8" bkimage="file='../public/slider/slider_hor_bk.png' dest='0,8,1000,10'" progresscolor="bk_progress_progress" thumbnormalimage="../public/slider/slider_thumb.png"/>
|
||||
<Label name="lbl_header" width="52" halign="right" valign="center" font="system_12" normaltextcolor="lightcolor" text="100%"/>
|
||||
</HBox>
|
||||
|
||||
<HBox height="36">
|
||||
<Label text="新建任务" width="96" valign="center" font="system_12" normaltextcolor="darkcolor"/>
|
||||
<Slider name="slider_input" width="stretch" height="18" margin="8,0,8,0" valign="center" min="0" max="100" step="5" thumbsize="14,14" progressbarpadding="0,8,0,8" bkimage="file='../public/slider/slider_hor_bk.png' dest='0,8,1000,10'" progresscolor="bk_progress_progress" thumbnormalimage="../public/slider/slider_thumb.png"/>
|
||||
<Label name="lbl_input" width="52" halign="right" valign="center" font="system_12" normaltextcolor="lightcolor" text="100%"/>
|
||||
</HBox>
|
||||
|
||||
<HBox height="36">
|
||||
<Label text="任务列表" width="96" valign="center" font="system_12" normaltextcolor="darkcolor"/>
|
||||
<Slider name="slider_list" width="stretch" height="18" margin="8,0,8,0" valign="center" min="0" max="100" step="5" thumbsize="14,14" progressbarpadding="0,8,0,8" bkimage="file='../public/slider/slider_hor_bk.png' dest='0,8,1000,10'" progresscolor="bk_progress_progress" thumbnormalimage="../public/slider/slider_thumb.png"/>
|
||||
<Label name="lbl_list" width="52" halign="right" valign="center" font="system_12" normaltextcolor="lightcolor" text="100%"/>
|
||||
</HBox>
|
||||
|
||||
<HBox height="36">
|
||||
<Label text="底部操作栏" width="96" valign="center" font="system_12" normaltextcolor="darkcolor"/>
|
||||
<Slider name="slider_bottom" width="stretch" height="18" margin="8,0,8,0" valign="center" min="0" max="100" step="5" thumbsize="14,14" progressbarpadding="0,8,0,8" bkimage="file='../public/slider/slider_hor_bk.png' dest='0,8,1000,10'" progresscolor="bk_progress_progress" thumbnormalimage="../public/slider/slider_thumb.png"/>
|
||||
<Label name="lbl_bottom" width="52" halign="right" valign="center" font="system_12" normaltextcolor="lightcolor" text="100%"/>
|
||||
</HBox>
|
||||
</VBox>
|
||||
</VBox>
|
||||
</Window>
|
||||
@@ -0,0 +1,84 @@
|
||||
#include "stdafx.h"
|
||||
#include "add_task_form.h"
|
||||
#include <shlobj.h>
|
||||
#include <cwctype>
|
||||
#include <utility>
|
||||
namespace {
|
||||
enum { kUrl=100,kPath=101,kSubmit=200,kCancel=201 };
|
||||
std::wstring TrimInput(const std::wstring& text) {
|
||||
size_t begin=0,end=text.size();
|
||||
while (begin<end && iswspace(text[begin])) ++begin;
|
||||
while (end>begin && iswspace(text[end-1])) --end;
|
||||
return text.substr(begin,end-begin);
|
||||
}
|
||||
std::wstring DefaultDirectory() {
|
||||
PWSTR path=nullptr;
|
||||
if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Downloads,KF_FLAG_DONT_VERIFY,nullptr,&path))) {
|
||||
std::wstring directory(path); CoTaskMemFree(path); return directory;
|
||||
}
|
||||
wchar_t profile[32768]{};
|
||||
DWORD size=GetEnvironmentVariableW(L"USERPROFILE",profile,32768);
|
||||
return size>0 && size<32768?std::wstring(profile)+L"\\Downloads":L"";
|
||||
}
|
||||
}
|
||||
const std::wstring AddTaskForm::kClassName=L"TTDownloaderAddTaskWindow";
|
||||
AddTaskForm::AddTaskForm(SkinSettings* skin,SubmitCallback submit)
|
||||
:skin_(skin),submit_(std::move(submit)),directory_(DefaultDirectory()) { SetOpacity(skin_->window_alpha_percent); }
|
||||
AddTaskForm::~AddTaskForm() { if (IsOpen()) DestroyWindow(GetHWND()); }
|
||||
void AddTaskForm::OnCreate() {
|
||||
edit_url_=CreateEdit(kUrl,L"粘贴一个 HTTP/HTTPS 下载地址");
|
||||
edit_path_=CreateEdit(kPath,L"下载保存目录");
|
||||
SetWindowTextW(edit_url_,url_.c_str()); SetWindowTextW(edit_path_,directory_.c_str());
|
||||
EnableWindow(edit_url_,!pending_); EnableWindow(edit_path_,!pending_);
|
||||
RefreshAppearance();
|
||||
}
|
||||
void AddTaskForm::OnLayout() {
|
||||
Place(edit_url_,{104,20,Width()-24,54});
|
||||
Place(edit_path_,{104,72,Width()-24,106});
|
||||
ClearButtons();
|
||||
Button(kSubmit,pending_?L"正在添加...":L"添加任务",{Width()-238,Height()-52,Width()-124,Height()-18},true);
|
||||
Button(kCancel,pending_?L"关闭":L"取消",{Width()-112,Height()-52,Width()-24,Height()-18});
|
||||
}
|
||||
void AddTaskForm::OnPaint(ttui::Canvas& c) {
|
||||
c.Text(L"下载地址",{24,20,98,54},0x64748B);
|
||||
c.Text(L"保存到",{24,72,98,106},0x64748B);
|
||||
c.Text(status_,{24,116,Width()-24,Height()-64},pending_?0x64748B:0xB45309,13);
|
||||
}
|
||||
void AddTaskForm::OnCommand(int id) {
|
||||
if (id==kSubmit || id==kUrl || id==kPath) Submit();
|
||||
if (id==kCancel) Close();
|
||||
}
|
||||
void AddTaskForm::Submit() {
|
||||
if (pending_) return;
|
||||
url_=TrimInput(EditText(edit_url_)); directory_=TrimInput(EditText(edit_path_));
|
||||
if (url_.empty()) { status_=L"请输入下载地址"; SetFocus(edit_url_); Preview(); return; }
|
||||
if (directory_.empty()) { status_=L"请输入保存目录"; SetFocus(edit_path_); Preview(); return; }
|
||||
pending_=true; status_=L"正在提交任务,请稍候...";
|
||||
EnableWindow(edit_url_,FALSE); EnableWindow(edit_path_,FALSE);
|
||||
OnLayout(); Preview();
|
||||
if (!submit_ || !submit_(url_,directory_)) Complete(false,L"下载引擎未就绪,请稍后重试。");
|
||||
}
|
||||
void AddTaskForm::Complete(bool accepted,const std::wstring& message) {
|
||||
if (!pending_) return;
|
||||
pending_=false;
|
||||
if (accepted) {
|
||||
url_.clear(); status_.clear();
|
||||
if (IsOpen()) { SetWindowTextW(edit_url_,L""); Close(); }
|
||||
} else {
|
||||
status_=message;
|
||||
if (IsOpen()) { EnableWindow(edit_url_,TRUE); EnableWindow(edit_path_,TRUE); OnLayout(); Preview(); }
|
||||
}
|
||||
}
|
||||
void AddTaskForm::RefreshAppearance() {
|
||||
SetOpacity(skin_->window_alpha_percent);
|
||||
SetBackgroundImage(skin_->background_image); SetBackgroundImageOpacity(1-skin_->window_opacity/100.f); Invalidate();
|
||||
}
|
||||
std::optional<LRESULT> AddTaskForm::OnMessage(UINT msg,WPARAM wp,LPARAM lp) {
|
||||
if (msg==WM_SHOWWINDOW && wp && edit_url_ && !pending_) SetFocus(edit_url_);
|
||||
if (msg==WM_KEYDOWN && wp==VK_ESCAPE) { Close(); return 0; }
|
||||
if (msg==WM_NCDESTROY) { edit_url_=nullptr; edit_path_=nullptr; }
|
||||
if (msg==WM_CLOSE && edit_url_ && edit_path_ && !pending_) {
|
||||
url_=EditText(edit_url_); directory_=EditText(edit_path_);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
#include "ttui/window.h"
|
||||
#include "skin_settings.h"
|
||||
#include <functional>
|
||||
class AddTaskForm final : public ttui::Window {
|
||||
public:
|
||||
using SubmitCallback=std::function<bool(const std::wstring&,const std::wstring&)>;
|
||||
AddTaskForm(SkinSettings*,SubmitCallback);
|
||||
~AddTaskForm() override;
|
||||
static const std::wstring kClassName;
|
||||
bool Pending() const { return pending_; }
|
||||
const std::wstring& SubmittedUrl() const { return url_; }
|
||||
void Complete(bool accepted,const std::wstring& message=L"");
|
||||
void RefreshAppearance();
|
||||
private:
|
||||
void OnCreate() override;
|
||||
void OnLayout() override;
|
||||
void OnPaint(ttui::Canvas&) override;
|
||||
void OnCommand(int) override;
|
||||
std::optional<LRESULT> OnMessage(UINT,WPARAM,LPARAM) override;
|
||||
void Submit();
|
||||
SkinSettings* skin_;
|
||||
SubmitCallback submit_;
|
||||
HWND edit_url_=nullptr,edit_path_=nullptr;
|
||||
std::wstring url_,directory_,status_;
|
||||
bool pending_=false;
|
||||
};
|
||||
@@ -1,163 +0,0 @@
|
||||
#include "stdafx.h"
|
||||
#include "aero_backdrop.h"
|
||||
|
||||
#include <dwmapi.h>
|
||||
|
||||
#include <cstdarg>
|
||||
#include <cstdio>
|
||||
|
||||
#pragma comment(lib, "dwmapi.lib")
|
||||
|
||||
namespace
|
||||
{
|
||||
constexpr wchar_t kBackdropClassName[] = L"TTDownloaderAeroBackdrop";
|
||||
|
||||
void LogAero(const wchar_t* format, ...)
|
||||
{
|
||||
wchar_t temp[MAX_PATH] = {};
|
||||
if (::GetTempPathW(MAX_PATH, temp) == 0)
|
||||
return;
|
||||
|
||||
std::wstring path = std::wstring(temp) + L"TTDownloader_aero.log";
|
||||
FILE* file = nullptr;
|
||||
if (_wfopen_s(&file, path.c_str(), L"a") != 0 || file == nullptr)
|
||||
return;
|
||||
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vfwprintf(file, format, args);
|
||||
va_end(args);
|
||||
fputc(L'\n', file);
|
||||
fclose(file);
|
||||
}
|
||||
}
|
||||
|
||||
AeroBackdrop::~AeroBackdrop()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
bool AeroBackdrop::Create(HWND owner)
|
||||
{
|
||||
if (hwnd_ != nullptr)
|
||||
return true;
|
||||
|
||||
WNDCLASSEXW wc = {};
|
||||
wc.cbSize = sizeof(wc);
|
||||
wc.lpfnWndProc = &AeroBackdrop::WndProc;
|
||||
wc.hInstance = ::GetModuleHandleW(nullptr);
|
||||
wc.hCursor = ::LoadCursorW(nullptr, IDC_ARROW);
|
||||
wc.lpszClassName = kBackdropClassName;
|
||||
if (::RegisterClassExW(&wc) == 0 && ::GetLastError() != ERROR_CLASS_ALREADY_EXISTS)
|
||||
return false;
|
||||
|
||||
hwnd_ = ::CreateWindowExW(WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE | WS_EX_TRANSPARENT,
|
||||
kBackdropClassName, L"", WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, wc.hInstance, nullptr);
|
||||
if (hwnd_ == nullptr)
|
||||
return false;
|
||||
|
||||
BOOL composition = FALSE;
|
||||
::DwmIsCompositionEnabled(&composition);
|
||||
LogAero(L"create backdrop hwnd=%p composition=%d", hwnd_, composition);
|
||||
|
||||
Sync(owner);
|
||||
return true;
|
||||
}
|
||||
|
||||
void AeroBackdrop::Sync(HWND owner)
|
||||
{
|
||||
if (hwnd_ == nullptr || owner == nullptr)
|
||||
return;
|
||||
|
||||
bool visible = ::IsWindowVisible(owner) != FALSE && ::IsIconic(owner) == FALSE;
|
||||
if (!visible)
|
||||
{
|
||||
if (visible_)
|
||||
{
|
||||
visible_ = false;
|
||||
::ShowWindow(hwnd_, SW_HIDE);
|
||||
LogAero(L"sync hidden");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
RECT client = {};
|
||||
::GetClientRect(owner, &client);
|
||||
POINT origin = { client.left, client.top };
|
||||
::ClientToScreen(owner, &origin);
|
||||
|
||||
::SetWindowPos(hwnd_, owner, origin.x, origin.y,
|
||||
client.right - client.left, client.bottom - client.top, SWP_NOACTIVATE | SWP_SHOWWINDOW);
|
||||
|
||||
if (!visible_)
|
||||
{
|
||||
visible_ = true;
|
||||
LogAero(L"sync visible rect=%d,%d %dx%d", origin.x, origin.y,
|
||||
client.right - client.left, client.bottom - client.top);
|
||||
}
|
||||
|
||||
ApplyGlass(client.right - client.left, client.bottom - client.top);
|
||||
}
|
||||
|
||||
void AeroBackdrop::Refresh()
|
||||
{
|
||||
blur_width_ = 0;
|
||||
blur_height_ = 0;
|
||||
blur_enabled_ = false;
|
||||
}
|
||||
|
||||
void AeroBackdrop::ApplyGlass(int width, int height)
|
||||
{
|
||||
if (blur_enabled_ && width == blur_width_ && height == blur_height_)
|
||||
return;
|
||||
|
||||
blur_width_ = width;
|
||||
blur_height_ = height;
|
||||
|
||||
DWM_BLURBEHIND blur = {};
|
||||
blur.dwFlags = DWM_BB_ENABLE;
|
||||
blur.fEnable = TRUE;
|
||||
blur.hRgnBlur = nullptr;
|
||||
HRESULT result = ::DwmEnableBlurBehindWindow(hwnd_, &blur);
|
||||
blur_enabled_ = SUCCEEDED(result);
|
||||
LogAero(L"enable blur size=%dx%d hr=0x%08X", width, height,
|
||||
static_cast<unsigned int>(result));
|
||||
::InvalidateRect(hwnd_, nullptr, TRUE);
|
||||
}
|
||||
|
||||
void AeroBackdrop::Hide()
|
||||
{
|
||||
if (hwnd_ != nullptr && visible_)
|
||||
{
|
||||
visible_ = false;
|
||||
::ShowWindow(hwnd_, SW_HIDE);
|
||||
}
|
||||
}
|
||||
|
||||
void AeroBackdrop::Destroy()
|
||||
{
|
||||
if (hwnd_ != nullptr)
|
||||
{
|
||||
::DestroyWindow(hwnd_);
|
||||
hwnd_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT CALLBACK AeroBackdrop::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (uMsg == WM_ERASEBKGND)
|
||||
return 1;
|
||||
|
||||
if (uMsg == WM_PAINT)
|
||||
{
|
||||
PAINTSTRUCT ps = {};
|
||||
HDC dc = ::BeginPaint(hwnd, &ps);
|
||||
RECT client = {};
|
||||
::GetClientRect(hwnd, &client);
|
||||
::FillRect(dc, &client, static_cast<HBRUSH>(::GetStockObject(BLACK_BRUSH)));
|
||||
::EndPaint(hwnd, &ps);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ::DefWindowProcW(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
class AeroBackdrop
|
||||
{
|
||||
public:
|
||||
AeroBackdrop() = default;
|
||||
~AeroBackdrop();
|
||||
|
||||
AeroBackdrop(const AeroBackdrop&) = delete;
|
||||
AeroBackdrop& operator=(const AeroBackdrop&) = delete;
|
||||
|
||||
bool Create(HWND owner);
|
||||
void Sync(HWND owner);
|
||||
void Refresh();
|
||||
void Hide();
|
||||
void Destroy();
|
||||
bool IsValid() const { return hwnd_ != nullptr; }
|
||||
|
||||
private:
|
||||
static LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
void ApplyGlass(int width, int height);
|
||||
|
||||
HWND hwnd_ = nullptr;
|
||||
int blur_width_ = 0;
|
||||
int blur_height_ = 0;
|
||||
bool blur_enabled_ = false;
|
||||
bool visible_ = false;
|
||||
};
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#include "platform.h"
|
||||
#include "download_engine.h"
|
||||
|
||||
#include <winhttp.h>
|
||||
@@ -139,7 +140,7 @@ namespace
|
||||
|
||||
if (bytes.empty())
|
||||
return std::wstring();
|
||||
std::wstring decoded = nbase::UTF8ToUTF16(bytes);
|
||||
std::wstring decoded = platform::FromUtf8(bytes);
|
||||
return decoded.empty() ? text : decoded;
|
||||
}
|
||||
|
||||
@@ -270,15 +271,17 @@ namespace
|
||||
return text;
|
||||
}
|
||||
|
||||
int64_t QueryContentLength(HINTERNET request)
|
||||
{
|
||||
unsigned long long length = 0;
|
||||
DWORD size = sizeof(length);
|
||||
if (!::WinHttpQueryHeaders(request, WINHTTP_QUERY_CONTENT_LENGTH | WINHTTP_QUERY_FLAG_NUMBER64,
|
||||
WINHTTP_HEADER_NAME_BY_INDEX, &length, &size, WINHTTP_NO_HEADER_INDEX))
|
||||
return 0;
|
||||
return static_cast<int64_t>(length);
|
||||
}
|
||||
std::wstring QueryHeaderText(HINTERNET request, DWORD query);
|
||||
int64_t QueryContentLength(HINTERNET request) {
|
||||
const std::wstring text=QueryHeaderText(request,WINHTTP_QUERY_CONTENT_LENGTH);
|
||||
if (text.empty()) return 0;
|
||||
int64_t value=0;
|
||||
for (wchar_t ch:text) {
|
||||
if (ch<L'0' || ch>L'9' || value>(INT64_MAX-(ch-L'0'))/10) return 0;
|
||||
value=value*10+(ch-L'0');
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
std::wstring QueryHeaderText(HINTERNET request, DWORD query)
|
||||
{
|
||||
@@ -391,7 +394,15 @@ void DownloadEngine::DeleteTask(int64_t id, bool delete_file)
|
||||
|
||||
void DownloadEngine::ThreadMain()
|
||||
{
|
||||
std::wstring db_dir = nbase::win32::GetLocalAppDataDir() + L"\\TTDownloader";
|
||||
std::wstring local_data = platform::LocalAppData();
|
||||
if (local_data.empty()) {
|
||||
auto* event = new EngineEvent;
|
||||
event->type = EngineEventType::kFatal;
|
||||
event->message = L"无法定位用户应用数据目录,下载引擎未启动。";
|
||||
PostEvent(event);
|
||||
return;
|
||||
}
|
||||
std::wstring db_dir = local_data + L"\\TTDownloader";
|
||||
::CreateDirectoryW(db_dir.c_str(), nullptr);
|
||||
store_open_ = store_.Open(db_dir + L"\\tasks.db");
|
||||
|
||||
@@ -736,11 +747,19 @@ DownloadEngine::AttemptResult DownloadEngine::RunAttempt(TaskInfo& task,
|
||||
using WinHttpHandle = std::unique_ptr<void, decltype(&::WinHttpCloseHandle)>;
|
||||
WinHttpHandle session(::WinHttpOpen(L"TTDownloader/0.1", WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY,
|
||||
WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0), &::WinHttpCloseHandle);
|
||||
const bool legacy_proxy=!session && ::GetLastError()==ERROR_INVALID_PARAMETER;
|
||||
if (legacy_proxy)
|
||||
session.reset(::WinHttpOpen(L"TTDownloader/0.1",WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
|
||||
WINHTTP_NO_PROXY_NAME,WINHTTP_NO_PROXY_BYPASS,0));
|
||||
if (!session)
|
||||
{
|
||||
error = L"无法初始化网络连接";
|
||||
return AttemptResult::kRetry;
|
||||
}
|
||||
if (legacy_proxy) {
|
||||
DWORD protocols=WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2;
|
||||
::WinHttpSetOption(session.get(),WINHTTP_OPTION_SECURE_PROTOCOLS,&protocols,sizeof(protocols));
|
||||
}
|
||||
::WinHttpSetTimeouts(session.get(), 15000, 15000, 15000, 4000);
|
||||
|
||||
WinHttpHandle connect(::WinHttpConnect(session.get(), parts.host.c_str(), parts.port, 0),
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "task_store.h"
|
||||
|
||||
#include <atomic>
|
||||
|
||||
+232
-679
File diff suppressed because it is too large.
Load diff
@@ -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_;
|
||||
};
|
||||
+11
-31
@@ -1,12 +1,7 @@
|
||||
#include "stdafx.h"
|
||||
#include "main.h"
|
||||
#include "stdafx.h"
|
||||
#include "ttui/application.h"
|
||||
#include "downloader_form.h"
|
||||
|
||||
enum ThreadId
|
||||
{
|
||||
kThreadUI
|
||||
};
|
||||
|
||||
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
|
||||
_In_opt_ HINSTANCE hPrevInstance,
|
||||
_In_ LPWSTR lpCmdLine,
|
||||
@@ -27,30 +22,15 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
|
||||
return 0;
|
||||
}
|
||||
|
||||
MainThread thread;
|
||||
thread.RunOnCurrentThreadWithLoop(nbase::MessageLoop::kUIMessageLoop);
|
||||
|
||||
DownloaderForm form;
|
||||
int result=ttui::RunApplication([&] {
|
||||
if (!form.Create(nullptr,DownloaderForm::kClassName.c_str(),L"TTDownloader",940,640,true)) {
|
||||
MessageBoxW(nullptr,L"无法创建主窗口。",L"TTDownloader",MB_ICONERROR); return false;
|
||||
}
|
||||
form.CenterWindow(); form.ShowWindow(); return true;
|
||||
});
|
||||
|
||||
::CloseHandle(instance_mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MainThread::Init()
|
||||
{
|
||||
nbase::ThreadManager::RegisterThread(kThreadUI);
|
||||
|
||||
std::wstring module_dir = nbase::win32::GetCurrentModuleDirectory();
|
||||
ui::GlobalManager::Startup(module_dir + L"resources\\", ui::CreateControlCallback(), false);
|
||||
ui::GlobalManager::AddTextColor(L"tt_edit_bg", L"#D9FFFFFF");
|
||||
|
||||
DownloaderForm* form = new DownloaderForm();
|
||||
form->Create(NULL, DownloaderForm::kClassName.c_str(), WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX, 0);
|
||||
form->CenterWindow();
|
||||
form->ShowWindow();
|
||||
}
|
||||
|
||||
void MainThread::Cleanup()
|
||||
{
|
||||
ui::GlobalManager::Shutdown();
|
||||
SetThreadWasQuitProperly(true);
|
||||
nbase::ThreadManager::UnregisterThread();
|
||||
return result;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
class MainThread : public nbase::FrameworkThread
|
||||
{
|
||||
public:
|
||||
MainThread() : nbase::FrameworkThread("MainThread") {}
|
||||
virtual ~MainThread() {}
|
||||
|
||||
private:
|
||||
virtual void Init() override;
|
||||
virtual void Cleanup() override;
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <shlobj.h>
|
||||
#include <string>
|
||||
#include <limits>
|
||||
#pragma comment(lib,"shell32.lib")
|
||||
#pragma comment(lib,"ole32.lib")
|
||||
namespace platform {
|
||||
inline std::wstring FromUtf8(const std::string& value) {
|
||||
if (value.empty() || value.size()>static_cast<size_t>((std::numeric_limits<int>::max)())) return {};
|
||||
int length=MultiByteToWideChar(CP_UTF8,MB_ERR_INVALID_CHARS,value.data(),static_cast<int>(value.size()),nullptr,0);
|
||||
if (!length) return {};
|
||||
std::wstring output(length,L'\0');
|
||||
MultiByteToWideChar(CP_UTF8,MB_ERR_INVALID_CHARS,value.data(),static_cast<int>(value.size()),output.data(),length); return output;
|
||||
}
|
||||
inline std::string ToUtf8(const std::wstring& value) {
|
||||
if (value.empty() || value.size()>static_cast<size_t>((std::numeric_limits<int>::max)())) return {};
|
||||
int length=WideCharToMultiByte(CP_UTF8,WC_ERR_INVALID_CHARS,value.data(),static_cast<int>(value.size()),nullptr,0,nullptr,nullptr);
|
||||
if (!length) return {};
|
||||
std::string output(length,'\0');
|
||||
WideCharToMultiByte(CP_UTF8,WC_ERR_INVALID_CHARS,value.data(),static_cast<int>(value.size()),output.data(),length,nullptr,nullptr); return output;
|
||||
}
|
||||
inline std::wstring LocalAppData() {
|
||||
PWSTR path=nullptr;
|
||||
if (FAILED(SHGetKnownFolderPath(FOLDERID_LocalAppData,KF_FLAG_DEFAULT,nullptr,&path))) return {};
|
||||
std::wstring result(path); CoTaskMemFree(path); return result;
|
||||
}
|
||||
}
|
||||
+62
-145
@@ -1,154 +1,71 @@
|
||||
#include "stdafx.h"
|
||||
#include "settings_form.h"
|
||||
|
||||
#include <commctrl.h>
|
||||
#include <commdlg.h>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#pragma comment(lib, "comdlg32.lib")
|
||||
|
||||
const std::wstring SettingsForm::kClassName = L"TTDownloaderSettingsWindow";
|
||||
|
||||
SettingsForm::SettingsForm(SkinSettings* settings, ChangeCallback on_changed, CloseCallback on_closed)
|
||||
: settings_(settings)
|
||||
, on_changed_(std::move(on_changed))
|
||||
, on_closed_(std::move(on_closed))
|
||||
{
|
||||
#include <algorithm>
|
||||
#pragma comment(lib,"comdlg32.lib")
|
||||
const std::wstring SettingsForm::kClassName=L"TTDownloaderSettingsWindow";
|
||||
SettingsForm::SettingsForm(SkinSettings* settings,ChangeCallback changed,CloseCallback closed)
|
||||
:settings_(settings),on_changed_(std::move(changed)),on_closed_(std::move(closed)) { RefreshOpacity(); }
|
||||
SettingsForm::~SettingsForm() { if (IsOpen()) DestroyWindow(GetHWND()); }
|
||||
void SettingsForm::OnCreate() {
|
||||
INITCOMMONCONTROLSEX controls{sizeof(controls),ICC_BAR_CLASSES}; InitCommonControlsEx(&controls);
|
||||
slider_=CreateWindowExW(0,TRACKBAR_CLASSW,L"",WS_CHILD|WS_VISIBLE|WS_TABSTOP|TBS_AUTOTICKS,
|
||||
0,0,1,1,GetHWND(),reinterpret_cast<HMENU>(100),GetModuleHandleW(nullptr),nullptr);
|
||||
SendMessageW(slider_,TBM_SETRANGE,TRUE,MAKELPARAM(0,100));
|
||||
SendMessageW(slider_,TBM_SETTICFREQ,10,0);
|
||||
SendMessageW(slider_,TBM_SETPOS,TRUE,settings_->window_opacity);
|
||||
opacity_slider_=CreateWindowExW(0,TRACKBAR_CLASSW,L"",WS_CHILD|WS_VISIBLE|WS_TABSTOP|TBS_AUTOTICKS,
|
||||
0,0,1,1,GetHWND(),reinterpret_cast<HMENU>(101),GetModuleHandleW(nullptr),nullptr);
|
||||
SendMessageW(opacity_slider_,TBM_SETRANGE,TRUE,MAKELPARAM(30,100));
|
||||
SendMessageW(opacity_slider_,TBM_SETTICFREQ,10,0);
|
||||
SendMessageW(opacity_slider_,TBM_SETPOS,TRUE,settings_->window_alpha_percent);
|
||||
RefreshOpacity();
|
||||
}
|
||||
|
||||
std::wstring SettingsForm::GetSkinFolder()
|
||||
{
|
||||
return L"downloader";
|
||||
void SettingsForm::OnLayout() {
|
||||
Place(slider_,{150,74,Width()-80,108});
|
||||
Place(opacity_slider_,{150,122,Width()-80,156});
|
||||
ClearButtons(); Button(1,L"选择背景图片",{22,18,166,52},true); Button(2,L"清除背景",{178,18,286,52});
|
||||
Button(3,L"关闭",{Width()-110,Height()-48,Width()-22,Height()-16});
|
||||
}
|
||||
|
||||
std::wstring SettingsForm::GetSkinFile()
|
||||
{
|
||||
return L"settings.xml";
|
||||
void SettingsForm::OnPaint(ttui::Canvas& c) {
|
||||
c.Text(settings_->background_image.empty()?L"尚未选择背景图片":settings_->background_image,{302,16,Width()-22,54},0x64748B,12);
|
||||
c.Text(L"背景覆盖",{24,74,144,108});
|
||||
c.Text(std::to_wstring(settings_->window_opacity)+L"%",{Width()-70,74,Width()-20,108},0x64748B,12);
|
||||
c.Text(L"窗口透明度",{24,122,144,156});
|
||||
c.Text(std::to_wstring(settings_->window_alpha_percent)+L"%",{Width()-70,122,Width()-20,156},0x64748B,12);
|
||||
c.Text(L"修改即时生效,关闭设置后保存。",{22,Height()-48,Width()-130,Height()-16},0x64748B,12);
|
||||
}
|
||||
|
||||
std::wstring SettingsForm::GetWindowClassName() const
|
||||
{
|
||||
return kClassName;
|
||||
void SettingsForm::OnCommand(int id) {
|
||||
if (id==1) PickBackgroundImage();
|
||||
if (id==2) { settings_->background_image.clear(); if (on_changed_) on_changed_(); Invalidate(); }
|
||||
if (id==3) Close();
|
||||
}
|
||||
|
||||
void SettingsForm::InitWindow()
|
||||
{
|
||||
background_label_ = dynamic_cast<ui::Label*>(FindControl(L"lbl_background"));
|
||||
slider_window_ = dynamic_cast<ui::Slider*>(FindControl(L"slider_window"));
|
||||
slider_header_ = dynamic_cast<ui::Slider*>(FindControl(L"slider_header"));
|
||||
slider_input_ = dynamic_cast<ui::Slider*>(FindControl(L"slider_input"));
|
||||
slider_list_ = dynamic_cast<ui::Slider*>(FindControl(L"slider_list"));
|
||||
slider_bottom_ = dynamic_cast<ui::Slider*>(FindControl(L"slider_bottom"));
|
||||
lbl_window_ = dynamic_cast<ui::Label*>(FindControl(L"lbl_window"));
|
||||
lbl_header_ = dynamic_cast<ui::Label*>(FindControl(L"lbl_header"));
|
||||
lbl_input_ = dynamic_cast<ui::Label*>(FindControl(L"lbl_input"));
|
||||
lbl_list_ = dynamic_cast<ui::Label*>(FindControl(L"lbl_list"));
|
||||
lbl_bottom_ = dynamic_cast<ui::Label*>(FindControl(L"lbl_bottom"));
|
||||
|
||||
slider_window_->SetValue(settings_->window_opacity);
|
||||
slider_header_->SetValue(settings_->header_opacity);
|
||||
slider_input_->SetValue(settings_->input_opacity);
|
||||
slider_list_->SetValue(settings_->list_opacity);
|
||||
slider_bottom_->SetValue(settings_->bottom_opacity);
|
||||
|
||||
UpdateBackgroundLabel();
|
||||
RefreshPercentLabels();
|
||||
|
||||
m_pRoot->AttachBubbledEvent(ui::kEventClick, nbase::Bind(&SettingsForm::OnClicked, this, std::placeholders::_1));
|
||||
ui::Slider* sliders[] = { slider_window_, slider_header_, slider_input_, slider_list_, slider_bottom_ };
|
||||
for (ui::Slider* slider : sliders)
|
||||
slider->AttachValueChange(nbase::Bind(&SettingsForm::OnSliderChanged, this, std::placeholders::_1));
|
||||
std::optional<LRESULT> SettingsForm::OnMessage(UINT msg,WPARAM wp,LPARAM lp) {
|
||||
if (msg==WM_HSCROLL && (reinterpret_cast<HWND>(lp)==slider_ || reinterpret_cast<HWND>(lp)==opacity_slider_)) {
|
||||
HWND source=reinterpret_cast<HWND>(lp);
|
||||
const UINT notification=LOWORD(wp);
|
||||
const int position=(notification==TB_THUMBTRACK || notification==TB_THUMBPOSITION)
|
||||
? static_cast<int>(HIWORD(wp))
|
||||
: static_cast<int>(SendMessageW(source,TBM_GETPOS,0,0));
|
||||
if (source==opacity_slider_) settings_->window_alpha_percent=std::clamp(position,30,100);
|
||||
else settings_->window_opacity=std::clamp(position,0,100);
|
||||
RefreshOpacity();
|
||||
if (on_changed_) on_changed_();
|
||||
Preview();
|
||||
return 0;
|
||||
}
|
||||
if (msg==WM_DESTROY && on_closed_) on_closed_();
|
||||
return {};
|
||||
}
|
||||
|
||||
void SettingsForm::OnFinalMessage(HWND hWnd)
|
||||
{
|
||||
if (on_closed_)
|
||||
on_closed_();
|
||||
__super::OnFinalMessage(hWnd);
|
||||
}
|
||||
|
||||
bool SettingsForm::OnClicked(ui::EventArgs* args)
|
||||
{
|
||||
std::wstring name = args->pSender->GetName();
|
||||
if (name == L"btn_pick_bg")
|
||||
PickBackgroundImage();
|
||||
else if (name == L"btn_clear_bg")
|
||||
{
|
||||
settings_->background_image.clear();
|
||||
UpdateBackgroundLabel();
|
||||
ApplyChanged();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SettingsForm::OnSliderChanged(ui::EventArgs* args)
|
||||
{
|
||||
std::wstring name = args->pSender->GetName();
|
||||
if (name == L"slider_window")
|
||||
settings_->window_opacity = static_cast<int>(std::lround(slider_window_->GetValue()));
|
||||
else if (name == L"slider_header")
|
||||
settings_->header_opacity = static_cast<int>(std::lround(slider_header_->GetValue()));
|
||||
else if (name == L"slider_input")
|
||||
settings_->input_opacity = static_cast<int>(std::lround(slider_input_->GetValue()));
|
||||
else if (name == L"slider_list")
|
||||
settings_->list_opacity = static_cast<int>(std::lround(slider_list_->GetValue()));
|
||||
else if (name == L"slider_bottom")
|
||||
settings_->bottom_opacity = static_cast<int>(std::lround(slider_bottom_->GetValue()));
|
||||
else
|
||||
return false;
|
||||
|
||||
RefreshPercentLabels();
|
||||
ApplyChanged();
|
||||
return false;
|
||||
}
|
||||
|
||||
void SettingsForm::PickBackgroundImage()
|
||||
{
|
||||
wchar_t path[MAX_PATH] = {};
|
||||
if (!settings_->background_image.empty())
|
||||
wcsncpy_s(path, settings_->background_image.c_str(), _TRUNCATE);
|
||||
|
||||
OPENFILENAMEW dialog = {};
|
||||
dialog.lStructSize = sizeof(dialog);
|
||||
dialog.hwndOwner = GetHWND();
|
||||
dialog.lpstrFilter = L"图片文件\0*.bmp;*.jpg;*.jpeg;*.png;*.gif\0所有文件\0*.*\0";
|
||||
dialog.lpstrFile = path;
|
||||
dialog.nMaxFile = MAX_PATH;
|
||||
dialog.lpstrTitle = L"选择窗口背景图片";
|
||||
dialog.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY;
|
||||
|
||||
if (!::GetOpenFileNameW(&dialog))
|
||||
return;
|
||||
|
||||
std::wstring selected = path;
|
||||
if (selected.find(L'\'') != std::wstring::npos)
|
||||
{
|
||||
::MessageBoxW(GetHWND(), L"图片路径不能包含单引号。", L"TTDownloader", MB_ICONWARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
settings_->background_image = selected;
|
||||
UpdateBackgroundLabel();
|
||||
ApplyChanged();
|
||||
}
|
||||
|
||||
void SettingsForm::UpdateBackgroundLabel()
|
||||
{
|
||||
background_label_->SetText(settings_->background_image.empty()
|
||||
? L"未设置" : settings_->background_image);
|
||||
}
|
||||
|
||||
void SettingsForm::RefreshPercentLabels()
|
||||
{
|
||||
lbl_window_->SetText(nbase::StringPrintf(L"%d%%", settings_->window_opacity));
|
||||
lbl_header_->SetText(nbase::StringPrintf(L"%d%%", settings_->header_opacity));
|
||||
lbl_input_->SetText(nbase::StringPrintf(L"%d%%", settings_->input_opacity));
|
||||
lbl_list_->SetText(nbase::StringPrintf(L"%d%%", settings_->list_opacity));
|
||||
lbl_bottom_->SetText(nbase::StringPrintf(L"%d%%", settings_->bottom_opacity));
|
||||
}
|
||||
|
||||
void SettingsForm::ApplyChanged()
|
||||
{
|
||||
if (on_changed_)
|
||||
on_changed_();
|
||||
void SettingsForm::RefreshOpacity() { SetOpacity(settings_->window_alpha_percent); }
|
||||
void SettingsForm::PickBackgroundImage() {
|
||||
wchar_t path[32768]{};
|
||||
OPENFILENAMEW dialog{sizeof(dialog)};
|
||||
dialog.hwndOwner=GetHWND(); dialog.lpstrFilter=L"图片文件\0*.bmp;*.jpg;*.jpeg;*.png;*.gif\0所有文件\0*.*\0";
|
||||
dialog.lpstrFile=path; dialog.nMaxFile=32768; dialog.lpstrTitle=L"选择窗口背景图片";
|
||||
dialog.Flags=OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY|OFN_NOCHANGEDIR;
|
||||
if (GetOpenFileNameW(&dialog)) {
|
||||
settings_->background_image=path; if (on_changed_) on_changed_(); Invalidate();
|
||||
}
|
||||
}
|
||||
+19
-42
@@ -1,48 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "ttui/window.h"
|
||||
#include "skin_settings.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
class SettingsForm : public ui::WindowImplBase
|
||||
{
|
||||
class SettingsForm final : public ttui::Window {
|
||||
public:
|
||||
using ChangeCallback = std::function<void()>;
|
||||
using CloseCallback = std::function<void()>;
|
||||
|
||||
SettingsForm(SkinSettings* settings, ChangeCallback on_changed, CloseCallback on_closed);
|
||||
|
||||
virtual std::wstring GetSkinFolder() override;
|
||||
virtual std::wstring GetSkinFile() override;
|
||||
virtual std::wstring GetWindowClassName() const override;
|
||||
|
||||
virtual void InitWindow() override;
|
||||
virtual void OnFinalMessage(HWND hWnd) override;
|
||||
|
||||
static const std::wstring kClassName;
|
||||
|
||||
using ChangeCallback=std::function<void()>;
|
||||
using CloseCallback=std::function<void()>;
|
||||
SettingsForm(SkinSettings*,ChangeCallback,CloseCallback);
|
||||
~SettingsForm() override;
|
||||
static const std::wstring kClassName;
|
||||
void RefreshOpacity();
|
||||
private:
|
||||
bool OnClicked(ui::EventArgs* args);
|
||||
bool OnSliderChanged(ui::EventArgs* args);
|
||||
|
||||
void PickBackgroundImage();
|
||||
void UpdateBackgroundLabel();
|
||||
void RefreshPercentLabels();
|
||||
void ApplyChanged();
|
||||
|
||||
SkinSettings* settings_ = nullptr;
|
||||
ChangeCallback on_changed_;
|
||||
CloseCallback on_closed_;
|
||||
|
||||
ui::Label* background_label_ = nullptr;
|
||||
ui::Slider* slider_window_ = nullptr;
|
||||
ui::Slider* slider_header_ = nullptr;
|
||||
ui::Slider* slider_input_ = nullptr;
|
||||
ui::Slider* slider_list_ = nullptr;
|
||||
ui::Slider* slider_bottom_ = nullptr;
|
||||
ui::Label* lbl_window_ = nullptr;
|
||||
ui::Label* lbl_header_ = nullptr;
|
||||
ui::Label* lbl_input_ = nullptr;
|
||||
ui::Label* lbl_list_ = nullptr;
|
||||
ui::Label* lbl_bottom_ = nullptr;
|
||||
void OnCreate() override;
|
||||
void OnLayout() override;
|
||||
void OnPaint(ttui::Canvas&) override;
|
||||
void OnCommand(int) override;
|
||||
std::optional<LRESULT> OnMessage(UINT,WPARAM,LPARAM) override;
|
||||
void PickBackgroundImage();
|
||||
SkinSettings* settings_;
|
||||
ChangeCallback on_changed_;
|
||||
CloseCallback on_closed_;
|
||||
HWND slider_=nullptr;
|
||||
HWND opacity_slider_=nullptr;
|
||||
};
|
||||
@@ -5,9 +5,6 @@
|
||||
struct SkinSettings
|
||||
{
|
||||
std::wstring background_image;
|
||||
int window_opacity = 100;
|
||||
int header_opacity = 100;
|
||||
int input_opacity = 100;
|
||||
int list_opacity = 100;
|
||||
int bottom_opacity = 100;
|
||||
int window_opacity = 100; // Background image coverage.
|
||||
int window_alpha_percent = 100; // Whole-window opacity, shared by all application windows.
|
||||
};
|
||||
+10
-9
@@ -1,13 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#pragma once
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#include <shellapi.h>
|
||||
#include <ole2.h>
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <memory.h>
|
||||
#include <tchar.h>
|
||||
|
||||
// base 线程与消息循环
|
||||
#include "base/base.h"
|
||||
// DirectUI 控件库(NIM_Duilib_Framework)
|
||||
#include "duilib/UIlib.h"
|
||||
|
||||
#include <shellapi.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "stdafx.h"
|
||||
#include "platform.h"
|
||||
#include "task_store.h"
|
||||
#include "sqlite3.h"
|
||||
|
||||
@@ -17,12 +18,12 @@ namespace
|
||||
std::wstring ColumnText(sqlite3_stmt* stmt, int index)
|
||||
{
|
||||
const unsigned char* text = sqlite3_column_text(stmt, index);
|
||||
return text != nullptr ? nbase::UTF8ToUTF16(reinterpret_cast<const char*>(text)) : std::wstring();
|
||||
return text != nullptr ? platform::FromUtf8(reinterpret_cast<const char*>(text)) : std::wstring();
|
||||
}
|
||||
|
||||
void BindText(sqlite3_stmt* stmt, int index, const std::wstring& value)
|
||||
{
|
||||
std::string utf8 = nbase::UTF16ToUTF8(value);
|
||||
std::string utf8 = platform::ToUtf8(value);
|
||||
sqlite3_bind_text(stmt, index, utf8.c_str(), -1, SQLITE_TRANSIENT);
|
||||
}
|
||||
}
|
||||
@@ -34,7 +35,7 @@ TaskStore::~TaskStore()
|
||||
|
||||
bool TaskStore::Open(const std::wstring& db_path)
|
||||
{
|
||||
if (sqlite3_open_v2(nbase::UTF16ToUTF8(db_path).c_str(), &db_,
|
||||
if (sqlite3_open_v2(platform::ToUtf8(db_path).c_str(), &db_,
|
||||
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, nullptr) != SQLITE_OK)
|
||||
return false;
|
||||
|
||||
|
||||
+11
-33
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
@@ -15,7 +15,6 @@
|
||||
<ProjectGuid>{3A6D5C2E-8B41-4B7E-9F1D-2C5A7E6D0B14}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>ttdownloader</RootNamespace>
|
||||
<!-- 屏蔽本机 vcpkg 全局集成:它会注入上游 DuiLib 头文件,覆盖仓内 NIM_Duilib_Framework -->
|
||||
<VcpkgEnabled>false</VcpkgEnabled>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
@@ -43,20 +42,21 @@
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<Import Project="..\ui\ttui\ttui.props" />
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(ProjectDir)bin\</OutDir>
|
||||
<IntDir>$(ProjectDir)obj\$(PlatformName)\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_d</TargetName>
|
||||
<IncludePath>$(ProjectDir)..\third_party\NIM_Duilib_Framework;$(ProjectDir)..\third_party\sqlite3;$(IncludePath)</IncludePath>
|
||||
<IncludePath>$(ProjectDir)..\third_party\sqlite3;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(ProjectDir)bin\</OutDir>
|
||||
<IntDir>$(ProjectDir)obj\$(PlatformName)\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)</TargetName>
|
||||
<IncludePath>$(ProjectDir)..\third_party\NIM_Duilib_Framework;$(ProjectDir)..\third_party\sqlite3;$(IncludePath)</IncludePath>
|
||||
<IncludePath>$(ProjectDir)..\third_party\sqlite3;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
@@ -72,16 +72,9 @@
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalDependencies>advapi32.lib;comctl32.lib;ole32.lib;shell32.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /y /i /s "$(ProjectDir)resources\*" "$(OutDir)resources\" > nul
|
||||
xcopy /y /i /s "$(ProjectDir)..\third_party\NIM_Duilib_Framework\bin\resources\themes\default\public" "$(OutDir)resources\themes\default\public\" > nul
|
||||
xcopy /y /s "$(ProjectDir)..\third_party\NIM_Duilib_Framework\bin\resources\themes\default\shadow" "$(OutDir)resources\themes\default\shadow\" > nul
|
||||
xcopy /y "$(ProjectDir)..\third_party\NIM_Duilib_Framework\bin\resources\themes\default\global.xml" "$(OutDir)resources\themes\default\" > nul
|
||||
xcopy /y /i /s "$(ProjectDir)..\third_party\NIM_Duilib_Framework\bin\resources\lang" "$(OutDir)resources\lang\" > nul</Command>
|
||||
<Message>复制皮肤与主题资源到输出目录</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
@@ -99,32 +92,25 @@ xcopy /y /i /s "$(ProjectDir)..\third_party\NIM_Duilib_Framework\bin\resources\l
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalDependencies>advapi32.lib;comctl32.lib;ole32.lib;shell32.lib;uuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /y /i /s "$(ProjectDir)resources\*" "$(OutDir)resources\" > nul
|
||||
xcopy /y /i /s "$(ProjectDir)..\third_party\NIM_Duilib_Framework\bin\resources\themes\default\public" "$(OutDir)resources\themes\default\public\" > nul
|
||||
xcopy /y /s "$(ProjectDir)..\third_party\NIM_Duilib_Framework\bin\resources\themes\default\shadow" "$(OutDir)resources\themes\default\shadow\" > nul
|
||||
xcopy /y "$(ProjectDir)..\third_party\NIM_Duilib_Framework\bin\resources\themes\default\global.xml" "$(OutDir)resources\themes\default\" > nul
|
||||
xcopy /y /i /s "$(ProjectDir)..\third_party\NIM_Duilib_Framework\bin\resources\lang" "$(OutDir)resources\lang\" > nul</Command>
|
||||
<Message>复制皮肤与主题资源到输出目录</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\aero_backdrop.h" />
|
||||
<ClInclude Include="src\add_task_form.h" />
|
||||
<ClInclude Include="src\download_engine.h" />
|
||||
<ClInclude Include="src\downloader_form.h" />
|
||||
<ClInclude Include="src\file_drop_source.h" />
|
||||
<ClInclude Include="src\main.h" />
|
||||
<ClInclude Include="src\settings_form.h" />
|
||||
<ClInclude Include="src\skin_settings.h" />
|
||||
<ClInclude Include="src\platform.h" />
|
||||
<ClInclude Include="src\stdafx.h" />
|
||||
<ClInclude Include="src\task_store.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\aero_backdrop.cpp" />
|
||||
<ClCompile Include="src\add_task_form.cpp" />
|
||||
<ClCompile Include="src\download_engine.cpp" />
|
||||
<ClCompile Include="src\downloader_form.cpp" />
|
||||
<ClCompile Include="src\file_drop_source.cpp" />
|
||||
@@ -141,17 +127,9 @@ xcopy /y /i /s "$(ProjectDir)..\third_party\NIM_Duilib_Framework\bin\resources\l
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\third_party\NIM_Duilib_Framework\base\base.vcxproj">
|
||||
<Project>{8d9a6595-717a-41c8-b468-0011a72be3d1}</Project>
|
||||
<ProjectReference Include="..\ui\ttui\ttui.vcxproj">
|
||||
<Project>{19F8F655-C0F5-4AD9-B999-58D23F95AB43}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\third_party\NIM_Duilib_Framework\duilib\duilib.vcxproj">
|
||||
<Project>{e106acd7-4e53-4aee-942b-d0dd426db34e}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Xml Include="resources\themes\default\downloader\downloader.xml" />
|
||||
<Xml Include="resources\themes\default\downloader\downloader_aero.xml" />
|
||||
<Xml Include="resources\themes\default\downloader\settings.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
||||
Reference in new issue
Block a user