Tulip  4.2.0
Better Visualization Through Research
 All Classes Namespaces 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 
27 #include <tulip/Graph.h>
28 #include <tulip/CSVGraphImport.h>
29 
30 namespace Ui {
31 class CSVImportWizard;
32 }
33 namespace tlp {
34 
35 class CSVParser;
36 class CSVParserConfigurationWidget;
37 class CSVTableWidget;
38 class CSVImportConfigurationWidget;
39 class CSVToGraphDataMapping;
40 class CSVGraphMappingConfigurationWidget;
41 
42 /**
43  * @brief QWIzardPage encapsulating a CSVParserConfigurationWidget and a preview.
44  **/
45 class CSVParsingConfigurationQWizardPage : public QWizardPage {
46  Q_OBJECT
47 public:
48  CSVParsingConfigurationQWizardPage ( QWidget * parent = NULL );
49  bool isComplete() const;
50  CSVParser* buildParser()const;
51 
52 private:
53  void updatePreview();
54  CSVParserConfigurationWidget* parserConfigurationWidget;
55  CSVTableWidget* previewTableWidget;
56  unsigned int previewLineNumber;
57 
58 private slots:
59  void parserChanged();
60 };
61 
62 class CSVImportConfigurationQWizardPage : public QWizardPage {
63  Q_OBJECT
64 public:
65  CSVImportConfigurationQWizardPage ( QWidget * parent = NULL );
66  void initializePage();
67  CSVImportParameters getImportParameters()const;
68 
69 private:
70  CSVImportConfigurationWidget* importConfigurationWidget;
71 };
72 
73 class CSVGraphMappingConfigurationQWizardPage : public QWizardPage {
74  Q_OBJECT
75 public:
76  CSVGraphMappingConfigurationQWizardPage ( QWidget * parent = NULL );
77  void initializePage();
78  bool isComplete() const;
79  CSVToGraphDataMapping* buildMappingObject()const;
80 
81 private:
82  CSVGraphMappingConfigurationWidget* graphMappingConfigurationWidget;
83 };
84 
85 class TLP_QT_SCOPE CSVImportWizard : public QWizard {
86  Q_OBJECT
87 
88 public:
89  explicit CSVImportWizard(QWidget *parent = NULL);
90  ~CSVImportWizard();
91 
92  CSVParsingConfigurationQWizardPage* getParsingConfigurationPage()const;
93  CSVImportConfigurationQWizardPage* getImportConfigurationPage()const;
94  CSVGraphMappingConfigurationQWizardPage* getMappingConfigurationPage()const;
95 
96  inline void setGraph(Graph* graph) {
97  this->graph = graph;
98  }
99 
100  inline Graph* getGraph()const {
101  return graph;
102  }
103 
104 public slots:
105  void accept();
106 private:
107  Ui::CSVImportWizard *ui;
108  tlp::Graph* graph;
109 };
110 }
111 #endif // CSVIMPORTWIZARD_H
112 ///@endcond