1 /*
2  assoc_leaderboard_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_ASSOC_LEADERBOARD_PRESENTER_H
20 #define M8RUI_ASSOC_LEADERBOARD_PRESENTER_H
21 
22 #include <vector>
23 
24 #include "../../lib/src/model/note.h"
25 #include "../lib/src/mind/associated_notes.h"
26 
27 #include "assoc_leaderboard_view.h"
28 #include "assoc_leaderboard_model.h"
29 #include "orloj_presenter.h"
30 #include "html_delegate.h"
31 
32 #include <QtWidgets>
33 
34 namespace m8r {
35 
36 class AssocLeaderboardPresenter : public QObject
37 {
38     Q_OBJECT
39 
40 private:
41     AssocLeaderboardView* view;
42     AssocLeaderboardModel* model;
43 
44     OrlojPresenter* orloj;
45 
46 
47     AssociatedNotes* lastAssociations;
48 
49 public:
50     explicit AssocLeaderboardPresenter(AssocLeaderboardView* view, OrlojPresenter* orloj);
51     AssocLeaderboardPresenter(const AssocLeaderboardPresenter&) = delete;
52     AssocLeaderboardPresenter(const AssocLeaderboardPresenter&&) = delete;
53     AssocLeaderboardPresenter &operator=(const AssocLeaderboardPresenter&) = delete;
54     AssocLeaderboardPresenter &operator=(const AssocLeaderboardPresenter&&) = delete;
55     ~AssocLeaderboardPresenter();
56 
57     void refresh(AssociatedNotes* associations);
getView()58     AssocLeaderboardView* getView() const { return view; }
59 
60 public slots:
61     void slotShowNote(const QItemSelection& selected, const QItemSelection& deselected);
62 };
63 
64 }
65 #endif // M8RUI_ASSOC_LEADERBOARD_PRESENTER_H
66