Tulip  4.3.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
CSVParserConfigurationWidget.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 CSVPARSERCONFIGURATIONWIDGET_H
22 #define CSVPARSERCONFIGURATIONWIDGET_H
23 
24 #include <QWidget>
25 
26 #include <tulip/tulipconf.h>
27 
28 namespace Ui {
29 class CSVParserConfigurationWidget;
30 }
31 
32 namespace tlp {
33 
34 class CSVParser;
35 
36 class TLP_QT_SCOPE CSVParserConfigurationWidget : public QWidget {
37  Q_OBJECT
38 public:
39  CSVParserConfigurationWidget(QWidget *parent = NULL);
40  ~CSVParserConfigurationWidget();
41  /**
42  * @brief Generate a csv parser in function of the parameters in the widget. User define the range of line to import.
43  * The user takes the ownership of the widget.
44  **/
45  CSVParser * buildParser(unsigned int firstLine=0, unsigned int lastLine=UINT_MAX)const;
46 
47  std::string getFile()const;
48  bool isValid()const;
49  QString getSeparator()const;
50  char getTextSeparator()const;
51  std::string getEncoding()const;
52  bool invertMatrix()const;
53  bool getMergeSeparator() const;
54 
55 public slots:
56  void setFileToOpen(const QString& fileToOpen);
57 protected:
58  void fillEncodingComboBox();
59 
60 protected slots:
61  void changeFileNameButtonPressed();
62  void encodingChanged();
63  void changeSeparator(int index);
64 
65 private:
66 
67  QString getSeparator(int index)const;
68 
69  Ui::CSVParserConfigurationWidget *ui;
70 
71 signals:
72  void parserChanged();
73 };
74 }
75 #endif // CSVPARSERCONFIGURATIONWIDGET_H
76 ///@endcond