mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-09 04:30:43 +00:00
Removed unused update folder
This commit is contained in:
parent
991525852c
commit
1cc6d69954
@ -1,531 +0,0 @@
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
#include <QMessageBox>
|
||||
#include <QResource>
|
||||
#include <QProgressBar>
|
||||
#include <QTimer>
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
#include <QDate>
|
||||
#include <QDebug>
|
||||
#include <QXmlSimpleReader>
|
||||
#include <QCryptographicHash>
|
||||
#include "quazip/quazip.h"
|
||||
#include "quazip/quazipfile.h"
|
||||
#include "UpdateWindow.h"
|
||||
#include "ui_UpdateWindow.h"
|
||||
#include "../version.h"
|
||||
|
||||
#ifdef Q_WS_WIN32
|
||||
#include <dos.h>
|
||||
#endif
|
||||
|
||||
void delay(int ms)
|
||||
{
|
||||
#ifdef Q_WS_WIN32
|
||||
delay(ms);
|
||||
#else
|
||||
sleep(ms/1000);
|
||||
#endif
|
||||
}
|
||||
|
||||
UpdateWindow::UpdateWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::UpdateWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
if (QSystemTrayIcon::isSystemTrayAvailable() && QSystemTrayIcon::supportsMessages()) {
|
||||
systray=new QSystemTrayIcon(QIcon(":/images/sheep.png"),this);
|
||||
systray->show();
|
||||
systraymenu=new QMenu(this);
|
||||
systray->setContextMenu(systraymenu);
|
||||
QAction *a=systraymenu->addAction("SleepyHead Updater v"+VersionString());
|
||||
a->setEnabled(false);
|
||||
systraymenu->addSeparator();
|
||||
//systraymenu->addAction("About",this,SLOT(on_action_About_triggered()));
|
||||
//systraymenu->addAction("Check for Updates",this,SLOT(on_actionCheck_for_Updates_triggered()));
|
||||
systraymenu->addSeparator();
|
||||
systraymenu->addAction("Exit",this,SLOT(close()));
|
||||
connect(systray,SIGNAL(messageClicked()),this,SLOT(notify_clicked()));
|
||||
} else {
|
||||
systray=NULL;
|
||||
systraymenu=NULL;
|
||||
}
|
||||
requestmode=RM_None;
|
||||
netmanager = new QNetworkAccessManager(this);
|
||||
connect(netmanager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
|
||||
update=NULL;
|
||||
ui->stackedWidget->setCurrentIndex(0);
|
||||
|
||||
// QPalette p=ui->buildNotes->palette();
|
||||
// QColor win=p.color(QPalette::Window);
|
||||
// ui->buildNotes->setStyleSheet("background-color: "+win.name());
|
||||
}
|
||||
|
||||
UpdateWindow::~UpdateWindow()
|
||||
{
|
||||
if (systray) disconnect(systray,SIGNAL(messageClicked()),this,SLOT(notify_clicked()));
|
||||
|
||||
disconnect(netmanager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
void UpdateWindow::checkForUpdates()
|
||||
{
|
||||
QString filename=QApplication::applicationDirPath()+QDir::separator()+"update.xml";
|
||||
qDebug() << filename;
|
||||
// Check updates.xml file if it's still recent..
|
||||
if (QFile::exists(filename)) {
|
||||
QFileInfo fi(filename);
|
||||
QDateTime created=fi.created();
|
||||
int age=created.secsTo(QDateTime::currentDateTime());
|
||||
|
||||
if (age<7200) {
|
||||
QFile file(filename);
|
||||
file.open(QFile::ReadOnly);
|
||||
ParseUpdateXML(&file);
|
||||
file.close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
Notify("Checking for SleepyHead Updates");
|
||||
|
||||
requestmode=RM_CheckUpdates;
|
||||
|
||||
reply=netmanager->get(QNetworkRequest(QUrl("http://192.168.1.8/update.xml")));
|
||||
ui->plainTextEdit->appendPlainText("Requesting "+reply->url().toString());
|
||||
netmanager->connect(reply,SIGNAL(downloadProgress(qint64,qint64)),this, SLOT(downloadProgress(qint64,qint64)));
|
||||
dltime.start();
|
||||
}
|
||||
|
||||
void UpdateWindow::Start()
|
||||
{
|
||||
}
|
||||
|
||||
void UpdateWindow::Notify(QString s,int ms, QString title)
|
||||
{
|
||||
if (systray && systray->supportsMessages()) {
|
||||
systray->showMessage(title,s,QSystemTrayIcon::Information,ms);
|
||||
} else {
|
||||
//ui->statusBar->showMessage(s,ms);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateWindow::notify_clicked()
|
||||
{
|
||||
qDebug() << "Clicked on FOO!";
|
||||
|
||||
}
|
||||
|
||||
void UpdateWindow::dataReceived()
|
||||
{
|
||||
//HttpStatusCodeAttribute
|
||||
QString rs=reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toString();
|
||||
if (rs!="200") return;
|
||||
//QUrl redirectUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
|
||||
|
||||
QByteArray read=reply->read(reply->bytesAvailable());
|
||||
qDebug() << "Received" << read.size() << "bytes";
|
||||
file.write(read);
|
||||
}
|
||||
|
||||
void UpdateWindow::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
|
||||
{
|
||||
QString rs=reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toString();
|
||||
if (rs!="200") return;
|
||||
|
||||
double f=(double(bytesReceived) / double(bytesTotal)) * 100.0;
|
||||
QProgressBar *bar=qobject_cast<QProgressBar *>(ui->tableWidget->cellWidget(current_row,3));
|
||||
if (bar)
|
||||
bar->setValue(f);
|
||||
|
||||
ui->tableWidget->item(current_row,2)->setText(QString::number(bytesTotal/1048576.0,'f',3)+"MB");
|
||||
//ui->progressBar->setValue(f);
|
||||
int elapsed=dltime.elapsed();
|
||||
}
|
||||
|
||||
void UpdateWindow::requestFile()
|
||||
{
|
||||
if (!update) return;
|
||||
QProgressBar *bar=qobject_cast<QProgressBar *>(ui->tableWidget->cellWidget(current_row,3));
|
||||
QString style="QProgressBar{\
|
||||
border: 1px solid gray;\
|
||||
border-radius: 3px;\
|
||||
text-align: center;\
|
||||
text-decoration: bold;\
|
||||
color: yellow;\
|
||||
}\
|
||||
QProgressBar::chunk {\
|
||||
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 \"light green\", stop: 1 green);\
|
||||
width: 10px;\
|
||||
margin: 0px;\
|
||||
}";
|
||||
|
||||
if (bar)
|
||||
bar->setStyleSheet(style);
|
||||
|
||||
QString filename=update->filename;
|
||||
ui->plainTextEdit->appendPlainText("Requesting "+update->url);
|
||||
|
||||
requestmode=RM_GetFile;
|
||||
|
||||
QString path=QApplication::applicationDirPath()+QDir::separator()+"Download";
|
||||
QDir().mkdir(path);
|
||||
path+=QDir::separator()+filename;
|
||||
ui->plainTextEdit->appendPlainText("Saving as "+path);
|
||||
file.setFileName(path);
|
||||
file.open(QFile::WriteOnly);
|
||||
dltime.start();
|
||||
|
||||
QNetworkRequest req=QNetworkRequest(QUrl(update->url));
|
||||
req.setRawHeader("User-Agent", "Wget/1.12 (linux-gnu)");
|
||||
reply=netmanager->get(req);
|
||||
connect(reply,SIGNAL(readyRead()),this, SLOT(dataReceived()));
|
||||
connect(reply,SIGNAL(downloadProgress(qint64,qint64)),this, SLOT(downloadProgress(qint64,qint64)));
|
||||
}
|
||||
|
||||
void UpdateWindow::ParseUpdateXML(QIODevice * dev)
|
||||
{
|
||||
QXmlInputSource src(dev);
|
||||
QXmlSimpleReader reader;
|
||||
reader.setContentHandler(&updateparser);
|
||||
if (reader.parse(src)) {
|
||||
ui->plainTextEdit->appendPlainText("XML update structure parsed cleanly");
|
||||
|
||||
QStringList versions;
|
||||
for (QHash<QString,Release>::iterator it=updateparser.releases.begin();it!=updateparser.releases.end();it++) {
|
||||
versions.push_back(it.key());
|
||||
}
|
||||
qSort(versions);
|
||||
|
||||
QString platform=PlatformString.toLower();
|
||||
release=NULL;
|
||||
for (int i=versions.size()-1;i>=0;i--) {
|
||||
QString verstr=versions[i];
|
||||
release=&updateparser.releases[verstr];
|
||||
if (release->updates.contains(platform)) {
|
||||
break;
|
||||
} else release=NULL;
|
||||
}
|
||||
if (!release || (VersionString() > release->version)) {
|
||||
Notify("No updates were found for your platform",5000,"SleepyHead Updates");
|
||||
delay(4000);
|
||||
close();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
qDebug() << "Version" << release->version << "has updates for" << platform;
|
||||
|
||||
QString latestapp="", latestqt="";
|
||||
updates.clear();
|
||||
Update *upd=NULL;
|
||||
Update *upq=NULL;
|
||||
for (int i=0;i<release->updates[platform].size();i++) {
|
||||
update=&release->updates[platform][i];
|
||||
if (update->type=="qtlibs") {
|
||||
qDebug() << "QT Version" << update->version;
|
||||
if (update->version > latestqt) {
|
||||
latestqt=update->version;
|
||||
upq=update;
|
||||
}
|
||||
} else if (update->type=="application") {
|
||||
qDebug() << "Application Version" << update->version;
|
||||
if (update->version > latestapp) {
|
||||
latestapp=update->version;
|
||||
upd=update;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (upq && (upq->version > QT_VERSION_STR)) {
|
||||
updates.push_back(upq);
|
||||
}
|
||||
if (upd && upd->version > VersionString()) {
|
||||
updates.push_back(upd);
|
||||
}
|
||||
|
||||
|
||||
if (updates.size()>0) {
|
||||
QString html="<html><h3>SleepyHead v"+release->version+" codename \""+release->codename+"\"</h3><p>"+release->notes[""]+"</p><b>";
|
||||
html+=platform.left(1).toUpper()+platform.mid(1);
|
||||
html+=" platform notes</b><p>"+release->notes[platform]+"</p></html>";
|
||||
ui->webView->setHtml(html);
|
||||
QString info;
|
||||
if (VersionString()< release->version) {
|
||||
ui->Title->setText("<font size=+1>A new version of SleepyHead is available!</font>");
|
||||
info="Shiny new <b>v"+latestapp+"</b> is available. You're running old and busted v"+VersionString();
|
||||
ui->notesTabWidget->setCurrentIndex(0);
|
||||
} else {
|
||||
ui->Title->setText("<font size=+1>An update for SleepyHead is available.</font>");
|
||||
info="Version <b>"+latestapp+"</b> is available. You're currently running v"+VersionString();
|
||||
ui->notesTabWidget->setCurrentIndex(1);
|
||||
}
|
||||
ui->versionInfo->setText(info);
|
||||
|
||||
QString notes;
|
||||
for (int i=0;i<release->updates[platform].size();i++) {
|
||||
update=&release->updates[platform][i];
|
||||
if ((update->type=="application") && (update->version > VersionString())) {
|
||||
notes+="<b>SleepyHead v"+update->version+" build notes</b><br/>"+update->notes.trimmed()+"<br/><br/>";
|
||||
} else if ((update->type=="qtlibs") && (update->version > QT_VERSION_STR)) {
|
||||
notes+="<b>Update to QtLibs (v"+update->version+")</b><br/>"+update->notes.trimmed();
|
||||
}
|
||||
}
|
||||
ui->buildNotes->setText(notes);
|
||||
show();
|
||||
}
|
||||
} else {
|
||||
qDebug() << "XML Parsing Error";
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateWindow::replyFinished(QNetworkReply * reply)
|
||||
{
|
||||
netmanager->disconnect(reply,SIGNAL(downloadProgress(qint64,qint64)),this, SLOT(downloadProgress(qint64,qint64)));
|
||||
if (reply->error()==QNetworkReply::NoError) {
|
||||
if (requestmode==RM_CheckUpdates) {
|
||||
ui->plainTextEdit->appendPlainText(QString::number(reply->size())+" bytes received.");
|
||||
QString filename=QApplication::applicationDirPath()+QDir::separator()+reply->url().toString().section("/",-1);
|
||||
qDebug() << filename;
|
||||
QFile file(filename);
|
||||
file.open(QFile::WriteOnly);
|
||||
file.write(reply->readAll());
|
||||
file.close();
|
||||
file.open(QFile::ReadOnly);
|
||||
//QTextStream ts(&file);
|
||||
ParseUpdateXML(&file);
|
||||
file.close();
|
||||
reply->deleteLater();
|
||||
} else if (requestmode==RM_GetFile) {
|
||||
disconnect(reply,SIGNAL(readyRead()),this, SLOT(dataReceived()));
|
||||
file.close();
|
||||
//HttpStatusCodeAttribute
|
||||
QString rs=reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toString();
|
||||
|
||||
bool failed=false;
|
||||
if (rs=="404") {
|
||||
qDebug() << "File not found";
|
||||
failed=true;
|
||||
} else {
|
||||
qDebug() << "StatCodeAttr" << rs;
|
||||
QUrl redirectUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
|
||||
if (!redirectUrl.isEmpty() && (redirectUrl!=reply->url())) {
|
||||
file.open(QFile::WriteOnly); //reopen file..
|
||||
update->url=redirectUrl.toString();
|
||||
ui->plainTextEdit->appendPlainText("Redirected to "+update->url);
|
||||
QTimer::singleShot(100,this,SLOT(requestFile()));
|
||||
reply->deleteLater();
|
||||
return;
|
||||
}
|
||||
ui->plainTextEdit->appendPlainText("Received "+QString::number(file.size())+" bytes");
|
||||
if (update->size>0) {
|
||||
double s1=update->size/1048576.0;
|
||||
double s2=ui->tableWidget->item(current_row,2)->text().toDouble();
|
||||
if (s1!=s2) {
|
||||
failed=true;
|
||||
ui->plainTextEdit->appendPlainText("File size mismatch for "+update->filename);
|
||||
}
|
||||
} else {
|
||||
QString path=QApplication::applicationDirPath()+QDir::separator()+"Download";
|
||||
path+=QDir::separator()+update->filename;
|
||||
QFile f(path);
|
||||
f.open(QFile::ReadOnly);
|
||||
QCryptographicHash hash(QCryptographicHash::Sha1);
|
||||
hash.addData(f.readAll());
|
||||
QString res=hash.result().toHex();
|
||||
if (res!=update->hash) {
|
||||
ui->plainTextEdit->appendPlainText("File integrity check failed for "+update->filename);
|
||||
failed=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
reply->deleteLater();
|
||||
QProgressBar *bar=qobject_cast<QProgressBar *>(ui->tableWidget->cellWidget(current_row,3));
|
||||
if (!failed) {
|
||||
//file.open(QFile::ReadOnly);
|
||||
QuaZip zip(&file);
|
||||
|
||||
if (!zip.open(QuaZip::mdUnzip)) {
|
||||
failed=true;
|
||||
} else {
|
||||
|
||||
QStringList files=zip.getFileNameList();
|
||||
QFile f;
|
||||
int errors=0;
|
||||
int fsize=files.size();
|
||||
for (int i=0;i<fsize;i++) {
|
||||
ui->plainTextEdit->appendPlainText("Extracting "+files.at(i));
|
||||
QuaZipFile qzf(file.fileName(),files.at(i));
|
||||
qzf.open(QuaZipFile::ReadOnly);
|
||||
|
||||
QString path=QApplication::applicationDirPath()+QDir::separator()+"Download"+QDir::separator()+files.at(i);
|
||||
if (path.endsWith(QDir::separator())) {
|
||||
QDir().mkpath(path);
|
||||
if (update->unzipped_path.isEmpty())
|
||||
update->unzipped_path=path;
|
||||
} else {
|
||||
f.setFileName(path);
|
||||
f.open(QFile::WriteOnly);
|
||||
f.write(qzf.readAll());
|
||||
f.close();
|
||||
if (qzf.getZipError()) {
|
||||
errors++;
|
||||
} else {
|
||||
}
|
||||
}
|
||||
if (bar) {
|
||||
bar->setValue((1.0/float(fsize)*float(i+1))*100.0);
|
||||
QApplication::processEvents();
|
||||
}
|
||||
qzf.close();
|
||||
}
|
||||
zip.close();
|
||||
if (!errors) {
|
||||
file.remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
ui->tableWidget->item(current_row,0)->setCheckState(Qt::Checked);
|
||||
if (failed) {
|
||||
qDebug() << "File is corrupted";
|
||||
if (bar) {
|
||||
bar->setFormat("Failed");
|
||||
QString style="QProgressBar{\
|
||||
border: 1px solid gray;\
|
||||
border-radius: 3px;\
|
||||
text-align: center;\
|
||||
text-decoration: bold;\
|
||||
color: yellow;\
|
||||
}\
|
||||
QProgressBar::chunk {\
|
||||
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 \"dark red\", stop: 1 red);\
|
||||
width: 10px;\
|
||||
margin: 0px;\
|
||||
}";
|
||||
//: qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 red, stop: 1 white);
|
||||
bar->setStyleSheet(style);
|
||||
}
|
||||
}
|
||||
ui->tableWidget->item(current_row,0)->setData(Qt::UserRole+1,failed);
|
||||
QTimer::singleShot(100,this,SLOT(upgradeNext()));
|
||||
|
||||
/*if (!needQtVersion.isEmpty()) {
|
||||
requestmode=RM_UpdateQT;
|
||||
QString filename="qtlibs-"+needQtVersion+"-"+PlatformString.toLower()+".zip";
|
||||
QNetworkReply *nr=netmanager->get(QNetworkRequest(QUrl("http://192.168.1.8/"+filename)));
|
||||
netmanager->connect(nr,SIGNAL(downloadProgress(qint64,qint64)),this, SLOT(downloadProgress(qint64,qint64)));
|
||||
dltime.start();
|
||||
} else {
|
||||
ui->label->setText("Downloading Complete");
|
||||
requestmode=RM_None;
|
||||
} */
|
||||
ui->plainTextEdit->appendPlainText("Download Complete");
|
||||
|
||||
/*QByteArray ba=reply->readAll();
|
||||
QString a="Checking File Integrity";
|
||||
ui->label->setText(a);
|
||||
ui->plainTextEdit->appendPlainText(a);
|
||||
QCryptographicHash hash(QCryptographicHash::Sha1);
|
||||
hash.addData(ba);
|
||||
if (hash.result().toHex()!=update->hash) {
|
||||
QString a="Integrity check failed.";
|
||||
|
||||
ui->plainTextEdit->appendPlainText(a);
|
||||
Notify("Download file is corrupt :(\n",5000,"Download Failed");
|
||||
|
||||
return;
|
||||
} else ui->plainTextEdit->appendPlainText("File integrity checked out ok");
|
||||
|
||||
QByteArray bb=qUncompress(ba);
|
||||
if (bb.isEmpty()) {
|
||||
ui->plainTextEdit->appendPlainText("Couldn't decompress file "+update->filename);
|
||||
Notify("Could not decompress update file :(\n",5000,"Download Failed");
|
||||
return;
|
||||
}
|
||||
f.write(bb);
|
||||
f.close(); */
|
||||
} else if (requestmode==RM_UpdateQT) {
|
||||
ui->plainTextEdit->appendPlainText("Received "+QString::number(reply->size())+" bytes");
|
||||
}
|
||||
} else {
|
||||
Notify("There was an error completing a network request:\n\n("+reply->errorString()+")");
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateWindow::on_CloseButton_clicked()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
void UpdateWindow::upgradeNext()
|
||||
{
|
||||
QTableWidgetItem *item;
|
||||
bool fnd=false;
|
||||
for (current_row=0;current_row<ui->tableWidget->rowCount();current_row++) {
|
||||
item=ui->tableWidget->item(current_row,0);
|
||||
bool complete=item->checkState()==Qt::Checked;
|
||||
if (complete)
|
||||
continue;
|
||||
update=item->data(Qt::UserRole).value<Update *>();
|
||||
qDebug() << "Processing" << update->url;
|
||||
fnd=true;
|
||||
requestFile();
|
||||
break;
|
||||
}
|
||||
|
||||
if (!fnd) {
|
||||
bool ok=true;
|
||||
for (current_row=0;current_row<ui->tableWidget->rowCount();current_row++) {
|
||||
bool failed=ui->tableWidget->item(current_row,0)->data(Qt::UserRole+1).toBool();
|
||||
if (failed) {
|
||||
ok=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ok) {
|
||||
qDebug() << "Finished";
|
||||
} else {
|
||||
QMessageBox::warning(this,"Download Error","Sorry, could not get all necessary files for upgrade.. Aborting.",QMessageBox::Ok);
|
||||
close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void UpdateWindow::on_upgradeButton_clicked()
|
||||
{
|
||||
if (!updates.size()) return;
|
||||
ui->tableWidget->clearContents();
|
||||
ui->tableWidget->setColumnHidden(4,true);
|
||||
ui->tableWidget->setColumnHidden(5,true);
|
||||
|
||||
for (int i=0;i<updates.size();i++) {
|
||||
update=updates.at(i);
|
||||
ui->tableWidget->insertRow(i);
|
||||
QTableWidgetItem *item=new QTableWidgetItem(update->type);
|
||||
QVariant av;
|
||||
av.setValue(update);
|
||||
item->setData(Qt::UserRole,av);
|
||||
item->setCheckState(Qt::Unchecked);
|
||||
item->setFlags(Qt::ItemIsEnabled);
|
||||
ui->tableWidget->setItem(i,0,item);
|
||||
ui->tableWidget->setItem(i,1,new QTableWidgetItem(update->version));
|
||||
ui->tableWidget->setItem(i,2,new QTableWidgetItem(QString::number(update->size/1048576.0,'f',3)+"MB"));
|
||||
QProgressBar *bar=new QProgressBar(ui->tableWidget);
|
||||
bar->setMaximum(100);
|
||||
bar->setValue(0);
|
||||
|
||||
ui->tableWidget->setCellWidget(i,3,bar);
|
||||
//new QProgressBar(ui->tableWidget));
|
||||
//ui->tableWidget->setItem(i,3,wi); //new QTableWidgetItem(update->filename));
|
||||
ui->tableWidget->setItem(i,4,new QTableWidgetItem(update->url));
|
||||
}
|
||||
ui->stackedWidget->setCurrentIndex(1);
|
||||
upgradeNext();
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
#ifndef UPDATEWINDOW_H
|
||||
#define UPDATEWINDOW_H
|
||||
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QTableWidgetItem>
|
||||
#include <QMenu>
|
||||
#include <QMainWindow>
|
||||
|
||||
#include "../version.h"
|
||||
#include "updateparser.h"
|
||||
|
||||
namespace Ui {
|
||||
class UpdateWindow;
|
||||
}
|
||||
|
||||
enum RequestMode { RM_None, RM_CheckUpdates, RM_GetFile, RM_UpdateQT };
|
||||
|
||||
class UpdateWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit UpdateWindow(QWidget *parent = 0);
|
||||
~UpdateWindow();
|
||||
void checkForUpdates();
|
||||
|
||||
void Notify(QString s,int ms=5000, QString title="SleepyHead v"+VersionString());
|
||||
|
||||
void ParseUpdateXML(QIODevice * dev);
|
||||
|
||||
protected slots:
|
||||
void Start();
|
||||
void replyFinished(QNetworkReply * reply);
|
||||
void notify_clicked();
|
||||
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
|
||||
void dataReceived();
|
||||
void requestFile();
|
||||
|
||||
private slots:
|
||||
void on_CloseButton_clicked();
|
||||
|
||||
void on_upgradeButton_clicked();
|
||||
|
||||
void upgradeNext();
|
||||
|
||||
private:
|
||||
UpdateParser updateparser;
|
||||
|
||||
Ui::UpdateWindow *ui;
|
||||
QSystemTrayIcon *systray;
|
||||
QMenu *systraymenu;
|
||||
RequestMode requestmode;
|
||||
QTime dltime;
|
||||
QString needQtVersion;
|
||||
Update *update;
|
||||
Release *release;
|
||||
QFile file;
|
||||
QNetworkAccessManager *netmanager;
|
||||
QNetworkReply * reply;
|
||||
QList<Update *> updates;
|
||||
int current_row;
|
||||
};
|
||||
|
||||
#endif // UPDATEWINDOW_H
|
@ -1,387 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>UpdateWindow</class>
|
||||
<widget class="QMainWindow" name="UpdateWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>589</width>
|
||||
<height>416</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>SleepyHead Updater</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/images/sheep.png</normaloff>:/images/sheep.png</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="frontPage">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="Title">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>A new version of $APP is available</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" rowspan="3">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="graphicLabel">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="resources.qrc">:/images/sheep.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="versionInfo">
|
||||
<property name="text">
|
||||
<string>Version Information</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QTabWidget" name="notesTabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="relNotesTab">
|
||||
<attribute name="title">
|
||||
<string>Release Notes</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWebView" name="webView">
|
||||
<property name="url">
|
||||
<url>
|
||||
<string>about:blank</string>
|
||||
</url>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="buildNotesTab">
|
||||
<attribute name="title">
|
||||
<string>Build Notes</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="buildNotes">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="CloseButton">
|
||||
<property name="text">
|
||||
<string>&No Thanks</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="LaterButton">
|
||||
<property name="text">
|
||||
<string>&Remind Me Later</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="upgradeButton">
|
||||
<property name="text">
|
||||
<string>&Upgrade Now</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Please wait while updates are downloaded and installed...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabUpdates">
|
||||
<attribute name="title">
|
||||
<string>Updates</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::NoSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Component</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Version</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Size</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Progress</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabLog">
|
||||
<attribute name="title">
|
||||
<string>Log</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="plainTextEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cancelButton">
|
||||
<property name="text">
|
||||
<string>&Abort</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>&Finish</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QWebView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>QtWebKit/QWebView</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="resources.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>cancelButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>UpdateWindow</receiver>
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>46</x>
|
||||
<y>369</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>249</x>
|
||||
<y>158</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -1,14 +0,0 @@
|
||||
#include <QtGui/QApplication>
|
||||
#include <QTimer>
|
||||
#include "UpdateWindow.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
UpdateWindow w;
|
||||
|
||||
w.checkForUpdates();
|
||||
// w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/images">
|
||||
<file>sheep.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -1,120 +0,0 @@
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
#include "updateparser.h"
|
||||
|
||||
bool UpdateParser::startDocument()
|
||||
{
|
||||
inRelease=false;
|
||||
inUpdate=false;
|
||||
inNotes=false;
|
||||
inUpdateNotes=false;
|
||||
release=NULL;
|
||||
update=NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool UpdateParser::endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
|
||||
{
|
||||
QString name=qName.toLower();
|
||||
if (name=="release") {
|
||||
inRelease=false;
|
||||
release=NULL;
|
||||
} else if (inRelease && name=="update") {
|
||||
inUpdate=false;
|
||||
update=NULL;
|
||||
} else if (inUpdate && name=="notes")
|
||||
inUpdateNotes=false;
|
||||
else if (inRelease && name=="notes")
|
||||
inNotes=false;
|
||||
return true;
|
||||
}
|
||||
bool UpdateParser::characters(const QString &ch)
|
||||
{
|
||||
if (inUpdateNotes) {
|
||||
update->notes=ch;
|
||||
} else if (inNotes) {
|
||||
release->notes[platform]=ch;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool UpdateParser::startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
|
||||
{
|
||||
QString name=qName.toLower();
|
||||
if (inRelease && name=="update") {
|
||||
QString ver, type;
|
||||
for (int i=0;i<atts.count();i++) {
|
||||
if (atts.localName(i)=="type")
|
||||
type=atts.value(i).toLower();
|
||||
if (atts.localName(i)=="version")
|
||||
ver=atts.value(i).toLower();
|
||||
if (atts.localName(i)=="platform")
|
||||
platform=atts.value(i).toLower();
|
||||
if (atts.localName(i)=="release_date")
|
||||
release_date=atts.value(i);
|
||||
}
|
||||
QDate date=QDate::fromString(release_date,"yyyy-MM-dd");
|
||||
if (!date.isValid()) date=QDate::currentDate();
|
||||
|
||||
release->updates[platform].push_back(Update(type,ver,platform,date));
|
||||
update=&release->updates[platform][release->updates[platform].size()-1];
|
||||
inUpdate=true;
|
||||
} else if (inRelease && name=="info") {
|
||||
QString tmp=atts.value("url");
|
||||
if (tmp.isEmpty()) return false;
|
||||
release->info_url=tmp;
|
||||
} else if (inUpdate && name=="file") {
|
||||
for (int i=0;i<atts.count();i++) {
|
||||
if (atts.localName(i)=="name")
|
||||
update->filename=atts.value(i);
|
||||
if (atts.localName(i)=="size") {
|
||||
bool ok;
|
||||
update->size=atts.value(i).toLongLong(&ok);
|
||||
//if (!ok) return false;
|
||||
}
|
||||
if (atts.localName(i)=="url")
|
||||
update->url=atts.value(i);
|
||||
if (atts.localName(i)=="hash")
|
||||
update->hash=atts.value(i).toLower();
|
||||
}
|
||||
} else if (inUpdate && name=="notes") {
|
||||
inUpdateNotes=true;
|
||||
} else if (inRelease && name=="notes") {
|
||||
platform="";
|
||||
if (atts.count()>=1) {
|
||||
if (atts.localName(0)=="platform") {
|
||||
platform=atts.value(0);
|
||||
}
|
||||
}
|
||||
inNotes=true;
|
||||
} else if (name=="release") {
|
||||
inRelease=true;
|
||||
QString codename,status;
|
||||
for (int i=0;i<atts.count();i++) {
|
||||
if (atts.localName(i)=="version")
|
||||
version=atts.value(i).toLower();
|
||||
if (atts.localName(i)=="codename")
|
||||
codename=atts.value(i);
|
||||
if (atts.localName(i)=="status")
|
||||
status=atts.value(i);
|
||||
}
|
||||
releases[version]=Release(version,codename,status);
|
||||
release=&releases[version];
|
||||
if (version>latest_version) latest_version=version;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool UpdateParser::endDocument()
|
||||
{
|
||||
/*for (QHash<QString,Release>::iterator r=releases.begin();r!=releases.end();r++) {
|
||||
Release & rel=r.value();
|
||||
qDebug() << "New Version" << r.key() << rel.codename << rel.notes;
|
||||
for (QHash<QString,Update>::iterator u=rel.files.begin();u!=rel.files.end();u++) {
|
||||
Update & up=u.value();
|
||||
qDebug() << "Platform:" << u.key() << up.filename << up.date;
|
||||
}
|
||||
}*/
|
||||
return true;
|
||||
}
|
||||
|
@ -1,93 +0,0 @@
|
||||
#ifndef UPDATEPARSER_H
|
||||
#define UPDATEPARSER_H
|
||||
|
||||
#include <QXmlDefaultHandler>
|
||||
#include <QMetaType>
|
||||
#include <QDate>
|
||||
|
||||
struct Update
|
||||
{
|
||||
public:
|
||||
explicit Update() { size=0;}
|
||||
explicit Update(const Update & copy) {
|
||||
type=copy.type;
|
||||
version=copy.version;
|
||||
platform=copy.platform;
|
||||
date=copy.date;
|
||||
filename=copy.filename;
|
||||
url=copy.url;
|
||||
hash=copy.hash;
|
||||
size=copy.size;
|
||||
notes=copy.notes;
|
||||
unzipped_path=copy.unzipped_path;
|
||||
}
|
||||
|
||||
Update(QString _type, QString _version, QString _platform, QDate _date)
|
||||
{
|
||||
type=_type;
|
||||
version=_version;
|
||||
platform=_platform;
|
||||
date=_date;
|
||||
size=0;
|
||||
}
|
||||
QString type;
|
||||
QString version;
|
||||
QString platform;
|
||||
QDate date;
|
||||
QString filename;
|
||||
QString url;
|
||||
QString hash;
|
||||
qint64 size;
|
||||
QString notes;
|
||||
QString unzipped_path;
|
||||
};
|
||||
|
||||
struct Release
|
||||
{
|
||||
Release() {}
|
||||
Release(const Release & copy) {
|
||||
version=copy.version;
|
||||
codename=copy.version;
|
||||
notes=copy.notes;
|
||||
info_url=copy.info_url;
|
||||
status=copy.status;
|
||||
updates=copy.updates;
|
||||
}
|
||||
|
||||
Release(QString ver, QString code, QString stat) { version=ver; codename=code; status=stat; }
|
||||
QString version;
|
||||
QString codename;
|
||||
QString status;
|
||||
QString info_url;
|
||||
QHash<QString,QString> notes; // by platform
|
||||
QHash<QString,QList<Update> > updates;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(Update *)
|
||||
|
||||
class UpdateParser:public QXmlDefaultHandler
|
||||
{
|
||||
public:
|
||||
bool startDocument();
|
||||
bool endElement(const QString &namespaceURI, const QString &localName, const QString &name);
|
||||
bool characters(const QString &ch);
|
||||
bool startElement(const QString &namespaceURI, const QString &localName, const QString &name, const QXmlAttributes &atts);
|
||||
bool endDocument();
|
||||
QString latest() { return latest_version; }
|
||||
|
||||
QHash<QString,Release> releases;
|
||||
private:
|
||||
Update * update;
|
||||
Release * release;
|
||||
QString version, platform;
|
||||
QString release_date;
|
||||
QString latest_version;
|
||||
bool inRelease;
|
||||
bool inUpdate;
|
||||
bool inNotes;
|
||||
bool inUpdateNotes;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // UPDATEPARSER_H
|
@ -1,72 +0,0 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2011-12-14T23:44:40
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui network xml webkit
|
||||
|
||||
TARGET = upgrade
|
||||
TEMPLATE = app
|
||||
|
||||
DEFINES += QUAZIP_BUILD
|
||||
CONFIG(staticlib): DEFINES += QUAZIP_STATIC
|
||||
|
||||
unix:!symbian {
|
||||
headers.path=$$PREFIX/include/quazip
|
||||
headers.files=$$HEADERS
|
||||
target.path=$$PREFIX/lib
|
||||
INSTALLS += headers target
|
||||
|
||||
OBJECTS_DIR=.obj
|
||||
MOC_DIR=.moc
|
||||
|
||||
LIBS += -lz
|
||||
}
|
||||
|
||||
win32 {
|
||||
headers.path=$$PREFIX/include/quazip
|
||||
headers.files=$$HEADERS
|
||||
target.path=$$PREFIX/lib
|
||||
INSTALLS += headers target
|
||||
|
||||
*-g++*: LIBS += -lz.dll
|
||||
*-msvc*: LIBS += -lzlibwapi
|
||||
*-msvc*: QMAKE_LFLAGS += /IMPLIB:$$DESTDIR\\quazip.lib
|
||||
}
|
||||
|
||||
SOURCES += main.cpp\
|
||||
updateparser.cpp \
|
||||
quazip/zip.c \
|
||||
quazip/unzip.c \
|
||||
quazip/quazipnewinfo.cpp \
|
||||
quazip/quazipfile.cpp \
|
||||
quazip/quazip.cpp \
|
||||
quazip/quacrc32.cpp \
|
||||
quazip/quaadler32.cpp \
|
||||
quazip/qioapi.cpp \
|
||||
quazip/JlCompress.cpp \
|
||||
UpdateWindow.cpp
|
||||
|
||||
HEADERS += \
|
||||
updateparser.h \
|
||||
quazip/zip.h \
|
||||
quazip/unzip.h \
|
||||
quazip/quazipnewinfo.h \
|
||||
quazip/quazip_global.h \
|
||||
quazip/quazipfileinfo.h \
|
||||
quazip/quazipfile.h \
|
||||
quazip/quazip.h \
|
||||
quazip/quacrc32.h \
|
||||
quazip/quachecksum32.h \
|
||||
quazip/quaadler32.h \
|
||||
quazip/JlCompress.h \
|
||||
quazip/ioapi.h \
|
||||
quazip/crypt.h \
|
||||
UpdateWindow.h
|
||||
|
||||
FORMS += \
|
||||
UpdateWindow.ui
|
||||
|
||||
RESOURCES += \
|
||||
resources.qrc
|
Loading…
Reference in New Issue
Block a user