From: Konrad Rosenbaum Date: Wed, 14 Aug 2013 15:57:53 +0000 (+0200) Subject: finish auto-installer X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=ec8d098b1e6a04428635f3810f6bf8dcd4ab5daa;p=web%2Fkonrad%2Fsmoke.git finish auto-installer --- diff --git a/.gitignore b/.gitignore index 0f15957..b1d7698 100644 --- a/.gitignore +++ b/.gitignore @@ -7,9 +7,6 @@ #Build files, libs, executables libQtZip*.* Makefile* -msmoke -msmoke.exe -msmoke.app .ctmp core core.* @@ -44,6 +41,8 @@ debian/*log debian/*substvars debian/magicsmoke2-* bin/* +magicsmoke.xml +*.zip #Unit Test Environment tests/apache/*pid diff --git a/magicsmoke.aurora b/magicsmoke.aurora index 6abd186..69a34d0 100644 --- a/magicsmoke.aurora +++ b/magicsmoke.aurora @@ -2,7 +2,7 @@ - + - - magicsmoke - gpg - lib*.so* + + + magicsmoke + gpg + lib*.so* + - *.exe - *.dll + + *.exe + *.dll + @@ -42,7 +45,7 @@ - + libQt5Core.so* libQt5Gui.so* libQt5Network.so* @@ -53,7 +56,7 @@ libQt5Xml.so* libQt5Svg.so* - + platforms/*.so platforminputcontexts/*.so imageformats/*.so @@ -87,9 +90,4 @@ - - - - - diff --git a/mainapp/mainapp.pro b/mainapp/mainapp.pro index f3a0d25..8edd67d 100644 --- a/mainapp/mainapp.pro +++ b/mainapp/mainapp.pro @@ -34,3 +34,11 @@ linux-g++* { #make sure we find our libs QMAKE_LFLAGS += -Wl,-rpath,\'\$$ORIGIN\' } +#protect the stack +QMAKE_CFLAGS += -fstack-protector-all -Wstack-protector +QMAKE_CXXFLAGS += -fstack-protector-all -Wstack-protector + +#ASLR for windows +win32 { + QMAKE_LFLAGS += -Wl,--nxcompat -Wl,--dynamicbase +} diff --git a/src/main.cpp b/src/main.cpp index da5d776..12a88fc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -356,10 +356,40 @@ void MApplication::initialize() void MApplication::initUpdater() { - updater=new Aurora; - //TODO: read a local XML file to set Aurora + updater=new Aurora(applicationDirPath()+"/magicsmoke.xml",this); + connect(updater,SIGNAL(newVersionAvailable(QString)),this,SLOT(updateReadyDownload(QString))); + connect(updater,SIGNAL(readyForInstallation()),this,SLOT(updaterReadyInstall())); + connect(updater,SIGNAL(installationFinished()),this,SLOT(updaterCompleted())); + connect(updater,SIGNAL(downloadFailed()),this,SLOT(updaterFailed())); + connect(updater,SIGNAL(installationFailed()),this,SLOT(updaterFailed())); + //we ignore all errors that happen prior to successful verification, since they + //would create too much noise } +void MApplication::updateReadyDownload(const QString& v) +{ + qDebug()<<"Asking for Download permission"; + QMessageBox::StandardButton r=QMessageBox::question(0,tr("New Update"),tr("A new version of MagicSmoke is available. Do you want to download the new version %1?").arg(v),QMessageBox::Yes|QMessageBox::No,QMessageBox::Yes); + if(r==QMessageBox::Yes) + updater->startDownload(); +} + +void MApplication::updaterReadyInstall() +{ + QMessageBox::Button r=QMessageBox::question(0,tr("New Update"),tr("A new version of MagicSmoke is ready for installation. Do you want to install?"),QMessageBox::Yes|QMessageBox::No,QMessageBox::Yes); + if(r==QMessageBox::Yes) + updater->startInstallation(); +} + +void MApplication::updaterCompleted() +{ + QMessageBox::information(0,tr("Update Complete"),tr("A new version of MagicSmoke has been installed. It will be used the next time you start MagicSmoke.")); +} + +void MApplication::updaterFailed() +{ + QMessageBox::warning(0,tr("Update Failed"),tr("An update of MagicSmoke failed.")); +} QString MApplication::dataDir() { diff --git a/src/main.h b/src/main.h index 42d5ad7..98e2556 100644 --- a/src/main.h +++ b/src/main.h @@ -75,6 +75,15 @@ class MAGICSMOKE_EXPORT MApplication:public QApplication ///initialize the updater void initUpdater(); + ///updater is ready for download + void updateReadyDownload(const QString&); + ///updater is ready for install + void updaterReadyInstall(); + ///update complete + void updaterCompleted(); + ///something failed for the updater + void updaterFailed(); + private: EFilter *ef=nullptr; QTranslator*qttrans=nullptr,*mstrans=nullptr; diff --git a/src/smoke.pro b/src/smoke.pro index 97d046f..b9ca79d 100644 --- a/src/smoke.pro +++ b/src/smoke.pro @@ -49,3 +49,10 @@ include(wob/wob.pri) #make sure dependencies are found DEPENDPATH += $$INCLUDEPATH LIBS += -L$$PWD/../bin + +#protect the stack +QMAKE_CFLAGS += -fstack-protector-all -Wstack-protector +QMAKE_CXXFLAGS += -fstack-protector-all -Wstack-protector +win32 { + QMAKE_LFLAGS += -Wl,--nxcompat +} diff --git a/taurus b/taurus index 8db2c64..98700f9 160000 --- a/taurus +++ b/taurus @@ -1 +1 @@ -Subproject commit 8db2c6440c48b05426855aa64a1ce7673a754e2f +Subproject commit 98700f93f1c6bb32761da38b7d5b8d2a71da91ef