diff --git a/src/plugin/versionUpdate/ndd_plugin_implement.cpp b/src/plugin/versionUpdate/ndd_plugin_implement.cpp index 339200d..f9347a6 100644 --- a/src/plugin/versionUpdate/ndd_plugin_implement.cpp +++ b/src/plugin/versionUpdate/ndd_plugin_implement.cpp @@ -19,7 +19,7 @@ NddPluginImplement::NddPluginImplement(QWidget *parent, QsciScintilla *pEdit) : ui->setupUi(this); StatusWidget *statusWidget = new StatusWidget(currentEdit); - statusWidget->setShowMessage("提示", "正在检查更新"); + statusWidget->setShowMessage(u8"提示", u8"正在检查更新"); statusWidget->setDirection(StatusWidget::TopIn, StatusWidget::RightOut); statusWidget->start(false); statusWidget->show(); @@ -32,14 +32,14 @@ NddPluginImplement::NddPluginImplement(QWidget *parent, QsciScintilla *pEdit) : connect(&manager, &QNetworkAccessManager::finished, this, [&](QNetworkReply *reply){ if (reply->error() == QNetworkReply::NetworkError::NoError) { int statusCode = reply->attribute(QNetworkRequest::Attribute::HttpStatusCodeAttribute).toInt(); - qDebug() << "[Notepad--]: 请求状态: " << statusCode; + qDebug() << u8"[Notepad--]: 请求状态: " << statusCode; if (statusCode == 301) { QUrl redirectionUrl = reply->attribute(QNetworkRequest::Attribute::RedirectionTargetAttribute).toUrl(); - qDebug() << "[Notepad--]: 请求被重定向: (" << redirectionUrl.toString() << ")"; + qDebug() << u8"[Notepad--]: 请求被重定向: (" << redirectionUrl.toString() << ")"; manager.get(QNetworkRequest(redirectionUrl)); // tempFilePath = saveHttpImageToTemplateFile(redirectionUrl.toString()); } else { - qDebug() << "[Notepad--]: 请求被确认"; + qDebug() << u8"[Notepad--]: 请求被确认"; QByteArray byteArray; byteArray = reply->readAll(); if(!byteArray.isNull()) { @@ -54,24 +54,27 @@ NddPluginImplement::NddPluginImplement(QWidget *parent, QsciScintilla *pEdit) : QNetworkReply *reply = manager.get(QNetworkRequest(QUrl("https://gitee.com/api/v5/repos/cxasm/notepad--/releases/latest"))); loop.exec(); + qDebug() << reply->attribute(QNetworkRequest::Attribute::HttpStatusCodeAttribute).toInt(); + qDebug() << reply->errorString(); + if (!document.isEmpty()) { QJsonObject obj = document.object(); if (obj.contains("tag_name")) { QString kv = obj.value("tag_name").toString(); QString currentVersion = qApp->applicationVersion(); if (currentVersion.compare(kv) != 0) { - statusWidget->setShowMessage("版本更新", QString("%1 > %2").arg(currentVersion).arg(kv)); + statusWidget->setShowMessage(u8"版本更新", QString("%1 > %2").arg(currentVersion).arg(kv)); QDesktopServices::openUrl(QUrl("https://gitee.com/cxasm/notepad--/releases/latest")); } else { - statusWidget->setShowMessage("提示", "检查完成,没有任何更新"); + statusWidget->setShowMessage(u8"提示", u8"检查完成,没有任何更新"); } - qDebug() << "[Notepad--]: 版本确认 -" << kv; + qDebug() << u8"[Notepad--]: 版本确认 -" << kv; } else { } } else { - qDebug() << "[Notepad--]: 版本未未确认"; - statusWidget->setShowMessage("提示", "检查更新失败"); + qDebug() << u8"[Notepad--]: 版本未未确认"; + statusWidget->setShowMessage(u8"提示", u8"检查更新失败"); } }