endif(COMMAND cmake_policy)
#=========================================================
+
#=========================================================
#List of vv tools to compile
SET(vv_TOOLS
vvToolSimpleInputSelectorWidget
vvToolInputSelectorWidget
vvToolStructureSetManager
+ vvRegisterForm
)
# All others sources
vvStructureSetActor.h
vvROIActor.h
vvToolCreatorBase.h
+ vvRegisterForm.h
)
QT4_WRAP_UI(vv_UI_CXX
qt_ui/vvHelpDialog.ui
+ qt_ui/vvRegisterForm.ui
qt_ui/vvDocumentation.ui
qt_ui/vvDicomSeriesSelector.ui
qt_ui/vvDummyWindow.ui #For testing
ENDIF(WIN32)
INCLUDE(CPack)
#=========================================================
+#=========================================================
+configure_file (
+ vvCommon.h.in
+ vvCommon.h
+)
+#=========================================================
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>vvRegisterForm</class>
+ <widget class="QDialog" name="vvRegisterForm">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>389</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="geometry">
+ <rect>
+ <x>40</x>
+ <y>260</y>
+ <width>341</width>
+ <height>32</height>
+ </rect>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="firstName">
+ <property name="geometry">
+ <rect>
+ <x>160</x>
+ <y>120</y>
+ <width>201</width>
+ <height>21</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label">
+ <property name="geometry">
+ <rect>
+ <x>100</x>
+ <y>120</y>
+ <width>61</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>First name</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_2">
+ <property name="geometry">
+ <rect>
+ <x>100</x>
+ <y>140</y>
+ <width>61</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Last name</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="lastName">
+ <property name="geometry">
+ <rect>
+ <x>160</x>
+ <y>140</y>
+ <width>201</width>
+ <height>21</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="email">
+ <property name="geometry">
+ <rect>
+ <x>160</x>
+ <y>160</y>
+ <width>201</width>
+ <height>21</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="group">
+ <property name="geometry">
+ <rect>
+ <x>160</x>
+ <y>180</y>
+ <width>201</width>
+ <height>21</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_3">
+ <property name="geometry">
+ <rect>
+ <x>100</x>
+ <y>160</y>
+ <width>61</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Email</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_4">
+ <property name="geometry">
+ <rect>
+ <x>100</x>
+ <y>180</y>
+ <width>61</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Institute</string>
+ </property>
+ </widget>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>vvRegisterForm</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>vvRegisterForm</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
--- /dev/null
+#define VV_VERSION "v@CPACK_PACKAGE_VERSION_MAJOR@.@CPACK_PACKAGE_VERSION_MINOR@.@CPACK_PACKAGE_VERSION_PATCH@"
+
\ No newline at end of file
#include <QInputDialog>
#include <QTimer>
#include "QTreePushButton.h"
+#include <QUrl>
// VV include
#include "vvMainWindow.h"
#include "vvHelpDialog.h"
+#include "vvRegisterForm.h"
#include "vvDocumentation.h"
#include "vvProgressDialog.h"
#include "vvQDicomSeriesSelector.h"
connect(timerMemory, SIGNAL(timeout()), this, SLOT(UpdateMemoryUsage()));
timerMemory->start(2000);
+
+ vvRegisterForm* registerForm = new vvRegisterForm(QUrl("http://localhost/vvregister/write.php"));
+ registerForm->show();
+
}
//------------------------------------------------------------------------------
--- /dev/null
+/*=========================================================================
+ Program: vv http://www.creatis.insa-lyon.fr/rio/vv
+
+ Authors belong to:
+ - University of LYON http://www.universite-lyon.fr/
+ - Léon Bérard cancer center http://www.centreleonberard.fr
+ - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the copyright notices for more information.
+
+ It is distributed under dual licence
+
+ - BSD See included LICENSE.txt file
+ - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+#include <QApplication>
+
+#include "vvRegisterForm.h"
+#include <QNetworkRequest>
+#include <iostream>
+#include "common/globals.h"
+#include "vvCommon.h"
+
+vvRegisterForm::vvRegisterForm(QUrl url):url(url) {
+ manager = new QNetworkAccessManager(this);
+ setupUi(this);
+}
+
+void vvRegisterForm::sendData(){
+ if(canPush()){
+ QUrl url2(url);
+ url2.addQueryItem("name", firstName->text().toUtf8());
+ url2.addQueryItem("lastName", lastName->text().toUtf8());
+ url2.addQueryItem("email", email->text().toUtf8());
+ url2.addQueryItem("group", group->text().toUtf8());
+ url2.addQueryItem("os", QString::fromUtf8(OS_NAME));
+ url2.addQueryItem("vvVersion", QString::fromUtf8(VV_VERSION));
+ manager->get(QNetworkRequest(url2));//make pushed in callback?
+ acquitPushed();
+ }
+}
+void vvRegisterForm::accept(){
+ sendData();
+ QDialog::accept();
+}
+bool vvRegisterForm::canPush(){
+ return true;
+}
+void vvRegisterForm::acquitPushed(){
+
+}
\ No newline at end of file
--- /dev/null
+/*=========================================================================
+ Program: vv http://www.creatis.insa-lyon.fr/rio/vv
+
+ Authors belong to:
+ - University of LYON http://www.universite-lyon.fr/
+ - Léon Bérard cancer center http://www.centreleonberard.fr
+ - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the copyright notices for more information.
+
+ It is distributed under dual licence
+
+ - BSD See included LICENSE.txt file
+ - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+#ifndef vvRegisterForm_h
+#define vvRegisterForm_h
+
+#include "ui_vvRegisterForm.h"
+#include <QUrl>
+#include <QNetworkAccessManager>
+class vvRegisterForm : public QDialog, private Ui::vvRegisterForm
+{
+ Q_OBJECT
+
+public:
+ vvRegisterForm(QUrl url);
+ void sendData();
+ ~vvRegisterForm() {}
+ //return true only if first time
+ virtual bool canPush();
+ virtual void acquitPushed();
+public slots:
+ virtual void accept();
+protected:
+ QUrl url;
+ QNetworkAccessManager* manager;
+};
+
+#endif
- BSD See included LICENSE.txt file
- CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
===========================================================================**/
-#include <fstream>
+#include <sstream>
#include <algorithm>
#include <QDir>
-
+#include <QSettings>
#include "clitkCommon.h"
#include "vvUtils.h"
const std::string vv_user_file=".vv_settings.txt";
typedef std::list<std::string> FileListType;
+static QSettings settings(QDir::homePath()+QString::fromStdString("/"+vv_user_file), QSettings::NativeFormat);
///Returns the last images opened by the user
FileListType GetRecentlyOpenedImages()
{
- std::ifstream in((QDir::homePath().toStdString() + "/" + vv_user_file).c_str());
- std::string current_file;
FileListType result;
- in >> current_file;
- while (in.good()) {
- result.push_back(current_file);
- in >> current_file;
- }
- in.close();
+ settings.beginGroup("recentFiles");
+ QStringList keys = settings.childKeys();
+ for(int i=0; i<keys.size(); i++){
+ std::string value=settings.value(QString::fromStdString (keys[i].toStdString())).toString().toStdString();
+ result.push_back(value);
+ }
+ settings.endGroup();
return result;
}
void AddToRecentlyOpenedImages(std::string filename)
{
FileListType file_list = GetRecentlyOpenedImages();
+
FileListType::iterator i = std::find(file_list.begin(),file_list.end(),filename);
if (i != file_list.end()) // avoid dupes
file_list.erase(i);
while (file_list.size() >= 6) //keep list to a reasonable size
file_list.pop_back();
file_list.push_front(filename);
- std::ofstream out((QDir::homePath().toStdString() + "/" + vv_user_file).c_str(),std::ios_base::out | std::ios_base::trunc);
- for (FileListType::iterator j = file_list.begin() ; j != file_list.end() ; j++)
- out << (*j) << std::endl;
- out.close();
+
+ settings.beginGroup("recentFiles");
+ int index=0;
+ for (FileListType::iterator j = file_list.begin() ; j != file_list.end() ; j++){
+ QString s=QString(index++);
+ settings.setValue(s, QString::fromStdString ( *j ));
+ }
+ settings.endGroup();
}