DISPLACE  1.0
A spatial model of fisheries to help sustainable fishing and maritime spatial planning
tseditorwindow.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 TSEDITORWINDOW_H
22 #define TSEDITORWINDOW_H
23 
24 #include <QMainWindow>
25 #include <QProcess>
26 #include <QTemporaryFile>
27 #include <QFuture>
28 #include <QFutureWatcher>
29 #include <QModelIndex>
30 
31 #include <memory>
32 
33 namespace Ui {
34 class TsEditorWindow;
35 }
36 
37 class QLabel;
38 class CsvTableModel;
39 class QProgressDialog;
40 
41 class TsEditorWindow : public QMainWindow
42 {
43  Q_OBJECT
44 
45 public:
46  explicit TsEditorWindow(QWidget *parent = 0);
48 
49 private slots:
50  void on_action_Open_triggered();
51  void on_varSelect_currentIndexChanged(const QString &arg1);
52  void on_areaSelect_activated(const QString &arg1);
53  void on_adimSelect_activated(const QString &arg1);
54  void on_action_Log_Window_triggered();
55  void on_clearLog_clicked();
56  void on_dockLogWindow_visibilityChanged(bool visible);
57  void on_actionQuit_triggered();
58  void on_action_Save_triggered();
59  void on_actionGenerate_triggered();
60  void on_actionRScript_location_triggered();
61  void on_actionGen_Script_location_triggered();
62 
63 signals:
64  void dataDirty();
65  void exportProgress(int value);
66  void exportTotalChanged(int total);
67 
68 public slots:
69  void processStarted();
70  void readOutput();
71  void readError();
72  void processExit(int);
73  void dataChanged(QModelIndex from, QModelIndex to, QVector<int> roles);
74  void dataDirtyChanged();
75  void exportFinished();
76 
77 protected:
78  void closeEvent(QCloseEvent *event);
79 
80 private:
82 
83  QString mFilename;
84  std::shared_ptr<QList<QStringList> > mData;
85  CsvTableModel *mModel;
86 
87  int colVar, colArea, colADim;
88 
89  QProcess *mProcess;
90  QTemporaryFile mDestFile, mParFile;
91 
92  bool mDirty;
93  QLabel *mDirtyIndicator;
94 
95  QFuture<QString> mExportWorker;
96  QFutureWatcher<QString> mExportWorkerWatcher;
97  QProgressDialog *mExporterWorkerDialog;
98 
99  void checkEnv();
100 
101  QString getScriptPath();
102 
103  void load(QString filename);
104  void updateKeys();
105  void genSampleFile();
106  void loadSampleFileGraph(QString name);
107 
108  void saveTempParamFile();
109  void generate(QString param_file, QString dest, QString variable, QString area, QString adim);
110  void generateAll (QString outpath);
111  QString generateAllWorker(QString outpath);
112 
113  double parseThreshold(QString l);
114 };
115 
116 #endif // TSEDITORWINDOW_H
void processExit(int)
Definition: tseditorwindow.cpp:470
Definition: tseditorwindow.h:41
void exportTotalChanged(int total)
Definition: moc_tseditorwindow.cpp:274
void dataDirtyChanged()
Definition: tseditorwindow.cpp:514
void dataDirty()
Definition: moc_tseditorwindow.cpp:261
Definition: csvtablemodel.h:11
Definition: dteditorwindow.h:32
void dataChanged(QModelIndex from, QModelIndex to, QVector< int > roles)
Definition: tseditorwindow.cpp:494
void processStarted()
Definition: tseditorwindow.cpp:451
TsEditorWindow(QWidget *parent=0)
Definition: tseditorwindow.cpp:40
std::pair< box, unsigned > value
Definition: diffusion.cpp:30
void readOutput()
Definition: tseditorwindow.cpp:458
void readError()
Definition: tseditorwindow.cpp:464
void exportProgress(int value)
Definition: moc_tseditorwindow.cpp:267
Definition: ui_tseditorwindow.h:251
~TsEditorWindow()
Definition: tseditorwindow.cpp:80
void exportFinished()
Definition: tseditorwindow.cpp:520
void closeEvent(QCloseEvent *event)
Definition: tseditorwindow.cpp:85