All Classes Namespaces Functions Variables Enumerations Properties Pages
statusbar.h
1 /*
2 
3 Pencil2D - Traditional Animation Software
4 Copyright (C) 2020 Jakob Gahde
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; version 2 of the License.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 */
16 
17 #ifndef STATUSBAR_H
18 #define STATUSBAR_H
19 
20 #include <QStatusBar>
21 
22 #include "pencildef.h"
23 
24 class Editor;
25 class ElidedLabel;
26 class QComboBox;
27 class QLabel;
28 class QSlider;
29 
33 class StatusBar : public QStatusBar
34 {
35  Q_OBJECT
36 
37 public:
43  explicit StatusBar(QWidget *parent = nullptr);
44 
52  void setEditor(Editor *editor) { mEditor = editor; }
53 
54 public slots:
60  void updateToolStatus(ToolType tool);
61 
67  void updateModifiedStatus(bool modified);
68 
72  void updateZoomStatus();
73 
74 signals:
75 
81  void zoomChanged(double scale);
82 
83 private:
85  Editor *mEditor = nullptr;
86 
88  QLabel *mToolIcon = nullptr;
90  ElidedLabel *mToolLabel = nullptr;
92  QLabel *mModifiedLabel = nullptr;
94  QComboBox *mZoomBox = nullptr;
96  QSlider *mZoomSlider = nullptr;
97 };
98 
99 #endif // STATUSBAR_H
void updateModifiedStatus(bool modified)
Updates the file modification status.
Definition: statusbar.cpp:154
QSlider * mZoomSlider
Slider for adjusting the zoom level.
Definition: statusbar.h:96
StatusBar(QWidget *parent=nullptr)
Constructs a new status bar.
Definition: statusbar.cpp:31
void updateToolStatus(ToolType tool)
Updates the status bar with information about the current tool.
Definition: statusbar.cpp:89
void updateZoomStatus()
Updates the zoom level displayed in the status bar.
Definition: statusbar.cpp:167
Q_OBJECTQ_OBJECT
QComboBox * mZoomBox
Combo box for choosing pre-defined or custom zoom levels.
Definition: statusbar.h:94
QLabel * mModifiedLabel
Label indicating that the current file contains unsaved changes.
Definition: statusbar.h:92
ElidedLabel * mToolLabel
Label used to display a short help text for the current tool.
Definition: statusbar.h:90
QLabel * mToolIcon
Label used to display the icon of the current tool.
Definition: statusbar.h:88
The status bar of Pencil2D's main window.
Definition: statusbar.h:33
void zoomChanged(double scale)
This signal is sent when the user chooses a new zoom level through the status bar.
Definition: editor.h:55
QObject * parent() const const
Editor * mEditor
The editor associated with this status bar.
Definition: statusbar.h:85
void setEditor(Editor *editor)
Associates an Editor instance with the status bar.
Definition: statusbar.h:52