1 /*
2  recent_notes_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_RECENT_NOTES_TABLE_PRESENTER_H
20 #define M8RUI_RECENT_NOTES_TABLE_PRESENTER_H
21 
22 #include <QtWidgets>
23 
24 #include "../../lib/src/representations/html/html_outline_representation.h"
25 
26 #include "recent_notes_table_view.h"
27 #include "recent_notes_table_model.h"
28 #include "html_delegate.h"
29 
30 namespace m8r {
31 
32 class RecentNotesTablePresenter : public QObject
33 {
34     Q_OBJECT
35 
36     bool isDashboardlet;
37 
38     RecentNotesTableView* view;
39     RecentNotesTableModel* model;
40 
41 public:
42     static const int NO_ROW = -1;
43 
44 public:
45     explicit RecentNotesTablePresenter(RecentNotesTableView* view, HtmlOutlineRepresentation* htmlRepresentation);
46     RecentNotesTablePresenter(const RecentNotesTablePresenter&) = delete;
47     RecentNotesTablePresenter(const RecentNotesTablePresenter&&) = delete;
48     RecentNotesTablePresenter &operator=(const RecentNotesTablePresenter&) = delete;
49     RecentNotesTablePresenter &operator=(const RecentNotesTablePresenter&&) = delete;
50     ~RecentNotesTablePresenter();
51 
getModel()52     RecentNotesTableModel* getModel() const { return model; }
getView()53     RecentNotesTableView* getView() const { return view; }
54 
55     void refresh(const std::vector<Note*>& notes);
56     int getCurrentRow() const;
57 };
58 
59 }
60 #endif // M8RUI_RECENT_NOTES_TABLE_PRESENTER_H
61