v1.0.0
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
# Updater
|
||||
|
||||
> 联网更新模块
|
||||
|
||||

|
||||
|
||||
## 使用
|
||||
|
||||
### 待升级程序配置
|
||||
|
||||
```c++
|
||||
//升级进程
|
||||
QProcess *m_UpdateProc{nullptr};
|
||||
```
|
||||
|
||||
|
||||
|
||||
```c++
|
||||
if(!m_UpdateProc)
|
||||
{
|
||||
m_UpdateProc = new QProcess;
|
||||
}
|
||||
#if defined Q_OS_WIN
|
||||
m_UpdateProc->setProgram("updater.exe");
|
||||
#elif defined Q_OS_LINUX
|
||||
m_UpdateProc->setProgram("./updater");
|
||||
#endif
|
||||
QStringList argList;
|
||||
argList.append(qAppName());
|
||||
argList.append(APP_VERSION);
|
||||
extern QDateTime buildDateTime();
|
||||
const QDateTime _dateTime = buildDateTime();
|
||||
argList.append(_dateTime.date().toString("yyyyMMdd"));
|
||||
argList.append(QString::number(APP_MODIFYCNT));
|
||||
m_UpdateProc->setArguments(argList);
|
||||
m_UpdateProc->start();
|
||||
m_UpdateProc->waitForStarted();
|
||||
QApplication::quit();
|
||||
```
|
||||
|
||||
### updater程序配置
|
||||
|
||||
main函数中配置
|
||||
|
||||
```c++
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
|
||||
loadQss();
|
||||
|
||||
if(argc > 1)
|
||||
{
|
||||
APPNAME = argv[1];
|
||||
APPVERSION = argv[2];
|
||||
APPDATE = argv[3];
|
||||
MODIFYCNT = argv[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
//配置项目名称和版本号
|
||||
APPNAME = "LaunchControl";
|
||||
APPVERSION = "0";
|
||||
}
|
||||
CHECK_URL = CHECK_URL + APPNAME + "/updates.json";
|
||||
|
||||
UpdaterDialog w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||
```
|
||||
|
||||
updaterdialog.cpp中配置url
|
||||
|
||||
```c++
|
||||
QString CHECK_URL = "http://www.tianzd.cn:1995/TianZD/deploy/raw/branch/master/";
|
||||
```
|
||||
|
||||
### 远程仓库配置
|
||||
|
||||
远程仓库包含更新版本检测文件:updater.json和升级包(完整安装包和增量升级包)
|
||||
|
||||

|
||||
|
||||
```json
|
||||
{
|
||||
"updates":
|
||||
{
|
||||
"windows":
|
||||
{
|
||||
"full-url": "http://www.tianzd.cn:1995/TianZD/deploy/raw/branch/master/",
|
||||
"full-version": "2.2.3",
|
||||
"download-full":false,
|
||||
|
||||
"patch-url": "http://www.tianzd.cn:1995/TianZD/deploy/raw/branch/master/",
|
||||
"patch-version": "2.2.3",
|
||||
"changelog": "1.增加充电状态显示;2.改变发射角度时弹窗提示;3.优化更新模块",
|
||||
"modify-time": "20231216",
|
||||
"modifyCnt": "1"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 104 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Reference in New Issue
Block a user