dataload_csv.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <QObject>
4 #include <QtPlugin>
5 #include <QStandardItemModel>
7 #include "ui_dataload_csv.h"
8 #include "QCSVHighlighter"
9 
10 using namespace PJ;
11 
12 class DateTimeHelp;
13 
14 class DataLoadCSV : public DataLoader
15 {
16  Q_OBJECT
17  Q_PLUGIN_METADATA(IID "facontidavide.PlotJuggler3.DataLoader")
18  Q_INTERFACES(PJ::DataLoader)
19 
20 public:
21  DataLoadCSV();
22  virtual const std::vector<const char*>& compatibleFileExtensions() const override;
23 
24  virtual bool readDataFromFile(PJ::FileLoadInfo* fileload_info,
25  PlotDataMapRef& destination) override;
26 
27  virtual ~DataLoadCSV();
28 
29  virtual const char* name() const override
30  {
31  return "DataLoad CSV";
32  }
33 
34  bool xmlSaveState(QDomDocument& doc, QDomElement& parent_element) const override;
35 
36  bool xmlLoadState(const QDomElement& parent_element) override;
37 
38 protected:
39  void parseHeader(QFile& file, std::vector<std::string>& ordered_names);
40 
41  int launchDialog(QFile& file, std::vector<std::string>* ordered_names);
42 
43 private:
44  std::vector<const char*> _extensions;
45 
46  std::string _default_time_axis;
47 
48  QChar _delimiter;
49 
51 
53 
54  QDialog* _dialog;
55  Ui::DialogCSV* _ui;
57 
58  QStandardItemModel* _model;
59 
60  bool multiple_columns_warning_ = true;
61 };
DataLoadCSV::_ui
Ui::DialogCSV * _ui
Definition: dataload_csv.h:55
DataLoadCSV::_extensions
std::vector< const char * > _extensions
Definition: dataload_csv.h:44
DataLoadCSV::_fileInfo
FileLoadInfo * _fileInfo
Definition: dataload_csv.h:52
QCSVHighlighter
Class, that describes C++ code highlighter.
Definition: QCSVHighlighter.hpp:20
PJ::FileLoadInfo
Definition: dataloader_base.h:18
DataLoadCSV::_model
QStandardItemModel * _model
Definition: dataload_csv.h:58
DataLoadCSV::name
virtual const char * name() const override
Name of the plugin type, NOT the particular instance.
Definition: dataload_csv.h:29
DataLoadCSV
Definition: dataload_csv.h:14
DateTimeHelp
Definition: datetimehelp.h:11
DataLoadCSV::_dateTime_dialog
DateTimeHelp * _dateTime_dialog
Definition: dataload_csv.h:56
DataLoadCSV::_delimiter
QChar _delimiter
Definition: dataload_csv.h:48
DataLoadCSV::_dialog
QDialog * _dialog
Definition: dataload_csv.h:54
DataLoadCSV::_csvHighlighter
QCSVHighlighter _csvHighlighter
Definition: dataload_csv.h:50
dataloader_base.h
PJ::DataLoader
The DataLoader plugin type is used to load files.
Definition: dataloader_base.h:34
PJ
Definition: dataloader_base.h:16
PJ::PlotDataMapRef
Definition: plotdata.h:34
DataLoadCSV::_default_time_axis
std::string _default_time_axis
Definition: dataload_csv.h:46


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:43