DISPLACE  1.0
A spatial model of fisheries to help sustainable fishing and maritime spatial planning
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
mergepopulationplugincomponent.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 MERGEPOPULATIONPLUGINCOMPONENT_H
22 #define MERGEPOPULATIONPLUGINCOMPONENT_H
23 
24 #include <QWidget>
25 #include <QAbstractTableModel>
26 
27 namespace Ui {
29 }
30 
35 class MergePopulationPluginComponent : public QWidget
36 {
37  Q_OBJECT
38 
39 public:
40  explicit MergePopulationPluginComponent(QWidget *parent = 0);
42 
43  void loadStocksAndSizes (QString file, QChar separator);
44  void setSizeGroupsCount(int n);
45 
46  bool isOutputStocksChecked() const;
47  QStringList getSelectedStocks() const;
48  QList<int> getSelectedSizes() const;
49 
50  QString getOutputStockFilename() const;
51 
52 private slots:
53  void on_browsePopOut_clicked();
54  void on_expand_toggled(bool checked);
55  void on_optGeneratePopFile_toggled(bool checked);
56  void on_expandSizes_toggled(bool checked);
57  void on_allStocks_clicked();
58  void on_noStocks_clicked();
59  void on_invStocks_clicked();
60  void on_allGroups_clicked();
61  void on_noGroups_clicked();
62  void on_invGroups_clicked();
63 
64 private:
66 
67 protected:
68  class TableModel : public QAbstractTableModel {
69  public:
70  enum Type {Stocks, Sizes};
71  TableModel(MergePopulationPluginComponent *owner, Type type, QObject *parent = 0);
72 
73  int rowCount(const QModelIndex &parent) const;
74  int columnCount(const QModelIndex &parent) const;
75  QVariant data(const QModelIndex &index, int role) const;
76  bool setData(const QModelIndex &index, const QVariant &value, int role);
77  QVariant headerData(int section, Qt::Orientation orientation, int role) const;
78 
79  Qt::ItemFlags flags(const QModelIndex &index) const;
80 
81  void load(QStringList list, QList<bool> selection);
82  void setDataCollection (QStringList list);
83 
84  int getSelectionCount() const;
85  QStringList getSelection() const;
86  QList<int> getSelectionIndexes() const;
87 
89 
90  void selectAll();
91  void selectNone();
92  void invSelection();
93  protected:
96  int mNumSelected = 0;
97 
98  QStringList mList;
99  QList<bool> mListSelection;
100  };
101 
104 
105 private:
106  void selectedStocksNumberChanged(TableModel::Type type);
107 
108 
109 };
110 
111 #endif // MERGEPOPULATIONPLUGINCOMPONENT_H
Definition: mergepopulationplugincomponent.h:68
QList< bool > mListSelection
Definition: mergepopulationplugincomponent.h:99
void load(QStringList list, QList< bool > selection)
Definition: mergepopulationplugincomponent.cpp:271
TableModel * mModelStocks
Definition: mergepopulationplugincomponent.h:102
int columnCount(const QModelIndex &parent) const
Definition: mergepopulationplugincomponent.cpp:193
Type mType
Definition: mergepopulationplugincomponent.h:95
QStringList getSelectedStocks() const
Definition: mergepopulationplugincomponent.cpp:128
Definition: dteditorwindow.h:32
QVariant headerData(int section, Qt::Orientation orientation, int role) const
Definition: mergepopulationplugincomponent.cpp:234
Definition: mergepopulationplugincomponent.h:70
QStringList mList
Definition: mergepopulationplugincomponent.h:98
QString getOutputStockFilename() const
Definition: mergepopulationplugincomponent.cpp:138
void selectNone()
Definition: mergepopulationplugincomponent.cpp:341
QList< int > getSelectionIndexes() const
Definition: mergepopulationplugincomponent.cpp:312
void invSelection()
Definition: mergepopulationplugincomponent.cpp:353
void selectAll()
Definition: mergepopulationplugincomponent.cpp:329
int getSelectionCount() const
Definition: mergepopulationplugincomponent.cpp:295
TableModel * mModelSizes
Definition: mergepopulationplugincomponent.h:103
Definition: ui_mergepopulationplugincomponent.h:231
Type
Definition: mergepopulationplugincomponent.h:70
int rowCount(const QModelIndex &parent) const
Definition: mergepopulationplugincomponent.cpp:188
TableModel(MergePopulationPluginComponent *owner, Type type, QObject *parent=0)
Definition: mergepopulationplugincomponent.cpp:183
void loadStocksAndSizes(QString file, QChar separator)
Definition: mergepopulationplugincomponent.cpp:58
MergePopulationPluginComponent(QWidget *parent=0)
Definition: mergepopulationplugincomponent.cpp:34
std::pair< box, unsigned > value
Definition: diffusion.cpp:30
void setSizeGroupsCount(int n)
Definition: mergepopulationplugincomponent.cpp:115
int mNumSelected
Definition: mergepopulationplugincomponent.h:96
QVariant data(const QModelIndex &index, int role) const
Definition: mergepopulationplugincomponent.cpp:198
Qt::ItemFlags flags(const QModelIndex &index) const
Definition: mergepopulationplugincomponent.cpp:263
bool setData(const QModelIndex &index, const QVariant &value, int role)
Definition: mergepopulationplugincomponent.cpp:214
MergePopulationPluginComponent * mOwner
Definition: mergepopulationplugincomponent.h:94
Definition: mergepopulationplugincomponent.h:70
void stockSelectionNumberChanged()
Definition: mergepopulationplugincomponent.cpp:324
QList< int > getSelectedSizes() const
Definition: mergepopulationplugincomponent.cpp:133
void setDataCollection(QStringList list)
Definition: mergepopulationplugincomponent.cpp:282
QStringList getSelection() const
Definition: mergepopulationplugincomponent.cpp:300
a "pluggable" Widget to extends the MergeDataDialog This class extends the functionalities of MergeDa...
Definition: mergepopulationplugincomponent.h:35
~MergePopulationPluginComponent()
Definition: mergepopulationplugincomponent.cpp:53
bool isOutputStocksChecked() const
Definition: mergepopulationplugincomponent.cpp:123