diff --git a/Resources/res.qrc b/Resources/res.qrc index 56adcd8..5c2d00d 100644 --- a/Resources/res.qrc +++ b/Resources/res.qrc @@ -2,5 +2,7 @@ 140xfd.png 140xfd.ico + update.ico + update.svg diff --git a/Resources/update.ico b/Resources/update.ico new file mode 100644 index 0000000..d7c7591 Binary files /dev/null and b/Resources/update.ico differ diff --git a/Resources/update.svg b/Resources/update.svg new file mode 100644 index 0000000..4755743 --- /dev/null +++ b/Resources/update.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Src/main.cpp b/Src/main.cpp index a514b29..b1bf572 100644 --- a/Src/main.cpp +++ b/Src/main.cpp @@ -22,6 +22,7 @@ int main(int argc, char *argv[]) QApplication a(argc, argv); loadQss(); + UpdaterDialog w; if(argc > 1) { @@ -32,12 +33,12 @@ int main(int argc, char *argv[]) } else { - APPNAME = "FlightDataAnalysis"; + APPNAME = ""; APPVERSION = "0"; } - CHECK_URL = CHECK_URL + APPNAME + "/updates.json"; +// FlightDataAnalysis + CHECK_URL = ORIGIN_URL + APPNAME + "/updates.json"; - UpdaterDialog w; w.show(); return a.exec(); } diff --git a/Src/updaterdialog.cpp b/Src/updaterdialog.cpp index 9b66233..f2006ec 100644 --- a/Src/updaterdialog.cpp +++ b/Src/updaterdialog.cpp @@ -11,6 +11,8 @@ #include QString CHECK_URL = "http://www.tianzd.cn:1995/TianZD/deploy/raw/branch/master/"; +QString ORIGIN_URL = "http://www.tianzd.cn:1995/TianZD/deploy/raw/branch/master/"; + QString PLATFORM = "windows"; QString APPVERSION = ""; @@ -31,11 +33,12 @@ UpdaterDialog::UpdaterDialog(QWidget *parent) : m_version = APPVERSION; ui->versionInput->setText(m_version); + ui->appNameInput->setText(APPNAME); ui->show->setEnabled(0); ui->label_2->setText(""); ui->label_3->setText(""); - ui->label_4->setText(APPNAME); +// ui->label_4->setText(APPNAME); // ui->versionInput->setEnabled(false); } @@ -52,6 +55,12 @@ void UpdaterDialog::showStatus(const QString &s) void UpdaterDialog::on_btn_check_clicked() { + APPNAME = ui->appNameInput->text(); + if(QString(APPNAME) == "") + { + ui->show->appendPlainText("Please input app name"); + return; + } ui->show->clear(); ui->btn_update->setEnabled(0); //version @@ -62,6 +71,8 @@ void UpdaterDialog::on_btn_check_clicked() m_pManager = new QNetworkAccessManager(this); connect(m_pManager, SIGNAL(finished(QNetworkReply *)), this, SLOT(onCheckReply(QNetworkReply *))); } + CHECK_URL = ORIGIN_URL + APPNAME + "/updates.json"; + qDebug() << APPNAME << CHECK_URL; QNetworkRequest request(CHECK_URL); m_pManager->get(request); diff --git a/Src/updaterdialog.h b/Src/updaterdialog.h index ed1426b..69ce751 100644 --- a/Src/updaterdialog.h +++ b/Src/updaterdialog.h @@ -6,6 +6,7 @@ #include "downloader.h" extern QString APPVERSION; +extern QString ORIGIN_URL; extern QString APPNAME; extern QString CHECK_URL; extern QString APPDATE; diff --git a/Src/updaterdialog.ui b/Src/updaterdialog.ui index 4d0be41..120e178 100644 --- a/Src/updaterdialog.ui +++ b/Src/updaterdialog.ui @@ -35,37 +35,24 @@ 0 - + - - - - 0 - 0 - - + - 48 - 48 - - - - - 48 - 48 + 100 + 0 - 14 + Times New Roman + 12 + true - - border-image: url(:/140xfd.png); - - + AppName: Qt::AlignCenter @@ -73,7 +60,19 @@ - + + + + 200 + 0 + + + + + 200 + 16777215 + + Times New Roman @@ -81,19 +80,13 @@ true - - updater - - + Qt::Horizontal - - QSizePolicy::Preferred - 40 @@ -108,6 +101,12 @@ + + + 100 + 0 + + Times New Roman @@ -118,10 +117,25 @@ Version: + + Qt::AlignCenter + + + + 200 + 0 + + + + + 200 + 16777215 + + Times New Roman diff --git a/updater.pro b/updater.pro index 5415a9d..dbb915d 100644 --- a/updater.pro +++ b/updater.pro @@ -10,10 +10,10 @@ TEMPLATE = app #生成目录 unix { -DESTDIR = $$PWD/../../Build/bin +#DESTDIR = $$PWD/../../Build/bin } win32 { -DESTDIR = $$PWD/../../Build/release +#DESTDIR = $$PWD/../../Build/release } MOC_DIR = $$PWD/Build/moc @@ -38,5 +38,5 @@ RESOURCES += \ Resources/res.qrc win32 { - RC_ICONS += $$PWD/Resources/140xfd.ico + RC_ICONS += $$PWD/Resources/update.ico }