Tulip  4.1.0
Better Visualization Through Research
 All Classes Files Functions Variables Enumerations Enumerator Properties Groups Pages
CSVImportWizard.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef CSVIMPORTWIZARD_H
22 #define CSVIMPORTWIZARD_H
23 
24 #include <QtGui/QWizard>
25 #include <QtGui/QWizardPage>
26 #include <QtGui/QTableWidget>
27 #include <QtGui/QHeaderView>
28 #include "tulip/CSVParserConfigurationWidget.h"
29 #include "tulip/CSVImportConfigurationWidget.h"
30 #include "tulip/CSVGraphMappingConfigurationWidget.h"
31 namespace Ui {
32 class CSVImportWizard;
33 }
34 namespace tlp {
35 
36 /**
37  * @brief QWIzardPage encapsulating a CSVParserConfigurationWidget and a preview.
38  **/
39 class CSVParsingConfigurationQWizardPage : public QWizardPage {
40  Q_OBJECT
41 public:
42  CSVParsingConfigurationQWizardPage ( QWidget * parent = NULL );
43  bool isComplete() const;
44  CSVParser* buildParser()const;
45 
46 private:
47  void updatePreview();
48  CSVParserConfigurationWidget* parserConfigurationWidget;
49  CSVTableWidget* previewTableWidget;
50  unsigned int previewLineNumber;
51 
52 private slots:
53  void parserChanged();
54 };
55 
56 class CSVImportConfigurationQWizardPage : public QWizardPage {
57  Q_OBJECT
58 public:
59  CSVImportConfigurationQWizardPage ( QWidget * parent = NULL );
60  void initializePage();
61  CSVImportParameters getImportParameters()const {
62  return importConfigurationWidget->getImportParameters();
63  }
64 private:
65  CSVImportConfigurationWidget* importConfigurationWidget;
66 };
67 
68 class CSVGraphMappingConfigurationQWizardPage : public QWizardPage {
69  Q_OBJECT
70 public:
71  CSVGraphMappingConfigurationQWizardPage ( QWidget * parent = NULL );
72  void initializePage();
73  bool isComplete() const;
74  CSVToGraphDataMapping* buildMappingObject()const {
75  return graphMappingConfigurationWidget->buildMappingObject();
76  }
77 private:
78  CSVGraphMappingConfigurationWidget* graphMappingConfigurationWidget;
79 };
80 
81 class TLP_QT_SCOPE CSVImportWizard : public QWizard {
82  Q_OBJECT
83 
84 public:
85  explicit CSVImportWizard(QWidget *parent = NULL);
86  ~CSVImportWizard();
87 
88  CSVParsingConfigurationQWizardPage* getParsingConfigurationPage()const;
89  CSVImportConfigurationQWizardPage* getImportConfigurationPage()const;
90  CSVGraphMappingConfigurationQWizardPage* getMappingConfigurationPage()const;
91 
92  void setGraph(Graph* graph) {
93  this->graph = graph;
94  }
95 
96  Graph* getGraph()const {
97  return graph;
98  }
99 
100 public slots:
101  void accept();
102 private:
103  Ui::CSVImportWizard *ui;
104  tlp::Graph* graph;
105 };
106 }
107 #endif // CSVIMPORTWIZARD_H
108 ///@endcond