1 /* 2 outline_header_view_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_OUTLINE_HEADER_VIEW_PRESENTER_H 20 #define M8RUI_OUTLINE_HEADER_VIEW_PRESENTER_H 21 22 #include "../../lib/src/model/outline.h" 23 #include "../../lib/src/representations/html/html_outline_representation.h" 24 #include "../../lib/src/mind/associated_notes.h" 25 26 #include <QtWidgets> 27 28 #include "orloj_presenter.h" 29 #include "outline_header_view.h" 30 31 namespace m8r { 32 33 class OrlojPresenter; 34 35 class OutlineHeaderViewPresenter : public QObject 36 { 37 Q_OBJECT 38 39 private: 40 // IMPROVE to model 41 Outline* currentOutline; 42 43 std::string html; 44 45 OutlineHeaderView* view; 46 OrlojPresenter* orloj; 47 HtmlOutlineRepresentation* htmlRepresentation; 48 49 public: 50 explicit OutlineHeaderViewPresenter(OutlineHeaderView* view, OrlojPresenter* orloj); 51 OutlineHeaderViewPresenter(const OutlineHeaderViewPresenter&) = delete; 52 OutlineHeaderViewPresenter(const OutlineHeaderViewPresenter&&) = delete; 53 OutlineHeaderViewPresenter &operator=(const OutlineHeaderViewPresenter&) = delete; 54 OutlineHeaderViewPresenter &operator=(const OutlineHeaderViewPresenter&&) = delete; 55 ~OutlineHeaderViewPresenter() = default; 56 57 /** 58 * @brief Refresh live preview. 59 */ 60 void refreshLivePreview(); 61 62 void refresh(Outline* outline); refreshCurrent()63 void refreshCurrent() { refresh(currentOutline); } 64 65 public slots: 66 void slotLinkClicked(const QUrl& url); 67 void slotEditOutlineHeader(); 68 void slotRefreshHeaderLeaderboardByValue(AssociatedNotes* associations); 69 }; 70 71 } 72 #endif // M8RUI_OUTLINE_HEADER_VIEW_PRESENTER_H 73