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