API Documentation
Loading...
Searching...
No Matches
UnitsDialog.h
Go to the documentation of this file.
1/**--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Widgets
28File: UnitsDialog
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/Unit.h>
35#include <NDEVR/Pointer.h>
36#include <QWidget>
37namespace Ui
38{
39 class UnitsDialogUI;
40}
41namespace NDEVR
42{
43 class UnitManager;
44 class UnitOption;
45 class CustomUnit;
46 class QCustomComboBox;
47 class QTResourceListener;
48 class NDEVR_WIDGETS_API UnitsDialog : public QWidget
49 {
50 Q_OBJECT
51 public:
52 UnitsDialog(QWidget* parent = nullptr);
53 UnitsDialog(UnitManager* manager, QWidget* parent = nullptr);
54 void setManager(UnitManager* manager);
55 void setAutosize(bool auto_size);
56 void setAllowSubUnit(bool allow_sub_unit);
57 void hideSurfaceVolumeUnit();
58 void hideAngleUnit();
59 void hideDefaultButtons();
60 void resetToDefaultUnits();
61 void hideSpacialLabels();
62 void hideCoordinateMode();
63 void removeScrollArea();
64 void refreshUnitsDialog();
65 signals:
66 void edited();
67 protected:
68 void updateComboContents();
69 void setupCombo(UnitType type, QCustomComboBox* combo, QCustomComboBox* subcombo = nullptr);
70 void setupCombo(const Buffer<ConstPointer<UnitOption>>& options, const ConstPointer<Unit>& unit, QCustomComboBox* combo, QCustomComboBox* subcombo);
71 ConstPointer<UnitOption> setupCombo(const Buffer<ConstPointer<UnitOption>>& options, const ConstPointer<Unit>& unit, QCustomComboBox* combo);
72 ConstPointer<Unit> selectedUnit(UnitType type, QCustomComboBox* combo, QCustomComboBox* subcombo = nullptr);
73 ConstPointer<Unit> selectedUnit(const Buffer<ConstPointer<UnitOption>>& options, const ConstPointer<Unit>& reference_unit, QCustomComboBox* combo, QCustomComboBox* subcombo = nullptr);
74 void setSelectedUnit(UnitType type, QCustomComboBox* combo, QCustomComboBox* subcombo = nullptr);
75 void initialize();
76 bool event(QEvent* event) override;
77 void retranslate();
78 void setup();
79 void updateFromUnit();
80 QWidget* extraUnitWidget(DynamicPointer<CustomUnit> custom_unit);
81 protected slots:
82 void updateSpacialUnitFromUISlot();
83 void updateOrientationUnitFromUISlot();
84 void updateSurfaceAreaUnitFromUISlot();
85 void updateVolumeUnitFromUISlot();
86 void updateWeightUnitFromUISlot();
87 protected:
91 bool m_update_posted = false;
92 Ui::UnitsDialogUI* ui;
93 };
94}
#define NDEVR_WIDGETS_API
Definition DLLInfo.h:81
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition GraphicsPipeline.h:42
Definition Pointer.hpp:303
Definition QCustomCombobox.h:47
Definition QTTools.h:183
Definition UnitManager.h:126
Definition UnitsDialog.h:49
Ui::UnitsDialogUI * ui
Definition UnitsDialog.h:92
UnitManager * m_manager
Definition UnitsDialog.h:88
bool m_allow_sub_unit
Definition UnitsDialog.h:90
QTResourceListener * m_resource_listener
Definition UnitsDialog.h:89
Definition ACIColor.h:37
UnitType
Definition Unit.h:10
Definition FontEditor.h:6