1 /*
2  main_window_view.cpp     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 #include "main_window_view.h"
20 
21 namespace m8r {
22 
MainWindowView(LookAndFeels & lookAndFeel)23 MainWindowView::MainWindowView(LookAndFeels& lookAndFeel)
24     : QMainWindow(nullptr), // main window has no parent - it is destroyed by main MF class
25       lookAndFeel(lookAndFeel)
26 {
27     windowTitleSkeleton = "MindForger - "+tr("Thinking Notebook")+" - "+MINDFORGER_VERSION;
28     setWindowTitle(windowTitleSkeleton);
29 
30     toolBarView = new MainToolbarView{this};
31     // IMPROVE toolbar position to be configurable
32     addToolBar(Qt::TopToolBarArea, toolBarView);
33 
34     centralWidget = new QWidget(this);
35 
36     centralLayout = new QVBoxLayout{centralWidget};
37     orlojView = new OrlojView{centralWidget};
38     centralLayout->addWidget(orlojView);
39 
40     centralWidget->setLayout(centralLayout);
41     setCentralWidget(centralWidget);
42 
43     statusBarView = new StatusBarView(statusBar(), lookAndFeel);
44 }
45 
~MainWindowView()46 MainWindowView::~MainWindowView()
47 {
48     delete centralWidget;
49 }
50 
getCli() const51 CliAndBreadcrumbsView* MainWindowView::getCli() const
52 {
53     return toolBarView->getCli();
54 }
55 
setFileOrDirectory(QString f)56 void MainWindowView::setFileOrDirectory(QString f)
57 {
58     setWindowTitle(windowTitleSkeleton+" - "+f+" ");
59 }
60 
61 } // m8r namespace
62