This commit is contained in:
Gangphon 2023-05-18 19:14:40 +08:00
parent 57ea8006bb
commit dc8e119c0c

View File

@ -228,6 +228,7 @@ MainWindow::MainWindow(QWidget *parent) : BaseWin(parent) {
auto url = updates["url"].toString(); auto url = updates["url"].toString();
auto idx = url.lastIndexOf('.'); auto idx = url.lastIndexOf('.');
if(idx!=-1) filePath += url.midRef(idx); if(idx!=-1) filePath += url.midRef(idx);
qDebug()<<"filePath"<<filePath;
QFile qFile(filePath); QFile qFile(filePath);
if(! qFile.open(QFile::WriteOnly)) { if(! qFile.open(QFile::WriteOnly)) {
QMessageBox::critical(this, tr("Fail"), tr("Cannot Save File")+": "+qFile.errorString()+"\n"+filePath); QMessageBox::critical(this, tr("Fail"), tr("Cannot Save File")+": "+qFile.errorString()+"\n"+filePath);
@ -258,7 +259,7 @@ MainWindow::MainWindow(QWidget *parent) : BaseWin(parent) {
qFile.close(); qFile.close();
if(res != QDialog::Accepted) return; if(res != QDialog::Accepted) return;
QApplication::quit(); QApplication::quit();
QDesktopServices::openUrl(filePath); QDesktopServices::openUrl("file://"+filePath);
}); });
menu_setting->addAction(act_update); menu_setting->addAction(act_update);
@ -278,7 +279,8 @@ MainWindow::MainWindow(QWidget *parent) : BaseWin(parent) {
} }
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
updates = json["win"].toObject(); updates = json["win"].toObject();
#elif Q_OS_MAC #endif
#ifdef Q_OS_MAC
updates = json["mac"].toObject(); updates = json["mac"].toObject();
#endif #endif
if(verCompare(updates["ver"].toString(), APP_VERSION) > 0) { if(verCompare(updates["ver"].toString(), APP_VERSION) > 0) {