LibrePCB Developers Documentation
schematicpagesdock.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_SCHEMATICPAGESDOCK_H
21#define LIBREPCB_EDITOR_SCHEMATICPAGESDOCK_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
27
28#include <QtCore>
29#include <QtWidgets>
30
31#include <memory>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37
38class GraphicsExport;
39class GraphicsExportSettings;
40class Project;
41class SI_Symbol;
42class Theme;
43
44namespace editor {
45
46class UndoStack;
47
48namespace Ui {
49class SchematicPagesDock;
50}
51
52/*******************************************************************************
53 * Class SchematicPagesDock
54 ******************************************************************************/
55
59class SchematicPagesDock final : public QDockWidget {
60 Q_OBJECT
61
62public:
63 // Constructors / Destructor
65 SchematicPagesDock(const SchematicPagesDock& other) = delete;
66 SchematicPagesDock(Project& project, UndoStack& undoStack, const Theme& theme,
67 QWidget* parent = nullptr);
69
70 // General Methods
71 void setBackgroundColor(const QColor& c) noexcept { mBackgroundColor = c; }
72 void setSelectedSchematic(int index) noexcept;
73
74 // Operator Overloadings
76
77signals:
78 void selectedSchematicChanged(int index);
80 void removeSchematicTriggered(int index);
81 void renameSchematicTriggered(int index);
82
83protected:
84 void resizeEvent(QResizeEvent* event) noexcept override;
85
86private: // Methods
87 void removeSelectedSchematic() noexcept;
88 void renameSelectedSchematic() noexcept;
89 void schematicAdded(int newIndex) noexcept;
90 void schematicRemoved(int oldIndex) noexcept;
91 void schematicModified(SI_Symbol& symbol) noexcept;
92 void updateSchematicNames() noexcept;
93 void updateNextThumbnail() noexcept;
94 void thumbnailReady(int index, const QSize& pageSize, const QRectF margins,
95 std::shared_ptr<QPicture> picture);
96
97private: // Data
100 QScopedPointer<Ui::SchematicPagesDock> mUi;
102
103 // Thumbnail generator.
109 QVector<QVector<QMetaObject::Connection>> mSchematicConnections;
110};
111
112/*******************************************************************************
113 * End of File
114 ******************************************************************************/
115
116} // namespace editor
117} // namespace librepcb
118
119#endif
Asynchronously exports graphics to a QPainter.
Definition: graphicsexport.h:90
Settings for librepcb::GraphicsExport.
Definition: graphicsexportsettings.h:51
The Project class represents a whole (opened) project with all its content.
Definition: project.h:71
The SI_Symbol class.
Definition: si_symbol.h:54
Theme class as used by librepcb::WorkspaceSettingsItem_Themes.
Definition: theme.h:44
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The SchematicPagesDock class.
Definition: schematicpagesdock.h:59
void schematicModified(SI_Symbol &symbol) noexcept
Definition: schematicpagesdock.cpp:172
QScopedPointer< GraphicsExport > mThumbnailGenerator
Definition: schematicpagesdock.h:106
SchematicPagesDock(const SchematicPagesDock &other)=delete
void removeSelectedSchematic() noexcept
Definition: schematicpagesdock.cpp:134
std::shared_ptr< GraphicsExportSettings > mThumbnailSettings
Definition: schematicpagesdock.h:107
SchematicPagesDock & operator=(const SchematicPagesDock &rhs)=delete
void setBackgroundColor(const QColor &c) noexcept
Definition: schematicpagesdock.h:71
void schematicAdded(int newIndex) noexcept
Definition: schematicpagesdock.cpp:142
~SchematicPagesDock()
Definition: schematicpagesdock.cpp:109
QVector< QVector< QMetaObject::Connection > > mSchematicConnections
Definition: schematicpagesdock.h:109
QScopedPointer< Ui::SchematicPagesDock > mUi
Definition: schematicpagesdock.h:100
void renameSelectedSchematic() noexcept
Definition: schematicpagesdock.cpp:138
QSet< Uuid > mScheduledThumbnailSchematics
Definition: schematicpagesdock.h:104
UndoStack & mUndoStack
Definition: schematicpagesdock.h:99
Project & mProject
Definition: schematicpagesdock.h:98
void thumbnailReady(int index, const QSize &pageSize, const QRectF margins, std::shared_ptr< QPicture > picture)
Definition: schematicpagesdock.cpp:215
void updateNextThumbnail() noexcept
Definition: schematicpagesdock.cpp:186
void updateSchematicNames() noexcept
Definition: schematicpagesdock.cpp:176
tl::optional< Uuid > mCurrentThumbnailSchematic
Definition: schematicpagesdock.h:105
void resizeEvent(QResizeEvent *event) noexcept override
Definition: schematicpagesdock.cpp:124
QColor mBackgroundColor
Definition: schematicpagesdock.h:101
QTimer mThumbnailTimer
Definition: schematicpagesdock.h:108
void setSelectedSchematic(int index) noexcept
Definition: schematicpagesdock.cpp:116
void schematicRemoved(int oldIndex) noexcept
Definition: schematicpagesdock.cpp:164
The UndoStack class holds UndoCommand objects and provides undo/redo commands.
Definition: undostack.h:106
Definition: occmodel.cpp:77
Definition: uuid.h:183