Browse Source

modify:修改逻辑

master
tianzhendong 4 months ago
parent
commit
1d071d5739
  1. 2
      Resources/res.qrc
  2. BIN
      Resources/update.ico
  3. 1
      Resources/update.svg
  4. 7
      Src/main.cpp
  5. 13
      Src/updaterdialog.cpp
  6. 1
      Src/updaterdialog.h
  7. 72
      Src/updaterdialog.ui
  8. 6
      updater.pro

2
Resources/res.qrc

@ -2,5 +2,7 @@
<qresource prefix="/">
<file>140xfd.png</file>
<file>140xfd.ico</file>
<file>update.ico</file>
<file>update.svg</file>
</qresource>
</RCC>

BIN
Resources/update.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

1
Resources/update.svg

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1721820181570" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7019" xmlns:xlink="http://www.w3.org/1999/xlink" width="256" height="256"><path d="M512.487863 109.714286c159.780571 0 292.937143 113.846857 322.852571 264.850285A256.036571 256.036571 0 0 1 768.487863 877.714286h-73.142857a36.571429 36.571429 0 0 1 0-73.142857h73.142857a182.857143 182.857143 0 0 0 7.936-365.531429L768.487863 438.857143l-0.146286-8.777143a256 256 0 0 0-511.268571-8.777143l-0.438857 8.777143L256.487863 438.857143a182.857143 182.857143 0 0 0-7.936 365.531428L256.487863 804.571429h73.142857a36.571429 36.571429 0 0 1 0 73.142857H256.487863a256 256 0 0 1-66.889143-503.186286C219.514149 223.561143 352.707291 109.714286 512.487863 109.714286z" fill="#1296db" p-id="7020"></path><path d="M475.916434 512m36.571429 0l0 0q36.571429 0 36.571428 36.571429l0 329.142857q0 36.571429-36.571428 36.571428l0 0q-36.571429 0-36.571429-36.571428l0-329.142857q0-36.571429 36.571429-36.571429Z" fill="#1296db" p-id="7021"></path><path d="M642.097006 604.745143a36.571429 36.571429 0 0 1-51.712 0L512.780434 527.140571l-77.531428 77.604572A36.571429 36.571429 0 1 1 383.463863 552.96L486.887863 449.572571a36.571429 36.571429 0 0 1 51.748571 0L642.097006 552.96a36.571429 36.571429 0 0 1 0 51.748571z" fill="#1296db" p-id="7022"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

7
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();
}

13
Src/updaterdialog.cpp

@ -11,6 +11,8 @@
#include <private/qzipreader_p.h>
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);

1
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;

72
Src/updaterdialog.ui

@ -35,37 +35,24 @@
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="labelIcon">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QLabel" name="label_5">
<property name="minimumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
<family>Times New Roman</family>
<pointsize>12</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/140xfd.png);</string>
</property>
<property name="text">
<string/>
<string>AppName:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
@ -73,7 +60,19 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<widget class="QLineEdit" name="appNameInput">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<family>Times New Roman</family>
@ -81,19 +80,13 @@
<bold>true</bold>
</font>
</property>
<property name="text">
<string>updater</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
@ -108,6 +101,12 @@
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>Times New Roman</family>
@ -118,10 +117,25 @@
<property name="text">
<string>Version:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="versionInput">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<family>Times New Roman</family>

6
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
}

Loading…
Cancel
Save