LibrePCB Developers Documentation
gridsettingsdialog.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_EDITOR_GRIDSETTINGSDIALOG_H
21 #define LIBREPCB_EDITOR_GRIDSETTINGSDIALOG_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
29 
30 #include <QtCore>
31 #include <QtWidgets>
32 
33 /*******************************************************************************
34  * Namespace / Forward Declarations
35  ******************************************************************************/
36 namespace librepcb {
37 namespace editor {
38 
39 namespace Ui {
40 class GridSettingsDialog;
41 }
42 
43 /*******************************************************************************
44  * Class GridSettingsDialog
45  ******************************************************************************/
46 
51 class GridSettingsDialog final : public QDialog {
52  Q_OBJECT
53 
54 public:
55  // Constructors / Destructor
56  GridSettingsDialog() = delete;
57  GridSettingsDialog(const GridSettingsDialog& other) = delete;
58  explicit GridSettingsDialog(const PositiveLength& interval,
59  const LengthUnit& unit, Theme::GridStyle style,
60  QWidget* parent = nullptr) noexcept;
61  ~GridSettingsDialog() noexcept;
62 
63  // Getters
64  const PositiveLength& getInterval() const noexcept {
65  return mCurrentGrid.interval;
66  }
67  const LengthUnit& getUnit() const noexcept { return mCurrentGrid.unit; }
68  Theme::GridStyle getStyle() const noexcept { return mCurrentGrid.style; }
69 
70  // Operator Overloadings
71  GridSettingsDialog& operator=(const GridSettingsDialog& rhs) = delete;
72 
73 signals:
74  void gridPropertiesChanged(const PositiveLength& interval,
75  const LengthUnit& unit, Theme::GridStyle style);
76 
77 private: // Methods
78  void rbtnGroupClicked(int id) noexcept;
79  void edtIntervalValueChanged(const PositiveLength& value) noexcept;
80  void edtIntervalUnitChanged(const LengthUnit& unit) noexcept;
81  void buttonBoxClicked(QAbstractButton* button) noexcept;
82 
83 private: // Data
84  struct Grid {
88  };
89 
90  QScopedPointer<Ui::GridSettingsDialog> mUi;
93 };
94 
95 /*******************************************************************************
96  * End of File
97  ******************************************************************************/
98 
99 } // namespace editor
100 } // namespace librepcb
101 
102 #endif
Grid mOriginalGrid
Definition: gridsettingsdialog.h:91
const LengthUnit & getUnit() const noexcept
Definition: gridsettingsdialog.h:67
Definition: gridsettingsdialog.h:84
Definition: occmodel.cpp:77
This class provides a Dialog (GUI) to change the grid settings of a librepcb::editor::GraphicsView.
Definition: gridsettingsdialog.h:51
QScopedPointer< Ui::GridSettingsDialog > mUi
Definition: gridsettingsdialog.h:90
PositiveLength interval
Definition: gridsettingsdialog.h:85
Theme::GridStyle getStyle() const noexcept
Definition: gridsettingsdialog.h:68
LengthUnit unit
Definition: gridsettingsdialog.h:86
const PositiveLength & getInterval() const noexcept
Definition: gridsettingsdialog.h:64
GridStyle
Definition: theme.h:49
Theme::GridStyle style
Definition: gridsettingsdialog.h:87
Grid mCurrentGrid
Definition: gridsettingsdialog.h:92
type_safe::constrained_type< Length, PositiveLengthConstraint, PositiveLengthVerifier > PositiveLength
Definition: length.h:812
The LengthUnit class represents a length unit (millimeters, inches,...) and provides some useful meth...
Definition: lengthunit.h:60