更新模块
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
tianzhendong e7aad6b267 modify:修改逻辑 3 months ago
Resources modify:修改逻辑 3 months ago
Src modify:修改逻辑 3 months ago
assets/README v1.0.0 10 months ago
.gitignore v1.0.0 10 months ago
README.md v1.0.0 10 months ago
updater.pro modify:修改逻辑 3 months ago

README.md

Updater

联网更新模块

image-20231226165227506

使用

待升级程序配置

//升级进程
    QProcess *m_UpdateProc{nullptr};
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函数中配置

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

QString CHECK_URL = "http://www.tianzd.cn:1995/TianZD/deploy/raw/branch/master/";

远程仓库配置

远程仓库包含更新版本检测文件:updater.json和升级包(完整安装包和增量升级包)

image-20231226165035278

{
  "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"
    }
  }
}