# TTKMusicplayer
**Repository Path**: countryboy521/TTKMusicplayer
## Basic Information
- **Project Name**: TTKMusicplayer
- **Description**: TTKMusicPlayer imitates Kugou music, the music player uses of qmmp core library based on Qt for windows and linux.
- **Primary Language**: C++
- **License**: GPL-3.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 62
- **Created**: 2025-10-22
- **Last Updated**: 2025-10-23
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# TTKMusicPlayer
[英文 English](README.md) | [繁体中文 Chinese](README_tc.md)





### **|[关于](README_cn.md#使用方法)|[许可证](README_cn.md#许可证)|[下载](README_cn.md#下载)|[特性](README_cn.md#特性)|[快照](README_cn.md#快照)|[版权](README_cn.md#版权)|[贡献](README_cn.md#贡献)|**
使用方法
--------
**音乐播放器模仿酷狗,基于Qt和Qmmp库开发,支持Windows和Linux平台。**
**编译教程我已经写在wiki上了(看这里https://github.com/Greedysky/TTKMusicPlayer/wiki )**
### 本项目代码不用于商用,仅限研究和学习使用,资源版权归个音乐平台所有。
## 构建状态
* Qt stable version is tested on Qt4.x for windows-mingw 32bit
* Qt stable version is tested on Qt4.x for ubuntu-linux-gcc 64bit
* Qt stable version is tested on Qt5.x for ubuntu-linux-gcc 64bit
* Qt stable version is tested on Qt5.x for windows-mingw 32bit
| Platform | Qt & Compiler | Status |
| :---: | :---: | :---: |
| Linux | 4.x GCC & 5.x GCC |  |
| Windows | 4.x GCC & 5.x GCC |  |
| Windows | MSVC |  |
| OS X | Clang |  |
# 开发者
许可证
--------
TTKMusicPlayer是基于[Licence GPL v3](LICENSE)条款授权的免费软件。如果您使用TTKMusicPlayer或者它的动态库,则务必添加相关许可证到项目中。
API 文档
--------
文档请看这里: **https://greedysky.github.io/ttkdocs**
下载
--------
Gitee镜像下载地址: **https://gitee.com/Greedysky/TTKMusicplayer**
Github镜像下载地址: **https://github.com/Greedysky/TTKMusicplayer**
Qmmp原版下载地址: **https://qmmp.ylsoftware.com**
Qmmp原版镜像下载地址: **https://github.com/Greedysky/qmmp**
Qmmp修改版下载地址: **https://github.com/Greedysky/TTKMusicPlayer/tree/plugins**
Qmmp更多插件下载地址: **https://github.com/TTK-qmmp**
Qmmp修改版二进制库下载地址: **http://pan.baidu.com/s/1bv4iSY**
播放器及其他依赖下载地址: **http://pan.baidu.com/s/1gdB5QLH**
皮肤下载地址: **http://pan.baidu.com/s/1mh7AeG4**
二进制下载地址: **http://pan.baidu.com/s/1kVOHN0b**
特性
--------
TTKMusicPlayer的一些特性
* 支持绝大多数的音频播放格式。
* SID File(*.sid *.psid *.mus *.str *.p00 *.prg *.c64)
* MusePack File(*.mpc)
* WavPack File(*.wv)
* Ogg Vorbis File(*.ogg *.ogv)
* Ogg Opus File(*.opus)
* ADTS AAC File(*.aac)
* MIDI File(*.mid *.mus *.hmp *.hmi *.xmi)
* PCM File(*.wav *.au *.snd *.aif *.aiff *.8svx *.sph *.sf *.voc *.w64)
* CUE File(*.cue)
* MPEG File(*.mp1 *.mp2 *.mp3)
* Game Audio File(*.ay *.gbs *.gms *.gym *.hes *.kss *.nsf *.nsfe *.sap *.spc *.vgm *.vgz)
* FLAC File(*.flac *.oga)
* Monkey's Audio File(*.ape)
* FFmpeg File(*.wma *.ape *.tta *.m4a *.m4b *.aac *.ra *.shn *.ac3 *.mka *.vqf *.tak *.spx *.adx *.aix *.wve *.sln *.paf *.pvf *.ircam *.gsm *.avr *.amr *.dsf *.dsdiff *.webm *.3g2 *.3gp *.asf *.avi *.f4v *.flv *.hevc *.m4v *.mov *.mp4 *.mpeg *.rm *.swf *.vob *.wtv)
* OpenMPT File(*.669 *.ams *.amf *.c67 *.dsm *.dmf *.dbm *.digi *.dtm *.far *.fmt *.gdm *.it *.ice *.imf *.j2b *.mod *.mptm *.m15 *.mtm *.med *.mmd *.mmd0 *.mmd1 *.mmd2 *.mmd3 *.mdl *.mt2 *.mms *.mo3 *.mmcmp *.nst *.okt *.okta *.pt36 *.ptm *.psm *.plm *.ppm *.s3m *.stm *.stk *.st26 *.sfx *.sfx2 *.stp *.ult *.umx *.wow *.xm *.xpk *.mdr *.s3r *.xmr *.itr *.mdz *.s3z *.xmz *.itz *.mdgz *.s3gz *.xmgz *.itgz *.mdbz *.s3bz *.xmbz *.itbz)
* Unix Amiga Delitracker Emulator File(*.aam *.amc *.aon *.aon8 *.aps *.ash *.ast *.avp *.bd *.bds *.bsi *.bss *.bye *.cm *.core *.cust *.dh *.dl *.dlm1 *.dlm2 *.dln *.dm *.dm2 *.dmu *.doda *.dsc *.dsr *.dss *.dw *.dz *.ea *.ems *.emsv6 *.ex *.fp *.fred *.fw *.glue *.gmc *.gray *.hd *.hip *.hip7 *.hipc *.hot *.ims *.is *.is20 *.jam *.jcb *.jcbo *.jd *.jmf *.jo *.jpo *.jt *.kh *.kim *.kris *.lion *.lme *.ma *.mc *.mcmd *.mco *.md *.mii *.mk2 *.mkii *.ml *.mm8 *.mmdc *.mok *.mon *.mosh *.mso *.mug *.mug2 *.mw *.ntp *.pap *.pn *.ps *.psa *.psf *.pt *.puma *.pvp *.rh *.rho *.riff *.rmc *.s7g *.sa *.sas *.sb *.sc *.scn *.scr *.sct *.scumm *.sdr *.sg *.sid1 *.sid2 *.sm *.sm3 *.smn *.smpro *.sng *.snk *.soc *.sog *.spl *.sqt *.ss *.sun *.syn *.synmod *.tcb *.tf *.tfmx *.thx *.tits *.tme *.tro *.tronic *.tw *.ufo *.vss *.wb *.smus *.snx *.tiny *.adsc *.dat *.dum *.osp *.dns *.jpn *.jpnd *.max *.mcr *.mfp *.npp *.pat *.qpa *.qts *.sjs *.thm *.tmk *.tpu *.uds)
* RSN Archive File(*.rsn *.rps *.rdc *.rds *.rgs *.r64)
* 7z Archive File(*.7z *.xz *.bz2 *.gz *.tar *.zip *.wim *.ar *.arj *.cab *.chm *.cpio *.cramfs *.dmg *.ext *.fat *.gpt *.hfs *.ihex *.iso *.lzh *.lzma *.mbr *.msi *.nsis *.ntfs *.qcow2 *.rar *.rpm *.squashfs *.udf *.uefi *.vdi *.vhd *.vmdk *.xar *.z)
* AdLib Sound File(*.a2m *.adl *.adlib *.agd *.amd *.as3m *.bam *.bmf *.cff *.cmf *.d00 *.dfm *.dmo *.dro *.dtm *.got *.ha2 *.hsc *.hsq *.hsp *.imf *.ims *.jbm *.laa *.lds *.m *.mad *.mdi *.mkj *.msc *.mtk *.mus *.rac *.rad *.raw *.rix *.s3m *.sa2 *.sat *.sdb *.sng *.sop *.sqx *.xad *.xms *.xsm *.vgm *.vgz *.wlf *.ksm *.rol *.sci)
* XMP File(*.abk *.dsym *.emod *.fnk *.gtk *.ims *.liq *.mfp *.mgt *.rtm *.tcb *.xmf)
* Another Slight Atari File(*.cm3 *.cmc *.cmr *.cms *.dlt *.dmc *.fc *.mpd *.mpt *.rmt *.sap *.tm2 *.tm8 *.tmc)
* DTS Coherent Acoustics File(*.dts *.cpt)
* Future Composer File(*.fc *.fc13 *.fc14 *.smod)
* OptimFrog File(*.ofr *.ofs)
* Audio Overload File(*.pcm *.msu *.spu *.psf *.ssf *.qsf *.dsf *.psf2 *.minipsf *.minissf *.miniqsf *.minidsf *.minipsf2 *.2sf *.mini2sf *.gsf *.minigsf *.usf *.miniusf *.ncsf *.minincsf *.snsf *.minisnsf)
* Quite OK Audio File(*.qoa)
* Buzzic Audio File(*.buz *buz2)
* S98 Audio File(*.s98 *.cym *.mym *.x1f)
* Atari ST(E) And Amiga File(*.sc68 *.snd *.sndh)
* Speex Audio File(*.spx)
* V2 Player File(*.v2m)
* AY/YM Audio File(*.asc *.ay *.emul *.sqt *.st13 *.stc *.stp *.stp2 *.psc *.psg *.pt1 *.pt2 *.pt3 *.vtx *.zxs)
* ST-Sound File(*.ym)
* SunVox Audio File(*.sunvox)
* Hively Audio File(*.ahx *.hvl)
* BP SoundMon Audio File(*.bp *.bp3)
* Ken Silverman's Audio File(*.kdm *.ksm *.sm *.snd)
* XMDX Game Audio File(*.mdx *.pdx *.m *.mub *.muc *.vgs *.bgm *.mml)
* Cave Story's org Audio File(*.org *.pttune *.ptcop)
* Final Music System Tracker Module File(*.tfm *.tfmx *.mdat *.tfx)
* 支持的播放列表格式(tkpl, m3u, m3u8, pls, wpl, xspf, jspf, asx, fpl, dbpl, csv, txt)
* 华丽流星炫酷的界面设计,跨平台有良好的性能表现。
* 搜索和高速下载。歌曲搜索精度优化,智能节省带宽,可以禁用网络功能,支持多个国内音乐平台曲库。
* 支持本地播放,兼容所有音频文件,超级完美的声音,音乐和更吸引人。
* 友好的用户设计。注重细节设计,个性化,操作简单,发现音乐更方便。
* 个性化手机铃声。铃声DIY,让你拥有个性化的铃声。
* 个性化皮肤。DIY你自己的个性化皮肤,创造属于你的专属皮肤。
* 音乐立方体模型。进入迷你模式后,它会在你的桌面上保留一个“三叶草”形状的图标,你可以自由拖动桌面,你想控制播放器,剪切歌曲,播放,控制歌词,控制音量。
* 彩色定制皮肤。您可以选择肤色,设置自由的透明度,并支持透明磨砂玻璃(Windows Aero效果)。
* 搜索下载管理器。搜索结果标签合并-所有的搜索结果标签集中在一个标签下,使操作更容易。
* 本地音乐搜索,云音乐库和互动。
* 支持不同音乐格式的转换,可以像汤姆猫一样改变声音,也可以增强声音。
* 本地音乐传输到云或移动设备。
* 本地音乐和人声哼唱识别。
* 支持音乐歌曲、艺术家、专辑、播放列表、热门列表和电影搜索。
* 支持音乐数字信号处理效果和视觉效果。
* 音乐歌曲谱(projectm,goom,sonique,florid,wavebar)支持。
* 支持音乐重放扫描和写入。
* 支持音乐屏幕保护程序。
* 支持MPRIS总线接口规范。
* 支持MMS和在线调频收音机。
快照
--------
### 首页

### 搜索

### 歌词

### 桌面歌词

### 遥控器

### 歌词拓展显示

### 视频

### 视频弹幕

### 音效

### 工具

### 音乐频谱

### 其他功能

版权
--------
* This file is part of the TTK Music Player project.
* Copyright (C) 2015 - 2025 Greedysky Studio.
* Mail: greedysky@163.com.
贡献
--------
* Fork this project on github and make a branch. Commit in that branch, and push, then create a pull request to be reviewed and merged.
* Create an issue if you have any problem when using project or you find a bug, etc.
* What you can do: translation, write document, wiki, find or fix bugs, give your idea for this project etc.
* If you want to join the project developed together, please send e-mail to me.
```
E:\gitee\QtTest\build-TTKMusicPlayer-Desktop_Qt_5_12_9_MinGW_64_bit-Debug\bin\4.2.0.0>"D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x86\dumpbin.exe" /headers TTKqmmp.dll
Microsoft (R) COFF/PE Dumper Version 14.29.30145.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file TTKqmmp.dll
PE signature found
File Type: DLL
FILE HEADER VALUES
14C machine (x86)
A number of sections
374B5245 time date stamp Wed May 26 09:45:41 1999
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
230E characteristics
Executable
Line numbers stripped
Symbols stripped
32 bit word machine
Debug information stripped
DLL
OPTIONAL HEADER VALUES
10B magic # (PE32)
2.24 linker version
E4400 size of code
132200 size of initialized data
8D000 size of uninitialized data
1420 entry point (67E41420)
1000 base of code
E6000 base of data
67E40000 image base (67E40000 to 68004FFF)
1000 section alignment
200 file alignment
4.00 operating system version
1.00 image version
4.00 subsystem version
0 Win32 version
1C5000 size of image
400 size of headers
138E19 checksum
2 subsystem (Windows GUI)
0 DLL characteristics
200000 size of stack reserve
1000 size of stack commit
100000 size of heap reserve
1000 size of heap commit
0 loader flags
10 number of directories
1AD000 [ 853B] RVA [size] of Export Directory
1B6000 [ 5348] RVA [size] of Import Directory
0 [ 0] RVA [size] of Resource Directory
0 [ 0] RVA [size] of Exception Directory
0 [ 0] RVA [size] of Certificates Directory
1BE000 [ 6E74] RVA [size] of Base Relocation Directory
0 [ 0] RVA [size] of Debug Directory
0 [ 0] RVA [size] of Architecture Directory
0 [ 0] RVA [size] of Global Pointer Directory
1BD004 [ 18] RVA [size] of Thread Storage Directory
0 [ 0] RVA [size] of Load Configuration Directory
0 [ 0] RVA [size] of Bound Import Directory
1B67FC [ 75C] RVA [size] of Import Address Table Directory
0 [ 0] RVA [size] of Delay Import Directory
0 [ 0] RVA [size] of COM Descriptor Directory
0 [ 0] RVA [size] of Reserved Directory
SECTION HEADER #1
.text name
E42F4 virtual size
1000 virtual address (67E41000 to 67F252F3)
E4400 size of raw data
400 file pointer to raw data (00000400 to 000E47FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
60500060 flags
Code
Initialized Data
RESERVED - UNKNOWN
RESERVED - UNKNOWN
Execute Read
SECTION HEADER #2
.data name
450 virtual size
E6000 virtual address (67F26000 to 67F2644F)
600 size of raw data
E4800 file pointer to raw data (000E4800 to 000E4DFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0700040 flags
Initialized Data
RESERVED - UNKNOWN
RESERVED - UNKNOWN
RESERVED - UNKNOWN
Read Write
SECTION HEADER #3
.rdata name
FA18 virtual size
E7000 virtual address (67F27000 to 67F36A17)
FC00 size of raw data
E4E00 file pointer to raw data (000E4E00 to 000F49FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40700040 flags
Initialized Data
RESERVED - UNKNOWN
RESERVED - UNKNOWN
RESERVED - UNKNOWN
Read Only
SECTION HEADER #4
.eh_fram name
28CAC virtual size
F7000 virtual address (67F37000 to 67F5FCAB)
28E00 size of raw data
F4A00 file pointer to raw data (000F4A00 to 0011D7FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40300040 flags
Initialized Data
RESERVED - UNKNOWN
RESERVED - UNKNOWN
Read Only
SECTION HEADER #5
.bss name
8CF70 virtual size
120000 virtual address (67F60000 to 67FECF6F)
0 size of raw data
0 file pointer to raw data
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0700080 flags
Uninitialized Data
RESERVED - UNKNOWN
RESERVED - UNKNOWN
RESERVED - UNKNOWN
Read Write
SECTION HEADER #6
.edata name
853B virtual size
1AD000 virtual address (67FED000 to 67FF553A)
8600 size of raw data
11D800 file pointer to raw data (0011D800 to 00125DFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40300040 flags
Initialized Data
RESERVED - UNKNOWN
RESERVED - UNKNOWN
Read Only
SECTION HEADER #7
.idata name
5348 virtual size
1B6000 virtual address (67FF6000 to 67FFB347)
5400 size of raw data
125E00 file pointer to raw data (00125E00 to 0012B1FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0300040 flags
Initialized Data
RESERVED - UNKNOWN
RESERVED - UNKNOWN
Read Write
SECTION HEADER #8
.CRT name
2C virtual size
1BC000 virtual address (67FFC000 to 67FFC02B)
200 size of raw data
12B200 file pointer to raw data (0012B200 to 0012B3FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0300040 flags
Initialized Data
RESERVED - UNKNOWN
RESERVED - UNKNOWN
Read Write
SECTION HEADER #9
.tls name
20 virtual size
1BD000 virtual address (67FFD000 to 67FFD01F)
200 size of raw data
12B400 file pointer to raw data (0012B400 to 0012B5FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0300040 flags
Initialized Data
RESERVED - UNKNOWN
RESERVED - UNKNOWN
Read Write
SECTION HEADER #A
.reloc name
6E74 virtual size
1BE000 virtual address (67FFE000 to 68004E73)
7000 size of raw data
12B600 file pointer to raw data (0012B600 to 001325FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
42300040 flags
Initialized Data
RESERVED - UNKNOWN
RESERVED - UNKNOWN
Discardable
Read Only
Summary
1000 .CRT
8D000 .bss
1000 .data
9000 .edata
29000 .eh_fram
6000 .idata
10000 .rdata
7000 .reloc
E5000 .text
1000 .tls
```
主程序: TTKService
### 1 TTKMusiPlayer.pro
```
# TEMPLATE = subdirs 表示当前项目是一个子目录项目(Subdirs Project),也称为 “聚合项目” 或 “工程组”。它的主要作用是管理多个子项目(子模块),实现对多个相关联的项目进行统一构建。
TEMPLATE = subdir
CONFIG += ordered
# CONFIG += ordered 的作用:当设置 ordered 时,Qt 会强制按照 SUBDIRS 列表中子项目的排列顺序进行构建,前一个子项目构建完成后,才会开始构建下一个。
SUBDIRS += TTKCommon TTKConfig TTKUi TTKThirdParty TTKModule TTKService TTKRun
TRANSLATIONS += \
$$PWD/TTKLanguage/cn.ts \
$$PWD/TTKLanguage/tc.ts \
$$PWD/TTKLanguage/en.ts
##find translation module
unix:exists($$[QT_INSTALL_BINS]/lrelease){
LRELEASE_EXECUTABLE = $$[QT_INSTALL_BINS]/lrelease
}
unix:exists($$[QT_INSTALL_BINS]/lrelease-qt5){
LRELEASE_EXECUTABLE = $$[QT_INSTALL_BINS]/lrelease-qt5
}
# 翻译程序
win32:exists($$[QT_INSTALL_BINS]/lrelease.exe){
LRELEASE_EXECUTABLE = $$[QT_INSTALL_BINS]/lrelease.exe
}
isEmpty(LRELEASE_EXECUTABLE){
error(Could not find lrelease executable)
}else{
message(Found lrelease executable: $$LRELEASE_EXECUTABLE)
}
include($$PWD/TTKVersion.pri)
unix{
system($$PWD/TTKUtils/resource.sh $$PWD/TTKResource $$OUT_PWD/bin/$$TTK_VERSION)
system($$PWD/TTKUtils/ts_unix.py $$LRELEASE_EXECUTABLE $$OUT_PWD/bin/$$TTK_VERSION $$PWD)
}
win32{
output = $$OUT_PWD/bin/$$TTK_VERSION/GLanguage
output = $$replace(output, /, \\)
# 执行脚本。
# 参数 P1 可执行程序, P2 目标路径 P3 源文件
system($$PWD/TTKUtils/ts_win.bat $$LRELEASE_EXECUTABLE $$OUT_PWD/bin/$$TTK_VERSION $$PWD)
}
```
### 2 TTKVersion.pri
```
UI_DIR = ./.build/ui
MOC_DIR = ./.build/moc
OBJECTS_DIR = ./.build/obj
RCC_DIR = ./.build/rcc
# 禁用 Qt 5.4(0x050400 对应版本号 5.4.0)之前已被标记为 “过时(deprecated)” 的 API。
# 启用对 “过时 API” 的警告提示。
greaterThan(QT_MAJOR_VERSION, 4): DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050400 QT_DEPRECATED_WARNINGS
# update time 2025.07.18
TTK_VERSION = 4.2.0.0
```
#### 3 TTKCommon
```
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS += config TTKLibrary 构建顺序
```
##### 3-1 config
```
这两行配置用于定义当前项目的构建类型和属性,声明当前项目的构建目标为库文件
TEMPLATE = lib
添加项目的配置选项,这里同时启用了 console、plugin、lib 三个选项,
CONFIG += console plugin lib
SOURCES += main.cpp
greaterThan(QT_MAJOR_VERSION, 4){ #Qt5
这个文件通常包含与项目配置相关的通用逻辑,例如:
检测系统环境(如操作系统、编译器版本)。
根据环境变量或配置选项设置编译宏(DEFINES)、包含路径(INCLUDEPATH)或链接库(LIBS)。
定义条件编译规则(如不同平台下的差异化配置)。
load(configure)
# check default module 检查默认模块
qtCompileTest(default){
message("default module test is always true")
}else{
message("default module test failed, check the platform compiler")
}
# check strlcat module
qtCompileTest(strlcat){
HAVE_STRLCAT = 1
message("string.h has strlcat function module")
}else{
HAVE_STRLCAT = 0
message("string.h hasn't strlcat function module, use compat module")
}
# check strlcpy module
qtCompileTest(strlcpy){
HAVE_STRLCPY = 1
message("string.h has strlcpy function module")
}else{
HAVE_STRLCPY = 0
没有strlcpy函数模块,使用compat模块
message("string.h hasn't strlcpy function module, use compat module")
}
CONFIG+=recheck
}else{
HAVE_STRLCAT = 0
HAVE_STRLCPY = 0
}
这种配置的典型用途是根据项目配置动态生成头文件
# configure ttk config file
ttkconfig.input = $$PWD/ttkconfig.h.qmake
ttkconfig.output = $$OUT_PWD/../../Generate/ttkconfig.h
QMAKE_SUBSTITUTES += ttkconfig
```
##### 3-2 TTKLibrary
```
QT += xml network
greaterThan(QT_MAJOR_VERSION, 4){ #Qt5
QT += widgets
}
TEMPLATE = lib
CONFIG += plugin lib
include($$PWD/../../TTKVersion.pri)
目标路径
DESTDIR = $$OUT_PWD/../../bin/$$TTK_VERSION
最后生成: TTKLibrary.dll
TARGET = TTKLibrary
DEFINES += TTK_LIBRARY
message("TTK_LIBRARY:" $$TTK_LIBRARY)
gdi32.dll 是 Windows 系统的核心图形设备接口(GDI)库,提供绘图、字体、图像显示等底层图形功能(例如绘制窗口、处理位图等)
psapi.dll(Process Status API)是 Windows 系统的进程状态接口库,提供查询进程信息的功能(例如获取进程 ID、内存使用情况、模块列表等)。
win32:LIBS += -lgdi32 -lpsapi
win32:msvc{
CONFIG += c++11
user32.dll 是 Windows 系统的核心用户界面库,提供了与窗口管理、消息处理、用户输入(鼠标 / 键盘)等相关的核心功能。
窗口创建与管理:CreateWindowEx、DestroyWindow、MoveWindow 等。
消息处理:SendMessage、PostMessage、DispatchMessage 等。
用户输入处理:GetCursorPos、SetWindowText、MessageBox 等。
LIBS += -luser32
编译器添加一个预定义宏,主要作用是禁用 Microsoft Visual C++(MSVC)编译器关于 “不安全的 C 运行时库函数” 的警告。
DEFINES += _CRT_SECURE_NO_WARNINGS
}else{
equals(QT_MAJOR_VERSION, 6){ #Qt6
QT += core5compat
QMAKE_CXXFLAGS += -std=c++17
}else{
QMAKE_CXXFLAGS += -std=c++11
}
}
.pro 中 HEADERS 和 SOURCES 的顺序不决定编译顺序。
编译顺序由文件间的依赖关系(如 #include 引用)和构建系统的并行编译策略决定。
只要代码中的依赖关系正确(如先声明后使用),无论列表顺序如何,构建系统都会自动处理编译顺序,无需手动指定。
INCLUDEPATH += \
$$PWD/../ \
$$PWD/../base
HEADERS += \
$$PWD/../base/ttkcompat.h \
$$PWD/../base/ttkglobal.h \
$$PWD/../base/ttklogger.h \
$$PWD/../base/ttkmoduleexport.h \
$$PWD/../base/ttkprivate.h \
$$PWD/../base/ttkqtcompat.h \
$$PWD/../base/ttkqtglobal.h \
$$PWD/../base/ttkqtobject.h \
$$PWD/../base/ttksingleton.h \
$$PWD/../base/ttktraits.h \
$$PWD/../ttkobject.h \
$$PWD/../ttkversion.h
HEADERS += \
$$PWD/ttkabstractbufferinterface.h \
$$PWD/ttkabstractmovedialog.h \
$$PWD/ttkabstractmoveresizewidget.h \
$$PWD/ttkabstractmovewidget.h \
$$PWD/ttkabstractnetwork.h \
$$PWD/ttkabstractresizeinterface.h \
$$PWD/ttkabstracttablewidget.h \
$$PWD/ttkabstractthread.h \
$$PWD/ttkabstractxml.h \
$$PWD/ttkany.h \
$$PWD/ttkclickedgroup.h \
$$PWD/ttkclickedlabel.h \
$$PWD/ttkclickedslider.h \
$$PWD/ttkcommandline.h \
$$PWD/ttkconcurrent.h \
$$PWD/ttkconcurrentdata.h \
$$PWD/ttkconcurrentqueue.h \
$$PWD/ttkcryptographichash.h \
$$PWD/ttkdefer.h \
$$PWD/ttkdesktopscreen.h \
$$PWD/ttkdispatchmanager.h \
$$PWD/ttkdumper.h \
$$PWD/ttkeventloop.h \
$$PWD/ttkfileassociation.h \
$$PWD/ttkfileinterface.h \
$$PWD/ttkfunctor.h \
$$PWD/ttkglobalinterface.h \
$$PWD/ttkinitialization.h \
$$PWD/ttkitemdelegate.h \
$$PWD/ttklexicalcast.h \
$$PWD/ttklibrary.h \
$$PWD/ttklibraryversion.h \
$$PWD/ttklogoutput.h \
$$PWD/ttkoptional.h \
$$PWD/ttkplatformsystem.h \
$$PWD/ttkprocess.h \
$$PWD/ttkregularexpression.h \
$$PWD/ttksmartptr.h \
$$PWD/ttkspinlock.h \
$$PWD/ttkstringliterals.h \
$$PWD/ttkstringview.h \
$$PWD/ttksuperenum.h \
$$PWD/ttktabbutton.h \
$$PWD/ttkthemelinelabel.h \
$$PWD/ttktime.h \
$$PWD/ttktoastlabel.h \
$$PWD/ttktree.h \
$$PWD/ttkunsortedmap.h \
$$PWD/ttkvariant.h
SOURCES += \
$$PWD/ttkabstractmovedialog.cpp \
$$PWD/ttkabstractmoveresizewidget.cpp \
$$PWD/ttkabstractmovewidget.cpp \
$$PWD/ttkabstractnetwork.cpp \
$$PWD/ttkabstracttablewidget.cpp \
$$PWD/ttkabstractthread.cpp \
$$PWD/ttkabstractxml.cpp \
$$PWD/ttkany.cpp \
$$PWD/ttkclickedgroup.cpp \
$$PWD/ttkclickedlabel.cpp \
$$PWD/ttkclickedslider.cpp \
$$PWD/ttkcommandline.cpp \
$$PWD/ttkcryptographichash.cpp \
$$PWD/ttkdesktopscreen.cpp \
$$PWD/ttkdispatchmanager.cpp \
$$PWD/ttkdumper.cpp \
$$PWD/ttkeventloop.cpp \
$$PWD/ttkfileassociation.cpp \
$$PWD/ttkglobalinterface.cpp \
$$PWD/ttkinitialization.cpp \
$$PWD/ttkitemdelegate.cpp \
$$PWD/ttklogoutput.cpp \
$$PWD/ttkplatformsystem.cpp \
$$PWD/ttkprocess.cpp \
$$PWD/ttkregularexpression.cpp \
$$PWD/ttksuperenum.cpp \
$$PWD/ttktabbutton.cpp \
$$PWD/ttkthemelinelabel.cpp \
$$PWD/ttktime.cpp \
$$PWD/ttktoastlabel.cpp
RESOURCES += $$PWD/$${TARGET}.qrc
win32:RC_FILE = $$PWD/$${TARGET}.rc
```
#### 2 TTKConfig
```
QT += core
TEMPLATE = lib
CONFIG += plugin lib
include($$PWD/../TTKVersion.pri)
# 指定目录
DESTDIR = $$OUT_PWD/../bin/$$TTK_VERSION
TARGET = TTKConfig
# 依赖
DEFINES += TTK_LIBRARY
win32:msvc{
CONFIG += c++11
}else{
equals(QT_MAJOR_VERSION, 6){ #Qt6
QMAKE_CXXFLAGS += -std=c++17
}else{
QMAKE_CXXFLAGS += -std=c++11
}
}
头文件
INCLUDEPATH += \
$$PWD/../TTKCommon \
$$PWD/../TTKCommon/base \
$$PWD/../TTKModule/TTKCore/musicCoreKits
HEADERS += \
$$PWD/musicconfigdefine.h \ 宏定义
$$PWD/musicconfigmodule.h
提供目录检测接口
SOURCES += $$PWD/musicconfigmodule.cpp
RESOURCES += $$PWD/../TTKUi/TTKApp.qrc
win32:RC_FILE = $$PWD/$${TARGET}.rc
```
#### 2 TTKUi
```
这些生成的代码会被编译并链接到你的库(TTKUi.dll 等)中,资源数据以二进制形式存储在库文件内部。
TEMPLATE = lib
msvc:CONFIG += staticlib
CONFIG += plugin lib
include($$PWD/../TTKVersion.pri)
目标路径
DESTDIR = $$OUT_PWD/../bin/$$TTK_VERSION
TARGET = TTKUi
音频和图片资源
RESOURCES += $$PWD/TTKModule.qrc
win32:RC_FILE = $$PWD/$${TARGET}.rc
```
#### 2 TTKThirdParty
```
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS += Zlib TTKWatcher TTKExtras
```
##### 2-1 Zlib
```
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS += zlib ttkzip
```
###### 2-1-1 zlib
```
压缩库的目标相关实用程序函数
TEMPLATE = lib
CONFIG += warn_off plugin lib
include($$PWD/../../../TTKVersion.pri)
DESTDIR = $$OUT_PWD/../../../bin/$$TTK_VERSION
TARGET = zlib
DEFINES += ZLIB_DLL
HEADERS += \
$$PWD/zconf.h \
$$PWD/zlib.h \
$$PWD/crc32.h \
$$PWD/deflate.h \
$$PWD/gzguts.h \
$$PWD/inffixed.h \
$$PWD/inffast.h \
$$PWD/inflate.h \
$$PWD/inftrees.h \
$$PWD/trees.h \
$$PWD/zutil.h
SOURCES += \
$$PWD/adler32.c \
$$PWD/compress.c \
$$PWD/crc32.c \
$$PWD/deflate.c \
$$PWD/gzclose.c \
$$PWD/gzlib.c \
$$PWD/gzread.c \
$$PWD/gzwrite.c \
$$PWD/inflate.c \
$$PWD/infback.c \
$$PWD/inftrees.c \
$$PWD/inffast.c \
$$PWD/trees.c \
$$PWD/uncompr.c \
$$PWD/zutil.c
win32:RC_FILE = $$PWD/$${TARGET}.rc
```
###### 2-1-2 ttkzip 压缩
```
使用zlib对.zip文件进行IO处理
TEMPLATE = lib
CONFIG += warn_off plugin lib
include($$PWD/../../../TTKVersion.pri)
DESTDIR = $$OUT_PWD/../../../bin/$$TTK_VERSION
TARGET = ttkzip
DEFINES += \
ZLIB_DLL \
ZLIB_INTERNAL
LIBS += -L$$DESTDIR -lzlib
INCLUDEPATH += $$PWD/../
HEADERS += \
$$PWD/zip.h \
$$PWD/unzip.h \
$$PWD/mztools.h \
$$PWD/ioapi.h \
$$PWD/crypt.h
SOURCES += \
$$PWD/zip.c \
$$PWD/unzip.c \
$$PWD/mztools.c \
$$PWD/ioapi.c
win32{
HEADERS += $$PWD/iowin32.h
SOURCES += $$PWD/iowin32.c
RC_FILE = $$PWD/$${TARGET}.rc
}
```
##### 2-2 TTKWatcher 硬件设备检测类
```
QT += core
TEMPLATE = lib
CONFIG += warn_off plugin lib
include($$PWD/../../TTKVersion.pri)
目标路径
DESTDIR = $$OUT_PWD/../../bin/$$TTK_VERSION
TARGET = TTKWatcher
DEFINES += TTK_LIBRARY
unix{
macx{
SOURCES += $$PWD/qdevicewatcher_mac.cpp
LIBS += -framework DiskArbitration -framework Foundation
}else{
SOURCES += $$PWD/qdevicewatcher_linux.cpp
}
}
win32{
wince*: SOURCES += $$PWD/qdevicewatcher_wince.cpp
else: SOURCES += $$PWD/qdevicewatcher_win32.cpp
LIBS *= -luser32
}
win32:msvc{
CONFIG += c++11
}else{
equals(QT_MAJOR_VERSION, 6){ #Qt6
QMAKE_CXXFLAGS += -std=c++17
QT += core5compat
}else{
QMAKE_CXXFLAGS += -std=c++11
}
}
HEADERS += \
$$PWD/qdevicewatcher_p.h \
$$PWD/qdevicewatcher.h
SOURCES += $$PWD/qdevicewatcher.cpp
#load extra define
include($$PWD/../TTKThirdParty.pri)
win32:RC_FILE = $$PWD/$${TARGET}.rc
```
###### 2-1-3 TTKThirdParty
```
包含头文件
INCLUDEPATH += \
$$PWD \
$$PWD/Zlib \
$$PWD/TTKWatcher \
$$PWD/TTKExtras \
$$PWD/../TTKCommon \
$$PWD/../TTKCommon/base \
$$PWD/../TTKCommon/TTKLibrary
```
##### 2-3 TTKExtras
```
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4){ #Qt5
QT += widgets
}
TEMPLATE = lib
CONFIG += plugin lib
include($$PWD/../../TTKVersion.pri)
DESTDIR = $$OUT_PWD/../../bin/$$TTK_VERSION
TARGET = TTKExtras
DEFINES += TTK_LIBRARY
win32:msvc{
LIBS += -luser32
CONFIG += c++11
}else{
equals(QT_MAJOR_VERSION, 6){ #Qt6
QMAKE_CXXFLAGS += -std=c++17
}else{
QMAKE_CXXFLAGS += -std=c++11
}
}
依赖库文件
LIBS += -L$$DESTDIR -lTTKLibrary -lTTKUi
#load extra define
include($$PWD/../TTKThirdParty.pri)
include($$PWD/qalgorithm/QAlgorithm.pri)
include($$PWD/qdlna/QDlna.pri)
include($$PWD/qhttpserver/QHttpServer.pri)
include($$PWD/qsync/QSync.pri)
include($$PWD/qjson/QJson.pri)
include($$PWD/qkugou/QKuGou.pri)
include($$PWD/qrencode/QRencode.pri)
include($$PWD/qshortcut/QShortCut.pri)
win32:RC_FILE = $$PWD/$${TARGET}.rc
```
###### 2-1-5 QAlgorithm 算法模块
```
INCLUDEPATH += $$PWD
HEADERS += \
$$PWD/aes.h \
$$PWD/aes_locl.h \
$$PWD/cbc128.h \
$$PWD/aeswrapper.h \
$$PWD/deswrapper.h \
$$PWD/imagewrapper.h
SOURCES += \
$$PWD/aes_ecb.cpp \
$$PWD/aes_cbc.cpp \
$$PWD/aes_core.cpp \
$$PWD/cbc128.cpp \
$$PWD/aeswrapper.cpp \
$$PWD/deswrapper.cpp \
$$PWD/imagewrapper.cpp
```
###### 2-1-6 QDlna-TCP 网络请求处理类型
```
QT += network xml
INCLUDEPATH += $$PWD
HEADERS += \
$$PWD/qdlna.h \
$$PWD/qdlnafinder.h \
$$PWD/qdlnafileserver.h \
$$PWD/qdlnaclient.h \
$$PWD/qdlnaservice.h \
$$PWD/qdlnaxml.h
SOURCES += \
$$PWD/qdlna.cpp \
$$PWD/qdlnafinder.cpp \
$$PWD/qdlnafileserver.cpp \
$$PWD/qdlnaclient.cpp \
$$PWD/qdlnaxml.cpp
```
###### 2-1-7 QHttpServer
```
QT += network
INCLUDEPATH += $$PWD
HEADERS += \
$$PWD/http_parser.h \
$$PWD/qhttpconnection.h \
$$PWD/qhttpserver.h \
$$PWD/qhttprequest.h \
$$PWD/qhttpresponse.h \
$$PWD/qhttpserverfwd.h
SOURCES += \
$$PWD/http_parser.c \
$$PWD/qhttpconnection.cpp \
$$PWD/qhttpserver.cpp \
$$PWD/qhttprequest.cpp \
$$PWD/qhttpresponse.cpp
```
2-1-8 QJSON
```
INCLUDEPATH += $$PWD
HEADERS += \
$$PWD/json.h \
$$PWD/QJsonArray.h \
$$PWD/QJsonDocument.h \
$$PWD/QJsonObject.h \
$$PWD/QJsonParseError.h \
$$PWD/QJsonValue.h \
$$PWD/QJsonValueRef.h \
$$PWD/QJsonParser.h \
$$PWD/QJsonRoot.h
SOURCES += \
$$PWD/QJsonArray.cpp \
$$PWD/QJsonDocument.cpp \
$$PWD/QJsonObject.cpp \
$$PWD/QJsonParseError.cpp \
$$PWD/QJsonValue.cpp \
$$PWD/QJsonValueRef.cpp \
$$PWD/QJsonParser.cpp
```
###### 2-1-8 QKuGou 窗口
```
TTK_WEB_MODULE = 0
win32{
DEFINES += TTK_MINIBLINK
TTK_WEB_MODULE = 1
}else{
equals(QT_MAJOR_VERSION, 4){
DEFINES += TTK_WEBKIT
QT += webkit webkitwidgets
TTK_WEB_MODULE = 2
}
equals(QT_MAJOR_VERSION, 5){
unix:!mac{
exists($$[QT_INSTALL_LIBS]/libQt5WebKit.so){
QT += webkit webkitwidgets
DEFINES += TTK_WEBKIT
TTK_WEB_MODULE = 2
}
#5.6 or later use webengine
greaterThan(QT_MINOR_VERSION, 5){
exists($$[QT_INSTALL_LIBS]/libQt5WebEngine.so){
QT += webenginewidgets
DEFINES -= TTK_WEBKIT
DEFINES += TTK_WEBENGINE
TTK_WEB_MODULE = 3
}
}
}
mac{
exists($$[QT_INSTALL_LIBS]/libQt5WebKit.dylib){
QT += webkit webkitwidgets
DEFINES += TTK_WEBKIT
TTK_WEB_MODULE = 2
}
#5.6 or later use webengine
greaterThan(QT_MINOR_VERSION, 5){
exists($$[QT_INSTALL_LIBS]/libQt5WebEngine.dylib){
QT += webenginewidgets
DEFINES -= TTK_WEBKIT
DEFINES += TTK_WEBENGINE
TTK_WEB_MODULE = 3
}
}
}
}
}
找到Qt web组件,通过Qt miniblink在酷狗模块中构建
equals(TTK_WEB_MODULE, 1): message("Found Qt web component, build in KuGou module by Qt miniblink")
equals(TTK_WEB_MODULE, 2): message("Found Qt web component, build in KuGou module by Qt webkit")
equals(TTK_WEB_MODULE, 3): message("Found Qt web component, build in KuGou module by Qt webengine")
equals(TTK_WEB_MODULE, 0): message("Not found Qt web component, build in KuGou module by none web component")
INCLUDEPATH += $$PWD
HEADERS += \
$$PWD/qkugouurl.h \
$$PWD/qkugouwindow.h \
$$PWD/qkugouuiobject.h
SOURCES += \
$$PWD/qkugouurl.cpp \
$$PWD/qkugouwindow.cpp
win32:include($$PWD/miniblink/miniblink.pri)
```
###### 2-1-9 miniblink 浏览器内核
Miniblink 是一个独立的、追求极致小巧的浏览器内核项目。它保持了约 10M 的极简大小,是所有同类产品中最小的体积,同时支持 Windows XP 和 NPAPI。
```
HEADERS += \
$$PWD/wke.h \
$$PWD/miniblink.h
SOURCES += \
$$PWD/miniblink.cpp
```
###### 2-1-10 二维码编码
```
INCLUDEPATH += $$PWD
HEADERS += \
$$PWD/qrcodewidget.h \
$$PWD/bitstream.h \
$$PWD/config.h \
$$PWD/mask.h \
$$PWD/mmask.h \
$$PWD/mqrspec.h \
$$PWD/qrencode_inner.h \
$$PWD/qrencode.h \
$$PWD/qrinput.h \
$$PWD/qrspec.h \
$$PWD/rscode.h \
$$PWD/rsecc.h \
$$PWD/split.h
SOURCES += \
$$PWD/qrcodewidget.cpp \
$$PWD/bitstream.c \
$$PWD/mask.c \
$$PWD/mmask.c \
$$PWD/mqrspec.c \
$$PWD/qrencode.c \
$$PWD/qrinput.c \
$$PWD/qrspec.c \
$$PWD/rscode.c \
$$PWD/rsecc.c \
$$PWD/split.c
```
###### 2-1-11 快捷键
```
unix:!mac{
equals(QT_MAJOR_VERSION, 5):greaterThan(QT_MINOR_VERSION, 0){
QT += x11extras
}
}
INCLUDEPATH += $$PWD
HEADERS += \
$$PWD/qglobalshortcut.h \
$$PWD/qglobalshortcut_p.h
win32{
SOURCES += $$PWD/qglobalshortcut_win.cpp
LIBS += -luser32
}
unix:SOURCES += $$PWD/qglobalshortcut_x11.cpp
mac{
SOURCES += $$PWD/qglobalshortcut_mac.cpp
# qglobalshortcut_mac.cpp needs this.
# Notice, it cannot work on recent macOS versions,
# so either additional implementation is needed, using
# modern API, or at least a dummy fallback.
LIBS += -framework Carbon
}
SOURCES += $$PWD/qglobalshortcut.cpp
```
###### 2-1-12 QSync 同步云数据接口的类
```
QT += network
INCLUDEPATH += $$PWD
HEADERS += \
$$PWD/qsyncconfig.h \
$$PWD/qsyncdataitem.h \
$$PWD/qsyncutils.h \
$$PWD/qsyncdatainterface.h \
$$PWD/qsyncdatainterface_p.h \
$$PWD/qsynclistdata.h \
$$PWD/qsyncdeletedata.h \
$$PWD/qsyncuploaddata.h \
$$PWD/qsyncdownloaddata.h
SOURCES += \
$$PWD/qsyncconfig.cpp \
$$PWD/qsyncutils.cpp \
$$PWD/qsyncdatainterface.cpp \
$$PWD/qsynclistdata.cpp \
$$PWD/qsyncdeletedata.cpp \
$$PWD/qsyncuploaddata.cpp \
$$PWD/qsyncdownloaddata.cpp
```
### 2 TTKModule 应用程序主小部件的类
```
TEMPLATE = lib
CONFIG += plugin lib
include($$PWD/TTKModule.pri)
include($$PWD/../TTKMusicPlayer.pri)
##qmmp lib check
win32{
QMMP_DEPANDS = $$DESTDIR/TTKqmmp.dll
QMMP_DEPANDS = $$replace(QMMP_DEPANDS, /, \\)
}
unix:!mac:QMMP_DEPANDS = $$DESTDIR/libTTKqmmp.so
mac:QMMP_DEPANDS = $$DESTDIR/libTTKqmmp.dylib
!exists($$QMMP_DEPANDS): error("Could not find ttk qmmp library, please download and put it to output dir")
TARGET = TTKCore
使用第三方库
INCLUDEPATH += \
$$PWD \
$$PWD/../TTKThirdParty/TTKqmmp
HEADERS += \
$$PWD/musicapplication.h \
$$PWD/musicapplicationmodule.h \
$$PWD/musicleftareawidget.h \
$$PWD/musictopareawidget.h \
$$PWD/musicrightareawidget.h \
$$PWD/musicbottomareawidget.h
SOURCES += \
$$PWD/musicapplication.cpp \
$$PWD/musicapplicationmodule.cpp \
$$PWD/musicleftareawidget.cpp \
$$PWD/musictopareawidget.cpp \
$$PWD/musicrightareawidget.cpp \
$$PWD/musicbottomareawidget.cpp
win32:RC_FILE = $$PWD/$${TARGET}.rc
```
#### 2-1 TTKModule
```
include($$PWD/musicCoreKits/MusicCoreKits.pri)
include($$PWD/musicLrcKits/MusicLrcKits.pri)
include($$PWD/musicNetworkKits/MusicNetworkKits.pri)
include($$PWD/musicPlaylistKits/MusicPlaylistKits.pri)
include($$PWD/musicSearchKits/MusicSearchKits.pri)
include($$PWD/musicToolsKits/MusicToolsKits.pri)
include($$PWD/musicToolsSetsKits/MusicToolsSetsKits.pri)
include($$PWD/musicUtilsKits/MusicUtilsKits.pri)
```