LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
statusbar.h
Go to the documentation of this file.
1 /*
2  * LibrePCB - Professional EDA for everyone!
3  * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4  * https://librepcb.org/
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (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 LIBREPCB_STATUSBAR_H
21 #define LIBREPCB_STATUSBAR_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../units/point.h"
27 
28 #include <QtCore>
29 #include <QtWidgets>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 
36 /*******************************************************************************
37  * Class StatusBar
38  ******************************************************************************/
39 
43 class StatusBar final : public QStatusBar {
44  Q_OBJECT
45 
46 public:
47  // Types
48  enum Field {
49  AbsolutePosition = 1 << 0,
50  ProgressBar = 1 << 1,
51  };
52  Q_DECLARE_FLAGS(Fields, Field);
53 
54  // Constructors / Destructor
55  explicit StatusBar(QWidget* parent = nullptr) noexcept;
56  StatusBar(const StatusBar& other) = delete;
57  ~StatusBar() noexcept;
58 
59  // Getters
60  Fields getFields() const noexcept { return mFields; }
61 
62  // Setters
63  void setFields(Fields fields) noexcept;
64  void setField(Field field, bool enable) noexcept;
65  void setAbsoluteCursorPosition(const Point& pos) noexcept;
66  void setProgressBarTextFormat(const QString& format) noexcept;
67  void setProgressBarPercent(int percent) noexcept;
68 
69  // Operator Overloadings
70  StatusBar& operator=(const StatusBar& rhs) = delete;
71 
72 private: // Data
73  Fields mFields;
74  QScopedPointer<QLabel> mAbsPosXLabel;
75  QScopedPointer<QLabel> mAbsPosYLabel;
76  QScopedPointer<QProgressBar> mProgressBar;
77  QScopedPointer<QWidget> mProgressBarPlaceHolder;
78 };
79 
80 /*******************************************************************************
81  * End of File
82  ******************************************************************************/
83 
84 } // namespace librepcb
85 
86 Q_DECLARE_OPERATORS_FOR_FLAGS(librepcb::StatusBar::Fields)
87 
88 #endif // LIBREPCB_STATUSBAR_H
QScopedPointer< QWidget > mProgressBarPlaceHolder
Definition: statusbar.h:77
Fields mFields
Definition: statusbar.h:73
void setField(Field field, bool enable) noexcept
Definition: statusbar.cpp:82
QScopedPointer< QProgressBar > mProgressBar
Definition: statusbar.h:76
Definition: statusbar.h:50
The Point class is used to represent a point/coordinate/vector, for example (1.2mm; 5...
Definition: point.h:78
StatusBar(QWidget *parent=nullptr) noexcept
Definition: statusbar.cpp:37
QScopedPointer< QLabel > mAbsPosXLabel
Definition: statusbar.h:74
Field
Definition: statusbar.h:48
void setFields(Fields fields) noexcept
Definition: statusbar.cpp:77
Q_DECLARE_FLAGS(Fields, Field)
The StatusBar class extends QStatusBar for some commonly used fields.
Definition: statusbar.h:43
StatusBar & operator=(const StatusBar &rhs)=delete
void setAbsoluteCursorPosition(const Point &pos) noexcept
Definition: statusbar.cpp:91
Definition: statusbar.h:49
void setProgressBarPercent(int percent) noexcept
Definition: statusbar.cpp:100
Fields getFields() const noexcept
Definition: statusbar.h:60
void setProgressBarTextFormat(const QString &format) noexcept
Definition: statusbar.cpp:96
QScopedPointer< QLabel > mAbsPosYLabel
Definition: statusbar.h:75