1 /*
2  status_bar_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 "status_bar_view.h"
20 
21 namespace m8r {
22 
StatusBarView(QStatusBar * qStatusBar,LookAndFeels & lookAndFeel)23 StatusBarView::StatusBarView(QStatusBar* qStatusBar, LookAndFeels& lookAndFeel)
24     : lookAndFeel(lookAndFeel)
25 {
26     this->statusBar = qStatusBar;
27 
28     font.setFamily(statusBar->font().family());
29     font.setPointSize(lookAndFeel.getFontPointSize());
30     statusBar->setFont(font);
31 }
32 
showInfo(const QString & message) const33 void StatusBarView::showInfo(const QString& message) const
34 {
35     // IMPROVE set style sheet - code below causes SIGSEGV (lookAndFeel nullptr)
36     QString style;
37     style += "color: ";
38     style += lookAndFeel.getTextColor();
39     style += ";";
40     statusBar->setStyleSheet(style);
41 
42     statusBar->showMessage(message);
43 }
44 
showWarning(const QString & message) const45 void StatusBarView::showWarning(const QString& message) const
46 {
47     // IMPROVE set style sheet > ORANGE
48     statusBar->showMessage(message);
49 }
50 
showError(const QString & message) const51 void StatusBarView::showError(const QString& message) const
52 {
53     // IMPROVE set style sheet > RED
54     statusBar->showMessage(message);
55 }
56 
~StatusBarView()57 StatusBarView::~StatusBarView()
58 {
59 }
60 
61 } // namespace
62