]> Creatis software - clitk.git/blob - vv/vvRegisterForm.cxx
Message for registering vv's user information
[clitk.git] / vv / vvRegisterForm.cxx
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to:
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://www.centreleonberard.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
8
9   This software is distributed WITHOUT ANY WARRANTY; without even
10   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11   PURPOSE.  See the copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
18 #include <QApplication>
19
20 #include "vvRegisterForm.h"
21 #include <QNetworkRequest>
22 #include <QSettings>
23 #include <QDir>
24 #include <iostream>
25 #include "common/globals.h"
26 #include "vvCommon.h"
27 #include "vvUtils.h"
28
29 vvRegisterForm::vvRegisterForm(QUrl url):url(url) { 
30   manager = new QNetworkAccessManager(this);
31   setupUi(this);
32 }
33
34 void vvRegisterForm::sendData(){
35   QUrl url2(url);
36   url2.addQueryItem("name", firstName->text().toUtf8());
37   url2.addQueryItem("lastName", lastName->text().toUtf8());
38   url2.addQueryItem("email", email->text().toUtf8());
39   url2.addQueryItem("group", group->text().toUtf8());
40   url2.addQueryItem("os", QString::fromUtf8(OS_NAME));
41   url2.addQueryItem("vvVersion", QString::fromUtf8(VV_VERSION));
42   manager->get(QNetworkRequest(url2));
43 }
44 void vvRegisterForm::accept(){
45   sendData();
46   QDialog::accept();
47 }
48 bool vvRegisterForm::canPush(){
49   QSettings settings(getVVSettingsPath(), getSettingsOptionFormat());
50   return settings.value("vvVersion").toString().toStdString()<VV_VERSION;
51 }
52 void vvRegisterForm::acquitPushed(){
53   QSettings settings(getVVSettingsPath(), getSettingsOptionFormat());
54   settings.setValue("vvVersion", VV_VERSION);
55 }
56 void vvRegisterForm::show(){
57  osName->setText(QString::fromStdString(OS_NAME));
58  QDialog::show();
59 }