Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
izuolan committed Dec 24, 2024
0 parents commit 2486e24
Show file tree
Hide file tree
Showing 71 changed files with 12,649 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/gen/
/res/scripts
/res/vip-pool-server-list.txt
/res/keys/
*.user
*.autosave
*~
*.exe
.vs/
.vscode/
.DS_Store
msvc_make.bat
85 changes: 85 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# BTC tools GUI

## Build

### Linux

See details: https://github.com/btccom/btctools-snap

### Windows

1. Compile and install [libbtctools](https://github.com/btccom/libbtctools), details:[libbtctools:README.md](https://github.com/btccom/libbtctools/blob/master/README.md#build-on-windows)

2. Compile and install qt and libcurl (the vcpkg command used was already installed in the first step):

```bash
cd vcpkg

# 32-bit
.\vcpkg install qt5:x86-windows-static curl:x86-windows-static

# 64-bit
.\vcpkg install qt5:x64-windows-static curl:x64-windows-static
```

3. Install Qt Creator, the installation package can be downloaded here: https://download.qt.io/official_releases/qtcreator/

After installation, open Qt Creator > Tools > Options > Kits, click "Add", add the following **qmake.exe** to it, and then click "Apply":

- `F:\work\vcpkg\installed\x86-windows-static\tools\qt5\bin\qmake.exe`

Fill in the **Name** input box: `Qt %{Qt:Version} x86`

- `F:\work\vcpkg\installed\x64-windows-static\tools\qt5\bin\qmake.exe`

Fill in the **Name** input box: `Qt %{Qt:Version} x64`

Replace `F:\work\vcpkg` with your `vcpkg` installation path.

![qt-versions](doc/img/qt-versions.jpg)

4. Click the "Kits" tab next to "Qt Versions", and then click "Desktop (x86)" in "Manual", select "Qt version" as the x86 version of qt you just added. Desktop (x86......)", and select "Qt version" as the x86 version of qt you just added.

Then select "Desktop (x64......)" and choose "Qt version" as the x64 version of qt you just added.

![qt-kits](doc/img/qt-kits.jpg)

5. Clone this project in the parent directory of the "libbtctools" project and create a symbolic link to "libbtctools":

```bash
git clone https://github.com/btccom/btctools-gui.git
cd btctools-gui
.\mklink.bat
```

6. Use Qt Creator to open "btctools-gui.pro" in this project, then check the desired "Kits", and then click "Configure Project and click "Configure Project".

![qt-configure](doc/img/qt-configure.jpg)

7. Click "Project" on the left side of Qt Creator, then click "Build" for 32-bit Kit in "Build & Run", then scroll to the "Build Environment" section. "Build Environment" section, click "Details" to expand the environment variable editor, click "Bulk Edit" button on the right side, fill in the following content (Modify `F:\work` to your actual installation path):

```bash
BTCTOOLS_INCLUDE_DIR=F:\work\lib32\btctools\include
BTCTOOLS_LIB_DIR=F:\work\lib32\btctools\lib
LUA_INCLUDE_DIR=F:\work\vcpkg\installed\x86-windows-static\include\luajit
LUA_LIB_DIR=F:\work\vcpkg\installed\x86-windows-static\lib
QT_INCLUDE_DIR=F:\work\vcpkg\installed\x86-windows-static\include
QT_LIB_DIR=F:\work\vcpkg\installed\x86-windows-static\lib
```

If it is a 64-bit Kit, fill in the following:

```bash
BTCTOOLS_INCLUDE_DIR=F:\work\lib64\btctools\include
BTCTOOLS_LIB_DIR=F:\work\lib64\btctools\lib
LUA_INCLUDE_DIR=F:\work\vcpkg\installed\x64-windows-static\include\luajit
LUA_LIB_DIR=F:\work\vcpkg\installed\x64-windows-static\lib
QT_INCLUDE_DIR=F:\work\vcpkg\installed\x64-windows-static\include
QT_LIB_DIR=F:\work\vcpkg\installed\x64-windows-static\lib
```

![qt-envs.jpg](doc/img/qt-envs.jpg)

8. Trying to compile the project for 32-bit and 64-bit Release. Since the libbtctools library only compiles the Release version, it cannot be Debug compiled.

9. If you are prompted that the header file or library file cannot be found, remember to delete the temporary compilation folder, which is in the same directory as btctools-gui, and the directory name is like "build-btctools-gui-Desktop_x86_windows_msvc2022_pe_32bit-Release". The compiled exe is also located here.
126 changes: 126 additions & 0 deletions btctools-gui.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
#-------------------------------------------------
#
# Project created by QtCreator 2017-03-20T15:38:12
#
#-------------------------------------------------

QT += core gui network widgets sql

#-------------------------------------------------
# uncoment the follow line if the program cannot be executed in Windows XP.
#-------------------------------------------------

TARGET = btctools-gui
TEMPLATE = app
RC_FILE = res/appinfo.rc

SOURCES += src/main.cpp\
src/minerscanner.cpp \
src/minertablemodel.cpp \
src/mainwindow.cpp \
src/minerconfigurator.cpp \
src/autoupdater.cpp \
src/iprangeedit.cpp \
src/iprangelistitem.cpp \
src/minerrebooter.cpp \
src/iprangeedititem.cpp \
src/iprangewindow.cpp \
src/passworddelegate.cpp \
src/utils.cpp \
src/settingwindow.cpp \
src/checkmessagebox.cpp \
src/upgradewindow.cpp \
src/minerupgrader.cpp

HEADERS += \
src/passworddelegate.h \
src/translation.h\
src/minerscanner.h \
src/minertablemodel.h \
src/mainwindow.h \
src/minerconfigurator.h \
src/config.h \
src/autoupdater.h \
src/iprangeedit.h \
src/iprangelistitem.h \
src/minerrebooter.h \
src/iprangewindow.h \
src/iprangeedititem.h \
src/utils.h \
src/settingwindow.h \
src/checkmessagebox.h \
src/upgradewindow.h \
src/minerupgrader.h

FORMS += \
res/ui/mainwindow.ui \
res/ui/iprangewindow.ui \
res/ui/settingwindow.ui \
res/ui/upgradewindow.ui

DISTFILES += \
doc/miner-type-stat-spec.md \
doc/auto-update-spec.md \
.gitignore \
res/locale/zh_CN.ts \
res/appinfo.rc \
res/update-data-linuxsnap-amd64.json \
res/update-data-linuxsnap-arm64.json \
res/update-data-winexe-i386.json

RESOURCES += \
res/resources.qrc

TRANSLATIONS += \
res/locale/zh_CN.ts

win32 {
CONFIG(debug, debug|release) {
LIBS += -lbtctools -llua51 -lcryptopp-static -llibcurl-d -llibssl -llibcrypto \
-lboost_regex-vc140-mt-gd -lboost_chrono-vc140-mt-gd -lboost_context-vc140-mt-gd \
-lbz2d -lzlibd -lws2_32 -lwldap32 -lcrypt32
} else {
LIBS += -lbtctools -llua51 -lcryptopp-static -llibcurl -llibssl -llibcrypto \
-lboost_regex-vc140-mt -lboost_chrono-vc140-mt -lboost_context-vc140-mt \
-lbz2 -lzlib -lws2_32 -lwldap32 -lcrypt32
}
} else {
LIBS += -lbtctools -llua5.1 -lcryptopp -lcurl -lssl -lcrypto \
-lboost_regex -lboost_system -lboost_chrono -lboost_context
}

msvc: QMAKE_CXXFLAGS += -source-charset:utf-8 -D_WIN32_WINNT=0x0601 -DWIN32_LEAN_AND_MEAN

defineTest(envNotEmpty) {
env = $$1
isEmpty(env) {
return(false)
} else {
return(true)
}
}

envNotEmpty("$$(QT_INCLUDE_DIR)") {
INCLUDEPATH += "$$(QT_INCLUDE_DIR)"
TR_EXCLUDE += "$$(QT_INCLUDE_DIR)/*"
}

envNotEmpty("$$(BTCTOOLS_INCLUDE_DIR)") {
INCLUDEPATH += "$$(BTCTOOLS_INCLUDE_DIR)"
TR_EXCLUDE += "$$(BTCTOOLS_INCLUDE_DIR)/*"
}
envNotEmpty("$$(LUA_INCLUDE_DIR)") {
INCLUDEPATH += "$$(LUA_INCLUDE_DIR)"
TR_EXCLUDE += "$$(LUA_INCLUDE_DIR)/*"
}
envNotEmpty("$$(CRYPTOPP_INCLUDE_DIR)") {
INCLUDEPATH += "$$(CRYPTOPP_INCLUDE_DIR)"
TR_EXCLUDE += "$$(CRYPTOPP_INCLUDE_DIR)/*"
}

envNotEmpty("$$(QT_LIB_DIR)"): LIBS += -L"$$(QT_LIB_DIR)"
envNotEmpty("$$(BTCTOOLS_LIB_DIR)"): LIBS += -L"$$(BTCTOOLS_LIB_DIR)"
envNotEmpty("$$(LUA_LIB_DIR)"): LIBS += -L"$$(LUA_LIB_DIR)"
envNotEmpty("$$(CRYPTOPP_LIB_DIR)"): LIBS += -L"$$(CRYPTOPP_LIB_DIR)"

envNotEmpty("$$(PLATFORM_NAME)"): QMAKE_CXXFLAGS += -DPLATFORM_NAME="'\"$$(PLATFORM_NAME)\"'"
14 changes: 14 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
set BTCTOOLS_INCLUDE_DIR=C:\Users\hu60c\lib32\btctools\include
set BTCTOOLS_LIB_DIR=C:\Users\hu60c\lib32\btctools\lib
set LUA_INCLUDE_DIR=C:\Users\hu60c\vcpkg\installed\x86-windows-static\include\luajit
set LUA_LIB_DIR=C:\Users\hu60c\vcpkg\installed\x86-windows-static\lib
set CRYPTOPP_INCLUDE_DIR=C:\Users\hu60c\vcpkg\installed\x86-windows-static\include
set CRYPTOPP_LIB_DIR=C:\Users\hu60c\vcpkg\installed\x86-windows-static\lib

md build
cd build

C:\Users\hu60c\vcpkg\installed\x86-windows-static\tools\qt5\bin\qmake.exe ..\btctools-gui.pro
C:\Users\hu60c\vcpkg\downloads\tools\jom\jom-1.1.3\jom.exe

cd ..
26 changes: 26 additions & 0 deletions doc/auto-update-spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Auto Update Specification (Language: zh_CN)
## 自动更新规范

### 客户端的自动更新请求
1. 请求形式为 HTTP GET。
2. 支持 HTTPS。
3. User-Agent 为 "BTC Tools v1.0" 这样的格式
4. 客户端会附加扩展头信息 X-App-Version-Id 和 X-App-Version-Name 用于服务器端识别其版本。

### 服务器的自动更新响应
1. 响应数据为JSON类型
2. 格式如下:
```json
{
"minVersionId": 1,
"versionId": 2,
"versionName": "v1.1",
"desc": "this is a test update\ntest update\ntest update",
"desc_zh_CN": "这是一个测试更新\n测试更新\n测试更新",
"downloadUrl": "https://pool.btc.com/tools"
}
```
3. `minVersionId`为允许运行的最小版本号,小于该版本号的客户端将会要求强制更新。
4. `versionId`为当前最新的版本号,`versionName`为对应的版本名。
5. `desc_zh_CN`为中文更新说明,其他语言的更新说明为`desc_对应的语言`,如`desc_en_US`
6. 如果没有对应语言代码的更新说明,客户端使用`desc`做为其更新说明。目前建议`desc`中的内容使用英语。
28 changes: 28 additions & 0 deletions doc/build-boost-for-xp/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
https://blogs.msdn.microsoft.com/vcblog/2012/10/08/windows-xp-targeting-with-c-in-visual-studio-2012/

Targeting from the Command Line

Visual Studio 2012 solutions and projects which have been switched to the v110_xp toolset can be built from the command line using MSBuild or DEVENV without additional steps.

However, if you wish to use CL and Link directly, additional steps are needed. Note that the steps below may be automated by creating a batch script.

Set the path and environment variables for Visual Studio 2012 command-line builds.
Set the required SDK paths and compiler flags using the following commands:

set INCLUDE=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Include;%INCLUDE%
set PATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Bin;%PATH%
set LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Lib;%LIB%
set CL=/D_USING_V110_SDK71_;%CL%

When targeting x64, set the lib path as follows:
set LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Lib\x64;%LIB%

Specify the correct subsystem and subsystem version for the linker based on the type of application you are building. Applications targeting the x86 version of Windows XP must specify subsystem version 5.01, and applications targeting x64 must specify version 5.02.

For x86 console applications:
set LINK=/SUBSYSTEM:CONSOLE,5.01 %LINK%

For x64 console applications:
set LINK=/SUBSYSTEM:CONSOLE,5.02 %LINK%

Execute CL and Link as you normally would within the command prompt.
14 changes: 14 additions & 0 deletions doc/build-boost-for-xp/build-boost-for-xp.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
set baseDIR=%cd%
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64_x86
cd %baseDIR%

SET PATH=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin;%PATH%
SET INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include;%INCLUDE%
SET LIB=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib;%LIB%
SET CL=/D_USING_V110_SDK71_;%CL%

CALL bootstrap
pause

b2 --stagedir=./stage.xp --build-type=minimal toolset=msvc-14.1_xp variant=release link=static threading=multi runtime-link=static
pause
28 changes: 28 additions & 0 deletions doc/build-luajit-for-xp/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
https://blogs.msdn.microsoft.com/vcblog/2012/10/08/windows-xp-targeting-with-c-in-visual-studio-2012/

Targeting from the Command Line

Visual Studio 2012 solutions and projects which have been switched to the v110_xp toolset can be built from the command line using MSBuild or DEVENV without additional steps.

However, if you wish to use CL and Link directly, additional steps are needed. Note that the steps below may be automated by creating a batch script.

Set the path and environment variables for Visual Studio 2012 command-line builds.
Set the required SDK paths and compiler flags using the following commands:

set INCLUDE=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Include;%INCLUDE%
set PATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Bin;%PATH%
set LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Lib;%LIB%
set CL=/D_USING_V110_SDK71_;%CL%

When targeting x64, set the lib path as follows:
set LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Lib\x64;%LIB%

Specify the correct subsystem and subsystem version for the linker based on the type of application you are building. Applications targeting the x86 version of Windows XP must specify subsystem version 5.01, and applications targeting x64 must specify version 5.02.

For x86 console applications:
set LINK=/SUBSYSTEM:CONSOLE,5.01 %LINK%

For x64 console applications:
set LINK=/SUBSYSTEM:CONSOLE,5.02 %LINK%

Execute CL and Link as you normally would within the command prompt.
11 changes: 11 additions & 0 deletions doc/build-luajit-for-xp/build-luajit-for-xp.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
set baseDIR=%cd%
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64_x86
cd %baseDIR%

SET PATH=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin;%PATH%
SET INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include;%INCLUDE%
SET LIB=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib;%LIB%
SET CL=/D_USING_V110_SDK71_;%CL%

CALL msvcbuild.bat static
pause
20 changes: 20 additions & 0 deletions doc/build-openssl-for-xp/build-openssl-for-xp.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
set baseDIR=%cd%
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64_x86
cd %baseDIR%

SET PATH=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin;%PATH%
SET INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include;%INCLUDE%
SET LIB=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib;%LIB%
SET CL=/D_USING_V110_SDK71_;%CL%

perl Configure VC-WIN32 no-asm --prefix=build
pause

CALL ms\do_ms
pause

nmake -f ms\nt.mak
pause

nmake -f ms\nt.mak install
pause
Loading

0 comments on commit 2486e24

Please sign in to comment.