LibrePCB Developers Documentation
Loading...
Searching...
No Matches
uihelpers.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_UIHELPERS_H
21#define LIBREPCB_EDITOR_UIHELPERS_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "appwindow.h"
27
33
34#include <optional>
35
36/*******************************************************************************
37 * Namespace / Forward Declarations
38 ******************************************************************************/
39namespace librepcb {
40namespace editor {
41
42class EditorCommand;
43
44// l2s(): LibrePCB C++ to LibrePCB Slint UI type conversion
45// s2l(): LibrePCB Slint UI to LibrePCB C++ type conversion
46
47/*******************************************************************************
48 * Non-Member Functions
49 ******************************************************************************/
50
51static_assert(sizeof(ui::Int64) == 8);
52static_assert(sizeof(LengthBase_t) == 8);
53static_assert(sizeof(Angle) == sizeof(int));
54
55qint64 s2l(const ui::Int64& v) noexcept;
56
57ui::Int64 l2s(const Length& v) noexcept;
58Length s2length(const ui::Int64& v) noexcept;
59std::optional<UnsignedLength> s2ulength(const ui::Int64& v) noexcept;
60std::optional<PositiveLength> s2plength(const ui::Int64& v) noexcept;
61
62int l2s(const Angle& v) noexcept;
63Angle s2angle(int v) noexcept;
64
65ui::GridStyle l2s(Theme::GridStyle v) noexcept;
66Theme::GridStyle s2l(ui::GridStyle v) noexcept;
67
68ui::LengthUnit l2s(const LengthUnit& v) noexcept;
69LengthUnit s2l(ui::LengthUnit v) noexcept;
70
71slint::cbindgen_private::TextHorizontalAlignment l2s(const HAlign& v) noexcept;
72HAlign s2l(slint::cbindgen_private::TextHorizontalAlignment v) noexcept;
73
74slint::cbindgen_private::TextVerticalAlignment l2s(const VAlign& v) noexcept;
75VAlign s2l(slint::cbindgen_private::TextVerticalAlignment v) noexcept;
76
77ui::NotificationType l2s(RuleCheckMessage::Severity v) noexcept;
78
79ui::EditorCommand l2s(const EditorCommand& cmd, ui::EditorCommand in) noexcept;
80
81ui::FeatureState toFs(bool enabled) noexcept;
82
83/*******************************************************************************
84 * End of File
85 ******************************************************************************/
86
87} // namespace editor
88} // namespace librepcb
89
90#endif
Severity
Message severity type (higher number = higher severity)
Definition rulecheckmessage.h:50
GridStyle
Definition theme.h:49
static ui::WireMode l2s(BoardEditorState_DrawTrace::WireMode v) noexcept
Definition board2dtab.cpp:91
std::optional< PositiveLength > s2plength(const ui::Int64 &v) noexcept
Definition uihelpers.cpp:61
static BoardEditorState_DrawTrace::WireMode s2l(ui::WireMode v) noexcept
Definition board2dtab.cpp:107
ui::FeatureState toFs(bool enabled) noexcept
Definition uihelpers.cpp:215
Angle s2angle(int v) noexcept
Definition uihelpers.cpp:70
Length s2length(const ui::Int64 &v) noexcept
Definition uihelpers.cpp:52
std::optional< UnsignedLength > s2ulength(const ui::Int64 &v) noexcept
Definition uihelpers.cpp:56
Definition occmodel.cpp:77
qint64 LengthBase_t
This type is the ONLY base type to store all lengths (always in nanometers)!
Definition length.h:61