Tulip  4.9.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
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(int firstLine = 0)const;
52  int getFirstLineIndex() const;
53 
54 private:
55  void updatePreview();
56  CSVParserConfigurationWidget* parserConfigurationWidget;
57  CSVTableWidget* previewTableWidget;
58  unsigned int previewLineNumber;
59 
60 private slots:
61  void parserChanged();
62 };
63 
64 class CSVImportConfigurationQWizardPage : public QWizardPage {
65  Q_OBJECT
66 public:
67  CSVImportConfigurationQWizardPage ( QWidget * parent = NULL );
68  void initializePage();
69  CSVImportParameters getImportParameters()const;
70 
71 private:
72  CSVImportConfigurationWidget* importConfigurationWidget;
73 };
74 
75 class CSVGraphMappingConfigurationQWizardPage : public QWizardPage {
76  Q_OBJECT
77 public:
78  CSVGraphMappingConfigurationQWizardPage ( QWidget * parent = NULL );
79  void initializePage();
80  bool isComplete() const;
81  CSVToGraphDataMapping* buildMappingObject()const;
82 
83 private:
84  CSVGraphMappingConfigurationWidget* graphMappingConfigurationWidget;
85 };
86 
87 class TLP_QT_SCOPE CSVImportWizard : public QWizard {
88  Q_OBJECT
89 
90 public:
91  explicit CSVImportWizard(QWidget *parent = NULL);
92  ~CSVImportWizard();
93 
94  CSVParsingConfigurationQWizardPage* getParsingConfigurationPage()const;
95  CSVImportConfigurationQWizardPage* getImportConfigurationPage()const;
96  CSVGraphMappingConfigurationQWizardPage* getMappingConfigurationPage()const;
97 
98  inline void setGraph(Graph* graph) {
99  this->graph = graph;
100  }
101 
102  inline Graph* getGraph()const {
103  return graph;
104  }
105 
106 public slots:
107  void accept();
108 private:
109  Ui::CSVImportWizard *ui;
110  tlp::Graph* graph;
111 };
112 }
113 #endif // CSVIMPORTWIZARD_H
114 ///@endcond