1 /*
2  tags_table_presenter.h     MindForger thinking notebook
3 
4  Copyright (C) 2016-2020 Martin Dvorak <martin.dvorak@mindforger.com>
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License
8  as published by the Free Software Foundation; either version 2
9  of the License, or (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
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 #ifndef M8RUI_TAGS_TABLE_PRESENTER_H
20 #define M8RUI_TAGS_TABLE_PRESENTER_H
21 
22 #include <QtWidgets>
23 
24 #include "../../lib/src/representations/html/html_outline_representation.h"
25 
26 #include "tags_table_view.h"
27 #include "tags_table_model.h"
28 #include "html_delegate.h"
29 
30 namespace m8r {
31 
32 class TagsTablePresenter : public QObject
33 {
34     Q_OBJECT
35 
36     TagsTableView* view;
37     TagsTableModel* model;
38 
39 public:
40     static const int NO_ROW = -1;
41 
42 public:
43     explicit TagsTablePresenter(TagsTableView* view, HtmlOutlineRepresentation* htmlRepresentation);
44     TagsTablePresenter(const TagsTablePresenter&) = delete;
45     TagsTablePresenter(const TagsTablePresenter&&) = delete;
46     TagsTablePresenter &operator=(const TagsTablePresenter&) = delete;
47     TagsTablePresenter &operator=(const TagsTablePresenter&&) = delete;
48     ~TagsTablePresenter();
49 
getModel()50     TagsTableModel* getModel() const { return model; }
getView()51     TagsTableView* getView() const { return view; }
52 
53     void refresh(const std::map<const Tag*, int>& tags);
54     int getCurrentRow() const;
55 };
56 
57 }
58 #endif // M8RUI_TAGS_TABLE_PRESENTER_H
59