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