Drone checks for updated software version at startup

This commit is contained in:
Srivats P 2016-06-07 21:11:38 +05:30
parent 4a2c0066b9
commit cd100aa6e0
3 changed files with 20 additions and 1 deletions

View File

@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#include "myservice.h" #include "myservice.h"
#include "rpcserver.h" #include "rpcserver.h"
#include "settings.h" #include "settings.h"
#include "../common/updater.h"
#include <QMetaType> #include <QMetaType>
@ -32,8 +33,15 @@ extern const char* revision;
Drone::Drone(QObject *parent) Drone::Drone(QObject *parent)
: QObject(parent) : QObject(parent)
{ {
Updater *updater = new Updater();
rpcServer = new RpcServer(); rpcServer = new RpcServer();
service = new MyService(); service = new MyService();
connect(updater, SIGNAL(newVersionAvailable(QString)),
this, SLOT(onNewVersion(QString)));
updater->checkForNewVersion();
} }
Drone::~Drone() Drone::~Drone()
@ -74,3 +82,11 @@ MyService* Drone::rpcService()
{ {
return service; return service;
} }
void Drone::onNewVersion(QString newVersion)
{
qWarning("%s", qPrintable(QString("New Ostinato version %1 available. "
"Visit http://ostinato.org to download").arg(newVersion)));
}

View File

@ -34,6 +34,9 @@ public:
bool init(); bool init();
MyService* rpcService(); MyService* rpcService();
private slots:
void onNewVersion(QString version);
private: private:
RpcServer *rpcServer; RpcServer *rpcServer;
MyService *service; MyService *service;

View File

@ -1,6 +1,6 @@
TEMPLATE = app TEMPLATE = app
CONFIG += qt ver_info CONFIG += qt ver_info
QT += network script QT += network script xml
QT -= gui QT -= gui
DEFINES += HAVE_REMOTE WPCAP DEFINES += HAVE_REMOTE WPCAP
linux*:system(grep -q IFLA_STATS64 /usr/include/linux/if_link.h): \ linux*:system(grep -q IFLA_STATS64 /usr/include/linux/if_link.h): \