DISPLACE  1.0
A spatial model of fisheries to help sustainable fishing and maritime spatial planning
csveditor.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // DISPLACE: DYNAMIC INDIVIDUAL VESSEL-BASED SPATIAL PLANNING
3 // AND EFFORT DISPLACEMENT
4 // Copyright (c) 2012-2019 Francois Bastardie <fba@aqua.dtu.dk>
5 
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 
16 // You should have received a copy of the GNU General Public License along
17 // with this program; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 // --------------------------------------------------------------------------
20 
21 #ifndef CSVEDITOR_H
22 #define CSVEDITOR_H
23 
24 #include <QMainWindow>
25 #include <QList>
26 #include <QString>
27 #include <QFuture>
28 #include <QFutureWatcher>
29 
30 #include <csv/csvtablemodel.h>
31 #include <waitdialog.h>
32 #include <csv/csvimporter.h>
33 
34 #include <memory>
35 
36 namespace Ui {
37 class CsvEditor;
38 }
39 
40 class CsvEditor : public QMainWindow
41 {
42  Q_OBJECT
43 
44 public:
45  explicit CsvEditor(QWidget *parent = 0);
46  ~CsvEditor();
47 
48 private slots:
49  void onLoadFinished();
50  void separatorChanged(QAction *);
51 
52  void on_action_Open_triggered();
53  void on_actionFirst_line_as_Headers_toggled(bool);
54  void on_action_Save_triggered();
55  void on_action_Insert_row_after_triggered();
56  void on_action_Insert_row_at_current_position_triggered();
57  void on_action_Remove_current_row_triggered();
58 
59 protected:
60  void closeEvent(QCloseEvent *);
61 
62 private:
63  Ui::CsvEditor *ui;
64  CsvTableModel *mModel;
65  std::shared_ptr<QList<QStringList> > mData;
66  QString mFilename;
67  QChar mSeparator;
68 
69  QFuture<QList<QStringList>> mWorkLoading;
70  QFutureWatcher<QList<QStringList>> mWorkLoadingWatcher;
71  WaitDialog *mWaitDialog;
72  CsvImporter mImporter;
73 
74  void load (QString file);
75  void updateCheckState(bool state);
76 };
77 
78 #endif // CSVEDITOR_H
Definition: csvtablemodel.h:11
Definition: dteditorwindow.h:32
CsvEditor(QWidget *parent=0)
Definition: csveditor.cpp:33
Definition: csveditor.h:40
~CsvEditor()
Definition: csveditor.cpp:69
Definition: csvimporter.h:9
Definition: waitdialog.h:56
Definition: ui_csveditor.h:173
void closeEvent(QCloseEvent *)
Definition: csveditor.cpp:151