1 /*
2  main_window_view.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 
20 #ifndef M8RUI_MAIN_WINDOW_VIEW_H
21 #define M8RUI_MAIN_WINDOW_VIEW_H
22 
23 #include <QtWidgets>
24 
25 #include "../../lib/src/version.h"
26 
27 #include "main_window_presenter.h"
28 #include "main_toolbar_view.h"
29 #include "main_menu_presenter.h"
30 #include "cli_n_breadcrumbs_view.h"
31 #include "orloj_view.h"
32 #include "status_bar_view.h"
33 
34 namespace m8r {
35 
36 class OrlojView;
37 class MainWindowPresenter;
38 class MainToolbarView;
39 class CliAndBreadcrumbsView;
40 
41 /**
42  * @brief MindForger main window View.
43  *
44  * Main window is a special (and the only) case that violates
45  * MVP - View instantiates Presenter. However, this View class
46  * aims to be application logic code and backend dependency free.
47  */
48 class MainWindowView: public QMainWindow
49 {
50     Q_OBJECT
51 
52 private:
53     QString windowTitleSkeleton;
54 
55     LookAndFeels& lookAndFeel;
56 
57     QWidget* centralWidget;
58     QVBoxLayout *centralLayout;
59 
60     OrlojView* orlojView;
61     MainToolbarView* toolBarView;
62     StatusBarView* statusBarView;
63 
64 public:
65     explicit MainWindowView(LookAndFeels& lookAndFeel);
66     MainWindowView(const MainWindowView&) = delete;
67     MainWindowView(const MainWindowView&&) = delete;
68     MainWindowView &operator=(const MainWindowView&) = delete;
69     MainWindowView &operator=(const MainWindowView&&) = delete;
70     virtual ~MainWindowView();
71 
getMenuBar()72     QMenuBar* getMenuBar() const { return menuBar(); }
getToolBar()73     MainToolbarView* getToolBar() const { return toolBarView; }
74     CliAndBreadcrumbsView* getCli() const;
getOrloj()75     OrlojView* getOrloj() const { return orlojView; }
getStatusBar()76     StatusBarView* getStatusBar() const { return statusBarView; }
77 
78     void setFileOrDirectory(QString f);
79 };
80 
81 }
82 
83 #endif // M8RUI_MAIN_WINDOW_VIEW_H
84