feat(shell): classic 用 DuiLib 重做,8 套皮肤全部支持按配置切界面
原 classic 是 Direct2D 自绘壳(shell/classic/shell5.cpp、shell6.cpp),里面
login_mode、FetchAppInfo、卡密、billing_type 全是 0 处匹配 —— 它没有
「读 /info 再改界面」这套逻辑,界面永远固定成「账号+密码+注册」。
而它偏偏是面板皮肤的默认值(NormalizeTheme("")、ShellThemeOrder[0]、
Runner 和 BuildCfgThemedVer 的兜底都指向它),等于默认就把界面配置废掉。
## 做法
照搬原 Direct2D 壳的配色,用 DuiLib 重写一套 classic 皮肤:
#1E1E1E 卡片/主背景 #252527 标题栏 #252526 输入框
#3F3F46 边框/输入框边 #0E639C 主按钮 #0A4E7A 按下
#E6E6E6 主文字 #9D9D9D 次要文字 #0078D4 聚焦
做法是把 dark 皮肤的 XML 按上面这张表做颜色替换(11 种色全部命中),
布局和控件沿用 DuiLib 那套 —— 也就是拿到 classic 的观感 + DuiLib 的功能。
(skins_v4.h 里加了 kSkin_classic,kSkins 注册为 470x436。)
## 选壳逻辑
AssetsThemed 不再给 classic 开后门:
改动前:theme == "classic" → shell64.bin (Direct2D 老壳)
改动后:所有主题 → shell64_dui.bin (DuiLib 壳)
老产物不受影响(已经加过壳的照跑),HasVfy 仍然认 .vfy 节。
shell64.bin / shell32.bin 留在 assets 里没删,要回退直接改回来即可。
## 实测
- 64 位壳 907264 → 924160 字节、32 位 1045504 → 1059328(多出的是 classic 皮肤)
- 用 classic 主题加壳产物 1378816 字节,wine 跑起来:
深灰底 + 蓝色主按钮(VS Code 观感)、4 个 tab「登录/我的设备/卡密充值/找回绑定」、
单个「卡密」输入框、「卡密登录」按钮、无黑框错位
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -78,19 +78,20 @@ func Assets(arch string) (blob, dll []byte, err error) {
|
||||
|
||||
// AssetsThemed 按主题取壳。DuiLib 壳 x64 / x86 各有一份构建
|
||||
// (shell64_dui.bin / shell32_dui.bin),两边的皮肤完全一致。
|
||||
//
|
||||
// 注意:classic 现在也走 DuiLib 壳。原来它指向 shell64.bin / shell32.bin
|
||||
// 那套 Direct2D 壳,但那套壳里没有 login_mode / FetchAppInfo 逻辑,
|
||||
// 界面永远固定成「账号+密码+注册」,跟着应用配置切卡密登录、隐藏注册、
|
||||
// 控制充值 tab 全都不生效。现在已经用 DuiLib 按原配色(VS Code 暗色系)
|
||||
// 重做了一套 classic 皮肤,走和其他 7 套一样的链路。
|
||||
// 老产物(.vfy 节)不受影响,HasVfy 仍然认 .vfy。
|
||||
func AssetsThemed(arch, theme string) (blob, dll []byte, err error) {
|
||||
var bp, dp string
|
||||
switch arch {
|
||||
case "x64":
|
||||
bp, dp = "assets/blob64.bin", "assets/shell64.bin"
|
||||
if theme != "" && theme != "classic" {
|
||||
dp = "assets/shell64_dui.bin"
|
||||
}
|
||||
bp, dp = "assets/blob64.bin", "assets/shell64_dui.bin"
|
||||
case "x86":
|
||||
bp, dp = "assets/blob32.bin", "assets/shell32.bin"
|
||||
if theme != "" && theme != "classic" {
|
||||
dp = "assets/shell32_dui.bin"
|
||||
}
|
||||
bp, dp = "assets/blob32.bin", "assets/shell32_dui.bin"
|
||||
default:
|
||||
return nil, nil, fmt.Errorf("不支持的架构: %s", arch)
|
||||
}
|
||||
|
||||
@@ -212,6 +212,216 @@ static const char *kSkin_dark = R"SKIN(<?xml version="1.0" encoding="utf-8"?>
|
||||
</VerticalLayout>
|
||||
</Window>)SKIN";
|
||||
|
||||
// classic 的 DuiLib 实现:配色照搬原 Direct2D 壳(VS Code 暗色系:
|
||||
// #1E1E1E 卡片 / #252527 标题栏 / #0E639C 主色按钮 / #0078D4 聚焦)。
|
||||
// 老 Direct2D 壳不支持按配置切卡密登录,用它重做后 classic 也能跟随应用设置。
|
||||
static const char *kSkin_classic = R"SKIN(<?xml version="1.0" encoding="utf-8"?>
|
||||
<Window size="470,436" caption="0,0,-1,44" mininfo="470,380" bkcolor="#FF1E1E1E">
|
||||
<VerticalLayout bkcolor="#FF1E1E1E" bordercolor="#FF3F3F46" bordersize="1">
|
||||
<HorizontalLayout height="44" bkcolor="#FF252527">
|
||||
<Label name="lblTitle" text="软件授权验证" textcolor="#FFE6E6E6" font="1" width="260" textpadding="20,0,0,0" />
|
||||
<Control />
|
||||
<Button name="btnClose" text="×" font="3" width="40" height="44" textcolor="#FFE6E6E6" bkcolor="#FF252527" hotbkcolor="#33FFFFFF" pushedbkcolor="#55FFFFFF" />
|
||||
</HorizontalLayout>
|
||||
<HorizontalLayout height="44" inset="20,0,20,0">
|
||||
<VerticalLayout width="84">
|
||||
<Button name="tabLogin" text="登录" height="42" bkcolor="#00000000" textcolor="#FF0E639C" font="1" />
|
||||
<Control height="2" bkcolor="#FF0E639C" />
|
||||
</VerticalLayout>
|
||||
<VerticalLayout width="84">
|
||||
<Button name="tabRegister" text="注册" height="42" bkcolor="#00000000" textcolor="#FF9D9D9D" />
|
||||
<Control name="lineRegister" height="2" bkcolor="#00000000" />
|
||||
</VerticalLayout>
|
||||
<VerticalLayout width="84">
|
||||
<Button name="tabCard" text="卡密充值" height="42" bkcolor="#00000000" textcolor="#FF9D9D9D" />
|
||||
<Control name="lineCard" height="2" bkcolor="#00000000" />
|
||||
</VerticalLayout>
|
||||
<VerticalLayout width="84">
|
||||
<Button name="tabReset" text="忘记密码" height="42" bkcolor="#00000000" textcolor="#FF9D9D9D" />
|
||||
<Control name="lineReset" height="2" bkcolor="#00000000" />
|
||||
</VerticalLayout>
|
||||
<Control />
|
||||
</HorizontalLayout>
|
||||
<VerticalLayout inset="24,14,24,16">
|
||||
<Label name="lblApp" text="演示程序" textcolor="#FF0E639C" height="30" font="2" />
|
||||
<Control height="8" />
|
||||
<VerticalLayout name="panelLogin" height="248">
|
||||
<Label name="lblUser" text="账号或卡密" textcolor="#FFB4B4BE" height="18" />
|
||||
<Edit name="editUser" height="40" bkcolor="#FF252526" nativebkcolor="#FF252526" textcolor="#FFE6E6E6" bordercolor="#FF3F3F46" inset="10,0,0,0" bordersize="1" />
|
||||
<Control height="12" />
|
||||
<Label name="lblPass" text="密码" textcolor="#FFB4B4BE" height="18" />
|
||||
<Edit name="editPass" height="40" bkcolor="#FF252526" nativebkcolor="#FF252526" textcolor="#FFE6E6E6" bordercolor="#FF3F3F46" inset="10,0,0,0" password="true" bordersize="1" />
|
||||
<Control height="12" />
|
||||
<HorizontalLayout name="rowRemember" height="22">
|
||||
<Button name="btnRemember" text="[ ] 记住账号" textcolor="#FFB4B4BE" bkcolor="#00000000" width="104" height="22" />
|
||||
</HorizontalLayout>
|
||||
<Control height="14" />
|
||||
<Button name="btnLogin" text="登录" height="44" bkcolor="#FF0A4E7A" textcolor="#FFFFFFFF" font="1" />
|
||||
<Label name="lblTip" text="" textcolor="#FFE08A8A" height="22" margin="0,8,0,0" />
|
||||
</VerticalLayout>
|
||||
|
||||
<VerticalLayout name="panelRegister" height="404" visible="false">
|
||||
<Label text="用户名" textcolor="#FFB4B4BE" height="18" />
|
||||
<Edit name="regUser" height="38" bkcolor="#FF252526" nativebkcolor="#FF252526" textcolor="#FFE6E6E6" bordercolor="#FF3F3F46" inset="10,0,0,0" bordersize="1" />
|
||||
<Control height="10" />
|
||||
<Label text="邮箱" textcolor="#FFB4B4BE" height="18" />
|
||||
<HorizontalLayout height="38">
|
||||
<Edit name="regEmail" bkcolor="#FF252526" nativebkcolor="#FF252526" textcolor="#FFE6E6E6" bordercolor="#FF3F3F46" inset="10,0,0,0" bordersize="1" />
|
||||
<Control width="8" />
|
||||
<Button name="btnSendCode" text="发送验证码" width="104" height="38" bkcolor="#FF2F6E4E" textcolor="#FFFFFFFF" />
|
||||
</HorizontalLayout>
|
||||
<Control height="10" />
|
||||
<Label name="lblRegCode" text="邮箱验证码" textcolor="#FFB4B4BE" height="18" />
|
||||
<Edit name="regCode" height="38" bkcolor="#FF252526" nativebkcolor="#FF252526" textcolor="#FFE6E6E6" bordercolor="#FF3F3F46" inset="10,0,0,0" bordersize="1" />
|
||||
<Control height="10" />
|
||||
<Label text="密码" textcolor="#FFB4B4BE" height="18" />
|
||||
<Edit name="regPass" height="38" bkcolor="#FF252526" nativebkcolor="#FF252526" textcolor="#FFE6E6E6" bordercolor="#FF3F3F46" inset="10,0,0,0" password="true" bordersize="1" />
|
||||
<Control height="10" />
|
||||
<Label text="确认密码" textcolor="#FFB4B4BE" height="18" />
|
||||
<Edit name="regPass2" height="38" bkcolor="#FF252526" nativebkcolor="#FF252526" textcolor="#FFE6E6E6" bordercolor="#FF3F3F46" inset="10,0,0,0" password="true" bordersize="1" />
|
||||
<Control height="14" />
|
||||
<Button name="btnRegister" text="注册并登录" height="44" bkcolor="#FF0A4E7A" textcolor="#FFFFFFFF" font="1" />
|
||||
<Label name="regTip" text="" textcolor="#FFE08A8A" height="22" margin="0,8,0,0" />
|
||||
</VerticalLayout>
|
||||
|
||||
<VerticalLayout name="panelCard" height="250" visible="false">
|
||||
<Label text="用户名" textcolor="#FFB4B4BE" height="18" />
|
||||
<Edit name="cardUser" height="40" bkcolor="#FF252526" nativebkcolor="#FF252526" textcolor="#FFE6E6E6" bordercolor="#FF3F3F46" inset="10,0,0,0" bordersize="1" />
|
||||
<Control height="12" />
|
||||
<Label text="卡密" textcolor="#FFB4B4BE" height="18" />
|
||||
<Edit name="cardKey" height="40" bkcolor="#FF252526" nativebkcolor="#FF252526" textcolor="#FFE6E6E6" bordercolor="#FF3F3F46" inset="10,0,0,0" bordersize="1" />
|
||||
<Control height="10" />
|
||||
<Label text="卡密充入该账号余额,充值后请用账号密码登录" textcolor="#FFB4B4BE" height="18" />
|
||||
<Control height="14" />
|
||||
<Button name="btnRecharge" text="立即充值" height="44" bkcolor="#FF0A4E7A" textcolor="#FFFFFFFF" font="1" />
|
||||
<Label name="cardTip" text="" textcolor="#FFE08A8A" height="22" margin="0,8,0,0" />
|
||||
</VerticalLayout>
|
||||
|
||||
<VerticalLayout name="panelReset" height="322" visible="false">
|
||||
<Label name="lblResetCard" text="卡密" textcolor="#FFB4B4BE" height="18" visible="false" />
|
||||
<Edit name="resetCardKey" height="40" bkcolor="#FF252526" nativebkcolor="#FF252526" textcolor="#FFE6E6E6" bordercolor="#FF3F3F46" inset="10,0,0,0" visible="false" bordersize="1" />
|
||||
<Control name="spResetCard" height="12" visible="false" />
|
||||
<Label text="邮箱" textcolor="#FFB4B4BE" height="18" />
|
||||
<HorizontalLayout height="40">
|
||||
<Edit name="resetEmail" bkcolor="#FF252526" nativebkcolor="#FF252526" textcolor="#FFE6E6E6" bordercolor="#FF3F3F46" inset="10,0,0,0" bordersize="1" />
|
||||
<Control width="8" />
|
||||
<Button name="btnSendCode2" text="发送验证码" width="104" height="40" bkcolor="#FF2F6E4E" textcolor="#FFFFFFFF" />
|
||||
</HorizontalLayout>
|
||||
<Control height="12" />
|
||||
<Label text="邮箱验证码" textcolor="#FFB4B4BE" height="18" />
|
||||
<Edit name="resetCode" height="40" bkcolor="#FF252526" nativebkcolor="#FF252526" textcolor="#FFE6E6E6" bordercolor="#FF3F3F46" inset="10,0,0,0" bordersize="1" />
|
||||
<Control height="12" />
|
||||
<Label text="新密码" textcolor="#FFB4B4BE" height="18" />
|
||||
<Edit name="resetPass" height="40" bkcolor="#FF252526" nativebkcolor="#FF252526" textcolor="#FFE6E6E6" bordercolor="#FF3F3F46" inset="10,0,0,0" password="true" bordersize="1" />
|
||||
<Control height="14" />
|
||||
<Button name="btnReset" text="重置密码" height="44" bkcolor="#FF0A4E7A" textcolor="#FFFFFFFF" font="1" />
|
||||
<Label name="resetTip" text="" textcolor="#FFE08A8A" height="22" margin="0,8,0,0" />
|
||||
</VerticalLayout>
|
||||
|
||||
<VerticalLayout name="panelNotice" height="322" visible="false">
|
||||
<Label text="公 告" textcolor="#FF0A4E7A" font="1" height="30" />
|
||||
<Label name="noticeTitle" text="" textcolor="#FFE6E6E6" height="26" />
|
||||
<Control height="6" />
|
||||
<Label name="noticeBody" text="" textcolor="#FFB4B4BE" height="150" multiline="true" endellipsis="true" />
|
||||
<HorizontalLayout height="34">
|
||||
<Button name="btnNoticePrev" text="上一条" width="86" height="32" bkcolor="#FF252526" textcolor="#FFE6E6E6" />
|
||||
<Control width="8" />
|
||||
<Button name="btnNoticeNext" text="下一条" width="86" height="32" bkcolor="#FF252526" textcolor="#FFE6E6E6" />
|
||||
<Control />
|
||||
<Label name="noticeIdx" text="" textcolor="#FF5C5C68" width="54" />
|
||||
</HorizontalLayout>
|
||||
<Control height="12" />
|
||||
<Button name="btnNoticeOk" text="我知道了" height="44" bkcolor="#FF0A4E7A" textcolor="#FFFFFFFF" font="1" />
|
||||
</VerticalLayout>
|
||||
<VerticalLayout name="panelUpdate" height="300" visible="false">
|
||||
<Label text="版本更新" textcolor="#FF0A4E7A" font="1" height="28" />
|
||||
<Label name="updTitle" text="" textcolor="#FFE6E6E6" height="26" />
|
||||
<Control height="6" />
|
||||
<Label name="updNotes" text="" textcolor="#FFB4B4BE" height="130" multiline="true" endellipsis="true" />
|
||||
<Label name="updTip" text="" textcolor="#FF5C5C68" height="24" />
|
||||
<HorizontalLayout height="44">
|
||||
<Button name="btnUpdLater" text="稍后提醒" width="112" height="44" bkcolor="#FF252526" textcolor="#FFE6E6E6" />
|
||||
<Control width="10" />
|
||||
<Button name="btnUpdate" text="立即更新" height="44" bkcolor="#FF0A4E7A" textcolor="#FFFFFFFF" font="1" />
|
||||
</HorizontalLayout>
|
||||
</VerticalLayout>
|
||||
<VerticalLayout name="panelDevice" height="-1" visible="false">
|
||||
<Label name="devHead" text="设备数量已满" textcolor="#FF0A4E7A" font="1" height="28" />
|
||||
<Label name="devTitle" text="" textcolor="#FFE6E6E6" height="24" />
|
||||
<Control height="6" />
|
||||
<Label name="lblDevCard" text="卡密" textcolor="#FFB4B4BE" height="18" visible="false" />
|
||||
<Edit name="devCardKey" height="36" bkcolor="#FF252526" nativebkcolor="#FF252526" textcolor="#FFE6E6E6" bordercolor="#FF3F3F46" inset="10,0,0,0" visible="false" bordersize="1" />
|
||||
<Control name="spDevCard" height="6" visible="false" />
|
||||
<Control height="6" />
|
||||
<HorizontalLayout name="rowBox0" height="40">
|
||||
<Button name="devRow0" height="40" width="-96" bkcolor="#FF252526" textcolor="#FFE6E6E6" textalign="left" inset="10,0,0,0" />
|
||||
<Control width="8" />
|
||||
<Button name="devUnbind0" text="解绑" width="84" height="40" bkcolor="#FF0A4E7A" textcolor="#FFFFFFFF" />
|
||||
</HorizontalLayout>
|
||||
<Control height="6" />
|
||||
<HorizontalLayout name="rowBox1" height="40">
|
||||
<Button name="devRow1" height="40" width="-96" bkcolor="#FF252526" textcolor="#FFE6E6E6" textalign="left" inset="10,0,0,0" />
|
||||
<Control width="8" />
|
||||
<Button name="devUnbind1" text="解绑" width="84" height="40" bkcolor="#FF0A4E7A" textcolor="#FFFFFFFF" />
|
||||
</HorizontalLayout>
|
||||
<Control height="6" />
|
||||
<HorizontalLayout name="rowBox2" height="40">
|
||||
<Button name="devRow2" height="40" width="-96" bkcolor="#FF252526" textcolor="#FFE6E6E6" textalign="left" inset="10,0,0,0" />
|
||||
<Control width="8" />
|
||||
<Button name="devUnbind2" text="解绑" width="84" height="40" bkcolor="#FF0A4E7A" textcolor="#FFFFFFFF" />
|
||||
</HorizontalLayout>
|
||||
<Control height="6" />
|
||||
<HorizontalLayout name="rowBox3" height="40">
|
||||
<Button name="devRow3" height="40" width="-96" bkcolor="#FF252526" textcolor="#FFE6E6E6" textalign="left" inset="10,0,0,0" />
|
||||
<Control width="8" />
|
||||
<Button name="devUnbind3" text="解绑" width="84" height="40" bkcolor="#FF0A4E7A" textcolor="#FFFFFFFF" />
|
||||
</HorizontalLayout>
|
||||
<Control height="6" />
|
||||
<HorizontalLayout name="rowBox4" height="40">
|
||||
<Button name="devRow4" height="40" width="-96" bkcolor="#FF252526" textcolor="#FFE6E6E6" textalign="left" inset="10,0,0,0" />
|
||||
<Control width="8" />
|
||||
<Button name="devUnbind4" text="解绑" width="84" height="40" bkcolor="#FF0A4E7A" textcolor="#FFFFFFFF" />
|
||||
</HorizontalLayout>
|
||||
<Control height="6" />
|
||||
<HorizontalLayout name="rowBox5" height="40">
|
||||
<Button name="devRow5" height="40" width="-96" bkcolor="#FF252526" textcolor="#FFE6E6E6" textalign="left" inset="10,0,0,0" />
|
||||
<Control width="8" />
|
||||
<Button name="devUnbind5" text="解绑" width="84" height="40" bkcolor="#FF0A4E7A" textcolor="#FFFFFFFF" />
|
||||
</HorizontalLayout>
|
||||
<Control height="6" />
|
||||
<HorizontalLayout name="rowBox6" height="40">
|
||||
<Button name="devRow6" height="40" width="-96" bkcolor="#FF252526" textcolor="#FFE6E6E6" textalign="left" inset="10,0,0,0" />
|
||||
<Control width="8" />
|
||||
<Button name="devUnbind6" text="解绑" width="84" height="40" bkcolor="#FF0A4E7A" textcolor="#FFFFFFFF" />
|
||||
</HorizontalLayout>
|
||||
<Control height="6" />
|
||||
<HorizontalLayout name="rowBox7" height="40">
|
||||
<Button name="devRow7" height="40" width="-96" bkcolor="#FF252526" textcolor="#FFE6E6E6" textalign="left" inset="10,0,0,0" />
|
||||
<Control width="8" />
|
||||
<Button name="devUnbind7" text="解绑" width="84" height="40" bkcolor="#FF0A4E7A" textcolor="#FFFFFFFF" />
|
||||
</HorizontalLayout>
|
||||
<Control height="6" />
|
||||
<Control height="6" />
|
||||
<Label visible="false" text="输入要解绑的设备序号" textcolor="#FF5C5C68" height="18" />
|
||||
<Edit visible="false" name="devIdx" height="36" bkcolor="#FF252526" nativebkcolor="#FF252526" textcolor="#FFE6E6E6" bordercolor="#FF3F3F46" inset="10,0,0,0" bordersize="1" />
|
||||
<Label name="devTip" text="" textcolor="#FF5C5C68" height="22" />
|
||||
<HorizontalLayout height="44">
|
||||
<Button visible="false" name="btnUnbind" text="解绑该设备" width="118" height="44" bkcolor="#FF0A4E7A" textcolor="#FFFFFFFF" font="1" />
|
||||
<Control width="8" />
|
||||
<Button name="btnUnbindOld" text="解绑最早一台" width="118" height="44" bkcolor="#FF0A4E7A" textcolor="#FFFFFFFF" />
|
||||
<Control width="8" />
|
||||
<Button name="btnRetryLogin" text="重试" width="72" height="44" bkcolor="#FF252526" textcolor="#FFE6E6E6" />
|
||||
<Control width="8" />
|
||||
<Button name="btnBack" text="返回" width="72" height="44" bkcolor="#FF252526" textcolor="#FFE6E6E6" />
|
||||
</HorizontalLayout>
|
||||
</VerticalLayout>
|
||||
|
||||
<Label name="lblDevice" text="设备" textcolor="#FF5C5C68" height="18" margin="0,6,0,0" />
|
||||
|
||||
</VerticalLayout>
|
||||
</VerticalLayout>
|
||||
</Window>)SKIN";
|
||||
|
||||
static const char *kSkin_light = R"SKIN(<?xml version="1.0" encoding="utf-8"?>
|
||||
<Window size="470,436" caption="0,0,-1,44" mininfo="470,380" bkcolor="#FFFAFAFC">
|
||||
<VerticalLayout bkcolor="#FFFAFAFC" bordercolor="#FFDCDCE3" bordersize="1">
|
||||
@@ -1418,6 +1628,7 @@ static const char *kSkin_compact = R"SKIN(<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
struct SkinDef { const char *name; const char *xml; int w, h; };
|
||||
static const SkinDef kSkins[] = {
|
||||
{ "classic", kSkin_classic, 470, 436 },
|
||||
{ "dark", kSkin_dark, 470, 436 },
|
||||
{ "light", kSkin_light, 470, 436 },
|
||||
{ "split", kSkin_split, 680, 452 },
|
||||
|
||||
Reference in New Issue
Block a user