xref: /glogg/src/versionchecker.cpp (revision 431d01de442c70924efde84d3dac666867149578)
1 /*
2  * Copyright (C) 2014 Nicolas Bonnefon and other contributors
3  *
4  * This file is part of glogg.
5  *
6  * glogg is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * glogg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with glogg.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #include "versionchecker.h"
21 
22 #include "log.h"
23 
24 const char* VersionChecker::VERSION_URL =
25     "http://gloggversion.bonnefon.org/latest";
26 
27 VersionChecker::VersionChecker() : QObject(), manager_( this )
28 {
29 }
30 
31 VersionChecker::~VersionChecker()
32 {
33 }
34 
35 void VersionChecker::startCheck()
36 {
37     LOG(logDEBUG) << "VersionChecker::startCheck()";
38 
39     connect( &manager_, SIGNAL( finished( QNetworkReply* ) ),
40             this, SLOT( downloadFinished( QNetworkReply* ) ) );
41 
42     QNetworkRequest request;
43     request.setUrl( QUrl( VERSION_URL ) );
44     request.setRawHeader( "User-Agent", "glogg-" GLOGG_VERSION );
45     manager_.get( request );
46 }
47 
48 void VersionChecker::downloadFinished( QNetworkReply* reply )
49 {
50     LOG(logDEBUG) << "VersionChecker::downloadFinished()";
51 }
52