LibrePCB Developers Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mainwindow.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_MAINWINDOW_H
21#define LIBREPCB_EDITOR_MAINWINDOW_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "appwindow.h"
27#include "utils/uiobjectlist.h"
28
29#include <QtCore>
30
31#include <memory>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37namespace editor {
38
39class GuiApplication;
40class MainWindowTestAdapter;
41class ProjectReadmeRenderer;
42class WindowSection;
43class WindowTab;
44
45/*******************************************************************************
46 * Class MainWindow
47 ******************************************************************************/
48
52class MainWindow final : public QObject {
53 Q_OBJECT
54
55public:
56 // Constructors / Destructor
57 MainWindow() = delete;
58 MainWindow(const MainWindow& other) = delete;
59 explicit MainWindow(GuiApplication& app,
60 slint::ComponentHandle<ui::AppWindow> win, int id,
61 QObject* parent = nullptr) noexcept;
62 ~MainWindow() noexcept;
63
64 // General Methods
65 int getId() const noexcept { return mId; }
66 bool isCurrentWindow() const noexcept;
67 void makeCurrentWindow() noexcept;
68 void showPanelPage(ui::PanelPage page) noexcept;
69 void popUpNotifications() noexcept;
70
71 // Operator Overloadings
72 MainWindow& operator=(const MainWindow& rhs) = delete;
73
74signals:
76
77private:
78 slint::CloseRequestResponse closeRequested() noexcept;
79 void triggerAsync(ui::Action a) noexcept;
80 bool trigger(ui::Action a) noexcept;
81 void splitSection(int index) noexcept;
82 void updateHomeTabSection() noexcept;
83 void addTab(std::shared_ptr<WindowTab> tab) noexcept;
84 template <typename T>
85 bool switchToTab() noexcept;
86
87 const int mId;
88 const QString mSettingsPrefix;
90 slint::ComponentHandle<ui::AppWindow> mWindow;
91 QWidget* mWidget;
92 std::shared_ptr<UiObjectList<WindowSection, ui::WindowSectionData>> mSections;
95};
96
97/*******************************************************************************
98 * End of File
99 ******************************************************************************/
100
101} // namespace editor
102} // namespace librepcb
103
104#endif
The GuiApplication class.
Definition guiapplication.h:60
The MainWindow class.
Definition mainwindow.h:52
bool trigger(ui::Action a) noexcept
Definition mainwindow.cpp:216
slint::CloseRequestResponse closeRequested() noexcept
Definition mainwindow.cpp:195
std::unique_ptr< MainWindowTestAdapter > mTestAdapter
Definition mainwindow.h:94
void addTab(std::shared_ptr< WindowTab > tab) noexcept
Definition mainwindow.cpp:363
void popUpNotifications() noexcept
Definition mainwindow.cpp:185
void showPanelPage(ui::PanelPage page) noexcept
Definition mainwindow.cpp:181
std::unique_ptr< ProjectReadmeRenderer > mProjectPreviewRenderer
Definition mainwindow.h:93
void splitSection(int index) noexcept
Definition mainwindow.cpp:319
bool isCurrentWindow() const noexcept
Definition mainwindow.cpp:171
void updateHomeTabSection() noexcept
Definition mainwindow.cpp:357
int getId() const noexcept
Definition mainwindow.h:65
void triggerAsync(ui::Action a) noexcept
Definition mainwindow.cpp:210
const QString mSettingsPrefix
Definition mainwindow.h:88
slint::ComponentHandle< ui::AppWindow > mWindow
Definition mainwindow.h:90
std::shared_ptr< UiObjectList< WindowSection, ui::WindowSectionData > > mSections
Definition mainwindow.h:92
MainWindow(const MainWindow &other)=delete
const int mId
Definition mainwindow.h:87
void makeCurrentWindow() noexcept
Definition mainwindow.cpp:175
QWidget * mWidget
Definition mainwindow.h:91
bool switchToTab() noexcept
Definition mainwindow.cpp:373
GuiApplication & mApp
Definition mainwindow.h:89
Adapter class for automated GUI tests.
Definition mainwindowtestadapter.h:46
Renders a README.md or other file types as a QPixmap.
Definition projectreadmerenderer.h:44
The UiObjectList class.
Definition uiobjectlist.h:47
The WindowSection class.
Definition windowsection.h:51
The WindowTab class.
Definition windowtab.h:47
Definition occmodel.cpp:77
Definition uuid.h:186